Datagen moved out
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DPGetDataContract\DPGetDataContract.csproj" />
|
||||
<ProjectReference Include="..\Models\Models.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,355 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DPGetDataContract;
|
||||
using Models;
|
||||
|
||||
namespace DataGen
|
||||
{
|
||||
public class MeasureDataGen : IDPGetDataContract
|
||||
{
|
||||
List<MeasureData> messureList = new List<MeasureData>();
|
||||
public List<MeasureData> ReadMessureList { get => messureList;}
|
||||
|
||||
|
||||
/*
|
||||
public void GenerateÜberdruck(DateTime startprüfung, double prüfdruck, bool failure=false) {
|
||||
List<MeasureData> messreihen = new List<MeasureData>();
|
||||
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 MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.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 MeasureData()
|
||||
{
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
EintragID = 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 MeasureData()
|
||||
{
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
EintragID = 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 MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE,
|
||||
Pressure = druck.ToString()
|
||||
});
|
||||
messreiheID++;
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region EndePrüfung
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER,
|
||||
Pressure = druck.ToString()
|
||||
}) ;
|
||||
|
||||
start = start.AddSeconds(4);
|
||||
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Pressure = druckwerte.Last().ToString(),
|
||||
Datum = start,
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER,
|
||||
EintragID = messreiheID
|
||||
}) ;
|
||||
|
||||
while(druck > 10)
|
||||
{
|
||||
start = start.AddSeconds(2);
|
||||
double abbau = druck / 2;
|
||||
druck -= abbau;
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(2),
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(4),
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID+1,
|
||||
MeasureType = EMeasureType.ENDEPRÜFUNGMARKER
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
messureList = messreihen;
|
||||
}
|
||||
*/
|
||||
/// <summary>
|
||||
/// Generiert unterdruck reihen
|
||||
/// </summary>
|
||||
/// <param name="startprüfung"></param>
|
||||
/// <param name="prüfdruck"></param>
|
||||
/// <param name="testduration">Länge der Prüfung in Sekunden</param>
|
||||
/// <param name="failure"></param>
|
||||
public void GenerateUnterdruck(DateTime startprüfung, double prüfdruck, int testduration , bool failure = false)
|
||||
{
|
||||
List<MeasureData> messreihen = new List<MeasureData>();
|
||||
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.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 MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
Pressure = (druck * -1).ToString(),
|
||||
MeasureType = EMeasureType.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 MeasureData()
|
||||
{
|
||||
Pressure = (druck * -1).ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
EintragID = 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 MeasureData()
|
||||
{
|
||||
Pressure = druck.ToString(),
|
||||
MeasureType = EMeasureType.BERUHUNGSZEIT,
|
||||
Datum = start,
|
||||
EintragID = messreiheID
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Prüfungsphase
|
||||
if (!failure)
|
||||
{
|
||||
for (int i = 0; i < (testduration / 2); 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 MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE,
|
||||
Pressure = (druck * -1).ToString()
|
||||
});
|
||||
messreiheID++;
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region EndePrüfung
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.ENDE,
|
||||
Pressure = (druck * -1).ToString()
|
||||
});
|
||||
|
||||
start = start.AddSeconds(4);
|
||||
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Pressure = (druckwerte.Last() * -1).ToString(),
|
||||
Datum = start,
|
||||
MeasureType = EMeasureType.ENDE,
|
||||
EintragID = messreiheID
|
||||
});
|
||||
|
||||
while (druck > 10)
|
||||
{
|
||||
start = start.AddSeconds(2);
|
||||
double abbau = druck / 2;
|
||||
druck -= abbau;
|
||||
druckwerte.Add(druck);
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = (druck * -1).ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.ABLUFT
|
||||
});
|
||||
messreiheID++;
|
||||
}
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(2),
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.ABLUFT
|
||||
});
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start.AddSeconds(4),
|
||||
Pressure = "0,0",
|
||||
EintragID = messreiheID + 1,
|
||||
MeasureType = EMeasureType.ENDE
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
messureList = messreihen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
23
obj/Debug/netstandard2.0/DataGen.AssemblyInfo.cs
Normal file
23
obj/Debug/netstandard2.0/DataGen.AssemblyInfo.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("DataGen")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("DataGen")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("DataGen")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
9113d0cf00bae8fabc242e3d8175fb5a59bf4d1d
|
||||
@@ -0,0 +1,3 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = DataGen
|
||||
build_property.ProjectDir = C:\Users\KFZ\Desktop\source\Dichtheitsprüfung_\DataGen\
|
||||
Reference in New Issue
Block a user