From 75b9df14eef84803467ec3783f9d9d94e7c951ec Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Tue, 23 Feb 2021 14:50:29 +0100 Subject: [PATCH] Initial commit --- .gitignore | 2 + .vscode/launch.json | 27 ++ .vscode/tasks.json | 42 +++ ConsoleApplication/ConsoleApplication.csproj | 13 + ConsoleApplication/Program.cs | 13 + DPGetDataContract/DPGetDataContract.csproj | 7 + DPGetDataContract/EDataType.cs | 12 + DPGetDataContract/GetDataStructure.cs | 12 + DPGetDataContract/IDPGetDataContract.cs | 8 + DataGen/DataGen.csproj | 11 + DataGen/ProtokollWriter.cs | 281 +++++++++++++++++++ Dichtheitsprüfung.sln | 62 ++++ 12 files changed, 490 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 ConsoleApplication/ConsoleApplication.csproj create mode 100644 ConsoleApplication/Program.cs create mode 100644 DPGetDataContract/DPGetDataContract.csproj create mode 100644 DPGetDataContract/EDataType.cs create mode 100644 DPGetDataContract/GetDataStructure.cs create mode 100644 DPGetDataContract/IDPGetDataContract.cs create mode 100644 DataGen/DataGen.csproj create mode 100644 DataGen/ProtokollWriter.cs create mode 100644 Dichtheitsprüfung.sln diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3105e41 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/*/bin/* +/*/obj/* diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..731f333 --- /dev/null +++ b/.vscode/launch.json @@ -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}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..483dbeb --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/ConsoleApplication/ConsoleApplication.csproj b/ConsoleApplication/ConsoleApplication.csproj new file mode 100644 index 0000000..3318d5f --- /dev/null +++ b/ConsoleApplication/ConsoleApplication.csproj @@ -0,0 +1,13 @@ + + + + + + + + + Exe + netcoreapp3.1 + + + diff --git a/ConsoleApplication/Program.cs b/ConsoleApplication/Program.cs new file mode 100644 index 0000000..dbf9f7e --- /dev/null +++ b/ConsoleApplication/Program.cs @@ -0,0 +1,13 @@ +using System; +using DPGetDataContract; + +namespace ConsoleApplication +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/DPGetDataContract/DPGetDataContract.csproj b/DPGetDataContract/DPGetDataContract.csproj new file mode 100644 index 0000000..9f5c4f4 --- /dev/null +++ b/DPGetDataContract/DPGetDataContract.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/DPGetDataContract/EDataType.cs b/DPGetDataContract/EDataType.cs new file mode 100644 index 0000000..850ac99 --- /dev/null +++ b/DPGetDataContract/EDataType.cs @@ -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 + } +} \ No newline at end of file diff --git a/DPGetDataContract/GetDataStructure.cs b/DPGetDataContract/GetDataStructure.cs new file mode 100644 index 0000000..dce407a --- /dev/null +++ b/DPGetDataContract/GetDataStructure.cs @@ -0,0 +1,12 @@ +using System; + +namespace DPGetDataContract +{ + public class GetDataStructure + { + public int Eintrag; + public DateTime Datum; + public string Druck; + public EDataType Methode; + } +} diff --git a/DPGetDataContract/IDPGetDataContract.cs b/DPGetDataContract/IDPGetDataContract.cs new file mode 100644 index 0000000..d025d4a --- /dev/null +++ b/DPGetDataContract/IDPGetDataContract.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; + +namespace DPGetDataContract { + public interface IDPGetDataContract { + List ReadMessureList {get;} + } +} \ No newline at end of file diff --git a/DataGen/DataGen.csproj b/DataGen/DataGen.csproj new file mode 100644 index 0000000..f7bee2f --- /dev/null +++ b/DataGen/DataGen.csproj @@ -0,0 +1,11 @@ + + + + + + + + netstandard2.0 + + + diff --git a/DataGen/ProtokollWriter.cs b/DataGen/ProtokollWriter.cs new file mode 100644 index 0000000..8c849fa --- /dev/null +++ b/DataGen/ProtokollWriter.cs @@ -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 messureList = new List(); + public List ReadMessureList { get => messureList;} + + + public void GenerateUnterdruck(DateTime startprüfung, double prüfdruck, bool failure=false) { + + int messreiheID = -1; + List messreihen = new List(); + List druckwerte = new List(); + 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 messreihen = new List(); + string prüfdatum = startprüfung.ToShortDateString(); + bool Bestanden = !failure; + + List druckwerte = new List(); + 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; + } + + + + } +} diff --git a/Dichtheitsprüfung.sln b/Dichtheitsprüfung.sln new file mode 100644 index 0000000..8283d80 --- /dev/null +++ b/Dichtheitsprüfung.sln @@ -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