-a
This commit is contained in:
@@ -14,104 +14,7 @@ namespace DataGen
|
||||
public List<MeasureData> ReadMessureList { get => messureList;}
|
||||
|
||||
|
||||
public void GenerateUnterdruck(DateTime startprüfung, double prüfdruck, bool failure=false) {
|
||||
|
||||
int messreiheID = -1;
|
||||
List<MeasureData> messreihen = new List<MeasureData>();
|
||||
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 MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
#endregion
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.BEFÜLLPHASE
|
||||
});
|
||||
start = start.AddMinutes(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE
|
||||
});
|
||||
start = start.AddMinutes(15);
|
||||
start = start.AddSeconds(3);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.PRÜFUNGSPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.BEFÜLLPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = druck.ToString(),
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
start = start.AddSeconds(2);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = "0,000",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
}) ;
|
||||
start = start.AddSeconds(1);
|
||||
messreiheID++;
|
||||
messreihen.Add(new MeasureData()
|
||||
{
|
||||
Datum = start,
|
||||
Pressure = "0,000",
|
||||
EintragID = messreiheID,
|
||||
MeasureType = EMeasureType.LEERPHASE
|
||||
});
|
||||
messureList = messreihen;
|
||||
}
|
||||
/*
|
||||
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();
|
||||
@@ -274,8 +177,179 @@ namespace DataGen
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user