Refactoring
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DataGen\DataGen.csproj" />
|
||||
<ProjectReference Include="..\DPGetDataContract\DPGetDataContract.csproj" />
|
||||
<ProjectReference Include="..\ProtokollWriterContract\ProtokollWriterContract.csproj" />
|
||||
<ProjectReference Include="..\ProtokollWriter\ProtokollWriter.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace ConsoleApplication
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
IDPGetDataContract eingabe = new ProtokollWriter();
|
||||
(eingabe as ProtokollWriter).GenerateUnterdruck(DateTime.Now,-100);
|
||||
IDPGetDataContract eingabe = new MeasureDataGen();
|
||||
(eingabe as MeasureDataGen).GenerateUnterdruck(DateTime.Now,-100);
|
||||
Debugger.Break();
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Models\Models.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace DPGetDataContract
|
||||
{
|
||||
public class GetDataStructure
|
||||
{
|
||||
public int Eintrag;
|
||||
public DateTime Datum;
|
||||
public string Druck;
|
||||
public EDataType Methode;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Models;
|
||||
namespace DPGetDataContract {
|
||||
public interface IDPGetDataContract {
|
||||
List<GetDataStructure> ReadMessureList {get;}
|
||||
List<MeasureData> ReadMessureList {get;}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DPGetDataContract\DPGetDataContract.csproj" />
|
||||
<ProjectReference Include="..\Models\Models.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -4,19 +4,20 @@ using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DPGetDataContract;
|
||||
using Models;
|
||||
|
||||
namespace DataGen
|
||||
{
|
||||
public class ProtokollWriter : IDPGetDataContract
|
||||
public class MeasureDataGen : IDPGetDataContract
|
||||
{
|
||||
List<GetDataStructure> messureList = new List<GetDataStructure>();
|
||||
public List<GetDataStructure> ReadMessureList { get => messureList;}
|
||||
List<MeasureData> messureList = new List<MeasureData>();
|
||||
public List<MeasureData> 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<MeasureData> messreihen = new List<MeasureData>();
|
||||
List<double> druckwerte = new List<double>();
|
||||
double druck = 0.0;
|
||||
bool druckerreicht = false;
|
||||
@@ -35,84 +36,84 @@ namespace DataGen
|
||||
Random zufall = new Random(DateTime.Now.Millisecond);
|
||||
druck -= Convert.ToDouble((zufall.Next(1000, 10000) / 1000.0));
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
#endregion
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.BEFÜLLPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.BEFÜLLPHASE
|
||||
});
|
||||
start = start.AddMinutes(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.PRÜFUNGSPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE
|
||||
});
|
||||
start = start.AddMinutes(15);
|
||||
start = start.AddSeconds(3);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.PRÜFUNGSPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.BEFÜLLPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.BEFÜLLPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = "0,000",
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = "0,000",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
}) ;
|
||||
start = start.AddSeconds(1);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = "0,000",
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = "0,000",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messureList = messreihen;
|
||||
}
|
||||
public void GenerateÜberdruck(DateTime startprüfung, double prüfdruck, bool failure=false) {
|
||||
List<GetDataStructure> messreihen = new List<GetDataStructure>();
|
||||
List<MeasureData> messreihen = new List<MeasureData>();
|
||||
string prüfdatum = startprüfung.ToShortDateString();
|
||||
bool Bestanden = !failure;
|
||||
|
||||
@@ -136,12 +137,12 @@ namespace DataGen
|
||||
{
|
||||
druck += Convert.ToDouble((zufall.Next(1000, 10000) / 1000.0));
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Eintrag = messreiheID,
|
||||
Druck = druck.ToString(),
|
||||
Methode = EDataType.BEFÜLLPHASE
|
||||
EintragID = messreiheID,
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BEFÜLLPHASE
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
@@ -161,12 +162,12 @@ namespace DataGen
|
||||
start = start.AddSeconds(2);
|
||||
druck -= dpt;
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Druck = druck.ToString(),
|
||||
Methode = EDataType.BERUHUNGSZEIT,
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
Eintrag = messreiheID
|
||||
EintragID = messreiheID
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
@@ -181,12 +182,12 @@ namespace DataGen
|
||||
druck -= druckabfall;
|
||||
if (druck < 0) druck = 0;
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Druck = druck.ToString(),
|
||||
Methode = EDataType.BERUHUNGSZEIT,
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
Eintrag = messreiheID
|
||||
EintragID = messreiheID
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
@@ -206,12 +207,12 @@ namespace DataGen
|
||||
|
||||
}
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.PRÜFUNGSPHASE,
|
||||
Druck = druck.ToString()
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE,
|
||||
Pressure = druck.ToString()
|
||||
});
|
||||
messreiheID++;
|
||||
Thread.Sleep(100);
|
||||
@@ -221,22 +222,22 @@ namespace DataGen
|
||||
#region EndePrüfung
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.ENDEPRÜFUNGMARKER,
|
||||
Druck = druck.ToString()
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER,
|
||||
Pressure = druck.ToString()
|
||||
}) ;
|
||||
|
||||
start = start.AddSeconds(4);
|
||||
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Druck = druckwerte.Last().ToString(),
|
||||
Pressure = druckwerte.Last().ToString(),
|
||||
Datum = start,
|
||||
Methode = EDataType.ENDEPRÜFUNGMARKER,
|
||||
Eintrag = messreiheID
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER,
|
||||
EintragID = messreiheID
|
||||
}) ;
|
||||
|
||||
while(druck > 10)
|
||||
@@ -245,28 +246,28 @@ namespace DataGen
|
||||
double abbau = druck / 2;
|
||||
druck -= abbau;
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Druck = druck.ToString(),
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(2),
|
||||
Druck = "0,0",
|
||||
Eintrag = messreiheID,
|
||||
Methode = EDataType.LEERPHASE
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messreihen.Add(new GetDataStructure()
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(4),
|
||||
Druck = "0,0",
|
||||
Eintrag = messreiheID+1,
|
||||
Methode = EDataType.ENDEPRÜFUNGMARKER
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID+1,
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER
|
||||
});
|
||||
|
||||
#endregion
|
||||
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtokollWriterContract", "
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{E5A85D83-CEC8-4925-B8AA-068BD6B50528}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtokollWriter", "ProtokollWriter\ProtokollWriter.csproj", "{9762AAF6-BB07-4416-9522-3D2A05C4216A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -86,5 +88,17 @@ Global
|
||||
{E5A85D83-CEC8-4925-B8AA-068BD6B50528}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E5A85D83-CEC8-4925-B8AA-068BD6B50528}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E5A85D83-CEC8-4925-B8AA-068BD6B50528}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9762AAF6-BB07-4416-9522-3D2A05C4216A}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace DPGetDataContract
|
||||
namespace Models
|
||||
{
|
||||
public enum EDataType {
|
||||
public enum EMeasureType {
|
||||
LEERPHASE = 0, // 004
|
||||
BEFÜLLPHASE = 1, // 000
|
||||
BERUHUNGSZEIT = 2, // 001
|
||||
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Models {
|
||||
public enum EMeasureType {
|
||||
|
||||
}
|
||||
namespace Models
|
||||
{
|
||||
public class MeasureData {
|
||||
public int EintragID {get;set;}
|
||||
public DateTime Datum {get;set;}
|
||||
public string Pressure {get;set;}
|
||||
public EMeasureType MeasureType {get;set;}
|
||||
|
||||
11
ProtokollWriter/ProtokollWriter.csproj
Normal file
11
ProtokollWriter/ProtokollWriter.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ProtokollWriterContract\ProtokollWriterContract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user