Completato setup + sim x FL di interclays01
This commit is contained in:
@@ -1,103 +1,136 @@
|
||||
{
|
||||
"SetupSimFloat": {
|
||||
"Temp_Filtro": {
|
||||
0: 0.1,
|
||||
1: 5.6,
|
||||
25: 89.1,
|
||||
50: 103.7,
|
||||
75: 108.3,
|
||||
99: 118.1,
|
||||
100: 135.6
|
||||
},
|
||||
"T_Attuale_Cil": {
|
||||
0: 0.01,
|
||||
1: 0.65,
|
||||
25: 10.36,
|
||||
50: 11.46,
|
||||
75: 11.98,
|
||||
99: 13.99,
|
||||
100: 327.67
|
||||
},
|
||||
"Flowrate": {
|
||||
0: 0.01,
|
||||
1: 0.06,
|
||||
25: 5.34,
|
||||
50: 8.22,
|
||||
75: 9.48,
|
||||
99: 12.86,
|
||||
100: 262.8
|
||||
},
|
||||
"Ampere_Cil": {
|
||||
0: 10.6,
|
||||
1: 14.1,
|
||||
25: 14.4,
|
||||
50: 14.6,
|
||||
75: 15,
|
||||
99: 16.4,
|
||||
100: 79.1
|
||||
},
|
||||
"Ampere_Asp": {
|
||||
0: 12.1,
|
||||
1: 14.8,
|
||||
25: 15.9,
|
||||
50: 17.2,
|
||||
75: 22.1,
|
||||
99: 32.4,
|
||||
100: 87.3
|
||||
},
|
||||
"Ampere_Dosat": {
|
||||
0: 0.1,
|
||||
1: 1.8,
|
||||
25: 2,
|
||||
50: 2,
|
||||
75: 2.1,
|
||||
99: 2.4,
|
||||
100: 3.3
|
||||
}
|
||||
"SetupSimInt": {
|
||||
"Dep_Cil_mmH2O": {
|
||||
0: 1,
|
||||
1: 1,
|
||||
25: 5,
|
||||
50: 10,
|
||||
75: 15,
|
||||
99: 26,
|
||||
100: 52
|
||||
},
|
||||
"SetupSimInt": {
|
||||
"Dep_Cil_mmH2O": {
|
||||
0: 1,
|
||||
1: 1,
|
||||
25: 5,
|
||||
50: 10,
|
||||
75: 15,
|
||||
99: 26,
|
||||
100: 52
|
||||
},
|
||||
"Bruc_0_100": {
|
||||
0: 1,
|
||||
1: 17,
|
||||
25: 24,
|
||||
50: 33,
|
||||
75: 47,
|
||||
99: 71,
|
||||
100: 100
|
||||
},
|
||||
"Asp_0_100": {
|
||||
0: 3,
|
||||
1: 36,
|
||||
25: 52,
|
||||
50: 59,
|
||||
75: 77,
|
||||
99: 100,
|
||||
100: 100
|
||||
}
|
||||
"Bruc_0_100": {
|
||||
0: 1,
|
||||
1: 17,
|
||||
25: 24,
|
||||
50: 33,
|
||||
75: 47,
|
||||
99: 71,
|
||||
100: 100
|
||||
},
|
||||
"SetupDtData": {
|
||||
"Tot_Parz_Dosatore": {
|
||||
"2020-06-30 19:56:21": 1225.481,
|
||||
"2020-11-16 13:01:33": 5419.626,
|
||||
"2022-03-14 11:33:21": 20782.475,
|
||||
"2022-11-21 08:48:21": 27770.447,
|
||||
"2023-03-07 15:40:44": 30951.118
|
||||
},
|
||||
"Tot_Dosatore": {
|
||||
"2020-06-30 19:56:21": 9053.072,
|
||||
"2020-11-16 13:01:33": 13247.217,
|
||||
"2022-03-14 11:33:21": 28610.066,
|
||||
"2022-11-21 08:48:21": 35598.038,
|
||||
"2023-03-07 15:40:44": 38778.709
|
||||
}
|
||||
"Asp_0_100": {
|
||||
0: 3,
|
||||
1: 36,
|
||||
25: 52,
|
||||
50: 59,
|
||||
75: 77,
|
||||
99: 100,
|
||||
100: 100
|
||||
}
|
||||
},
|
||||
"SetupSimReal": {
|
||||
"Temp_Filtro": {
|
||||
0: 0.1,
|
||||
1: 5.6,
|
||||
25: 89.1,
|
||||
50: 103.7,
|
||||
75: 108.3,
|
||||
99: 118.1,
|
||||
100: 135.6
|
||||
},
|
||||
"T_Attuale_Cil": {
|
||||
0: 0.01,
|
||||
1: 0.65,
|
||||
25: 10.36,
|
||||
50: 11.46,
|
||||
75: 11.98,
|
||||
99: 13.99,
|
||||
100: 327.67
|
||||
},
|
||||
"Flowrate": {
|
||||
0: 0.01,
|
||||
1: 0.06,
|
||||
25: 5.34,
|
||||
50: 8.22,
|
||||
75: 9.48,
|
||||
99: 12.86,
|
||||
100: 262.8
|
||||
},
|
||||
"Ampere_Cil": {
|
||||
0: 10.6,
|
||||
1: 14.1,
|
||||
25: 14.4,
|
||||
50: 14.6,
|
||||
75: 15,
|
||||
99: 16.4,
|
||||
100: 79.1
|
||||
},
|
||||
"Ampere_Asp": {
|
||||
0: 12.1,
|
||||
1: 14.8,
|
||||
25: 15.9,
|
||||
50: 17.2,
|
||||
75: 22.1,
|
||||
99: 32.4,
|
||||
100: 87.3
|
||||
},
|
||||
"Ampere_Dosat": {
|
||||
0: 0.1,
|
||||
1: 1.8,
|
||||
25: 2,
|
||||
50: 2,
|
||||
75: 2.1,
|
||||
99: 2.4,
|
||||
100: 3.3
|
||||
}
|
||||
},
|
||||
"SetupDtData": {
|
||||
"Tot_Parz_Dosatore": {
|
||||
"2019-11-29 02:24:13": 3619.129,
|
||||
"2020-01-08 13:56:24": 4101.16,
|
||||
"2020-01-12 17:34:34": 4201.494,
|
||||
"2020-01-12 17:34:35": 0,
|
||||
"2020-01-17 17:34:35": 119.352,
|
||||
"2020-01-31 11:39:32": 471.494,
|
||||
"2020-02-07 19:38:58": 606.883,
|
||||
"2020-03-19 23:59:53": 2112.625,
|
||||
"2020-04-23 20:38:32": 2929.045,
|
||||
"2020-05-15 17:30:57": 3500.943,
|
||||
"2020-05-15 17:30:58": 447.943,
|
||||
"2020-05-15 20:04:57": 457.217,
|
||||
"2020-05-15 20:04:58": 0,
|
||||
"2020-06-12 19:19:36": 736.229,
|
||||
"2020-06-30 19:56:21": 1225.481,
|
||||
"2020-07-14 20:05:37": 1828.772,
|
||||
"2020-07-28 20:15:55": 2358.175,
|
||||
"2020-09-30 11:29:26": 4081.050,
|
||||
"2020-11-16 13:01:33": 5419.626,
|
||||
"2021-11-24 12:50:37": 16632.060,
|
||||
"2022-01-14 20:07:39": 18187.904,
|
||||
"2022-03-14 11:33:21": 20782.475,
|
||||
"2022-11-21 08:48:21": 27770.447,
|
||||
"2023-03-07 15:40:44": 30951.118
|
||||
},
|
||||
"Tot_Dosatore": {
|
||||
"2019-11-29 02:24:14": 3770.426,
|
||||
"2020-01-08 13:56:24": 4252.457,
|
||||
"2020-01-17 17:34:35": 4465.844,
|
||||
"2020-01-31 11:39:32": 4817.986,
|
||||
"2020-02-07 19:38:58": 4953.375,
|
||||
"2020-03-19 23:59:53": 6459.117,
|
||||
"2020-04-23 20:38:32": 7275.537,
|
||||
"2020-05-15 17:30:58": 7818.401,
|
||||
"2020-06-12 19:19:36": 8563.820,
|
||||
"2020-06-30 19:56:21": 9053.072,
|
||||
"2020-07-14 20:05:37": 9656.363,
|
||||
"2020-07-28 20:15:55": 10185.766,
|
||||
"2020-09-30 11:29:26": 11908.641,
|
||||
"2020-11-16 13:01:33": 13247.217,
|
||||
"2021-11-24 12:50:37": 24459.651,
|
||||
"2022-01-14 20:07:39": 26015.495,
|
||||
"2022-03-14 11:33:21": 28610.066,
|
||||
"2022-11-21 08:48:21": 35598.038,
|
||||
"2023-03-07 15:40:44": 38778.709
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +1,103 @@
|
||||
{
|
||||
"SetupSimFloat": {
|
||||
"Temp_Filtro": {
|
||||
0: 0.1,
|
||||
1: 5.6,
|
||||
25: 89.1,
|
||||
50: 103.7,
|
||||
75: 108.3,
|
||||
99: 118.1,
|
||||
100: 135.6
|
||||
},
|
||||
"T_Attuale_Cil": {
|
||||
0: 0.01,
|
||||
1: 0.65,
|
||||
25: 10.36,
|
||||
50: 11.46,
|
||||
75: 11.98,
|
||||
99: 13.99,
|
||||
100: 327.67
|
||||
},
|
||||
"Flowrate": {
|
||||
0: 0.01,
|
||||
1: 0.06,
|
||||
25: 5.34,
|
||||
50: 8.22,
|
||||
75: 9.48,
|
||||
99: 12.86,
|
||||
100: 262.8
|
||||
},
|
||||
"Ampere_Cil": {
|
||||
0: 10.6,
|
||||
1: 14.1,
|
||||
25: 14.4,
|
||||
50: 14.6,
|
||||
75: 15,
|
||||
99: 16.4,
|
||||
100: 79.1
|
||||
},
|
||||
"Ampere_Asp": {
|
||||
0: 12.1,
|
||||
1: 14.8,
|
||||
25: 15.9,
|
||||
50: 17.2,
|
||||
75: 22.1,
|
||||
99: 32.4,
|
||||
100: 87.3
|
||||
},
|
||||
"Ampere_Dosat": {
|
||||
0: 0.1,
|
||||
1: 1.8,
|
||||
25: 2,
|
||||
50: 2,
|
||||
75: 2.1,
|
||||
99: 2.4,
|
||||
100: 3.3
|
||||
}
|
||||
"SetupSimInt": {
|
||||
"Dep_Cil_mmH2O": {
|
||||
0: 1,
|
||||
1: 1,
|
||||
25: 5,
|
||||
50: 10,
|
||||
75: 15,
|
||||
99: 26,
|
||||
100: 52
|
||||
},
|
||||
"SetupSimInt": {
|
||||
"Dep_Cil_mmH2O": {
|
||||
0: 1,
|
||||
1: 1,
|
||||
25: 5,
|
||||
50: 10,
|
||||
75: 15,
|
||||
99: 26,
|
||||
100: 52
|
||||
},
|
||||
"Bruc_0_100": {
|
||||
0: 1,
|
||||
1: 17,
|
||||
25: 24,
|
||||
50: 33,
|
||||
75: 47,
|
||||
99: 71,
|
||||
100: 100
|
||||
},
|
||||
"Asp_0_100": {
|
||||
0: 3,
|
||||
1: 36,
|
||||
25: 52,
|
||||
50: 59,
|
||||
75: 77,
|
||||
99: 100,
|
||||
100: 100
|
||||
}
|
||||
"Bruc_0_100": {
|
||||
0: 1,
|
||||
1: 17,
|
||||
25: 24,
|
||||
50: 33,
|
||||
75: 47,
|
||||
99: 71,
|
||||
100: 100
|
||||
},
|
||||
"SetupDtData": {
|
||||
"Tot_Parz_Dosatore": {
|
||||
"2020-06-30 19:56:21": 1225.481,
|
||||
"2020-11-16 13:01:33": 5419.626,
|
||||
"2022-03-14 11:33:21": 20782.475,
|
||||
"2022-11-21 08:48:21": 27770.447,
|
||||
"2023-03-07 15:40:44": 30951.118
|
||||
},
|
||||
"Tot_Dosatore": {
|
||||
"2020-06-30 19:56:21": 9053.072,
|
||||
"2020-11-16 13:01:33": 13247.217,
|
||||
"2022-03-14 11:33:21": 28610.066,
|
||||
"2022-11-21 08:48:21": 35598.038,
|
||||
"2023-03-07 15:40:44": 38778.709
|
||||
}
|
||||
"Asp_0_100": {
|
||||
0: 3,
|
||||
1: 36,
|
||||
25: 52,
|
||||
50: 59,
|
||||
75: 77,
|
||||
99: 100,
|
||||
100: 100
|
||||
}
|
||||
},
|
||||
"SetupSimReal": {
|
||||
"Temp_Filtro": {
|
||||
0: 0.1,
|
||||
1: 5.6,
|
||||
25: 89.1,
|
||||
50: 103.7,
|
||||
75: 108.3,
|
||||
99: 118.1,
|
||||
100: 135.6
|
||||
},
|
||||
"T_Attuale_Cil": {
|
||||
0: 0.01,
|
||||
1: 0.65,
|
||||
25: 10.36,
|
||||
50: 11.46,
|
||||
75: 11.98,
|
||||
99: 13.99,
|
||||
100: 327.67
|
||||
},
|
||||
"Flowrate": {
|
||||
0: 0.01,
|
||||
1: 0.06,
|
||||
25: 5.34,
|
||||
50: 8.22,
|
||||
75: 9.48,
|
||||
99: 12.86,
|
||||
100: 262.8
|
||||
},
|
||||
"Ampere_Cil": {
|
||||
0: 10.6,
|
||||
1: 14.1,
|
||||
25: 14.4,
|
||||
50: 14.6,
|
||||
75: 15,
|
||||
99: 16.4,
|
||||
100: 79.1
|
||||
},
|
||||
"Ampere_Asp": {
|
||||
0: 12.1,
|
||||
1: 14.8,
|
||||
25: 15.9,
|
||||
50: 17.2,
|
||||
75: 22.1,
|
||||
99: 32.4,
|
||||
100: 87.3
|
||||
},
|
||||
"Ampere_Dosat": {
|
||||
0: 0.1,
|
||||
1: 1.8,
|
||||
25: 2,
|
||||
50: 2,
|
||||
75: 2.1,
|
||||
99: 2.4,
|
||||
100: 3.3
|
||||
}
|
||||
},
|
||||
"SetupDtData": {
|
||||
"Tot_Parz_Dosatore": {
|
||||
"2020-06-30 19:56:21": 1225.481,
|
||||
"2020-11-16 13:01:33": 5419.626,
|
||||
"2022-03-14 11:33:21": 20782.475,
|
||||
"2022-11-21 08:48:21": 27770.447,
|
||||
"2023-03-07 15:40:44": 30951.118
|
||||
},
|
||||
"Tot_Dosatore": {
|
||||
"2020-06-30 19:56:21": 9053.072,
|
||||
"2020-11-16 13:01:33": 13247.217,
|
||||
"2022-03-14 11:33:21": 28610.066,
|
||||
"2022-11-21 08:48:21": 35598.038,
|
||||
"2023-03-07 15:40:44": 38778.709
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,38 +277,36 @@
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};{item.Key};{simInt};{idxCount++}";
|
||||
rows.Add(currRow);
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(5, 50));
|
||||
idxCount = idxCount <= 9999 ? idxCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// poi gli item FLOAT
|
||||
// poi gli item REAL
|
||||
if (currSetup.SetupSimReal.Count > 0)
|
||||
{
|
||||
foreach (var item in currSetup.SetupSimReal)
|
||||
{
|
||||
simReal = simValReal(doProd, item.Key, item.Value);
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};{item.Key};{simInt};{idxCount++}";
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};{item.Key};{simReal};{idxCount++}";
|
||||
rows.Add(currRow);
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(5, 50));
|
||||
idxCount = idxCount <= 9999 ? idxCount : 0;
|
||||
}
|
||||
}
|
||||
// infine certo gli items basati su datetime
|
||||
if (currSetup.SetupDtData.Count > 0 && doProd)
|
||||
{
|
||||
foreach (var item in currSetup.SetupDtData)
|
||||
{
|
||||
simReal = simValData(dtCurs, item.Key, item.Value);
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};{item.Key};{simReal};{idxCount++}";
|
||||
rows.Add(currRow);
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(5, 50));
|
||||
idxCount = idxCount <= 9999 ? idxCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// infine certo gli items basati su datetime
|
||||
|
||||
|
||||
|
||||
#if false
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};kgImp;{valReq};{idxCount++}";
|
||||
rows.Add(currRow);
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(50, 300));
|
||||
currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};kgAct;{valCurr};{idxCount++}";
|
||||
rows.Add(currRow);
|
||||
// incremento peso... SE <= max...
|
||||
if (valCurr < valTo)
|
||||
{
|
||||
valCurr += rnd.Next(stepMin / valStep, stepMax / valStep) * valStep;
|
||||
}
|
||||
#endif
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(27000, 33000));
|
||||
dtCurs = dtCurs.AddMilliseconds(rnd.Next(87000, 93000));
|
||||
// reset counter
|
||||
idxCount = idxCount <= 9999 ? idxCount : 0;
|
||||
}
|
||||
@@ -327,23 +325,20 @@
|
||||
int result = 0;
|
||||
// se è in prod --> 50° perc in su...
|
||||
int rawSim = rnd.Next(0, 50) + (doProd ? 50 : 0);
|
||||
if (currSetup.SetupSimInt.ContainsKey(codFlux))
|
||||
{
|
||||
// transcodifico
|
||||
var val0 = transcMap
|
||||
.Where(x => x.Key <= rawSim)
|
||||
.OrderByDescending(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
var val1 = transcMap
|
||||
.Where(x => x.Key >= rawSim)
|
||||
.OrderBy(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
result = val0.Value + (int)Math.Round((double)(val1.Value - val0.Value) * (rawSim - val0.Key) / (val1.Key - val0.Key), 0);
|
||||
}
|
||||
// transcodifico
|
||||
var val0 = transcMap
|
||||
.Where(x => x.Key <= rawSim)
|
||||
.OrderByDescending(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
var val1 = transcMap
|
||||
.Where(x => x.Key >= rawSim)
|
||||
.OrderBy(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
result = val0.Value + (int)Math.Round((double)(val1.Value - val0.Value) * (rawSim - val0.Key) / (val1.Key - val0.Key), 0);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Simulazione valore int secondo tab transcodifica:
|
||||
/// Simulazione valore REAL secondo tab transcodifica:
|
||||
/// doProd=true --> simulo 50° percentile in su, altrimenti primi 50 percentili...
|
||||
/// </summary>
|
||||
/// <param name="doProd"></param>
|
||||
@@ -355,19 +350,42 @@
|
||||
double result = 0;
|
||||
// se è in prod --> 50° perc in su...
|
||||
int rawSim = rnd.Next(0, 50) + (doProd ? 50 : 0);
|
||||
if (currSetup.SetupSimInt.ContainsKey(codFlux))
|
||||
{
|
||||
// transcodifico
|
||||
var val0 = transcMap
|
||||
.Where(x => x.Key <= rawSim)
|
||||
.OrderByDescending(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
var val1 = transcMap
|
||||
.Where(x => x.Key >= rawSim)
|
||||
.OrderBy(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
result = val0.Value + Math.Round((val1.Value - val0.Value) * (rawSim - val0.Key) / (val1.Key - val0.Key), 0);
|
||||
}
|
||||
// transcodifico
|
||||
var val0 = transcMap
|
||||
.Where(x => x.Key <= rawSim)
|
||||
.OrderByDescending(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
var val1 = transcMap
|
||||
.Where(x => x.Key >= rawSim)
|
||||
.OrderBy(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
result = Math.Round(val0.Value + (val1.Value - val0.Value) * (rawSim - val0.Key) / (val1.Key - val0.Key), 2);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Simulazione valore Real dt-based secondo tab transcodifica
|
||||
/// </summary>
|
||||
/// <param name="dtCurs"></param>
|
||||
/// <param name="codFlux"></param>
|
||||
/// <param name="transcMap"></param>
|
||||
/// <returns></returns>
|
||||
protected double simValData(DateTime dtCurs, string codFlux, Dictionary<DateTime, double> transcMap)
|
||||
{
|
||||
double result = 0;
|
||||
int rawSim = rnd.Next(-5000, 5000);
|
||||
// perturbo la data in ms per +/-5 sec
|
||||
dtCurs = dtCurs.AddMilliseconds(rawSim);
|
||||
// transcodifico
|
||||
var val0 = transcMap
|
||||
.Where(x => x.Key <= dtCurs)
|
||||
.OrderByDescending(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
var val1 = transcMap
|
||||
.Where(x => x.Key >= dtCurs)
|
||||
.OrderBy(x => x.Value)
|
||||
.FirstOrDefault();
|
||||
// prendo valore intervallo calcolato...
|
||||
result = Math.Round(val0.Value + (val1.Value - val0.Value) * (dtCurs - val0.Key) / (val1.Key - val0.Key), 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user