Initial commit

This commit is contained in:
HuskyTeufel
2021-02-23 14:50:29 +01:00
commit 75b9df14ee
12 changed files with 490 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/*/bin/*
/*/obj/*

27
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/ConsoleApplication/bin/Debug/netcoreapp3.1/ConsoleApplication.dll",
"args": [],
"cwd": "${workspaceFolder}/ConsoleApplication",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/ConsoleApplication/ConsoleApplication.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/ConsoleApplication/ConsoleApplication.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/ConsoleApplication/ConsoleApplication.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\DataGen\DataGen.csproj" />
<ProjectReference Include="..\DPGetDataContract\DPGetDataContract.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,13 @@
using System;
using DPGetDataContract;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,12 @@
using System;
namespace DPGetDataContract
{
public enum EDataType {
LEERPHASE = 0, // 004
BEFÜLLPHASE = 1, // 000
BERUHUNGSZEIT = 2, // 001
PRÜFUNGSPHASE = 3, // 002
ENDEPRÜFUNGMARKER = 4 // 003
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace DPGetDataContract
{
public class GetDataStructure
{
public int Eintrag;
public DateTime Datum;
public string Druck;
public EDataType Methode;
}
}

View File

@@ -0,0 +1,8 @@
using System;
using System.Collections.Generic;
namespace DPGetDataContract {
public interface IDPGetDataContract {
List<GetDataStructure> ReadMessureList {get;}
}
}

11
DataGen/DataGen.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\DPGetDataContract\DPGetDataContract.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

281
DataGen/ProtokollWriter.cs Normal file
View File

@@ -0,0 +1,281 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Linq;
using System.Threading.Tasks;
using DPGetDataContract;
namespace DataGen
{
public class ProtokollWriter : IDPGetDataContract
{
List<GetDataStructure> messureList = new List<GetDataStructure>();
public List<GetDataStructure> ReadMessureList { get => messureList;}
public void GenerateUnterdruck(DateTime startprüfung, double prüfdruck, bool failure=false) {
int messreiheID = -1;
List<GetDataStructure> messreihen = new List<GetDataStructure>();
List<double> druckwerte = new List<double>();
double druck = 0.0;
bool druckerreicht = false;
DateTime start = startprüfung;
prüfdruck = ((prüfdruck - (new Random(DateTime.Now.Millisecond).NextDouble() * 115.8)));
#region Anstiegskurve
while (!druckerreicht)
{
start = start.AddSeconds(2);
messreiheID++;
if (druck <= prüfdruck)
{
break;
}
Random zufall = new Random(DateTime.Now.Millisecond);
druck -= Convert.ToDouble((zufall.Next(1000, 10000) / 1000.0));
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
});
Thread.Sleep(100);
}
#endregion
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.BEFÜLLPHASE
});
start = start.AddMinutes(2);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.PRÜFUNGSPHASE
});
start = start.AddMinutes(15);
start = start.AddSeconds(3);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.PRÜFUNGSPHASE
});
start = start.AddSeconds(2);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.BEFÜLLPHASE
});
start = start.AddSeconds(2);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
});
start = start.AddSeconds(2);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = "0,000",
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
}) ;
start = start.AddSeconds(1);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = "0,000",
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
});
messureList = messreihen;
}
public void GenerateÜberdruck(DateTime startprüfung, double prüfdruck, bool failure=false) {
List<GetDataStructure> messreihen = new List<GetDataStructure>();
string prüfdatum = startprüfung.ToShortDateString();
bool Bestanden = !failure;
List<double> druckwerte = new List<double>();
double druck = 0.0;
bool druckerreicht = false;
int messreiheID = 0;
// Anstiegskurve erzeugen
DateTime start = startprüfung;
#region Befüllphase
while (!druckerreicht)
{
start = start.AddSeconds(4);
if (failure && druck >= 56)
break;
if (!failure &&(druck > (prüfdruck * 1.1)))
druckerreicht = true;
Random zufall = new Random(DateTime.Now.Millisecond);
if(!druckerreicht)
{
druck += Convert.ToDouble((zufall.Next(1000, 10000) / 1000.0));
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Datum = start,
Eintrag = messreiheID,
Druck = druck.ToString(),
Methode = EDataType.BEFÜLLPHASE
});
messreiheID++;
}
Thread.Sleep(100);
}
#endregion
#region Beruhigungsphase
if (!failure)
{
Random druckabfall = new Random(DateTime.Now.Millisecond);
double dp = druckabfall.Next(2, 9) + druckabfall.NextDouble();
//double startdruck = druckwerte.Last() - dp;
//startdruck += druckabfall.NextDouble();
double dpt = dp / 90.0;
for (int i = 0; i <= 90; i++)
{
start = start.AddSeconds(2);
druck -= dpt;
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Druck = druck.ToString(),
Methode = EDataType.BERUHUNGSZEIT,
Datum = start,
Eintrag = messreiheID
});
messreiheID++;
}
}
else
{
int anzahlschritte = 20;
double druckabfall = druck / anzahlschritte;
for(int i = 0; i <= anzahlschritte; i++)
{
start = start.AddSeconds(2);
druck -= druckabfall;
if (druck < 0) druck = 0;
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Druck = druck.ToString(),
Methode = EDataType.BERUHUNGSZEIT,
Datum = start,
Eintrag = messreiheID
});
messreiheID++;
}
}
#endregion
#region Prüfungsphase
if (!failure)
{
for (int i = 0; i < 90; i++)
{
Random Prüfung = new Random(DateTime.Now.Millisecond);
double abfall = Prüfung.NextDouble() / 10;
start = start.AddSeconds(2);
if (abfall <= 0.07 && (i % 2 == 0))
{
druck -= abfall;
}
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Datum = start,
Eintrag = messreiheID,
Methode = EDataType.PRÜFUNGSPHASE,
Druck = druck.ToString()
});
messreiheID++;
Thread.Sleep(100);
}
}
#endregion
#region EndePrüfung
start = start.AddSeconds(2);
messreiheID++;
messreihen.Add(new GetDataStructure()
{
Datum = start,
Eintrag = messreiheID,
Methode = EDataType.ENDEPRÜFUNGMARKER,
Druck = druck.ToString()
}) ;
start = start.AddSeconds(4);
messreihen.Add(new GetDataStructure()
{
Druck = druckwerte.Last().ToString(),
Datum = start,
Methode = EDataType.ENDEPRÜFUNGMARKER,
Eintrag = messreiheID
}) ;
while(druck > 10)
{
start = start.AddSeconds(2);
double abbau = druck / 2;
druck -= abbau;
druckwerte.Add(druck);
messreihen.Add(new GetDataStructure()
{
Datum = start,
Druck = druck.ToString(),
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
});
messreiheID++;
}
messreihen.Add(new GetDataStructure()
{
Datum = start.AddSeconds(2),
Druck = "0,0",
Eintrag = messreiheID,
Methode = EDataType.LEERPHASE
});
messreihen.Add(new GetDataStructure()
{
Datum = start.AddSeconds(4),
Druck = "0,0",
Eintrag = messreiheID+1,
Methode = EDataType.ENDEPRÜFUNGMARKER
});
#endregion
// Debugger.Break();
messureList = messreihen;
}
}
}

62
Dichtheitsprüfung.sln Normal file
View File

@@ -0,0 +1,62 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DPGetDataContract", "DPGetDataContract\DPGetDataContract.csproj", "{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataGen", "DataGen\DataGen.csproj", "{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication", "ConsoleApplication\ConsoleApplication.csproj", "{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|x64.ActiveCfg = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|x64.Build.0 = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|x86.ActiveCfg = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Debug|x86.Build.0 = Debug|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|Any CPU.Build.0 = Release|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|x64.ActiveCfg = Release|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|x64.Build.0 = Release|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|x86.ActiveCfg = Release|Any CPU
{FEAFDFF0-4E0F-4C3F-AA04-3DB55FE40EEF}.Release|x86.Build.0 = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|x64.ActiveCfg = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|x64.Build.0 = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|x86.ActiveCfg = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Debug|x86.Build.0 = Debug|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|Any CPU.Build.0 = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|x64.ActiveCfg = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|x64.Build.0 = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|x86.ActiveCfg = Release|Any CPU
{6353BC4D-10F2-44D5-AB72-DB93B51E8B04}.Release|x86.Build.0 = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|x64.ActiveCfg = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|x64.Build.0 = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|x86.ActiveCfg = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Debug|x86.Build.0 = Debug|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|Any CPU.Build.0 = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|x64.ActiveCfg = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|x64.Build.0 = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|x86.ActiveCfg = Release|Any CPU
{1C7FAD38-27EA-44DD-BACF-D5C6D03D48BB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal