From e2867b0cad237888be7c3567d43deee496ab8e2c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 8 May 2023 20:04:35 +0200 Subject: [PATCH] Completato SIM Eventi x 01 --- MapoDataFiller/Filler/InterClays.cs | 48 +++++++++++++++++------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/MapoDataFiller/Filler/InterClays.cs b/MapoDataFiller/Filler/InterClays.cs index ad2df43..514323a 100644 --- a/MapoDataFiller/Filler/InterClays.cs +++ b/MapoDataFiller/Filler/InterClays.cs @@ -51,8 +51,8 @@ // verifico il tipo di CodIOB if (CodIOB == "INTERCL_01") { - // tiro a dadi x decidere SE LAVORA periodo... 60% dei casi - doProd = (rnd.Next(0, 100) <= 60); + // tiro a dadi x decidere SE LAVORA periodo... 50% dei casi nel periodo TRACCIATO + doProd = (rnd.Next(0, 100) <= 40); // FluxLOG: genero righe FL x periodo e sommo nextRowsFL = IC_ESS_getFlRows(CodIOB, dtStart, dtEnd, doProd, ref idxFl); @@ -216,29 +216,39 @@ string currRow = ""; // reset counter idxCount = idxCount <= 9999 ? idxCount : 0; - // se produce registro poweron... + var fullDuration = dtEnd.Subtract(dtStart).TotalMinutes; + // se produce registro riscaldamento + poweron... if (doProd) { - currRow = $"{CodIOB};{dtStart.AddSeconds(5):yyyy-MM-dd HH:mm:ss.fff};16;ND;[{idxCount++}] 23;0;-"; + // calcolo 1/8 = 12.5% riscaldamento... + currRow = $"{CodIOB};{dtStart.AddSeconds(1):yyyy-MM-dd HH:mm:ss.fff};40;ND;[{idxCount++}] 34;0;-"; rows.Add(currRow); - currRow = $"{CodIOB};{dtEnd.AddSeconds(-5):yyyy-MM-dd HH:mm:ss.fff};15;ND;[{idxCount++}] 01;0;-"; + // ...il resto lavoro... partendo a 1/8 + currRow = $"{CodIOB};{dtStart.AddMinutes(fullDuration / 8):yyyy-MM-dd HH:mm:ss.fff};16;ND;[{idxCount++}] 13;0;-"; + rows.Add(currRow); + currRow = $"{CodIOB};{dtEnd.AddSeconds(-1):yyyy-MM-dd HH:mm:ss.fff};15;ND;[{idxCount++}] 12;0;-"; rows.Add(currRow); } // se NON produce alterno valori spenta/accesa else { - // genera i dati secondo lo schema configurato... con periodo da 15" a 15 min di pausa - while (dtCurs < dtEnd) - { - currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};15;ND;[{idxCount++}] 01;0;-"; - rows.Add(currRow); - dtCurs = dtCurs.AddSeconds(rnd.Next(60 * 5, 60 * 15)); - currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};14;ND;[{idxCount++}] 00;0;-"; - rows.Add(currRow); - dtCurs = dtCurs.AddMilliseconds(rnd.Next(500, 5000)); - // reset counter - idxCount = idxCount <= 9999 ? idxCount : 0; - } + /* + * genera i dati con durata secondo pareto standard... + * - 10% --> 24: manuale + * - 30% --> 15: fermo generico + * - 60% --> 14: spenta + */ + // manuale + currRow = $"{CodIOB};{dtStart.AddSeconds(1):yyyy-MM-dd HH:mm:ss.fff};24;ND;[{idxCount++}] 24;0;-"; + rows.Add(currRow); + // fermo generico dopo 10% + currRow = $"{CodIOB};{dtStart.AddMinutes(fullDuration / 10):yyyy-MM-dd HH:mm:ss.fff};15;ND;[{idxCount++}] 12;0;-"; + rows.Add(currRow); + // spenta dopo 40% + currRow = $"{CodIOB};{dtStart.AddMinutes(fullDuration * 4 / 10):yyyy-MM-dd HH:mm:ss.fff};15;ND;[{idxCount++}] 12;0;-"; + rows.Add(currRow); + // reset counter + idxCount = idxCount <= 9999 ? idxCount : 0; } return rows; } @@ -297,8 +307,8 @@ { 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++}"; + simDTime = simValData(dtCurs, item.Key, item.Value); + currRow = $"{CodIOB};{dtCurs:yyyy-MM-dd HH:mm:ss.fff};{item.Key};{simDTime};{idxCount++}"; rows.Add(currRow); dtCurs = dtCurs.AddMilliseconds(rnd.Next(5, 50)); idxCount = idxCount <= 9999 ? idxCount : 0;