diff --git a/Docs/DevNotes.txt b/Docs/DevNotes.txt new file mode 100644 index 0000000..34ead7d --- /dev/null +++ b/Docs/DevNotes.txt @@ -0,0 +1,9 @@ +Gestione veto registrazione intervento +Manutenzione: impostare il valore come % della vita residua MINIMO, es 95% --> significa che anche se resta 95% del tempo --> permetto di fare manutenzione + + +nuovi stati da aggiungere... +Serve una gestione dal plc x indicare carico vuoto oppure scarico pieno, questo deve dare un segnale di stato/modo che si possa interpretare sul decoder e riportare. Va fatto forse no su impulso ma su un segnale che duri ALMENO 5-10 secondi + + + diff --git a/MP.MONO.ADAPTER.OPC/CONF/Alarms.json b/MP.MONO.ADAPTER.OPC/CONF/Alarms.json index 115c6c9..f64383c 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Alarms.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Alarms.json @@ -1,7 +1,7 @@ [ { "Order": 1, - "ExtCode": "ns=5;i=1274", + "ExtCode": "ns=1;s=3_1_ALARM NC", "Type": "ALARM", "Title": "ALARM NC", "Value": "", @@ -13,7 +13,7 @@ }, { "Order": 2, - "ExtCode": "ns=5;i=1259", + "ExtCode": "ns=1;s=3_2_ALARM PLC 1", "Type": "ALARM", "Title": "ALARM PLC 01", "Value": "", @@ -22,5 +22,173 @@ "MaxVal": 0, "DisplFormat": "", "IsNumeric": false + }, + { + "Order": 3, + "ExtCode": "ns=1;s=3_3_ALARM PLC 2", + "Type": "ALARM", + "Title": "ALARM PLC 02", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 4, + "ExtCode": "ns=1;s=3_4_ALARM PLC 3", + "Type": "ALARM", + "Title": "ALARM PLC 03", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 5, + "ExtCode": "ns=1;s=3_5_ALARM PLC 4", + "Type": "ALARM", + "Title": "ALARM PLC 04", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 6, + "ExtCode": "ns=1;s=3_6_ALARM PLC 5", + "Type": "ALARM", + "Title": "ALARM PLC 05", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 7, + "ExtCode": "ns=1;s=3_7_ALARM PLC 6", + "Type": "ALARM", + "Title": "ALARM PLC 06", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 8, + "ExtCode": "ns=1;s=3_8_ALARM PLC 7", + "Type": "ALARM", + "Title": "ALARM PLC 07", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 9, + "ExtCode": "ns=1;s=3_9_ALARM PLC 8", + "Type": "ALARM", + "Title": "ALARM PLC 08", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 10, + "ExtCode": "ns=1;s=3_10_ALARM PLC 9", + "Type": "ALARM", + "Title": "ALARM PLC 09", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 11, + "ExtCode": "ns=1;s=3_11_ALARM PLC 10", + "Type": "ALARM", + "Title": "ALARM PLC 10", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 12, + "ExtCode": "ns=1;s=3_12_ALARM PLC 11", + "Type": "ALARM", + "Title": "ALARM PLC 11", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 13, + "ExtCode": "ns=1;s=3_13_ALARM PLC 12", + "Type": "ALARM", + "Title": "ALARM PLC 12", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 14, + "ExtCode": "ns=1;s=3_14_ALARM PLC 13", + "Type": "ALARM", + "Title": "ALARM PLC 13", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 15, + "ExtCode": "ns=1;s=3_15_ALARM PLC 14", + "Type": "ALARM", + "Title": "ALARM PLC 14", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 16, + "ExtCode": "ns=1;s=3_16_ALARM PLC 15", + "Type": "ALARM", + "Title": "ALARM PLC 15", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/Alarms.multiax.json b/MP.MONO.ADAPTER.OPC/CONF/Alarms.multiax.json index 6532f6f..f64383c 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Alarms.multiax.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Alarms.multiax.json @@ -130,5 +130,65 @@ "MaxVal": 0, "DisplFormat": "", "IsNumeric": false + }, + { + "Order": 12, + "ExtCode": "ns=1;s=3_12_ALARM PLC 11", + "Type": "ALARM", + "Title": "ALARM PLC 11", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 13, + "ExtCode": "ns=1;s=3_13_ALARM PLC 12", + "Type": "ALARM", + "Title": "ALARM PLC 12", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 14, + "ExtCode": "ns=1;s=3_14_ALARM PLC 13", + "Type": "ALARM", + "Title": "ALARM PLC 13", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 15, + "ExtCode": "ns=1;s=3_15_ALARM PLC 14", + "Type": "ALARM", + "Title": "ALARM PLC 14", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 16, + "ExtCode": "ns=1;s=3_16_ALARM PLC 15", + "Type": "ALARM", + "Title": "ALARM PLC 15", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/Counters.json b/MP.MONO.ADAPTER.OPC/CONF/Counters.json index af1b8cb..d3ed7d0 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Counters.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Counters.json @@ -98,5 +98,17 @@ "EnablePlot": true, "ShowBar": true, "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 7, + "ExtCode": "ns=1;s=502_1_RECIPE NAME", + "Type": "PROGRAM", + "Title": "RECIPE NAME", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.demo.json b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.demo.json index 115c6c9..a493844 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.demo.json +++ b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.demo.json @@ -1,26 +1,41 @@ [ { "Order": 1, - "ExtCode": "ns=5;i=1274", - "Type": "ALARM", - "Title": "ALARM NC", + "ExtCode": "ns=3;i=11176", + "Type": "STATUS", + "Title": "MACHINE STATUS", "Value": "", "ValueNum": 0, "MinVal": 0, - "MaxVal": 0, - "DisplFormat": "", - "IsNumeric": false + "MaxVal": 10, + "ScaleFactor": 0.1, + "DisplFormat": "N0", + "IsNumeric": true }, { "Order": 2, - "ExtCode": "ns=5;i=1259", - "Type": "ALARM", - "Title": "ALARM PLC 01", + "ExtCode": "ns=3;i=11230", + "Type": "STATUS", + "Title": "PROCESS STATUS", "Value": "", "ValueNum": 0, "MinVal": 0, - "MaxVal": 0, - "DisplFormat": "", - "IsNumeric": false + "MaxVal": 20, + "ScaleFactor": 0.1, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 3, + "ExtCode": "ns=3;i=11236", + "Type": "MODE", + "Title": "PROCESS MODE", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "ScaleFactor": 0.1, + "DisplFormat": "N0", + "IsNumeric": true } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json index 1b6edea..e879939 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json +++ b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json @@ -34,5 +34,65 @@ "MaxVal": 10, "DisplFormat": "N0", "IsNumeric": true + }, + { + "Order": 4, + "ExtCode": "ns=1;s=502_1_RECIPE NAME", + "Type": "PROGRAM", + "Title": "RECIPE NAME", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 5, + "ExtCode": "ns=1;s=51_P2 PALLET STATUS", + "Type": "STATUS", + "Title": "P2 PALLET STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 6, + "ExtCode": "ns=1;s=52_P3 PALLET STATUS", + "Type": "STATUS", + "Title": "P3 PALLET STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 7, + "ExtCode": "ns=1;s=53_P2 EXTERNAL PALLET STATUS", + "Type": "STATUS", + "Title": "P2 EXTERNAL PALLET STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 8, + "ExtCode": "ns=1;s=54_P3 EXTERNAL PALLET STATUS", + "Type": "STATUS", + "Title": "P3 EXTERNAL PALLET STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.multiax.json b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.multiax.json index 1b6edea..fed7f9a 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.multiax.json +++ b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.multiax.json @@ -34,5 +34,17 @@ "MaxVal": 10, "DisplFormat": "N0", "IsNumeric": true + }, + { + "Order": 4, + "ExtCode": "ns=1;s=502_1_RECIPE NAME", + "Type": "PROGRAM", + "Title": "RECIPE NAME", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/Multiax.json b/MP.MONO.ADAPTER.OPC/CONF/Multiax.json index 6847e47..9b24df7 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Multiax.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Multiax.json @@ -121,6 +121,11 @@ "ns=1;s=3_9_ALARM PLC 8", "ns=1;s=3_10_ALARM PLC 9", "ns=1;s=3_11_ALARM PLC 10", + "ns=1;s=3_12_ALARM PLC 11", + "ns=1;s=3_13_ALARM PLC 12", + "ns=1;s=3_14_ALARM PLC 13", + "ns=1;s=3_15_ALARM PLC 14", + "ns=1;s=3_16_ALARM PLC 15", "ns=1;s=4_1_AXIS 1 LOAD PC", "ns=1;s=4_2_AXIS 2 LOAD PC", "ns=1;s=4_3_AXIS 3 LOAD PC", @@ -152,6 +157,10 @@ "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC", "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC", "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC", + "ns=1;s=51_P2 PALLET STATUS", + "ns=1;s=52_P3 PALLET STATUS", + "ns=1;s=53_P2 EXTERNAL PALLET STATUS", + "ns=1;s=54_P3 EXTERNAL PALLET STATUS", "ns=1;s=500_1_STATUS", "ns=1;s=501_1_MODE", "ns=1;s=502_1_RECIPE NAME", diff --git a/MP.MONO.ADAPTER.OPC/CONF/ParamList.json b/MP.MONO.ADAPTER.OPC/CONF/ParamList.json deleted file mode 100644 index 5eb6977..0000000 --- a/MP.MONO.ADAPTER.OPC/CONF/ParamList.json +++ /dev/null @@ -1,128 +0,0 @@ -[ - { - "Order": 3, - "HLShow": true, - "Type": "SPEED-5000-10000", - "Title": "SPEED", - "Value": "4000", - "ValueNum": 4000, - "MinVal": 1000, - "MaxVal": 10000, - "DisplFormat": "N0", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-gauge-high", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 2, - "HLShow": true, - "Type": "FEED-3000-5000", - "Title": "FEED", - "Value": "2500", - "ValueNum": 2500, - "MinVal": 1000, - "MaxVal": 5000, - "DisplFormat": "N0", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-gauge-high", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 1, - "HLShow": true, - "Type": "LOAD", - "Title": "SPINDLE LOAD", - "Value": "30", - "ValueNum": 30, - "MinVal": 0, - "MaxVal": 100, - "DisplFormat": "N1", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-bolt", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 4, - "Type": "POS", - "Title": "X POS", - "Value": "1500", - "ValueNum": 1500, - "MinVal": 0, - "MaxVal": 5000, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 5, - "Type": "POS", - "Title": "Y POS", - "Value": "5000", - "ValueNum": 5000, - "MinVal": 0, - "MaxVal": 10000, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 6, - "Type": "POS", - "Title": "Z POS", - "Value": "-1500", - "ValueNum": -1500, - "MinVal": -3000, - "MaxVal": 0, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 7, - "Type": "POS", - "Title": "A POS", - "Value": "150", - "ValueNum": 150, - "MinVal": 0, - "MaxVal": 360, - "DisplFormat": "N3", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-rotate-right", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 8, - "Type": "POS", - "Title": "B POS", - "Value": "150", - "ValueNum": 150, - "MinVal": 0, - "MaxVal": 360, - "DisplFormat": "N3", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-rotate-right", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - } -] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/Tools.json b/MP.MONO.ADAPTER.OPC/CONF/Tools.json index d255f07..04e9d12 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Tools.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Tools.json @@ -3,7 +3,7 @@ "Order": 0, "ExtCode": "ns=1;s=5_1_TOOL 1 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 01", + "Title": "SPINDLE 1 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -15,7 +15,7 @@ "Order": 1, "ExtCode": "ns=1;s=5_2_TOOL 2 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 02", + "Title": "SPINDLE 1 TOOL 02", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -27,7 +27,7 @@ "Order": 2, "ExtCode": "ns=1;s=5_3_TOOL 3 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 03", + "Title": "SPINDLE 1 TOOL 03", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -39,7 +39,7 @@ "Order": 3, "ExtCode": "ns=1;s=5_4_TOOL 4 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 04", + "Title": "SPINDLE 1 TOOL 04", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -51,7 +51,7 @@ "Order": 4, "ExtCode": "ns=1;s=5_5_TOOL 11 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 05", + "Title": "SPINDLE 2 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -63,7 +63,7 @@ "Order": 5, "ExtCode": "ns=1;s=5_6_TOOL 12 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 06", + "Title": "SPINDLE 2 TOOL 02", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -75,7 +75,7 @@ "Order": 6, "ExtCode": "ns=1;s=5_7_TOOL 13 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 07", + "Title": "SPINDLE 2 TOOL 03", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -87,7 +87,7 @@ "Order": 7, "ExtCode": "ns=1;s=5_8_TOOL 14 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 08", + "Title": "SPINDLE 2 TOOL 04", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -99,7 +99,7 @@ "Order": 8, "ExtCode": "ns=1;s=5_9_TOOL 21 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 09", + "Title": "SPINDLE 3 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -111,7 +111,7 @@ "Order": 9, "ExtCode": "ns=1;s=5_10_TOOL 22 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 10", + "Title": "SPINDLE 3 TOOL 2", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -123,7 +123,7 @@ "Order": 10, "ExtCode": "ns=1;s=5_11_TOOL 23 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 11", + "Title": "SPINDLE 3 TOOL 3", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -135,7 +135,7 @@ "Order": 11, "ExtCode": "ns=1;s=5_12_TOOL 24 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 12", + "Title": "SPINDLE 3 TOOL 4", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -147,7 +147,7 @@ "Order": 12, "ExtCode": "ns=1;s=5_13_TOOL 31 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 13", + "Title": "SPINDLE 4 TOOL 1", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -159,7 +159,7 @@ "Order": 13, "ExtCode": "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 14", + "Title": "SPINDLE 4 TOOL 2", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -171,7 +171,7 @@ "Order": 14, "ExtCode": "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 15", + "Title": "SPINDLE 4 TOOL 3", "Value": "0", "ValueNum": 0, "MinVal": -9999, @@ -183,7 +183,7 @@ "Order": 15, "ExtCode": "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 16", + "Title": "SPINDLE 4 TOOL 4", "Value": "0", "ValueNum": 0, "MinVal": -9999, diff --git a/MP.MONO.ADAPTER.OPC/CONF/Tools.multiax.json b/MP.MONO.ADAPTER.OPC/CONF/Tools.multiax.json index c7b2b88..04e9d12 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Tools.multiax.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Tools.multiax.json @@ -3,192 +3,192 @@ "Order": 0, "ExtCode": "ns=1;s=5_1_TOOL 1 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 01", + "Title": "SPINDLE 1 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 1, "ExtCode": "ns=1;s=5_2_TOOL 2 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 02", + "Title": "SPINDLE 1 TOOL 02", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 2, "ExtCode": "ns=1;s=5_3_TOOL 3 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 03", + "Title": "SPINDLE 1 TOOL 03", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 3, "ExtCode": "ns=1;s=5_4_TOOL 4 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 04", + "Title": "SPINDLE 1 TOOL 04", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 4, "ExtCode": "ns=1;s=5_5_TOOL 11 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 05", + "Title": "SPINDLE 2 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 5, "ExtCode": "ns=1;s=5_6_TOOL 12 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 06", + "Title": "SPINDLE 2 TOOL 02", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 6, "ExtCode": "ns=1;s=5_7_TOOL 13 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 07", + "Title": "SPINDLE 2 TOOL 03", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 7, "ExtCode": "ns=1;s=5_8_TOOL 14 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 08", + "Title": "SPINDLE 2 TOOL 04", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 8, "ExtCode": "ns=1;s=5_9_TOOL 21 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 09", + "Title": "SPINDLE 3 TOOL 01", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 9, "ExtCode": "ns=1;s=5_10_TOOL 22 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 10", + "Title": "SPINDLE 3 TOOL 2", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 10, "ExtCode": "ns=1;s=5_11_TOOL 23 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 11", + "Title": "SPINDLE 3 TOOL 3", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 11, "ExtCode": "ns=1;s=5_12_TOOL 24 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 12", + "Title": "SPINDLE 3 TOOL 4", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 12, "ExtCode": "ns=1;s=5_13_TOOL 31 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 13", + "Title": "SPINDLE 4 TOOL 1", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 13, "ExtCode": "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 14", + "Title": "SPINDLE 4 TOOL 2", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 14, "ExtCode": "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 15", + "Title": "SPINDLE 4 TOOL 3", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true }, { "Order": 15, "ExtCode": "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC", "Type": "TOOL", - "Title": "TOOL 16", + "Title": "SPINDLE 4 TOOL 4", "Value": "0", "ValueNum": 0, "MinVal": -9999, "MaxVal": 9999, - "DisplFormat": "N2", + "DisplFormat": "N1", "IsNumeric": true } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/ConsoleUtils.cs b/MP.MONO.ADAPTER.OPC/ConsoleUtils.cs index 92bcf42..680cc5f 100644 --- a/MP.MONO.ADAPTER.OPC/ConsoleUtils.cs +++ b/MP.MONO.ADAPTER.OPC/ConsoleUtils.cs @@ -284,13 +284,11 @@ namespace MP.MONO.ADAPTER.OPC restrictedToMinimumLevel: (LogEventLevel)consoleLogLevel ); } -#if DEBUG else { loggerConfiguration .WriteTo.Debug(restrictedToMinimumLevel: (LogEventLevel)consoleLogLevel); } -#endif LogLevel fileLevel = LogLevel.Information; // switch for Trace/Verbose output diff --git a/MP.MONO.ADAPTER.OPC/IobGeneric.cs b/MP.MONO.ADAPTER.OPC/IobGeneric.cs index 21a7bbc..767e599 100644 --- a/MP.MONO.ADAPTER.OPC/IobGeneric.cs +++ b/MP.MONO.ADAPTER.OPC/IobGeneric.cs @@ -59,7 +59,7 @@ namespace MP.MONO.ADAPTER.OPC CleanupRegexpPre = optPar.GetValue("CleanupRegexpPre"); if (optPar.GetValue("FiltCrLf")) { - FiltSplitChar = new char[] { '\n', '\r' }; + FiltSplitChar = new char[] { '\n', '\r', '\0' }; } else { diff --git a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs index abaac44..cb929b5 100644 --- a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs +++ b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs @@ -23,6 +23,8 @@ namespace MP.MONO.ADAPTER.OPC /// public class IobOpcUa : IobGeneric { + private ConfigManager confManager { get; set; } + #region Public Constructors /// @@ -40,10 +42,15 @@ namespace MP.MONO.ADAPTER.OPC sub = redis.GetSubscriber(); redisDb = redis.GetDatabase(); + confManager = new ConfigManager(redisConf, confPath); + msVetoRedCache = config.GetValue("OptPar:VetoSendCache"); MinWait = config.GetValue("OptPar:MinWait"); MaxWait = config.GetValue("OptPar:MaxWait"); - logInfo($"VetoSendCache: {msVetoRedCache}s | MinWait: {MinWait} | MaxWait: {MaxWait}"); + AlarmCleanPre = config.GetValue("OptPar:AlarmCleanPre"); + AlarmCleanPost= config.GetValue("OptPar:AlarmCleanPost"); + AlarmTrimWSpace = config.GetValue("OptPar:AlarmTrimWSpace"); + logInfo($"VetoSendCache: {msVetoRedCache}s | MinWait: {MinWait} | MaxWait: {MaxWait} | AlarmCleanPre: {AlarmCleanPre} | AlarmCleanPost: {AlarmCleanPost}"); // gestione data filtering... if (!string.IsNullOrEmpty(config.GetValue("ENABLE_DATA_FILTER"))) @@ -397,7 +404,7 @@ namespace MP.MONO.ADAPTER.OPC bool doSend = true; if (LastSend.ContainsKey(memKey)) { - if (DateTime.Now.Subtract(LastSend[memKey]).TotalSeconds < msVetoRedCache) + if (DateTime.Now.Subtract(LastSend[memKey]).TotalMilliseconds < msVetoRedCache) { doSend = false; } @@ -629,12 +636,6 @@ namespace MP.MONO.ADAPTER.OPC return rawByte; } - // // log opzionale! - // if (verboseLog) - // { - // logDebug($"Trasformazione checkPing: {checkPing} | hasPowerOn: {hasPowerOn} | B_input: {B_input} | currRun = {currRun}"); - // } - //} /// /// Effettua traduzione ITEM da LUT parametrica (key: tipo+id) del file di conf, se non /// trovo uso key @@ -663,10 +664,6 @@ namespace MP.MONO.ADAPTER.OPC return answ; } - // List nodes2Write = new List(); nodes2Write.Add(commWriteVal); - // UA_ref.WriteNodes(nodes2Write); logTrace("Effettuata scrittura WatchDog"); } catch - // (Exception exc) { logError($"Eccezione in gestione WatchDog, valore attuale - // {WatchDog}{Environment.NewLine}{exc}"); } } } else { logTrace("WatchDog disabilitato"); } /// /// Effettua lettura file di conf specifico OPC-UA da oggetto serializzato json Nome file da cui leggere i parametri json @@ -757,7 +754,7 @@ namespace MP.MONO.ADAPTER.OPC numOk = double.TryParse(rawDataVal, out updVal); // aggiorno nella lista dei valori quello cambiato... var currItem = ToolStatus.FirstOrDefault(x => x.ExtCode == uuid); - if (numOk && currItem.IsNumeric) + if (numOk && currItem!=null && currItem.IsNumeric) { currItem.ValueNum = updVal; currItem.Value = updVal.ToString(currItem.DisplFormat); @@ -792,23 +789,47 @@ namespace MP.MONO.ADAPTER.OPC currItem.Value = rawDataVal; } logTrace($"R&S | ParamKList | {uuid} | {currItem.Value}"); + // genero un dictionary di valori stringa / double e lo serializzo... var dataDict = ParamStatus.ToDictionary(x => x.Title, x => x.Value); string payloadParams = JsonConvert.SerializeObject(dataDict); // invio - saveAndSendMessage(Constants.PARAMS_CURR_KEY, Constants.PARAMS_RAW_QUEUE, payloadParams); + saveAndSendMessage(Constants.PARAMS_ACT_KEY, Constants.PARAMS_RAW_QUEUE, payloadParams); +#if false + // parametri: inviati come DTO + string payloadParams = JsonConvert.SerializeObject(ParamStatus); + // invio + saveAndSendMessage(Constants.PARAMS_CURR_KEY, Constants.PARAMS_M_QUEUE, payloadParams); +#endif } // Allarmi if (AlarmsKList.Contains(uuid)) { + // allarmi: effettuo PRE processing x filtrare pre/post { } + if (!string.IsNullOrEmpty(AlarmCleanPre)) + { + rawDataVal = rawDataVal.Replace(AlarmCleanPre, ""); + } + if (!string.IsNullOrEmpty(AlarmCleanPost)) + { + rawDataVal = rawDataVal.Replace(AlarmCleanPost, ""); + } + if (AlarmTrimWSpace && string.IsNullOrWhiteSpace(rawDataVal)) + { + rawDataVal = rawDataVal.Trim(); + } // aggiorno nella lista dei valori quello cambiato... var currItem = AlarmsStatus.FirstOrDefault(x => x.ExtCode == uuid); currItem.Value = rawDataVal; // salvo in redis! redisDb.StringSet(Constants.ALARMS_ADAP_CONF_KEY, JsonConvert.SerializeObject(AlarmsStatus)); // genero elenco allarmi attivi - List adpActiveAlarm = AlarmsStatus.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x)).OrderBy(x => x).ToList(); + List adpActiveAlarm = AlarmsStatus + .Select(x => x.Value) + .Where(x => !string.IsNullOrEmpty(x)) + .OrderBy(x => x) + .ToList(); logTrace($"R&S | AlarmsKList | {uuid} | {currItem.Value}"); var payloadAlarms = JsonConvert.SerializeObject(adpActiveAlarm); @@ -935,6 +956,20 @@ namespace MP.MONO.ADAPTER.OPC /// private List AlarmsKList { get; set; } = new List(); + /// + /// Char x bonifica stringa allarmi - PRE + /// + private string AlarmCleanPre = ""; + /// + /// Char x bonifica stringa allarmi - POST + /// + private string AlarmCleanPost = ""; + + /// + /// Indica se forzare trim dei whitespace da allarmi + /// + private bool AlarmTrimWSpace = false; + /// /// Elenco oggetti DisplayDTO da gestire come Allarmi /// @@ -1007,259 +1042,14 @@ namespace MP.MONO.ADAPTER.OPC #endregion Private Properties - ///// - ///// Veto controllo status x log... - ///// - //protected DateTime vetoCheckStatus = DateTime.Now; - - //protected int WatchDog = 0; - - //#endregion Protected Fields - ///// - ///// Verifico se abbia ALMENO un errore... - ///// - //protected bool hasError - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condError); - // } - //} - - ///// - ///// Indica se abbia emergenza ARMATA (cond normale) - ///// - //protected bool hasEStopArmed - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condEStop); - // } - //} - - ///// - ///// Indica se abbia stato POWER ON (multicondizione) - ///// - //protected virtual bool hasPowerOn - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condPowerOn); - // } - //} - - ///// - ///// Indica se abbia stato MANUAL (condizioni varie, es stopped) - ///// - //protected virtual bool isManual - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condManual); - // } - //} - - ///// - ///// Indica se abbia stato READY (condizioni varie, es ausiliari OK) - ///// - //protected virtual bool isReady - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condReady); - // } - //} - - ///// - ///// Indica se sia in stato Ssetup - ///// - //protected bool isSetup - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condSetup); - // } - //} - - ///// - ///// Indica se sia in stato WarmUp / CoolDown (riscaldamento/raffreddamento) - ///// - //protected bool isWarmUpCoolDown - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condWarmUpCoolDown); - // } - //} - - ///// - ///// Indica se sia in stato Warning - ///// - //protected bool isWarning - //{ - // get - // { - // return checkMultiCondition(opcUaParams.condWarning); - // } - //} - - ///// - ///// Indica se abbia stato READY (condizioni varie, es ausiliari OK) - ///// - //protected bool isWorking - //{ - // get - // { - // // cerco SE HO cond OPC Ua o classica... nel caso creo e salvo - // if (opcUaParams.condWorkOpc.checkList == null || opcUaParams.condWorkOpc.checkList.Count == 0) - // { - // opcUaParams.condWorkOpc = new diCheckCondSetup() - // { - // checkList = opcUaParams.condWork, - // checkMode = boolCheckMode.AND, - // negateValue = false - // }; - // } - // return checkMultiCondition(opcUaParams.condWorkOpc); - // } - //} + ///// ///// Periodo massimo (in sec) per letture dati RAW in mancanza di eventi ///// //protected int lastCurrentMaxElapsed { get; set; } = 120; - ///// - ///// URL x salvataggio elenco dataItems OpcUa - ///// - //protected string urlSaveDataItems - //{ - // get - // { - // string answ = ""; - // try - // { - // string machineName = Environment.MachineName; - // answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/saveDataItems/{cIobConf.codIOB}"; - // } - // catch (Exception exc) - // { - // logError(exc, "Errore in composizione urlSaveDataItems"); - // } - // return answ; - // } - //} + - //#endregion Protected Properties - - //#region Protected Methods - - ///// - ///// Verifica un DataItem e se il valore corrisponde a quello indicato come "true value" - ///// restituisce true - ///// - ///// - ///// - ///// - //protected bool checkDataItem(string itemName, string trueVal) - //{ - // bool answ = false; - // OpcUaDataItemExt currValue = null; - // try - // { - // currValue = dataItemMem[itemName]; - // answ = (currValue.value.Equals(trueVal)); - // } - // catch - // { - // logError($"Errore in decodifica valore per {itemName} rispetto a {trueVal} | recuperato {currValue} / {currValue.value}"); - // } - // return answ; - //} - - ///// - ///// Verifica condizione "multipla" secondo setup json - ///// - ///// Set condizioni da validare - ///// - //protected bool checkMultiCondition(diCheckCondSetup reqCondition) - //{ - // bool answ = false; - // int numCondOk = 0; - // int numCond = 0; - // if (reqCondition.checkList != null && reqCondition.checkList.Count > 0) - // { - // numCond = reqCondition.checkList.Count; - // // cerco nell'elenco delle condizioni che indicano lavora se sono ok faccio +1 conteggio...... - // foreach (var item in reqCondition.checkList) - // { - // if (string.IsNullOrEmpty(item.keyName)) - // { - // logError($"Attenzione: item vuoto in checkMultiCondition{Environment.NewLine}StackTrace: {Environment.StackTrace}"); - // } - // else - // { - // if (getDataItemValue(item.keyName) == item.targetValue) - // { - // numCondOk++; - // } - // } - // } - // if (reqCondition.checkMode == boolCheckMode.AND) - // { - // answ = (numCond == numCondOk); - // } - // else if (reqCondition.checkMode == boolCheckMode.OR) - // { - // answ = numCondOk > 0; - // } - // } - // else - // { - // answ = true; - // } - // // verifico se devo negare il valore... - // answ = reqCondition.negateValue ? !answ : answ; - // // restituisco - // return answ; - //} - ///// - ///// Effettua decodifica aree memoria alla bitmap usata x MAPO - ///// - //protected virtual void decodeToBaseBitmap() - //{ - // DateTime adesso = DateTime.Now; - // // init a zero... - // B_input = 0; - - // /* ----------------------------------------------------- - // * STATE MACHINE 60 STD / SIMULA *------------------------------------------------------ - // * bitmap MAPO - // * B0: POWER_ON - // * B1: RUN - // * B2: pzCount - // * B3: allarme - // * B4: manuale - // * B5: SlowTC (NON gestito qui) - // * B6: warm-up / cool-down - // * B7: emergenza - // ---------------------------------------------------- */ - - // // se valido il check ping lo eseguo... altrimenti lo do x buono bool checkPing = - // !opcUaParams.pingAsPowerOn; string currRun = ""; if (!checkPing) { checkPing = - // (testPingMachine == IPStatus.Success); } // bit 0 (poweron) imposto a 1 SE pingo + - // PowerOn=="ON"... bool powerOnOk = checkPing && hasPowerOn; - - // // controllo se sono poweroff e se non ho dati buoni da > lastCurrentMaxElapsed --> - // disconnetto if (!powerOnOk && adesso.Subtract(lastCurrent).TotalSeconds > - // lastCurrentMaxElapsed) { tryDisconnect(); } - - // // solo se non ho veto check int vFactor = 2; if (vetoCheckStatus < adesso) { - // logTrace($"Stato variabili checkPing: {testPingMachine}"); // imposto veto per - // vetoSeconds... vetoCheckStatus = adesso.AddSeconds(vetoSeconds * vFactor); } - - // // se abilitato watchdog... if (opcUaParams.WatchDog.IsEnabled) { logTrace("WatchDog - // 01"); if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2) { lastWatchDogPLC = adesso; - // WatchDog++; WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog; #region Private Methods @@ -1403,7 +1193,8 @@ namespace MP.MONO.ADAPTER.OPC else { currVal = UA_ref.ReadNode(item.StartNodeId); - changed = checkAndSend(item, stringCleanup(currVal), true); + var fixString = stringCleanup(currVal); + changed = checkAndSend(item, fixString, true); } } // attesa x evitare problemi @@ -1481,92 +1272,26 @@ namespace MP.MONO.ADAPTER.OPC /// private void setupGroupConf() { - // leggo e salvo conf varie... + // leggo e salvo conf varie (dati x decodifica e gestione) - // ActLog - string fullPath = Path.Combine(configPath, "ActLog.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - ActLogStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.ACTLOG_CONF_KEY, JsonConvert.SerializeObject(ActLogStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - ActLogKList = ActLogStatus.Select(x => x.ExtCode).ToList(); - } - } + ActLogStatus = confManager.getActLog(); + ActLogKList = ActLogStatus.Select(x => x.ExtCode).ToList(); - fullPath = Path.Combine(configPath, "Tools.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - ToolStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.TOOLS_CONF_KEY, JsonConvert.SerializeObject(ToolStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - ToolKList = ToolStatus.Select(x => x.ExtCode).ToList(); - } - } + ToolStatus = confManager.getTools(); + ToolKList = ActLogStatus.Select(x => x.ExtCode).ToList(); - fullPath = Path.Combine(configPath, "Parameters.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - ParamStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.PARAMS_CONF_KEY, JsonConvert.SerializeObject(ParamStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - ParamKList = ParamStatus.Select(x => x.ExtCode).ToList(); - } - } + ParamStatus = confManager.getParamsConf(); + ParamKList = ParamStatus.Select(x => x.ExtCode).ToList(); - fullPath = Path.Combine(configPath, "Alarms.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - AlarmsStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.ALARMS_ADAP_CONF_KEY, JsonConvert.SerializeObject(AlarmsStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - AlarmsKList = AlarmsStatus.Select(x => x.ExtCode).ToList(); - } - } + AlarmsStatus = confManager.getAlarmsConf(); + AlarmsKList = AlarmsStatus.Select(x => x.ExtCode).ToList(); - fullPath = Path.Combine(configPath, "MPStatus.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - MPStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.MP_STATUS_CONF_KEY, JsonConvert.SerializeObject(MPStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - MPKList = MPStatus.Select(x => x.ExtCode).ToList(); - } - } + MPStatus = confManager.getMPStatusConf(); + MPKList = MPStatus.Select(x => x.ExtCode).ToList(); + + CountStatus = confManager.getCountersConf(); + CountKList = CountStatus.Select(x => x.ExtCode).ToList(); - fullPath = Path.Combine(configPath, "Counters.json"); - if (File.Exists(fullPath)) - { - var rawData = File.ReadAllText(fullPath); - if (!string.IsNullOrEmpty(rawData)) - { - CountStatus = JsonConvert.DeserializeObject>(rawData); - // salvo in redis! - redisDb.StringSetAsync(Constants.CNT_STATUS_CONF_KEY, JsonConvert.SerializeObject(CountStatus)); - // calcolo l'elenco dei cod univoci da gestire e lo salvo... - CountKList = CountStatus.Select(x => x.ExtCode).ToList(); - } - } } #endregion Private Methods diff --git a/MP.MONO.ADAPTER.OPC/MP.MONO.ADAPTER.OPC.csproj b/MP.MONO.ADAPTER.OPC/MP.MONO.ADAPTER.OPC.csproj index 0f1e66a..9483181 100644 --- a/MP.MONO.ADAPTER.OPC/MP.MONO.ADAPTER.OPC.csproj +++ b/MP.MONO.ADAPTER.OPC/MP.MONO.ADAPTER.OPC.csproj @@ -42,6 +42,12 @@ + + PreserveNewest + + + Never + PreserveNewest @@ -84,9 +90,6 @@ PreserveNewest - - Always - PreserveNewest diff --git a/MP.MONO.ADAPTER.OPC/appsettings.json b/MP.MONO.ADAPTER.OPC/appsettings.json index 1e4082a..12055af 100644 --- a/MP.MONO.ADAPTER.OPC/appsettings.json +++ b/MP.MONO.ADAPTER.OPC/appsettings.json @@ -6,19 +6,12 @@ } }, "ConnectionStrings": { - "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=nkc.password", + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, - //"ConnectionStrings": { - // "Redis": "localhost:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", - // "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - // "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - // "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", - // "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" - //}, "DbConfig": { "Server": "10.74.82.230", "nKey": "MONO", @@ -40,35 +33,34 @@ }, "Endpoint": { "ConfFile": "Demo.json", - "FullUrl": "opc.tcp://localhost:62541/Quickstarts/ReferenceServer", + "FullUrl": "opc.tcp://wrkst-r9-sam:62541/Quickstarts/ReferenceServer", "PingMsTimeout": 1500 }, - //"Endpoint": { - // "ConfFile": "Multiax.json", - // "FullUrl": "opc.tcp://192.168.0.2:4840", - //// "IpAddress": "192.168.0.2", - //// "Port": "4840", - // "PingMsTimeout": 1500 - //}, "OptPar": { "AlarmMode": "RawList", - "Log2Console": true, - "Log2File": true, - "ForceSplit": true, - "CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]", - "CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]", + "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", + //"AlarmRegexp": "^{.*}", + "AlarmCleanPre": "{", + "AlarmCleanPost": "}", + "AlarmTrimWSpace": true, + "CleanupRegexpPre": "", + //"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]", + "CleanupRegexpPost": "[^a-zA-Z0-9 %\\{\\},.\\-\\+]", "FiltCrLf": true, "FiltSplitChar": [], - "VetoSendCache": 200, + "ForceSplit": true, + "Log2Console": true, + "Log2File": true, "MinWait": 50, - "MaxWait": 150 + "MaxWait": 150, + "VetoSendCache": 50 }, "Machine": { "Manufacturer": "Multiax", - "Model": "M-D5", - "Name": "D5, - "SerialNumber": "03216549870" - } + "Model": "Model-D", + "Name": "D1521", + "SerialNumber": "1521" + }, "ENABLE_DATA_FILTER": true, "ENABLE_CLI_RESTART": true, "logEvery": 10, @@ -78,4 +70,4 @@ "disconMaxSec": 30, "verboseLogTOut": 60, "waitRecMSec": 60000 -} +} \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/appsettings.multiax.json b/MP.MONO.ADAPTER.OPC/appsettings.multiax.json new file mode 100644 index 0000000..3672fef --- /dev/null +++ b/MP.MONO.ADAPTER.OPC/appsettings.multiax.json @@ -0,0 +1,72 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "ConnectionStrings": { + "Redis": "localhost:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "localhost", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "MachineId": 1, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "Endpoint": { + "ConfFile": "Multiax.json", + "FullUrl": "opc.tcp://192.168.0.2:4840", + "PingMsTimeout": 1500 + }, + "OptPar": { + "AlarmMode": "RawList", + "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", + //"AlarmRegexp": "^{.*}", + "AlarmCleanPre": "{", + "AlarmCleanPost": "}", + "CleanupRegexpPre": "", + //"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]", + "CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]", + "FiltCrLf": true, + "FiltSplitChar": [], + "ForceSplit": true, + "Log2Console": true, + "Log2File": true, + "MinWait": 50, + "MaxWait": 150, + "VetoSendCache": 50 + }, + "Machine": { + "Manufacturer": "Multiax", + "Model": "Model-D", + "Name": "D1521", + "SerialNumber": "1521" + }, + "ENABLE_DATA_FILTER": true, + "ENABLE_CLI_RESTART": true, + "logEvery": 10, + "OPC_PARAM_CONF": "Multiax.json", + "pingTestSec": 5, + "verbose": false, + "disconMaxSec": 30, + "verboseLogTOut": 60, + "waitRecMSec": 60000 +} \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/appsettings.office.json b/MP.MONO.ADAPTER.OPC/appsettings.office.json new file mode 100644 index 0000000..5feae5a --- /dev/null +++ b/MP.MONO.ADAPTER.OPC/appsettings.office.json @@ -0,0 +1,72 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "ConnectionStrings": { + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "10.74.82.230", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "MachineId": 1, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "Endpoint": { + "ConfFile": "Demo.json", + "FullUrl": "opc.tcp://wrkst-r9-sam:62541/Quickstarts/ReferenceServer", + "PingMsTimeout": 1500 + }, + "OptPar": { + "AlarmMode": "RawList", + "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", + //"AlarmRegexp": "^{.*}", + "AlarmCleanPre": "{", + "AlarmCleanPost": "}", + "CleanupRegexpPre": "", + //"CleanupRegexpPre": "[^a-zA-Z0-9 %/,.\\-\\+\\r\\n]", + "CleanupRegexpPost": "[^a-zA-Z0-9 %/,.\\-\\+]", + "FiltCrLf": true, + "FiltSplitChar": [], + "ForceSplit": true, + "Log2Console": true, + "Log2File": true, + "MinWait": 50, + "MaxWait": 150, + "VetoSendCache": 50 + }, + "Machine": { + "Manufacturer": "Multiax", + "Model": "Model-D", + "Name": "D1521", + "SerialNumber": "1521" + }, + "ENABLE_DATA_FILTER": true, + "ENABLE_CLI_RESTART": true, + "logEvery": 10, + "OPC_PARAM_CONF": "Multiax.json", + "pingTestSec": 5, + "verbose": false, + "disconMaxSec": 30, + "verboseLogTOut": 60, + "waitRecMSec": 60000 +} \ No newline at end of file diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 7540ff5..34a5a0a 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,13 +6,13 @@ enable enable AnyCPU;x86;x64 - 1.2.2206.2217 + 1.2.2209.2116 - + diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 7109e9f..c13df71 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

Version: 1.2.2206.2217

+

Version: 1.2.2209.2116


Release Note:
  • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 8dd2eb6..d41b03e 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2206.2217 +1.2.2209.2116 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index ca79c2f..977b996 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2206.2217 + 1.2.2209.2116 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Core/ConfigManager.cs b/MP.MONO.Core/ConfigManager.cs index 0b656d8..7e444cc 100644 --- a/MP.MONO.Core/ConfigManager.cs +++ b/MP.MONO.Core/ConfigManager.cs @@ -8,18 +8,6 @@ namespace MP.MONO.Core { public class ConfigManager { - #region Private Fields - - private Logger Log = LogManager.GetCurrentClassLogger(); - - #endregion Private Fields - - #region Protected Fields - - protected string confPath = ""; - - #endregion Protected Fields - #region Public Constructors public ConfigManager(string redisConf, string confDirPath) @@ -32,19 +20,34 @@ namespace MP.MONO.Core #endregion Public Constructors - #region Protected Properties - - protected IDatabase redisDb { get; set; } = null!; - - #endregion Protected Properties - #region Public Methods - public List getAlarmsBankConf() + public List getActLog(string fileName = "ActLog.json") + { + List? currConf = null; + string fullPath = Path.Combine(confPath, fileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + currConf = JsonConvert.DeserializeObject>(rawData); + // salvo in redis! + redisDb.StringSetAsync(Constants.ACTLOG_CONF_KEY, JsonConvert.SerializeObject(currConf)); + } + } + if (currConf == null) + { + currConf = new List(); + } + return currConf; + } + + public List getAlarmsBankConf(string fileName = "AlarmBankList.json") { List? currConf = null; // leggo e salvo conf stati - string fullPath = Path.Combine(confPath, "AlarmBankList.json"); + string fullPath = Path.Combine(confPath, fileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -71,11 +74,33 @@ namespace MP.MONO.Core } return currConf; } - public List getAlarmsRawConf() + + public List getAlarmsConf(string fileName = "Alarms.json") + { + List? currConf = null; + string fullPath = Path.Combine(confPath, fileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + currConf = JsonConvert.DeserializeObject>(rawData); + // salvo in redis! + redisDb.StringSet(Constants.ALARMS_ADAP_CONF_KEY, JsonConvert.SerializeObject(currConf)); + } + } + if (currConf == null) + { + currConf = new List(); + } + return currConf; + } + + public List getAlarmsRawConf(string fileName = "AlarmRawList.json") { List? currConf = null; // leggo e salvo conf stati - string fullPath = Path.Combine(confPath, "AlarmRawList.json"); + string fullPath = Path.Combine(confPath, fileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -102,11 +127,32 @@ namespace MP.MONO.Core return currConf; } - public List getMachineModeConf() + public List getCountersConf(string fileName = "Counters.json") + { + List? currConf = null; + string fullPath = Path.Combine(confPath, fileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + currConf = JsonConvert.DeserializeObject>(rawData); + // salvo in redis! + redisDb.StringSetAsync(Constants.CNT_STATUS_CONF_KEY, JsonConvert.SerializeObject(currConf)); + } + } + if (currConf == null) + { + currConf = new List(); + } + return currConf; + } + + public List getMachineModeConf(string fileName = "ModeList.json") { List? currConf = null; // leggo e salvo conf stati - string fullPath = Path.Combine(confPath, "ModeList.json"); + string fullPath = Path.Combine(confPath, fileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -124,11 +170,11 @@ namespace MP.MONO.Core return currConf; } - public List getMachineStatusConf() + public List getMachineStatusConf(string fileName = "StatusList.json") { List? currConf = null; // leggo e salvo conf stati - string fullPath = Path.Combine(confPath, "StatusList.json"); + string fullPath = Path.Combine(confPath, fileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -146,11 +192,32 @@ namespace MP.MONO.Core return currConf; } - public List getParamsConf() + public List getMPStatusConf(string fileName = "MPStatus.json") + { + List? currConf = null; + string fullPath = Path.Combine(confPath, fileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + currConf = JsonConvert.DeserializeObject>(rawData); + // salvo in redis! + redisDb.StringSetAsync(Constants.MP_STATUS_CONF_KEY, JsonConvert.SerializeObject(currConf)); + } + } + if (currConf == null) + { + currConf = new List(); + } + return currConf; + } + + public List getParamsConf(string fileName = "Parameters.json") { List? currConf = null; // leggo e salvo conf stati - string fullPath = Path.Combine(confPath, "ParamList.json"); + string fullPath = Path.Combine(confPath, fileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -168,6 +235,45 @@ namespace MP.MONO.Core return currConf; } + public List getTools(string fileName = "Tools.json") + { + List? currConf = null; + string fullPath = Path.Combine(confPath, fileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + currConf = JsonConvert.DeserializeObject>(rawData); + // salvo in redis! + redisDb.StringSetAsync(Constants.TOOLS_CONF_KEY, JsonConvert.SerializeObject(currConf)); + } + } + if (currConf == null) + { + currConf = new List(); + } + return currConf; + } + #endregion Public Methods + + #region Protected Fields + + protected string confPath = ""; + + #endregion Protected Fields + + #region Protected Properties + + protected IDatabase redisDb { get; set; } = null!; + + #endregion Protected Properties + + #region Private Fields + + private Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields } } \ No newline at end of file diff --git a/MP.MONO.Core/Constants.cs b/MP.MONO.Core/Constants.cs index 8955d66..f65e3d5 100644 --- a/MP.MONO.Core/Constants.cs +++ b/MP.MONO.Core/Constants.cs @@ -43,6 +43,7 @@ namespace MP.MONO.Core public static readonly string ALARM_ADAPTER_ACT_KEY = $"{BASE_HASH}:Current:AdapterAlarm"; public static readonly string ALARM_ACT_KEY = $"{BASE_HASH}:Current:AlarmsVal"; public static readonly string ALARM_CURR_KEY = $"{BASE_HASH}:Current:Alarms"; + public static readonly string ALARM_BLINK_CURR_KEY = $"{BASE_HASH}:Current:AlarmsBlink"; public static readonly string EVENT_LOG_CURR_KEY = $"{BASE_HASH}:Current:EventsLog"; public static readonly string MACH_STATS_CURR_KEY = $"{BASE_HASH}:Current:MachStats"; public static readonly string MAINT_STATS_CURR_KEY = $"{BASE_HASH}:Current:Maintenance"; diff --git a/MP.MONO.Core/DTO/DisplayDataDTO.cs b/MP.MONO.Core/DTO/DisplayDataDTO.cs index b016e89..36970f0 100644 --- a/MP.MONO.Core/DTO/DisplayDataDTO.cs +++ b/MP.MONO.Core/DTO/DisplayDataDTO.cs @@ -37,6 +37,10 @@ namespace MP.MONO.Core.DTO ///
public double ValueNum { get; set; } = 0; /// + /// Valore scala (da moltiplicare, > 1 aumenta, 0>x>1 riduce) + /// + public double ScaleFactor { get; set; } = 1; + /// /// Display format /// public string DisplFormat { get; set; } = "N0"; diff --git a/MP.MONO.Core/MP.MONO.Core.csproj b/MP.MONO.Core/MP.MONO.Core.csproj index c9a681e..d8beca4 100644 --- a/MP.MONO.Core/MP.MONO.Core.csproj +++ b/MP.MONO.Core/MP.MONO.Core.csproj @@ -11,7 +11,7 @@ - + diff --git a/MP.MONO.Core/MachineDataValidator.cs b/MP.MONO.Core/MachineDataValidator.cs index bad303e..998d782 100644 --- a/MP.MONO.Core/MachineDataValidator.cs +++ b/MP.MONO.Core/MachineDataValidator.cs @@ -17,7 +17,10 @@ namespace MP.MONO.Core public MachineDataValidator() { // inizializzo info di base - machTestData = setupData().Result; + if (machTestData == null || machTestData.Count == 0) + { + machTestData = setupData().Result; + } } #endregion Public Constructors @@ -37,6 +40,17 @@ namespace MP.MONO.Core #region Public Methods +#if false + /// + /// Verifica validità info correnti + /// + /// + public async Task testCurrInfo() + { + return await testInfo(); + } +#endif + /// /// Verifica validità info correnti /// @@ -54,7 +68,7 @@ namespace MP.MONO.Core /// /// Dati rispetto cui fare i calcoli di validazione /// - private Dictionary machTestData = new Dictionary(); + private static Dictionary machTestData = new Dictionary(); #endregion Private Fields @@ -145,18 +159,25 @@ namespace MP.MONO.Core return answ; } + public static Dictionary biosInfo = new Dictionary(); + public static Dictionary cpuInfo = new Dictionary(); + public static Dictionary netInfo = new Dictionary(); + public static Dictionary osInfo = new Dictionary(); + public static Dictionary ramInfo = new Dictionary(); + /// /// Predispone elenco dati di test /// /// private async Task> setupData() - { // creo un unico array di info + { + // creo un unico array di info Dictionary testData = new Dictionary(); - var biosInfo = await MachineInfo.GetInfo("BIOS"); - var cpuInfo = await MachineInfo.GetInfo("CPU"); - var netInfo = await MachineInfo.GetInfo("NET"); - var osInfo = await MachineInfo.GetInfo("OS"); - var ramInfo = await MachineInfo.GetInfo("RAM"); + biosInfo = await MachineInfo.GetInfo("BIOS"); + cpuInfo = await MachineInfo.GetInfo("CPU"); + netInfo = await MachineInfo.GetInfo("NET"); + osInfo = await MachineInfo.GetInfo("OS"); + ramInfo = await MachineInfo.GetInfo("RAM"); testData = biosInfo.Concat(cpuInfo).Concat(netInfo).Concat(osInfo).Concat(ramInfo).GroupBy(ele => ele.Key).ToDictionary(ele => ele.Key, ele => ele.First().Value); return testData; } diff --git a/MP.MONO.Core/MachineInfo.cs b/MP.MONO.Core/MachineInfo.cs index dffce76..cb925e9 100644 --- a/MP.MONO.Core/MachineInfo.cs +++ b/MP.MONO.Core/MachineInfo.cs @@ -91,7 +91,7 @@ namespace MP.MONO.Core searchWmiParam(Processor, obj, "SystemBiosMinorVersion", "SystemBiosMinorVersion"); searchWmiParam(Processor, obj, "BiosVersion", "Version"); } - + await Task.Delay(1); return Processor; } @@ -157,9 +157,9 @@ namespace MP.MONO.Core searchWmiParam(Processor, obj, "SocketDesignation", "SocketDesignation"); searchWmiParam(Processor, obj, "SystemName", "SystemName"); searchWmiParam(Processor, obj, "CpuVersion", "Version"); - - } + } + await Task.Delay(1); return Processor; } @@ -194,9 +194,9 @@ namespace MP.MONO.Core searchWmiParam(Processor, obj, "PhysicalAdapter", "PhysicalAdapter"); searchWmiParam(Processor, obj, "ProductName", "ProductName"); searchWmiParam(Processor, obj, "ServiceName", "ServiceName"); - - } + } + await Task.Delay(1); return Processor; } @@ -230,7 +230,7 @@ namespace MP.MONO.Core searchWmiParam(Processor, obj, "BuildNumber", "BuildNumber"); } - + await Task.Delay(1); return Processor; } @@ -267,7 +267,7 @@ namespace MP.MONO.Core searchWmiParam(Processor, obj, "PartNumber", "PartNumber"); } - + await Task.Delay(1); return Processor; } diff --git a/MP.MONO.DECODER/CounterManager.cs b/MP.MONO.DECODER/CounterManager.cs index 281b22d..ea38f99 100644 --- a/MP.MONO.DECODER/CounterManager.cs +++ b/MP.MONO.DECODER/CounterManager.cs @@ -8,6 +8,26 @@ namespace MP.MONO.DECODER { public class CounterManager { + #region Public Fields + + public static string alarmStatus = ""; + + public static bool valueChanged = false; + + #endregion Public Fields + + #region Protected Fields + + protected static Logger Log = LogManager.GetCurrentClassLogger(); + + protected static string luaPath = ""; + + protected static Lua state = new Lua(); + + protected List AlarmList = new List(); + + #endregion Protected Fields + #region Private Fields /// @@ -17,22 +37,6 @@ namespace MP.MONO.DECODER #endregion Private Fields - #region Protected Fields - - protected static Logger Log = LogManager.GetCurrentClassLogger(); - protected static string luaPath = ""; - protected static Lua state = new Lua(); - protected List AlarmList = new List(); - - #endregion Protected Fields - - #region Public Fields - - public static string alarmStatus = ""; - public static bool valueChanged = false; - - #endregion Public Fields - #region Public Constructors public CounterManager() @@ -45,8 +49,8 @@ namespace MP.MONO.DECODER luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ParamsDecoder.lua"); state.DoFile(luaPath); - Log.Info("ParamsManager OK"); - Console.WriteLine("ParamsManager OK"); + Log.Info("CounterManager OK"); + Console.WriteLine("CounterManager OK"); } #endregion Public Constructors @@ -121,7 +125,7 @@ namespace MP.MONO.DECODER Log.Trace($"calcVal: {calcVal}"); } } - catch(Exception exc) + catch (Exception exc) { Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}"); } @@ -135,7 +139,6 @@ namespace MP.MONO.DECODER MachineId = 1, ValNum = calcVal, ValStr = $"{calcVal:N3}" - }; answ.Add(dbRecord); @@ -145,7 +148,6 @@ namespace MP.MONO.DECODER } } - return answ; } diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 589f70f..c330aa3 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,14 +6,26 @@ enable enable AnyCPU;x86;x64 - 1.2.2206.2217 + 1.2.2209.2116 + + + + PreserveNewest + true + PreserveNewest + + + Never + true + PreserveNewest + PreserveNewest true @@ -25,7 +37,7 @@ - + @@ -45,6 +57,12 @@ Always + + Always + + + Always + Always diff --git a/MP.MONO.DECODER/MPStatusManager.cs b/MP.MONO.DECODER/MPStatusManager.cs index 4bc80f6..5719255 100644 --- a/MP.MONO.DECODER/MPStatusManager.cs +++ b/MP.MONO.DECODER/MPStatusManager.cs @@ -8,30 +8,27 @@ namespace MP.MONO.DECODER { public class MPStatusManager { - #region Private Fields + #region Public Fields - /// - /// Dizionario dei valori accumulati sulle variabili - /// - private Dictionary ParamsAccumulator = new Dictionary(); + public static bool valueChanged = false; - #endregion Private Fields + #endregion Public Fields #region Protected Fields protected static Logger Log = LogManager.GetCurrentClassLogger(); + protected static string luaPath = ""; + protected static Lua state = new Lua(); - protected List AlarmList = new List(); + #endregion Protected Fields - #region Public Fields + #region Private Fields - public static string alarmStatus = ""; - public static bool valueChanged = false; - #endregion Public Fields + #endregion Private Fields #region Public Constructors @@ -39,14 +36,13 @@ namespace MP.MONO.DECODER { // preparo variabile x avvisare script che il modo è da NLua state["callMode"] = "NLua"; - state["vcFunct"] = "AVG"; // carico il file - luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ParamsDecoder.lua"); + luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "StatusDecoder.lua"); state.DoFile(luaPath); - Log.Info("ParamsManager OK"); - Console.WriteLine("ParamsManager OK"); + Log.Info("MPStatusManager OK"); + Console.WriteLine("MPStatusManager OK"); } #endregion Public Constructors @@ -54,99 +50,66 @@ namespace MP.MONO.DECODER #region Public Methods /// - /// Funzione chiamata LUA x calcolo degli eventuali parametri con periodi "scaduti" + /// Funzione chiamata LUA x calcolo dati PLATE (stato macchina e processo) /// /// - /// + /// /// - public List processData(Dictionary paramsList, List redisParamConf) + public bool processData(Dictionary paramsList, ref MachineDTO? MachinePlate) { - List answ = new List(); + bool calcOk = false; + if (MachinePlate == null) + { + MachinePlate = new MachineDTO(); + } DateTime adesso = DateTime.Now; - // vado ad "accumulare i dati" a quelli presenti... + state.NewTable("dataList"); + var currTable = state.GetTable("dataList"); foreach (var item in paramsList) { - var currParam = redisParamConf.FirstOrDefault(x => x.Title == item.Key); - // cerco nelle variabili accomulatori... - if (!ParamsAccumulator.ContainsKey(item.Key)) - { - if (currParam != null) - { - var dataList = new List(); - dataList.Add(item.Value); - VCData newSet = new VCData() - { - dataArray = dataList, - DTStart = adesso, - Funzione = currParam.VcFunc, - Period = currParam.SamplePeriod - }; - // se non ci fosse creo - ParamsAccumulator.Add(item.Key, newSet); - } - } - else - { - // altrimenti aggiungo - ParamsAccumulator[item.Key].dataArray.Add(item.Value); - } + currTable[item.Key] = item.Value; + } + // ripasso table + state["dataList"] = currTable; + state["numRec"] = paramsList.Count; - // effettuo verifiche scadenza - bool calcOk = false; - double calcVal = 0; - if (ParamsAccumulator.ContainsKey(item.Key)) - { - if (ParamsAccumulator[item.Key].isElapsed) - { - string funcMode = $"{ParamsAccumulator[item.Key].Funzione}"; - // se scaduto --> mando a LUA x calcolo - state["valList"] = ParamsAccumulator[item.Key].dataArray; - state["numRec"] = ParamsAccumulator[item.Key].dataArray.Count; - state["vcFunct"] = funcMode; - - // effettuo calcolo - state.DoString("doProcess()"); - - // recupero valore calcolato - bool.TryParse(state.GetString("calcOk"), out calcOk); - if (calcOk) - { - try - { - var stringVal = state.GetString("calcVal"); - if (!string.IsNullOrEmpty(stringVal)) - { - calcVal = state.GetNumber("calcVal"); - Log.Trace($"calcVal: {calcVal}"); - } - } - catch(Exception exc) - { - Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}"); - } - } - - // aggiungo alla lista finale... - var dbRecord = new DataLogModel() - { - DtRif = adesso, - FluxType = item.Key, - MachineId = 1, - ValNum = calcVal, - ValStr = $"{calcVal:N3}" - - }; - answ.Add(dbRecord); - - // elimino dai valori accumulati... - ParamsAccumulator.Remove(item.Key); - } - } + try + { + // effettuo calcolo + state.DoString("doProcess()"); + } + catch (Exception exc) + { + Log.Error($"exception during doProcess{Environment.NewLine}{exc}"); } + // recupero valore calcolato + bool.TryParse(state.GetString("calcOk"), out calcOk); + if (calcOk) + { + try + { + var stringVal = state.GetString("statusId"); + if (!string.IsNullOrEmpty(stringVal)) + { + MachinePlate.StatusId = state.GetInteger("statusId"); + } + stringVal = state.GetString("modeId"); + if (!string.IsNullOrEmpty(stringVal)) + { + MachinePlate.ModeId = state.GetInteger("modeId"); + } + } + catch (Exception exc) + { + Log.Error($"exception during processData{Environment.NewLine}{exc}"); + } + } + else + { } - return answ; + return calcOk; } #endregion Public Methods diff --git a/MP.MONO.DECODER/MyClass.cs b/MP.MONO.DECODER/MyClass.cs deleted file mode 100644 index 6f8b1da..0000000 --- a/MP.MONO.DECODER/MyClass.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MP.MONO.DECODER -{ - public class MyClass - { - public int IntegerProperty { get; set; } - public void DoSomething(string p) - { - Console.WriteLine($"Doing something: {p}"); - } - - public void SaveData(string key, object objVal) - { - string rawData = JsonConvert.SerializeObject(objVal); - Console.WriteLine($"Request save | key: {key} | value: {rawData}"); - } - } -} diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index bb74390..21e4a7b 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; using NLog; using NLua; using StackExchange.Redis; +using System.Diagnostics; using System.Reflection; using static MP.MONO.Core.Enums; @@ -83,6 +84,10 @@ List? machineStatusConf = new List(); MachineDTO machinePlate = new MachineDTO(); // gestione configurazioni da redis +int BlinkCount = 1; +bool AlarmIgnoreEmpty = true; +string AlarmCleanPre = ""; +string AlarmCleanPost = ""; setupConf(); /* -------------------------------- @@ -122,8 +127,6 @@ DateTime lastExecStatus = DateTime.Now.AddHours(-1); // registro gestione eventi mpStatusRecvPipe.EA_NewMessage += MpStatusRecvPipe_EA_NewMessage; - - /* -------------------------------- * Setup Gestione Counters * --------------------------------*/ @@ -136,7 +139,6 @@ DateTime lastExecCounters = DateTime.Now.AddHours(-1); // registro gestione eventi counterRecvPipe.EA_NewMessage += CounterRecvPipe_EA_NewMessage; - /* -------------------------------- * Funzioni / metodi accessori * --------------------------------*/ @@ -145,6 +147,14 @@ counterRecvPipe.EA_NewMessage += CounterRecvPipe_EA_NewMessage; /// void setupConf() { + // imposto blinkCount da conf... + string rConf = config["OptPar:BlinkCount"]; + int.TryParse(rConf, out BlinkCount); + // imposto parametri x Alarms + rConf = config["OptPar:AlarmIgnoreEmpty"]; + bool.TryParse(rConf, out AlarmIgnoreEmpty); + AlarmCleanPre = config["OptPar:AlarmCleanPre"]; + AlarmCleanPost = config["OptPar:AlarmCleanPost"]; // recupero valori e deserializzo string rawData = ""; @@ -153,7 +163,7 @@ void setupConf() if (!string.IsNullOrEmpty(rawData)) { var currData = JsonConvert.DeserializeObject(rawData); - machinePlate = currData != null ? currData: new MachineDTO(); + machinePlate = currData != null ? currData : new MachineDTO(); } // machine status (display) conf @@ -211,11 +221,21 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) try { // decodifico allarmi ricevuti - var alarmList = JsonConvert.DeserializeObject>(currArgs.newMessage); + var alarmListRaw = JsonConvert.DeserializeObject>(currArgs.newMessage); + + // effettuo selezione dei SOLI allarmi distinct (in caso di cambio posizione...) + List alarmList = new List(); + if (alarmListRaw != null && alarmListRaw.Count > 0) + { + alarmList = alarmListRaw + .GroupBy(x => x) + .Select(grp => grp.First()) + .ToList(); + } + List alarmRecList = new List(); List alarmLogList = new List(); - - + // gestione allarmi muted List? mutedAlarmsList = new List(); string rawData = redisDb.StringGet(Constants.ALARMS_SETT_RLIST_KEY); if (!string.IsNullOrEmpty(rawData)) @@ -228,72 +248,120 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) } // rileggo da REDIS la conf attuale allarmi già attivi da area ALARM_CURR_KEY - List? lastAlarms = new List(); + List lastAlarms = new List(); rawData = redisDb.StringGet(Constants.ALARM_CURR_KEY); // se trovati uso questi... if (!string.IsNullOrEmpty(rawData)) { - lastAlarms = JsonConvert.DeserializeObject>(rawData); + var rawLastAlarms = JsonConvert.DeserializeObject>(rawData); + lastAlarms = rawLastAlarms != null ? rawLastAlarms : new List(); } - // altrimenti parto da vuoto - else + + // recupero DICT dei blink allarmi (per filtrare fronte discesa in caso di allarmi che cessano e tornano attivi) + Dictionary blinkStatus = new Dictionary(); + rawData = redisDb.StringGet(Constants.ALARM_BLINK_CURR_KEY); + // se trovati uso questi... + if (!string.IsNullOrEmpty(rawData)) { - lastAlarms = new List(); + var rawBlink = JsonConvert.DeserializeObject>(rawData); + blinkStatus = rawBlink != null ? rawBlink : new Dictionary(); } + // ciclo x ogni allarme ricevuto x vedere se sia INIZIATO if (alarmList != null) { // ciclo x ogni allarme attivo x verificare se si sia CHIUSO foreach (var newAlarm in alarmList) { - // in primis... se è muted --> lo escludo... - bool isMuted = false; - var maybeMuted = mutedAlarmsList.Where(x => x.FullValue == newAlarm).FirstOrDefault(); - if (maybeMuted != null) + var currNewAlarm = newAlarm; + // se ho valori trim pre/post li applica... + if (!string.IsNullOrEmpty(AlarmCleanPre)) { - isMuted = maybeMuted.Muted; + currNewAlarm = currNewAlarm.Replace(AlarmCleanPre, ""); } - // cerco l'allarme nell'elenco degli allarmi dal DB - var foundAlarm = alarmsRecorded - .Where(x => x.FullValue == newAlarm) - .FirstOrDefault(); - // se non lo trovo --> chiamo procedura che verifica su DB, eventualmente inserisce, restituisce nuovo elenco - if (foundAlarm == null) + if (!string.IsNullOrEmpty(AlarmCleanPost)) { - // salvo sul DB - foundAlarm = dbController.AlarmListInsert(newAlarm); - // ora rileggo ed aggiorno redis e cerco di nuovo record... - alarmsRecorded = dbController.AlarmListGetAll(); - redisDb.StringSet(Constants.ALARMS_SETT_RLIST_KEY, JsonConvert.SerializeObject(alarmsRecorded)); + currNewAlarm = currNewAlarm.Replace(AlarmCleanPost, ""); } - if (!isMuted && lastAlarms != null) + // se AlarmIgnoreEmpty=true + vuoto --> salto + if (AlarmIgnoreEmpty && string.IsNullOrWhiteSpace(currNewAlarm)) { - if (!lastAlarms.Contains(newAlarm)) - { - if (foundAlarm != null) - { - - // segno come iniziato... - AlarmRecModel newAlarmRec = new AlarmRecModel() - { - MachineId = MachineId, - DtStart = adesso, - DtEnd = adesso, - AlarmId = foundAlarm.AlarmId - }; - alarmRecList.Add(newAlarmRec); - } - } + alarmList.Remove(currNewAlarm); + alarmList.Remove(newAlarm); } else { - // rimuovo da alarmList - alarmList.Remove(newAlarm); + // in primis... se è muted --> lo escludo... + bool isMuted = false; + var maybeMuted = mutedAlarmsList.Where(x => x.FullValue == currNewAlarm).FirstOrDefault(); + if (maybeMuted != null) + { + isMuted = maybeMuted.Muted; + } + // cerco l'allarme nell'elenco degli allarmi dal DB + var foundAlarm = alarmsRecorded + .Where(x => x.FullValue == currNewAlarm) + .FirstOrDefault(); + // se non lo trovo --> chiamo procedura che verifica su DB, eventualmente inserisce, restituisce nuovo elenco + if (foundAlarm == null) + { + // salvo sul DB + foundAlarm = dbController.AlarmListInsert(currNewAlarm); + // ora rileggo ed aggiorno redis e cerco di nuovo record... + alarmsRecorded = dbController.AlarmListGetAll(); + redisDb.StringSet(Constants.ALARMS_SETT_RLIST_KEY, JsonConvert.SerializeObject(alarmsRecorded)); + } + if (!isMuted) + { + if (!lastAlarms.Contains(currNewAlarm)) + { + if (foundAlarm != null) + { + // segno come iniziato... + AlarmRecModel newAlarmRec = new AlarmRecModel() + { + MachineId = MachineId, + DtStart = adesso, + DtEnd = adesso, + AlarmId = foundAlarm.AlarmId + }; + alarmRecList.Add(newAlarmRec); + } + // gestione blink allarmi + if (blinkStatus.ContainsKey(currNewAlarm)) + { + blinkStatus[currNewAlarm] = BlinkCount; + Log.Info($"Alarm: {currNewAlarm} | BlinkCount: {BlinkCount}"); + } + else + { + blinkStatus.Add(currNewAlarm, BlinkCount); + Log.Info($"NEW Alarm: {currNewAlarm} | BlinkCount: {BlinkCount}"); + } + } + } + else + { + // rimuovo da alarmList perché muted... + alarmList.Remove(currNewAlarm); + alarmList.Remove(newAlarm); + } } } - } + // recupero elenco valori blink + List chiavi = blinkStatus.Select(x => x.Key).ToList(); + // decremento i blink + foreach (var item in chiavi) + { + if (blinkStatus[item] > 0) + { + blinkStatus[item]--; + } + } + // salvo blink status counter... + redisDb.StringSet(Constants.ALARM_BLINK_CURR_KEY, JsonConvert.SerializeObject(blinkStatus)); // processo elenco allarmi già presenti if (lastAlarms != null) @@ -301,8 +369,18 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) // ciclo x ogni allarme attivo x verificare se si sia CHIUSO foreach (var oldData in lastAlarms) { - var trovato = alarmList.Contains(oldData); - if (!trovato) + bool trovato = false; + if (alarmList != null) + { + trovato = alarmList.Contains(oldData); + } + bool isBlinking = false; + if (blinkStatus.ContainsKey(oldData)) + { + isBlinking = blinkStatus[oldData] > 0; + } + + if (!trovato && !isBlinking) { // se non lo trovo var foundAlarm = alarmsRecorded @@ -318,27 +396,30 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) } // verifico se devo scrivere - bool wALog = lastAlarms.Count != alarmList.Count; - if (!wALog) + if (lastAlarms != null && alarmList != null) { - // verifico se ci siano differenze... - wALog = alarmList.Union(lastAlarms).Count() != lastAlarms.Count; - } - - // salvo se c'è stata variazione... - if (wALog) - { - // preparo dati x alarmLog - AlarmLogModel newAlarmLog = new AlarmLogModel() + bool wALog = lastAlarms.Count != alarmList.Count; + if (!wALog) { - MachineId = MachineId, - DtRif = adesso, - MemAddress = "ND", - Index = 0, - Status = (uint)alarmList.Count, - ValDecoded = alarmList.Count > 0 ? string.Join(", ", alarmList) : "All OK" - }; - alarmLogList.Add(newAlarmLog); + // verifico se ci siano differenze... + wALog = alarmList.Union(lastAlarms).Count() != lastAlarms.Count; + } + + // salvo se c'è stata variazione... + if (wALog) + { + // preparo dati x alarmLog + AlarmLogModel newAlarmLog = new AlarmLogModel() + { + MachineId = MachineId, + DtRif = adesso, + MemAddress = "ND", + Index = 0, + Status = (uint)alarmList.Count, + ValDecoded = alarmList.Count > 0 ? string.Join(", ", alarmList) : "All OK" + }; + alarmLogList.Add(newAlarmLog); + } } // serializzo l'elenco allarmi... @@ -353,7 +434,6 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) // salvo nuovo elenco allarmi lastAlarms = alarmList; - } catch { } @@ -524,21 +604,21 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) try { // verifico codici ricevuti - var dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); + var dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); if (dataList != null) { /************************************************************************ - * + * * * - * + * * * - * + * * * - * - * + * + * *************************************************************************/ - // recupero elenco parametri salvati in redis... MachineDTO? machinePlate = new MachineDTO(); + Dictionary parList = new Dictionary(); string rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); if (!string.IsNullOrEmpty(rawData)) { - machinePlate = JsonConvert.DeserializeObject(rawData); } int machStatus = 0; @@ -578,84 +657,118 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) int procMode = 0; string currKey = ""; - // ora processo il messaggio ricevuto x stati e modi vari currKey = "MACHINE STATUS"; if (dataList.ContainsKey(currKey)) { - int.TryParse(currKey, out machStatus); + int.TryParse(dataList[currKey], out machStatus); + parList.Add(currKey, machStatus); } currKey = "PROCESS STATUS"; if (dataList.ContainsKey(currKey)) { - int.TryParse(currKey, out procStatus); + int.TryParse(dataList[currKey], out procStatus); + parList.Add(currKey, procStatus); } currKey = "PROCESS MODE"; if (dataList.ContainsKey(currKey)) { - int.TryParse(currKey, out procMode); + int.TryParse(dataList[currKey], out procMode); + parList.Add(currKey, procMode); } + // fix me todo inserire gestione program name!!! + + Stopwatch sw = new Stopwatch(); + sw.Start(); +#if false + // calcolo status if (machStatus == 0) { machinePlate.StatusId = 7; } - else { + else + { switch (procMode) { case 1: machinePlate.StatusId = 8; break; + case 2: machinePlate.StatusId = 2; break; + case 3: machinePlate.StatusId = 9; break; + case 4: machinePlate.StatusId = 5; break; + case 5: machinePlate.StatusId = 10; break; + case 6: machinePlate.StatusId = 11; break; + case 7: machinePlate.StatusId = 12; break; + case 8: machinePlate.StatusId = 13; break; + default: break; } } - // eseguo cablata la gestione x ora... rispetto a MachineStatus + MachineMode invierò un machineDTO switch (procStatus) { case 1: machinePlate.ModeId = 2; break; + case 2: machinePlate.ModeId = 1; break; + case 3: machinePlate.ModeId = 3; break; + case 6: machinePlate.ModeId = 8; break; + case 8: machinePlate.ModeId = 9; break; + case 11: machinePlate.ModeId = 10; break; + default: break; } + sw.Stop(); + Log.Info($"Calcolo C# | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(machinePlate)}"); + Log.Info("-------------"); +#endif + + // calcolo con LUA e vedo se cambia... + sw.Restart(); + bool done = mpStatusMan.processData(parList, ref machinePlate); + sw.Stop(); + //Log.Info("-------------"); + Log.Info($"Calcolo LUA | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(machinePlate)}"); + //Log.Info("-------------"); // invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati string updRawVal = JsonConvert.SerializeObject(machinePlate); @@ -674,9 +787,174 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) /// void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) { - throw new NotImplementedException(); -} + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly Dictionary --> parametri valorizzati (tra quelli configurati) + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { +#if false + DateTime adesso = DateTime.Now; + try + { + // verifico codici ricevuti + var dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); + if (dataList != null) + { + /************************************************************************ + * + * + * + * + * + * + * + * + * + * + * + *************************************************************************/ + // recupero elenco parametri salvati in redis... + MachineDTO? machinePlate = new MachineDTO(); + + string rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); + if (!string.IsNullOrEmpty(rawData)) + { + machinePlate = JsonConvert.DeserializeObject(rawData); + } + int machStatus = 0; + int procStatus = 0; + int procMode = 0; + string currKey = ""; + + // ora processo il messaggio ricevuto x stati e modi vari + currKey = "MACHINE STATUS"; + if (dataList.ContainsKey(currKey)) + { + int.TryParse(dataList[currKey], out machStatus); + } + currKey = "PROCESS STATUS"; + if (dataList.ContainsKey(currKey)) + { + int.TryParse(dataList[currKey], out procStatus); + } + currKey = "PROCESS MODE"; + if (dataList.ContainsKey(currKey)) + { + int.TryParse(dataList[currKey], out procMode); + } + + // fix me todo inserire gestione program name!!! + + if (machStatus == 0) + { + machinePlate.StatusId = 7; + } + else + { + switch (procMode) + { + case 1: + machinePlate.StatusId = 8; + break; + + case 2: + machinePlate.StatusId = 2; + break; + + case 3: + machinePlate.StatusId = 9; + break; + + case 4: + machinePlate.StatusId = 5; + break; + + case 5: + machinePlate.StatusId = 10; + break; + + case 6: + machinePlate.StatusId = 11; + break; + + case 7: + machinePlate.StatusId = 12; + break; + + case 8: + machinePlate.StatusId = 13; + break; + + default: + break; + } + } + + // eseguo cablata la gestione x ora... rispetto a MachineStatus + MachineMode invierò un machineDTO + switch (procStatus) + { + case 1: + machinePlate.ModeId = 2; + break; + + case 2: + machinePlate.ModeId = 1; + break; + + case 3: + machinePlate.ModeId = 3; + break; + + case 6: + machinePlate.ModeId = 8; + break; + + case 8: + machinePlate.ModeId = 9; + break; + + case 11: + machinePlate.ModeId = 10; + break; + + default: + break; + } + + // invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati + string updRawVal = JsonConvert.SerializeObject(machinePlate); + paramsSendPipe.saveAndSendMessage(Constants.STATUS_CURR_KEY, updRawVal); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in MpStatusRecvPipe_EA_NewMessage:{Environment.NewLine}{exc}"); + } +#endif + } +} /* -------------------------------- * MAIN diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 7109e9f..c13df71 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

Version: 1.2.2206.2217

+

Version: 1.2.2209.2116


Release Note:
  • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 8dd2eb6..d41b03e 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2206.2217 +1.2.2209.2116 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 581c8f1..0aa6647 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2206.2217 + 1.2.2209.2116 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/appsettings.json b/MP.MONO.DECODER/appsettings.json index cd49bff..585b252 100644 --- a/MP.MONO.DECODER/appsettings.json +++ b/MP.MONO.DECODER/appsettings.json @@ -7,8 +7,8 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=nkc.password", - "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" @@ -33,6 +33,12 @@ } }, "OptPar": { - "AlarmMode": "RawList" + "AlarmCleanPre": "", + "AlarmCleanPost": "", + "AlarmIgnoreEmpty": true, + "AlarmMode": "RawList", + "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", + //"AlarmRegexp": "^{.*}", + "BlinkCount": 0 } } diff --git a/MP.MONO.DECODER/appsettings.multiax.json b/MP.MONO.DECODER/appsettings.multiax.json new file mode 100644 index 0000000..23a03ef --- /dev/null +++ b/MP.MONO.DECODER/appsettings.multiax.json @@ -0,0 +1,38 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "Redis": "localhost:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=pwd-MAPO!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "localhost", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "MachineId": 1, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "OptPar": { + "AlarmMode": "RawList" + } +} \ No newline at end of file diff --git a/MP.MONO.DECODER/appsettings.office.json b/MP.MONO.DECODER/appsettings.office.json new file mode 100644 index 0000000..efa264c --- /dev/null +++ b/MP.MONO.DECODER/appsettings.office.json @@ -0,0 +1,38 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "10.74.82.230", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "MachineId": 1, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "OptPar": { + "AlarmMode": "RawList" + } +} diff --git a/MP.MONO.DECODER/lua/CountersDecoder.lua b/MP.MONO.DECODER/lua/CountersDecoder.lua new file mode 100644 index 0000000..b56e76c --- /dev/null +++ b/MP.MONO.DECODER/lua/CountersDecoder.lua @@ -0,0 +1,105 @@ +--[[--------------------------------------------------- +Procedura calcolo statistiche parametri: + +Variabili IN: +- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX] +- valList(): elenco VALORI double da processare +- numRec(int): conteggio numero recorda da processare + +Variabili OUT: +- calcVal(double): valore calcolato finale +-----------------------------------------------------]] + + +-- Per eventuale debug +local ZBS = "c:/ZeroBraneStudio" +if not package.path:find(ZBS,1,true) then + package.path = ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua;" .. package.path + package.cpath = ZBS .. "/bin/?.dll;" .. ZBS .. "/bin/clibs53/?.dll;" .. package.cpath +end + +-- se non è da NLua inizializzo variabili accessorie +local function checkInit() + if (callMode ~= 'NLua') then + -- imposto valori test + valList = { 4467, 4468, 4467, 4467, 4467, 4467 } + numRec = #valList + --valList = { 4.0, 5.0, 3.0, 6.0, 1.0, 2.0 } + vcFunct = 'AVG' + --POINT AVG MEDIAN MIN MAX + end +end + +local function setupTable() + if numRec > 0 and valList[0] ~= nil then + for i = numRec, 1, -1 do + valListTable[i] = valList[i-1] + end + else + valListTable = valList + end +end + + +local function doCalc() + if(numRec > 0) then + -- verifica il tipo di richiesta + if(vcFunct == 'AVG') then + s = 0 + for i,v in ipairs(valListTable) do + s = s + v + end + calcVal = s / numRec + elseif(vcFunct == 'POINT') then + calcVal = valListTable[numRec] + elseif(vcFunct == 'MEDIAN') then + table.sort(valListTable) + calcVal = valListTable[numRec/2] + elseif(vcFunct == 'MIN') then + table.sort(valListTable) + calcVal = valListTable[1] + elseif(vcFunct == 'MAX') then + table.sort(valListTable) + calcVal = valListTable[numRec] + end + calcOk = true + else + calcVal = -999999 + numRec = 1 + calcOk = false + end +end + +local function displayTestInfo() + if (callMode ~= 'NLua') then + print('------------------------------') + print('calcOk: ' .. tostring(calcOk) .. ' | vcFunct: ' .. vcFunct) + for i,val in pairs(valList) do + print("v_"..i.." | "..val) + end + print('calcVal: ' .. calcVal) + print('------------------------------') + end +end + + +-- MAIN +function doProcess() + -- variabile semaforo callMode (locali o remote da NLua) + callMode = callMode or '' + calcVal = -999 + vcFunct = vcFunct or '' + valList = valList or {} + numRec = numRec or 1 + calcOk = false + valListTable = {} + + checkInit() + setupTable() + doCalc() + displayTestInfo() +end + +if (callMode ~= 'NLua') then + doProcess() +end diff --git a/MP.MONO.DECODER/lua/StatusDecoder.lua b/MP.MONO.DECODER/lua/StatusDecoder.lua new file mode 100644 index 0000000..81dd074 --- /dev/null +++ b/MP.MONO.DECODER/lua/StatusDecoder.lua @@ -0,0 +1,159 @@ +--[[--------------------------------------------------- +Procedura calcolo statistiche parametri: + +Variabili IN: +- lastMode +- valList(): elenco VALORI double da processare +- numRec(int): conteggio numero recorda da processare + +Variabili OUT: +- calcVal(double): valore calcolato finale +-----------------------------------------------------]] + + +-- Per eventuale debug +local ZBS = "c:/ZeroBraneStudio" +if not package.path:find(ZBS,1,true) then + package.path = ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua;" .. package.path + package.cpath = ZBS .. "/bin/?.dll;" .. ZBS .. "/bin/clibs53/?.dll;" .. package.cpath +end + +-- se non è da NLua inizializzo variabili accessorie +local function checkInit() + if (callMode ~= 'NLua') then + -- imposto valori test + dataList = {} + dataList["MACHINE STATUS"] = 1 + dataList["PROCESS STATUS"] = 2 + dataList["PROCESS MODE"] = 2 + end + numRec = tablelength(dataList) +end + +function tablelength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + +-- Main function: effettua calcolo stato secondo i parametri ricevuti +local function doCalc() + + -- se ho dati processo + if(numRec > 0) then + + -- /************************************************************************ + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- *************************************************************************/ + + -- calcolo dello statusId + if(dataList["MACHINE STATUS"] == 0) then + statusId = 7 + else + if(dataList["PROCESS MODE"] == 1) then + statusId = 8 + elseif(dataList["PROCESS MODE"] == 2) then + statusId = 2 + elseif(dataList["PROCESS MODE"] == 3) then + statusId = 9 + elseif(dataList["PROCESS MODE"] == 4) then + statusId = 5 + elseif(dataList["PROCESS MODE"] == 5) then + statusId = 10 + elseif(dataList["PROCESS MODE"] == 6) then + statusId = 11 + elseif(dataList["PROCESS MODE"] == 7) then + statusId = 12 + elseif(dataList["PROCESS MODE"] == 8) then + statusId = 13 + end + end + -- calcolo del processId + if(dataList["PROCESS STATUS"] == 1) then + modeId = 2 + elseif(dataList["PROCESS STATUS"] == 2) then + modeId = 1 + elseif(dataList["PROCESS STATUS"] == 3) then + modeId = 3 + elseif(dataList["PROCESS STATUS"] == 6) then + modeId = 8 + elseif(dataList["PROCESS STATUS"] == 8) then + modeId = 9 + elseif(dataList["PROCESS STATUS"] == 11) then + modeId = 10 + end + + calcOk = true + + -- altrimenti errore + else + numRec = 1 + calcOk = false + end +end + +local function displayTestInfo() + if (callMode ~= 'NLua') then + print('------------------------------') + print('calcOk: ' .. tostring(calcOk)) + for i,val in pairs(dataList) do + print(""..i.." | "..val) + end + print('statusId: ' .. statusId) + print('modeId: ' .. modeId) + print('------------------------------') + end +end + + +-- MAIN +function doProcess() + -- variabile semaforo callMode (locali o remote da NLua) + callMode = callMode or '' + numRec = 0 + statusId = 0 + modeId = 0 + dataList = dataList or {} + calcOk = false + + --vero task da eseguire + checkInit() + doCalc() + displayTestInfo() +end + +if (callMode ~= 'NLua') then + doProcess() +end diff --git a/MP.MONO.Data/DbModels/PendingMaintModel.cs b/MP.MONO.Data/DbModels/PendingMaintModel.cs index ec0acb7..38f0d1a 100644 --- a/MP.MONO.Data/DbModels/PendingMaintModel.cs +++ b/MP.MONO.Data/DbModels/PendingMaintModel.cs @@ -62,6 +62,20 @@ namespace MP.MONO.Data.DbModels return answ; } } + /// + /// Valore remaining come % ore rimanenti alla scadenza, range 0..100 + /// (valore expiry - valore attuale del counter) / ExpiryVal + /// + public double CountRemainPerc + { + get + { + double num = this.CountRemainVal; + double den = this.ExpiryVal > 0 ? this.ExpiryVal : 1; + double answ = num / den; + return answ; + } + } /// /// Contatore associato al task diff --git a/MP.MONO.Data/MP.MONO.Data.csproj b/MP.MONO.Data/MP.MONO.Data.csproj index 9716357..4832d7b 100644 --- a/MP.MONO.Data/MP.MONO.Data.csproj +++ b/MP.MONO.Data/MP.MONO.Data.csproj @@ -27,7 +27,7 @@ - + diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 54d6715..8e894fb 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2206.2217 + 1.2.2209.2116 @@ -30,7 +30,7 @@ - + @@ -45,47 +45,62 @@ + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + - Always + PreserveNewest - Always + PreserveNewest - Always + PreserveNewest - Always + PreserveNewest - - Always + + PreserveNewest - - Always + + PreserveNewest - Always + PreserveNewest - - Always - - - Always + + PreserveNewest - Always + PreserveNewest - - Always + + PreserveNewest - Always + PreserveNewest - - Always + + PreserveNewest - Always + PreserveNewest + + + PreserveNewest Always diff --git a/MP.MONO.SIM/Program.cs b/MP.MONO.SIM/Program.cs index 9ee9339..2104cf1 100644 --- a/MP.MONO.SIM/Program.cs +++ b/MP.MONO.SIM/Program.cs @@ -31,10 +31,11 @@ List? modeList = new List(); ThreadPool.SetMinThreads(10, 10); Dictionary LogSimulator = new Dictionary(); -Dictionary LastSend = new Dictionary(); +Dictionary LastKeySave = new Dictionary(); DateTime lastLog = DateTime.Now.AddMinutes(-1); bool verboseLog = false; bool logWriting = false; +int MinSaveIntSec = 15; logInfo(lineSep, true, true); logInfo($"Starting Machine SIM", true, true); @@ -61,7 +62,7 @@ List? machineStatusConf = new List(); // salvo configurazioni in redis setupConf(); -var currSimGen = new Simulator(confPath, modeList.Count, statusList.Count); +var currSimGen = new Simulator(confPath, modeList.Count, statusList.Count, redisDb, config); // preparo la lista dei contatori invio... LogSimulator.Add(Constants.ACT_LOG_M_QUEUE, 0); @@ -74,11 +75,12 @@ LogSimulator.Add(Constants.MAINT_STATS_M_QUEUE, 0); LogSimulator.Add(Constants.TOOLS_M_QUEUE, 0); // avvio tutti i thread... -Thread threadStatus = new Thread(simStatus); +Thread threadStatus = new Thread(simMPStatus); +Thread threadCount = new Thread(simCountersRaw); Thread threadAlarms = new Thread(simAlarms); Thread threadParams = new Thread(simParameters); Thread threadProd = new Thread(simProd); -Thread threadMachStat = new Thread(simMachStat); +Thread threadMacStats = new Thread(simMacStats); Thread threadMaint = new Thread(simMaint); Thread threadTools = new Thread(simTools); Thread threadEvHistory = new Thread(simEvents); @@ -88,7 +90,8 @@ threadStatus.Start(); threadAlarms.Start(); threadParams.Start(); threadProd.Start(); -threadMachStat.Start(); +threadCount.Start(); +threadMacStats.Start(); threadMaint.Start(); threadTools.Start(); threadEvHistory.Start(); @@ -111,12 +114,31 @@ void checkFilePresent(string filePath) /// void setupConf() { - alarmMode = config.GetValue("SimPar:AlarmMode"); + // intervallo minimo x salvataggio in redis cache + MinSaveIntSec = config.GetValue("SimPar:MinSaveIntSec"); + + // fix configurazioni di base + MachineDTO currMach = new MachineDTO() + { + Manufacturer = config.GetValue("Machine:Manufacturer"), + Model = config.GetValue("Machine:Model"), + SerNumber = config.GetValue("Machine:SerialNumber"), + Name = config.GetValue("Machine:Name"), + ModeId = 0, + StatusId = 0 + }; + redisDb.StringSet(Constants.MACHINE_CONF_PLATE, JsonConvert.SerializeObject(currMach)); + + // allarmi + alarmMode = config.GetValue("OptPar:AlarmMode"); redisDb.StringSetAsync(Constants.ALARMS_MODE_KEY, JsonConvert.SerializeObject(alarmMode)); + + + ConfigManager configManager = new ConfigManager(redisConf, confPath); if (alarmMode == AlarmReportingMode.RawList) { - alarmsRawConf = configManager.getAlarmsRawConf(); + alarmsRawConf = configManager.getAlarmsRawConf("SimAlarmRawList.json"); } else { @@ -124,7 +146,14 @@ void setupConf() } machineModeConf = configManager.getMachineModeConf(); machineStatusConf = configManager.getMachineStatusConf(); - _ = configManager.getParamsConf(); + + // altre conf x cui fare setup + var ActLogStatus = configManager.getActLog(); + var ToolStatus = configManager.getTools(); + var ParamStatus = configManager.getParamsConf(); + var AlarmsStatus = configManager.getAlarmsConf(); + var MPStatus = configManager.getMPStatusConf(); + var CountStatus = configManager.getCountersConf(); } /// @@ -159,22 +188,22 @@ void logError(string msg, bool log2file = true, bool log2console = false) void saveAndSendMessage(string memKey, string notifyChannel, string message) { // effettuo la scrittura nell'area di memoria indicata SE passato intervallo minimo - bool doSend = true; - if (LastSend.ContainsKey(memKey)) + bool doSave = true; + if (LastKeySave.ContainsKey(memKey)) { - if (DateTime.Now.Subtract(LastSend[memKey]).TotalSeconds < 60) + if (DateTime.Now.Subtract(LastKeySave[memKey]).TotalSeconds < MinSaveIntSec) { - doSend = false; + doSave = false; } } else { - LastSend.Add(memKey, DateTime.Now); + LastKeySave.Add(memKey, DateTime.Now); } - if (doSend) + if (doSave) { redisDb.StringSetAsync(memKey, message); - LastSend[memKey] = DateTime.Now; + LastKeySave[memKey] = DateTime.Now; logInfo($"Redis Cache Key: {memKey}"); } @@ -346,20 +375,41 @@ void simParameters() } } -void simStatus() +void simMPStatus() { int minPeriod = 1000; int maxPeriod = 5000; // controllo se devo fare (se ho valori da simulare...) - if (currSimGen.currSimStatus.Count > 0) + if (currSimGen.currSimMachStat.Count > 0) { do { // recupero uno stato simulato var newStatus = currSimGen.getStatus(); string rawData = JsonConvert.SerializeObject(newStatus); - saveAndSendMessage(Constants.STATUS_CURR_KEY, Constants.STATUS_M_QUEUE, rawData); + saveAndSendMessage(Constants.STATUS_ACT_KEY, Constants.STATUS_RAW_QUEUE, rawData); + + // attesa random + Thread.Sleep(rand.Next(minPeriod, maxPeriod)); + } while (true); + } +} + +void simCountersRaw() +{ + int minPeriod = 1000; + int maxPeriod = 5000; + + // controllo se devo fare (se ho valori da simulare...) + if (currSimGen.currSimMachStat.Count > 0) + { + do + { + // recupero uno stato simulato + var newStatus = currSimGen.getCountersRaw(); + string rawData = JsonConvert.SerializeObject(newStatus); + saveAndSendMessage(Constants.COUNT_CURR_KEY, Constants.COUNT_RAW_QUEUE, rawData); // attesa random Thread.Sleep(rand.Next(minPeriod, maxPeriod)); @@ -388,10 +438,11 @@ void simProd() } } -void simMachStat() + +void simMacStats() { - int minPeriod = 5000; - int maxPeriod = 15000; + int minPeriod = 3000; + int maxPeriod = 5000; // controllo se devo fare (se ho valori da simulare...) @@ -400,7 +451,7 @@ void simMachStat() do { // recupero uno stato simulato - var newVal = currSimGen.getProdStats(); + var newVal = currSimGen.getMacStats(); string rawData = JsonConvert.SerializeObject(newVal); saveAndSendMessage(Constants.MACH_STATS_CURR_KEY, Constants.MACH_STATS_M_QUEUE, rawData); diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 7109e9f..c13df71 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

    Version: 1.2.2206.2217

    +

    Version: 1.2.2209.2116


    Release Note:
    • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 8dd2eb6..d41b03e 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2206.2217 +1.2.2209.2116 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index c5e9d3d..7696e11 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2206.2217 + 1.2.2209.2116 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/Simulator.cs b/MP.MONO.SIM/Simulator.cs index f1c0996..3581686 100644 --- a/MP.MONO.SIM/Simulator.cs +++ b/MP.MONO.SIM/Simulator.cs @@ -1,6 +1,8 @@ using MathNet.Numerics.Distributions; +using Microsoft.Extensions.Configuration; using MP.MONO.Core.DTO; using Newtonsoft.Json; +using StackExchange.Redis; namespace MachineSim { @@ -11,24 +13,27 @@ namespace MachineSim { #region Public Fields + public List currCountersRaw = new List(); public List currSimActLog = new List(); public List currSimEvHist = new List(); - public List currSimMachStat = new List(); + public List currSimMachStat = new List(); public List currSimMaint = new List(); public List currSimPar = new List(); public List currSimProd = new List(); - public List currSimStatus = new List(); public List currSimTools = new List(); #endregion Public Fields #region Public Constructors - public Simulator(string _basePath, int nMode, int nStatus) + public Simulator(string _confPath, int nMode, int nStatus, IDatabase? currRedisDb, IConfigurationRoot currAppConf) { - basePath = _basePath; + confPath = _confPath; numMode = nMode; numStatus = nStatus; + redisDb = currRedisDb; + appConf = currAppConf; + setupConfig(); } @@ -49,7 +54,7 @@ namespace MachineSim Order = i.Order, Title = i.Title, Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd), + ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 1), DisplFormat = i.DisplFormat }).ToList(); @@ -78,6 +83,70 @@ namespace MachineSim return activeAlarms; } + /// + /// Restituisce elenco info dati x contatori come lista da adapter + /// + /// + public Dictionary getCountersRaw() + { + Dictionary answ = new Dictionary(); + + // simulo stato macchina ad 1 nel 99.5% (0 nel 0.5% dei casi + if (rand.Next(0, 1000) < 995) + { + answ.Add("MACHINE STATUS", "1"); + } + else + { + answ.Add("MACHINE STATUS", "1"); + } + + // simulo stato processo in ciclo 90% dei casi, resto HOLD + if (rand.Next(0, 1000) < 900) + { + answ.Add("PROCESS STATUS", "2"); + // simulo modo auto 90% dei casi + if (rand.Next(0, 1000) < 900) + { + answ.Add("PROCESS MODE", "2"); + // aggiungo spindle load che sono attivi 50% del tempo ogni coppia, random + if (rand.Next(0, 1000) < 500) + { + answ.Add("SPINDLE 1 LOAD", $"{rand.Next(5, 80)}"); + answ.Add("SPINDLE 2 LOAD", $"{rand.Next(5, 80)}"); + answ.Add("SPINDLE 3 LOAD", $"{rand.Next(5, 80)}"); + answ.Add("SPINDLE 4 LOAD", $"{rand.Next(5, 80)}"); + } + else + { + answ.Add("SPINDLE 1 LOAD", "0"); + answ.Add("SPINDLE 2 LOAD", "0"); + answ.Add("SPINDLE 3 LOAD", "0"); + answ.Add("SPINDLE 4 LOAD", "0"); + } + } + else + { + answ.Add("PROCESS MODE", "1"); + answ.Add("SPINDLE 1 LOAD", "0"); + answ.Add("SPINDLE 2 LOAD", "0"); + answ.Add("SPINDLE 3 LOAD", "0"); + answ.Add("SPINDLE 4 LOAD", "0"); + } + } + else + { + answ.Add("PROCESS STATUS", "3"); + answ.Add("PROCESS MODE", "7"); + answ.Add("SPINDLE 1 LOAD", "0"); + answ.Add("SPINDLE 2 LOAD", "0"); + answ.Add("SPINDLE 3 LOAD", "0"); + answ.Add("SPINDLE 4 LOAD", "0"); + } + + return answ; + } + public List getEvents() { List answ = new List(); @@ -91,9 +160,8 @@ namespace MachineSim Order = i.Order, Title = i.Title, Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd), + ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 1), DisplFormat = i.DisplFormat - //Value = $"{getNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd):N3}", }).ToList(); foreach (var item in answ) @@ -104,6 +172,31 @@ namespace MachineSim return answ; } + public List getMacStats() + { + List answ = new List(); + + var oee = new DisplayDataDTO() + { + IsNumeric = true, + MaxVal = 1, + MinVal = 0.50, + Order = 1, + Title = "OEE", + Type = "OEE", + ValueNum = simNext(.75, .50, 1, .1, .2, 1, 0.5), + DisplFormat = "P1" + }; + answ.Add(oee); + + foreach (var item in answ) + { + item.Value = $"{item.ValueNum.ToString(item.DisplFormat)}"; + } + + return answ; + } + public List getMaint() { List answ = new List(); @@ -117,9 +210,8 @@ namespace MachineSim Order = i.Order, Title = i.Title, Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, i.IsBoolean, i.TrueRatio), + ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, i.IsBoolean ? 2 : 1, i.TrueRatio), DisplFormat = i.DisplFormat - //Value = $"{getNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd):N3}", }).ToList(); foreach (var item in answ) @@ -143,7 +235,7 @@ namespace MachineSim Order = i.Order, Title = i.Title, Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd), + ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 1), DisplFormat = i.DisplFormat, CssIcon = i.CssIcon, EnablePlot = i.EnablePlot, @@ -162,7 +254,7 @@ namespace MachineSim { Dictionary answ = new Dictionary(); // genero a partire dall'elenco configurato da simulare... - answ = currSimPar.ToDictionary(i => i.Title, i => simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd)); + answ = currSimPar.ToDictionary(i => i.Title, i => simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 1)); return answ; } @@ -183,6 +275,7 @@ namespace MachineSim return currMachDto; } +#if false public List getProdStats() { List answ = new List(); @@ -208,29 +301,47 @@ namespace MachineSim return answ; } +#endif /// - /// Restituisce stato Macchina simulato come DTO + /// Restituisce elenco info stato Macchina simulato come lista da adapter /// /// - public MachineDTO getStatus() + public Dictionary getStatus() { - int maxRun = 7; - int maxExe = 7; - - MachineDTO currMachDto = new MachineDTO() + Dictionary answ = new Dictionary(); + // simulo stato macchina ad 1 nel 99.5% (0 nel 0.5% dei casi + if (rand.Next(0, 1000) < 995) { - Manufacturer = "Egalware", - Model = "SIM Machine", - Name = "DEMO 01", - SerNumber = "2022-0001", - ModeId = rand.Next(0, maxRun), - StatusId = rand.Next(0, maxExe) - //Mode = $"{(Enums.MachRunMode)rand.Next(0, maxRun)}", - //Status = $"{(Enums.MachExeStatus)rand.Next(0, maxExe)}" - }; + answ.Add("MACHINE STATUS", "1"); + } + else + { + answ.Add("MACHINE STATUS", "1"); + } - return currMachDto; + // simulo stato processo in ciclo 90% dei casi, resto HOLD + if (rand.Next(0, 1000) < 900) + { + answ.Add("PROCESS STATUS", "2"); + // simulo modo auto 90% dei casi + if (rand.Next(0, 1000) < 900) + { + answ.Add("PROCESS MODE", "2"); + } + else + { + answ.Add("PROCESS MODE", "1"); + } + } + else + { + answ.Add("PROCESS STATUS", "3"); + answ.Add("PROCESS MODE", "7"); + } + // aggiunta part program che cambia ogni minuto... + answ.Add("RECIPE NAME", $"{DateTime.Now:yyMMdd-HHmm}.prg"); + return answ; } public List getTools() @@ -246,14 +357,19 @@ namespace MachineSim Order = i.Order, Title = i.Title, Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd), + ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 3), DisplFormat = i.DisplFormat - //Value = $"{getNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd):N3}", }).ToList(); foreach (var item in answ) { item.Value = $"{item.ValueNum.ToString(item.DisplFormat)}"; + // aggiorno con ultimo valore simulato... + var simItem = currSimTools.FirstOrDefault(x => x.Title == item.Title); + if (simItem != null) + { + simItem.ValueNum = item.ValueNum; + } } return answ; @@ -273,46 +389,67 @@ namespace MachineSim /// /// /// - /// /// + /// Modalità simulazione + /// 1 = std, RandomWalk + trend periodico con memoria + /// 2 = boolean + /// 3 = trend secondo valore mean (crescente se >0, decrescente se <0) + /// /// - public double simNext(double CurrVal, double MinVal, double MaxVal, double sMean, double sStd, bool isBoolean = false, double trueRatio = 0.5) + public double simNext(double CurrVal, double MinVal, double MaxVal, double sMean, double sStd, int simMode = 1, double trueRatio = 0.5) { + double innov = 0; + double trend = 0; // se è boolean --> simulazione 0/1 rapida con % ratio indicata - if (isBoolean) + switch (simMode) { - CurrVal = rand.Next(10000) <= trueRatio * 10000 ? 1 : 0; - } - // simulazione complessa con memoria - else - { - // innovazione stocastica di base - double innov = Normal.Sample(sMean, sStd); - // innovazione deterministica: - int resto = (DateTime.Now.Second % 10); - double trend = 0; - switch (resto) - { - case 0: - case 1: - case 2: - trend = sMean + 15 * sStd; - break; + case 2: + CurrVal = rand.Next(10000) <= trueRatio * 10000 ? 1 : 0; + break; + case 3: + innov = Normal.Sample(sMean, sStd); + trend = rand.NextDouble() * 2 * sMean; + double delta = innov + trend; + // il delta deve essere dello stesso segno della media... + if (delta * sMean < 0) + { + delta = delta * -1; + } + CurrVal += delta; + // verifico estremi... + CurrVal = CurrVal > MaxVal ? MinVal : CurrVal; + CurrVal = CurrVal < MinVal ? MaxVal : CurrVal; + break; + case 1: + default: + // innovazione stocastica di base + innov = Normal.Sample(sMean, sStd); + int multFact = rand.Next(1, 6); + // innovazione deterministica: + int resto = (DateTime.Now.Second % 10); + trend = 0; + switch (resto) + { + case 0: + case 1: + case 7: + trend = sMean + multFact * sStd; + break; - case 5: - case 6: - case 7: - trend = -(sMean + 15 * sStd); - break; + case 2: + case 5: + case 6: + trend = -(sMean + multFact * sStd); + break; - default: - break; - } - - CurrVal += innov + trend; - // verifico estremi... - CurrVal = CurrVal > MaxVal ? MaxVal : CurrVal; - CurrVal = CurrVal < MinVal ? MinVal : CurrVal; + default: + break; + } + CurrVal += innov + trend; + // verifico estremi... + CurrVal = CurrVal > MaxVal ? MaxVal : CurrVal; + CurrVal = CurrVal < MinVal ? MinVal : CurrVal; + break; } return CurrVal; } @@ -321,23 +458,25 @@ namespace MachineSim #region Protected Fields - protected string basePath = ""; + protected string confPath = ""; protected Random rand = new Random(); #endregion Protected Fields #region Protected Properties + protected IConfigurationRoot appConf { get; set; } = null!; protected int numMode { get; set; } = 1; protected int numStatus { get; set; } = 1; + protected IDatabase redisDb { get; set; } = null!; #endregion Protected Properties #region Private Methods - private void setupConf(string paramFileName, ref List localObj) + private void setupConfDTO(string paramFileName, ref List localObj) { - string fullPath = Path.Combine(basePath, paramFileName); + string fullPath = Path.Combine(confPath, paramFileName); if (File.Exists(fullPath)) { var rawData = File.ReadAllText(fullPath); @@ -355,21 +494,38 @@ namespace MachineSim private void setupConfig() { // setup conf Parametri - setupConf("SimParams.json", ref currSimPar); - // setup conf MachStat - setupConf("SimMachStat.json", ref currSimMachStat); + setupConfDTO("SimParams.json", ref currSimPar); // setup conf Maintenance - setupConf("SimMaint.json", ref currSimMaint); + setupConfDTO("SimMaint.json", ref currSimMaint); // setup conf Tools - setupConf("SimTools.json", ref currSimTools); + setupConfDTO("SimTools.json", ref currSimTools); // setup conf Event History - setupConf("SimEvHist.json", ref currSimEvHist); + setupConfDTO("SimEvHist.json", ref currSimEvHist); // setup conf Activity Log - setupConf("SimActLog.json", ref currSimActLog); + setupConfDTO("SimActLog.json", ref currSimActLog); // setup conf Prod - setupConf("SimProd.json", ref currSimProd); + setupConfDTO("SimProd.json", ref currSimProd); + // setup conf MachStat + setupConfList("SimMachStat.json", ref currSimMachStat); // setup conf Prod - setupConf("SimStatus.json", ref currSimStatus); + setupConfList("SimStatus.json", ref currCountersRaw); + } + + private void setupConfList(string paramFileName, ref List localObj) + { + string fullPath = Path.Combine(confPath, paramFileName); + if (File.Exists(fullPath)) + { + var rawData = File.ReadAllText(fullPath); + if (!string.IsNullOrEmpty(rawData)) + { + var deserObj = JsonConvert.DeserializeObject>(rawData); + if (deserObj != null) + { + localObj = deserObj; + } + } + } } #endregion Private Methods diff --git a/MP.MONO.SIM/appsettings.json b/MP.MONO.SIM/appsettings.json index 399250c..4604ffb 100644 --- a/MP.MONO.SIM/appsettings.json +++ b/MP.MONO.SIM/appsettings.json @@ -7,14 +7,15 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=30000,syncTimeout=30000,asyncTimeout=30000,abortConnect=false,ssl=false,password=nkc.password", + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=30000,syncTimeout=30000,asyncTimeout=30000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { - "Server": "localhost", + "Server": "10.74.82.230", + //"Server": "localhost", "nKey": "MONO", "sKey": "M3T@n0-CH4" }, @@ -31,8 +32,17 @@ } } }, + "Machine": { + "Manufacturer": "Multiax", + "Model": "Model-D", + "Name": "D1521", + "SerialNumber": "1521" + }, + "OptPar": { + "AlarmMode": "RawList" + }, "SimPar": { - "AlarmMode": "RawList", + "MinSaveIntSec": 5, "PercAllarmi": 10, "MaxAddAllarmi": 3, "MaxDurationAllarmi": 10 diff --git a/MP.MONO.SIM/conf/ActLog.json b/MP.MONO.SIM/conf/ActLog.json new file mode 100644 index 0000000..eecc4e3 --- /dev/null +++ b/MP.MONO.SIM/conf/ActLog.json @@ -0,0 +1,38 @@ +[ + { + "Order": 0, + "ExtCode": "ns=5;i=1278", + "Type": "ACTLOG", + "Title": "User LC001", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N3", + "IsNumeric": true + }, + { + "Order": 1, + "ExtCode": "ns=5;i=1279", + "Type": "ACTLOG", + "Title": "User LC001 SetPoint", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N3", + "IsNumeric": true + }, + { + "Order": 2, + "ExtCode": "ns=5;i=1280", + "Type": "ACTLOG", + "Title": "User LC001 Ctrl OUT", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N3", + "IsNumeric": true + } +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/Alarms.json b/MP.MONO.SIM/conf/Alarms.json new file mode 100644 index 0000000..6532f6f --- /dev/null +++ b/MP.MONO.SIM/conf/Alarms.json @@ -0,0 +1,134 @@ +[ + { + "Order": 1, + "ExtCode": "ns=1;s=3_1_ALARM NC", + "Type": "ALARM", + "Title": "ALARM NC", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 2, + "ExtCode": "ns=1;s=3_2_ALARM PLC 1", + "Type": "ALARM", + "Title": "ALARM PLC 01", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 3, + "ExtCode": "ns=1;s=3_3_ALARM PLC 2", + "Type": "ALARM", + "Title": "ALARM PLC 02", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 4, + "ExtCode": "ns=1;s=3_4_ALARM PLC 3", + "Type": "ALARM", + "Title": "ALARM PLC 03", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 5, + "ExtCode": "ns=1;s=3_5_ALARM PLC 4", + "Type": "ALARM", + "Title": "ALARM PLC 04", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 6, + "ExtCode": "ns=1;s=3_6_ALARM PLC 5", + "Type": "ALARM", + "Title": "ALARM PLC 05", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 7, + "ExtCode": "ns=1;s=3_7_ALARM PLC 6", + "Type": "ALARM", + "Title": "ALARM PLC 06", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 8, + "ExtCode": "ns=1;s=3_8_ALARM PLC 7", + "Type": "ALARM", + "Title": "ALARM PLC 07", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 9, + "ExtCode": "ns=1;s=3_9_ALARM PLC 8", + "Type": "ALARM", + "Title": "ALARM PLC 08", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 10, + "ExtCode": "ns=1;s=3_10_ALARM PLC 9", + "Type": "ALARM", + "Title": "ALARM PLC 09", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + }, + { + "Order": 11, + "ExtCode": "ns=1;s=3_11_ALARM PLC 10", + "Type": "ALARM", + "Title": "ALARM PLC 10", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 0, + "DisplFormat": "", + "IsNumeric": false + } +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/Counters.json b/MP.MONO.SIM/conf/Counters.json new file mode 100644 index 0000000..d3ed7d0 --- /dev/null +++ b/MP.MONO.SIM/conf/Counters.json @@ -0,0 +1,114 @@ +[ + { + "Order": 1, + "ExtCode": "ns=1;s=1_1_MACHINE STATUS", + "Type": "STATUS", + "Title": "MACHINE STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 2, + "ExtCode": "ns=1;s=500_1_STATUS", + "Type": "STATUS", + "Title": "PROCESS STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 3, + "ExtCode": "ns=1;s=501_1_MODE", + "Type": "MODE", + "Title": "PROCESS MODE", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 4, + "ExtCode": "ns=1;s=516_PROC 1 SPINDLE 1 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 1 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 5, + "ExtCode": "ns=1;s=517_PROC 1 SPINDLE 2 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 2 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 6, + "ExtCode": "ns=1;s=518_PROC 1 SPINDLE 3 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 3 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 7, + "ExtCode": "ns=1;s=519_PROC 1 SPINDLE 4 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 4 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 7, + "ExtCode": "ns=1;s=502_1_RECIPE NAME", + "Type": "PROGRAM", + "Title": "RECIPE NAME", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + } +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/MPStatus.json b/MP.MONO.SIM/conf/MPStatus.json new file mode 100644 index 0000000..fed7f9a --- /dev/null +++ b/MP.MONO.SIM/conf/MPStatus.json @@ -0,0 +1,50 @@ +[ + { + "Order": 1, + "ExtCode": "ns=1;s=1_1_MACHINE STATUS", + "Type": "STATUS", + "Title": "MACHINE STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 2, + "ExtCode": "ns=1;s=500_1_STATUS", + "Type": "STATUS", + "Title": "PROCESS STATUS", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 3, + "ExtCode": "ns=1;s=501_1_MODE", + "Type": "MODE", + "Title": "PROCESS MODE", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + }, + { + "Order": 4, + "ExtCode": "ns=1;s=502_1_RECIPE NAME", + "Type": "PROGRAM", + "Title": "RECIPE NAME", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": true + } +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/ParamList.json b/MP.MONO.SIM/conf/ParamList.json deleted file mode 100644 index 5eb6977..0000000 --- a/MP.MONO.SIM/conf/ParamList.json +++ /dev/null @@ -1,128 +0,0 @@ -[ - { - "Order": 3, - "HLShow": true, - "Type": "SPEED-5000-10000", - "Title": "SPEED", - "Value": "4000", - "ValueNum": 4000, - "MinVal": 1000, - "MaxVal": 10000, - "DisplFormat": "N0", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-gauge-high", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 2, - "HLShow": true, - "Type": "FEED-3000-5000", - "Title": "FEED", - "Value": "2500", - "ValueNum": 2500, - "MinVal": 1000, - "MaxVal": 5000, - "DisplFormat": "N0", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-gauge-high", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 1, - "HLShow": true, - "Type": "LOAD", - "Title": "SPINDLE LOAD", - "Value": "30", - "ValueNum": 30, - "MinVal": 0, - "MaxVal": 100, - "DisplFormat": "N1", - "IsNumeric": true, - "EnablePlot": true, - "ShowBar": true, - "CssIcon": "fa-solid fa-bolt", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 4, - "Type": "POS", - "Title": "X POS", - "Value": "1500", - "ValueNum": 1500, - "MinVal": 0, - "MaxVal": 5000, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 5, - "Type": "POS", - "Title": "Y POS", - "Value": "5000", - "ValueNum": 5000, - "MinVal": 0, - "MaxVal": 10000, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 6, - "Type": "POS", - "Title": "Z POS", - "Value": "-1500", - "ValueNum": -1500, - "MinVal": -3000, - "MaxVal": 0, - "DisplFormat": "N2", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-ruler-horizontal", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 7, - "Type": "POS", - "Title": "A POS", - "Value": "150", - "ValueNum": 150, - "MinVal": 0, - "MaxVal": 360, - "DisplFormat": "N3", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-rotate-right", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - }, - { - "Order": 8, - "Type": "POS", - "Title": "B POS", - "Value": "150", - "ValueNum": 150, - "MinVal": 0, - "MaxVal": 360, - "DisplFormat": "N3", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-rotate-right", - "SamplePeriod": 180, - "VcFunc": "MEDIAN" - } -] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/Parameters.json b/MP.MONO.SIM/conf/Parameters.json new file mode 100644 index 0000000..43f49ca --- /dev/null +++ b/MP.MONO.SIM/conf/Parameters.json @@ -0,0 +1,387 @@ +[ + { + "Order": 1, + "ExtCode": "ns=1;s=515_PROC 1 FEED OVERRIDE", + "HLShow": true, + "Type": "FEED", + "Title": "FEED OVER", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 130, + "DisplFormat": "N0", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 2, + "ExtCode": "ns=1;s=518_PROC 1 SPEED OVERRIDE", + "HLShow": true, + "Type": "SPEED", + "Title": "SPEED OVER", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 130, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 3, + "ExtCode": "ns=1;s=521_PROC 1 SPINDLE 1 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 1 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 4, + "ExtCode": "ns=1;s=522_PROC 1 SPINDLE 2 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 2 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 5, + "ExtCode": "ns=1;s=523_PROC 1 SPINDLE 3 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 3 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 6, + "ExtCode": "ns=1;s=524_PROC 1 SPINDLE 4 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 4 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 31, + "ExtCode": "ns=1;s=4_1_AXIS 1 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "AXIS 1 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 32, + "ExtCode": "ns=1;s=4_2_AXIS 2 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "AXIS 2 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 33, + "ExtCode": "ns=1;s=4_3_AXIS 3 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "AXIS 3 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 34, + "ExtCode": "ns=1;s=4_4_AXIS 4 LOAD PC", + "HLShow": true, + "Type": "LOAD", + "Title": "AXIS 4 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 51, + "ExtCode": "ns=1;s=516_PROC 1 FEED PROGRAMMED", + "Type": "FEED", + "Title": "FEED PROG", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20000, + "DisplFormat": "N0", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 52, + "ExtCode": "ns=1;s=517_PROC 1 FEED ACTUAL", + "Type": "FEED", + "Title": "FEED ACT", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20000, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 53, + "ExtCode": "ns=1;s=519_PROC 1 SPEED PROGRAMMED", + "Type": "SPEED", + "Title": "SPEED PROG", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20000, + "DisplFormat": "N0", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 54, + "ExtCode": "ns=1;s=520_PROC 1 SPEED ACTUAL", + "Type": "SPEED", + "Title": "SPEED ACT", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 20000, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 105, + "ExtCode": "ns=1;s=4_5_AXIS 5 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 5 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 106, + "ExtCode": "ns=1;s=4_6_AXIS 6 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 6 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 107, + "ExtCode": "ns=1;s=4_7_AXIS 7 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 7 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 108, + "ExtCode": "ns=1;s=4_8_AXIS 8 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 8 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 109, + "ExtCode": "ns=1;s=4_9_AXIS 9 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 9 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 110, + "ExtCode": "ns=1;s=4_10_AXIS 10 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 10 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 111, + "ExtCode": "ns=1;s=4_11_AXIS 11 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 11 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 112, + "ExtCode": "ns=1;s=4_12_AXIS 12 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 12 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 113, + "ExtCode": "ns=1;s=4_13_AXIS 13 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 13 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 114, + "ExtCode": "ns=1;s=4_14_AXIS 14 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 14 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 115, + "ExtCode": "ns=1;s=4_15_AXIS 15 LOAD PC", + "Type": "LOAD", + "Title": "AXIS 15 LOAD", + "Value": "0", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 100, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + } +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/SimActLog.json b/MP.MONO.SIM/conf/SimActLog2.json similarity index 100% rename from MP.MONO.SIM/conf/SimActLog.json rename to MP.MONO.SIM/conf/SimActLog2.json diff --git a/MP.MONO.SIM/conf/SimCountersRaw2.json b/MP.MONO.SIM/conf/SimCountersRaw2.json new file mode 100644 index 0000000..001b0ef --- /dev/null +++ b/MP.MONO.SIM/conf/SimCountersRaw2.json @@ -0,0 +1,9 @@ +[ + "MACHINE STATUS", + "PROCESS STATUS", + "PROCESS MODE", + "SPINDLE 1 LOAD", + "SPINDLE 2 LOAD", + "SPINDLE 3 LOAD", + "SPINDLE 4 LOAD" +] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/SimEvHist.json b/MP.MONO.SIM/conf/SimEvHist2.json similarity index 100% rename from MP.MONO.SIM/conf/SimEvHist.json rename to MP.MONO.SIM/conf/SimEvHist2.json diff --git a/MP.MONO.SIM/conf/SimMachStat.json b/MP.MONO.SIM/conf/SimMachStat.json index 702cc02..ca488bf 100644 --- a/MP.MONO.SIM/conf/SimMachStat.json +++ b/MP.MONO.SIM/conf/SimMachStat.json @@ -1,14 +1,6 @@ [ - { - "Order": 0, - "Type": "OEE-75-90", - "Title": "OEE", - "Value": "0.5", - "ValueNum": 0.5, - "MinVal": 0.4, - "MaxVal": 1, - "SimMean": 0.2, - "SimStd": 0.2, - "DisplFormat": "P1" - } + "MACHINE STATUS", + "PROCESS STATUS", + "PROCESS MODE", + "RECIPE NAME" ] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/SimMaint.json b/MP.MONO.SIM/conf/SimMaint2.json similarity index 100% rename from MP.MONO.SIM/conf/SimMaint.json rename to MP.MONO.SIM/conf/SimMaint2.json diff --git a/MP.MONO.SIM/conf/SimParams.json b/MP.MONO.SIM/conf/SimParams.json index 0210ec4..d8e224d 100644 --- a/MP.MONO.SIM/conf/SimParams.json +++ b/MP.MONO.SIM/conf/SimParams.json @@ -3,12 +3,47 @@ "Order": 3, "HLShow": true, "Type": "SPEED-5000-10000", - "Title": "SPEED", + "Title": "SPEED PROG", "Value": "4000", "ValueNum": 4000, "MinVal": 1000, "MaxVal": 10000, - "SimMean": 100, + "SimMean": 300, + "SimStd": 100, + "DisplFormat": "N0", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + + }, + { + "Order": 2, + "HLShow": true, + "Type": "FEED-3000-5000", + "Title": "FEED PROG", + "Value": "2500", + "ValueNum": 2500, + "MinVal": 1000, + "MaxVal": 5000, + "SimMean": 450, + "SimStd": 150, + "DisplFormat": "N0", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, + { + "Order": 3, + "HLShow": true, + "Type": "SPEED-5000-10000", + "Title": "SPEED ACT", + "Value": "4000", + "ValueNum": 4000, + "MinVal": 1000, + "MaxVal": 10000, + "SimMean": 200, "SimStd": 50, "DisplFormat": "N0", "IsNumeric": true, @@ -21,29 +56,81 @@ "Order": 2, "HLShow": true, "Type": "FEED-3000-5000", - "Title": "FEED", + "Title": "FEED ACT", "Value": "2500", "ValueNum": 2500, "MinVal": 1000, "MaxVal": 5000, - "SimMean": 50, - "SimStd": 5, + "SimMean": 200, + "SimStd": 100, "DisplFormat": "N0", "IsNumeric": true, "EnablePlot": true, "ShowBar": true, "CssIcon": "fa-solid fa-gauge-high" }, + { + "Order": 3, + "HLShow": true, + "Type": "SPEED-5000-10000", + "Title": "SPEED OVER", + "Value": "75", + "ValueNum": 75, + "MinVal": 0, + "MaxVal": 170, + "SimMean": 6, + "SimStd": 3, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + + }, + { + "Order": 2, + "HLShow": true, + "Type": "FEED-3000-5000", + "Title": "FEED OVER", + "Value": "50", + "ValueNum": 50, + "MinVal": 0, + "MaxVal": 120, + "SimMean": 8, + "SimStd": 3, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-gauge-high" + }, { "Order": 1, "HLShow": true, "Type": "LOAD", - "Title": "SPINDLE LOAD", + "Title": "SPINDLE 1 LOAD", + "Value": "50", + "ValueNum": 50, + "MinVal": 0, + "MaxVal": 100, + "SimMean": 5, + "SimStd": 3, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 1, + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 2 LOAD", "Value": "30", "ValueNum": 30, "MinVal": 0, "MaxVal": 100, - "SimMean": 5, + "SimMean": 6, "SimStd": 2, "DisplFormat": "N1", "IsNumeric": true, @@ -52,76 +139,95 @@ "CssIcon": "fa-solid fa-bolt" }, { - "Order": 4, - "Type": "POS", - "Title": "X POS", - "Value": "1500", - "ValueNum": 1500, + "Order": 1, + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 3 LOAD", + "Value": "20", + "ValueNum": 20, "MinVal": 0, - "MaxVal": 5000, - "SimMean": 100, - "SimStd": 20, - "DisplFormat": "N2", + "MaxVal": 100, + "SimMean": 9, + "SimStd": 2, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 1, + "HLShow": true, + "Type": "LOAD", + "Title": "SPINDLE 4 LOAD", + "Value": "20", + "ValueNum": 20, + "MinVal": 0, + "MaxVal": 100, + "SimMean": 5, + "SimStd": 4, + "DisplFormat": "N1", + "IsNumeric": true, + "EnablePlot": true, + "ShowBar": true, + "CssIcon": "fa-solid fa-bolt" + }, + { + "Order": 4, + "Type": "AXIS", + "Title": "AXIS 1 LOAD", + "Value": "10", + "ValueNum": 10, + "MinVal": 0, + "MaxVal": 100, + "SimMean": 15, + "SimStd": 2, + "DisplFormat": "N1", "IsNumeric": true, "EnablePlot": true, "CssIcon": "fa-solid fa-ruler-horizontal" }, { "Order": 5, - "Type": "POS", - "Title": "Y POS", - "Value": "5000", - "ValueNum": 5000, + "Type": "AXIS", + "Title": "AXIS 2 LOAD", + "Value": "30", + "ValueNum": 30, "MinVal": 0, - "MaxVal": 10000, - "SimMean": 100, - "SimStd": 10, - "DisplFormat": "N2", + "MaxVal": 100, + "SimMean": 25, + "SimStd": 5, + "DisplFormat": "N1", "IsNumeric": true, "EnablePlot": true, "CssIcon": "fa-solid fa-ruler-horizontal" }, { "Order": 6, - "Type": "POS", - "Title": "Z POS", - "Value": "-1500", - "ValueNum": -1500, - "MinVal": -3000, - "MaxVal": 0, - "SimMean": 50, - "SimStd": 5, - "DisplFormat": "N2", + "Type": "AXIS", + "Title": "AXIS 3 LOAD", + "Value": "50", + "ValueNum": 50, + "MinVal": 0, + "MaxVal": 100, + "SimMean": 25, + "SimStd": 10, + "DisplFormat": "N1", "IsNumeric": true, "EnablePlot": true, "CssIcon": "fa-solid fa-ruler-horizontal" }, { "Order": 7, - "Type": "POS", - "Title": "A POS", - "Value": "150", - "ValueNum": 150, + "Type": "AXIS", + "Title": "AXIS 4 LOAD", + "Value": "40", + "ValueNum": 40, "MinVal": 0, - "MaxVal": 360, - "SimMean": 5, - "SimStd": 1, - "DisplFormat": "N3", - "IsNumeric": true, - "EnablePlot": true, - "CssIcon": "fa-solid fa-rotate-right" - }, - { - "Order": 8, - "Type": "POS", - "Title": "B POS", - "Value": "150", - "ValueNum": 150, - "MinVal": 0, - "MaxVal": 360, - "SimMean": 5, - "SimStd": 2, - "DisplFormat": "N3", + "MaxVal": 100, + "SimMean": 30, + "SimStd": 10, + "DisplFormat": "N1", "IsNumeric": true, "EnablePlot": true, "CssIcon": "fa-solid fa-rotate-right" diff --git a/MP.MONO.SIM/conf/SimProd.json b/MP.MONO.SIM/conf/SimProd2.json similarity index 100% rename from MP.MONO.SIM/conf/SimProd.json rename to MP.MONO.SIM/conf/SimProd2.json diff --git a/MP.MONO.SIM/conf/SimStatus.json b/MP.MONO.SIM/conf/SimStatus.json deleted file mode 100644 index 1a1efc0..0000000 --- a/MP.MONO.SIM/conf/SimStatus.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "Order": 0, - "Type": "POS", - "Title": "Z POS", - "Value": "-500", - "ValueNum": -500, - "MinVal": -3000, - "MaxVal": 0, - "SimMean": 50, - "SimStd": 5, - "DisplFormat": "N2" - } -] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/SimTools.json b/MP.MONO.SIM/conf/SimTools.json index 90f4a95..9845efb 100644 --- a/MP.MONO.SIM/conf/SimTools.json +++ b/MP.MONO.SIM/conf/SimTools.json @@ -3,22 +3,22 @@ "Order": 0, "Type": "TOOL", "Title": "Tool 01 life", - "Value": "1000", - "ValueNum": 1000, + "Value": "99", + "ValueNum": 99, "MinVal": 0, - "MaxVal": 2000, - "SimMean": -1, - "SimStd": 1, + "MaxVal": 100, + "SimMean": -1.5, + "SimStd": 0.5, "DisplFormat": "N1" }, { "Order": 1, "Type": "TOOL", "Title": "Tool 02 life", - "Value": "800", - "ValueNum": 800, + "Value": "85", + "ValueNum": 85, "MinVal": 0, - "MaxVal": 2000, + "MaxVal": 100, "SimMean": -1, "SimStd": 1, "DisplFormat": "N1" @@ -27,12 +27,12 @@ "Order": 2, "Type": "TOOL", "Title": "Tool 03 life", - "Value": "700", - "ValueNum": 700, + "Value": "70", + "ValueNum": 70, "MinVal": 0, - "MaxVal": 2000, - "SimMean": -1, - "SimStd": 1, + "MaxVal": 100, + "SimMean": -2.5, + "SimStd": 2, "DisplFormat": "N1" } ] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/Tools.json b/MP.MONO.SIM/conf/Tools.json new file mode 100644 index 0000000..04e9d12 --- /dev/null +++ b/MP.MONO.SIM/conf/Tools.json @@ -0,0 +1,194 @@ +[ + { + "Order": 0, + "ExtCode": "ns=1;s=5_1_TOOL 1 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 1 TOOL 01", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 1, + "ExtCode": "ns=1;s=5_2_TOOL 2 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 1 TOOL 02", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 2, + "ExtCode": "ns=1;s=5_3_TOOL 3 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 1 TOOL 03", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 3, + "ExtCode": "ns=1;s=5_4_TOOL 4 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 1 TOOL 04", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 4, + "ExtCode": "ns=1;s=5_5_TOOL 11 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 2 TOOL 01", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 5, + "ExtCode": "ns=1;s=5_6_TOOL 12 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 2 TOOL 02", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 6, + "ExtCode": "ns=1;s=5_7_TOOL 13 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 2 TOOL 03", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 7, + "ExtCode": "ns=1;s=5_8_TOOL 14 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 2 TOOL 04", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 8, + "ExtCode": "ns=1;s=5_9_TOOL 21 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 3 TOOL 01", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 9, + "ExtCode": "ns=1;s=5_10_TOOL 22 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 3 TOOL 2", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 10, + "ExtCode": "ns=1;s=5_11_TOOL 23 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 3 TOOL 3", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 11, + "ExtCode": "ns=1;s=5_12_TOOL 24 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 3 TOOL 4", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 12, + "ExtCode": "ns=1;s=5_13_TOOL 31 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 4 TOOL 1", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 13, + "ExtCode": "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 4 TOOL 2", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 14, + "ExtCode": "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 4 TOOL 3", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + }, + { + "Order": 15, + "ExtCode": "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC", + "Type": "TOOL", + "Title": "SPINDLE 4 TOOL 4", + "Value": "0", + "ValueNum": 0, + "MinVal": -9999, + "MaxVal": 9999, + "DisplFormat": "N1", + "IsNumeric": true + } +] \ No newline at end of file diff --git a/MP.MONO.UI/Components/DisplayInfo.razor b/MP.MONO.UI/Components/DisplayInfo.razor index 24382ea..c7c5ca2 100644 --- a/MP.MONO.UI/Components/DisplayInfo.razor +++ b/MP.MONO.UI/Components/DisplayInfo.razor @@ -23,28 +23,3 @@ } - -@code { - [Parameter] - public string ParamName { get; set; } = "ND"; - - [Parameter] - public string btnType { get; set; } = "btn-primary"; - - [Parameter] - public Dictionary currInfo { get; set; } = new Dictionary(); - - [Parameter] - public bool showSection { get; set; } = false; - - - protected void toggleDisplay() - { - showSection = !showSection; - } - - protected string caretIcon - { - get => showSection ? "bi bi-caret-up-square-fill" : "bi bi-caret-down-square-fill"; - } -} diff --git a/MP.MONO.UI/Components/DisplayInfo.razor.cs b/MP.MONO.UI/Components/DisplayInfo.razor.cs new file mode 100644 index 0000000..cd4960c --- /dev/null +++ b/MP.MONO.UI/Components/DisplayInfo.razor.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.MONO.UI; +using MP.MONO.UI.Shared; +using MP.MONO.UI.Components; +using MP.MONO.Core; + +namespace MP.MONO.UI.Components +{ + public partial class DisplayInfo + { + [Parameter] + public string ParamName { get; set; } = "ND"; + [Parameter] + public string btnType { get; set; } = "btn-primary"; + [Parameter] + public Dictionary currInfo { get; set; } = new Dictionary(); + [Parameter] + public bool showSection { get; set; } = false; + protected void toggleDisplay() + { + showSection = !showSection; + } + + protected string caretIcon { get => showSection ? "bi bi-caret-up-square-fill" : "bi bi-caret-down-square-fill"; } + } +} \ No newline at end of file diff --git a/MP.MONO.UI/Components/MaintTaskPending.razor b/MP.MONO.UI/Components/MaintTaskPending.razor index e4602b0..011effd 100644 --- a/MP.MONO.UI/Components/MaintTaskPending.razor +++ b/MP.MONO.UI/Components/MaintTaskPending.razor @@ -129,7 +129,7 @@ @if (!compMode) { - @if (record.CountRemainVal <= hourLim) + @if (record.CountRemainPerc <= PercLim) { } diff --git a/MP.MONO.UI/Components/MaintTaskPending.razor.cs b/MP.MONO.UI/Components/MaintTaskPending.razor.cs index 9e803a3..2a313bb 100644 --- a/MP.MONO.UI/Components/MaintTaskPending.razor.cs +++ b/MP.MONO.UI/Components/MaintTaskPending.razor.cs @@ -8,6 +8,38 @@ namespace MP.MONO.UI.Components { public partial class MaintTaskPending { + #region Private Fields + + private int _MaxRecord = 1000; + + private DateTime LastUpdate = DateTime.Now.AddHours(-12); + + private List? ListRecords = null; + + // FARE!!! filtro macchina + private int MachineId = 1; + + private int MaintPendingRefreshVetoMin = 10; + + /// + /// Valore limite (in %) per permettere di chiudere un intervento + /// + private int PercLim = 50; + + /// + /// Valore limite (in %) per indicare come rosso una scadenza + /// + private int redLim = 10; + + private List? SearchRecords = null; + + /// + /// Valore limite (in %) per indicare come giallo una scadenza + /// + private int yelLim = 20; + + #endregion Private Fields + #region Public Properties /// @@ -24,67 +56,6 @@ namespace MP.MONO.UI.Components #endregion Public Properties - #region Protected Methods - - protected override async Task OnInitializedAsync() - { - await ReloadData(); - MaintPendingRefreshVetoMin = Configuration.GetValue("OptPar:MaintPendingRefreshVetoMin"); - MMDataService.maintPipe.EA_NewMessage += MaintPipe_EA_NewMessage; - } - - private int MaintPendingRefreshVetoMin = 10; - - private DateTime LastUpdate = DateTime.Now.AddHours(-12); - - private async void MaintPipe_EA_NewMessage(object? sender, EventArgs e) - { - PubSubEventArgs currArgs = (PubSubEventArgs)e; - if (!string.IsNullOrEmpty(currArgs.newMessage)) - { - // faccio un update al massimo ogni tot minuti (da config) - if (DateTime.Now.Subtract(LastUpdate).TotalMinutes > MaintPendingRefreshVetoMin) - { - LastUpdate = DateTime.Now; - await ReloadData(); - await InvokeAsync(() => - { - StateHasChanged(); - }); - } - } - } - - #endregion Protected Methods - - #region Private Fields - - private int _MaxRecord = 1000; - - /// - /// Valore limite (in ore) per permettere di chiudere un intervento - /// - private int hourLim = 24 * 1; - - private List? ListRecords = null; - - // FARE!!! filtro macchina - private int MachineId = 1; - - /// - /// Valore limite (in %) per indicare come rosso una scadenza - /// - private int redLim = 10; - - private List? SearchRecords = null; - - /// - /// Valore limite (in %) per indicare come giallo una scadenza - /// - private int yelLim = 20; - - #endregion Private Fields - #region Private Properties private int _currPage { get; set; } = 1; @@ -188,6 +159,18 @@ namespace MP.MONO.UI.Components #endregion Private Properties + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + await ReloadData(); + MaintPendingRefreshVetoMin = Configuration.GetValue("OptPar:MaintPendingRefreshVetoMin"); + PercLim = Configuration.GetValue("OptPar:MaintLimitPerc"); + MMDataService.maintPipe.EA_NewMessage += MaintPipe_EA_NewMessage; + } + + #endregion Protected Methods + #region Private Methods /// @@ -224,6 +207,24 @@ namespace MP.MONO.UI.Components currPage = newNum; } + private async void MaintPipe_EA_NewMessage(object? sender, EventArgs e) + { + PubSubEventArgs currArgs = (PubSubEventArgs)e; + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + // faccio un update al massimo ogni tot minuti (da config) + if (DateTime.Now.Subtract(LastUpdate).TotalMinutes > MaintPendingRefreshVetoMin) + { + LastUpdate = DateTime.Now; + await ReloadData(); + await InvokeAsync(() => + { + StateHasChanged(); + }); + } + } + } + private async Task RegenTask() { await MMDataService.SchedMaintTaskCreateMissing(MachineId); diff --git a/MP.MONO.UI/Conf/lic.IIS01.file b/MP.MONO.UI/Conf/lic.IIS01.file new file mode 100644 index 0000000..187ca62 --- /dev/null +++ b/MP.MONO.UI/Conf/lic.IIS01.file @@ -0,0 +1 @@ +7846c819c695edbad32f74f84430d98a82e57cc6a99ec55a4dce6c9c5eb62bec560dbfe8feca34eef826fadb81c4884b9b215fda89cf4dcee5eb46f52287e722 \ No newline at end of file diff --git a/MP.MONO.UI/Conf/lic.file b/MP.MONO.UI/Conf/lic.file index 9540e9d..69f59a3 100644 --- a/MP.MONO.UI/Conf/lic.file +++ b/MP.MONO.UI/Conf/lic.file @@ -1 +1 @@ -31e9cc1c2e8f30a1b4098cb157d712f11f3f2e60fb74169a354c3fa646d6d0e28518b4e3139f844b25824fbcc4340051fc507d22c1c2d2786d3786c777c31cc3 \ No newline at end of file +467e4b24bc3fe9d237169aa274ae589b64f072fb1cd91f4d79aaee76c64afbfced7fb51536b62cf612dedfb304202a1e653778b7cc8c758f83bb058984460301 \ No newline at end of file diff --git a/MP.MONO.UI/Conf/lic.multiax.demo.file b/MP.MONO.UI/Conf/lic.multiax.demo.file new file mode 100644 index 0000000..9b807a0 --- /dev/null +++ b/MP.MONO.UI/Conf/lic.multiax.demo.file @@ -0,0 +1 @@ +ba277b1767d831427d18b76b0d65189aeac888948dd616d77bde620356de20d7143b2d8b82a2c02d08b2b6ef123f98758027f0cf39ca1243711cfa3066a7216d \ No newline at end of file diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 95c4cd8..1eb9880 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2206.2217 + 1.2.2209.2116 @@ -31,21 +31,36 @@ + + Never + + + Never + + + + + + Never + - PreserveNewest + Never - PreserveNewest + Never PreserveNewest + + Always + PreserveNewest - + diff --git a/MP.MONO.UI/Pages/Alarms.razor b/MP.MONO.UI/Pages/Alarms.razor index 7c164f5..78cd067 100644 --- a/MP.MONO.UI/Pages/Alarms.razor +++ b/MP.MONO.UI/Pages/Alarms.razor @@ -74,7 +74,26 @@ {
      -
      Alarm History
      +
      +
      +
      Alarm History
      +
      +
      + @if (!liveUpdate) + { + + } + else + { + + } +
      +
      @if (ListRecords == null) diff --git a/MP.MONO.UI/Pages/Alarms.razor.cs b/MP.MONO.UI/Pages/Alarms.razor.cs index 21fc959..3457264 100644 --- a/MP.MONO.UI/Pages/Alarms.razor.cs +++ b/MP.MONO.UI/Pages/Alarms.razor.cs @@ -1,4 +1,5 @@ using MP.MONO.Data.DbModels; +using System.Diagnostics; namespace MP.MONO.UI.Pages { @@ -13,6 +14,47 @@ namespace MP.MONO.UI.Pages #region Protected Properties + public bool liveUpdate { get; set; } = true; + public string lastUpdate { get; set; } = "-"; + + public void Dispose() + { + aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + } + + public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + if (!isLoading && liveUpdate) + { + aTimer.Stop(); + // inizio misura esecuzione + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + await InvokeAsync(() => ReloadData()); + }); + pUpd.Wait(); + // misuro tempo esecuzione + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + int deltaTime = RefreshPeriod - (int)ts.TotalMilliseconds; + aTimer.Interval = deltaTime > 100 ? deltaTime : 100; + aTimer.Start(); + } + } + public void StartTimer() + { + //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); + aTimer = new System.Timers.Timer(RefreshPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + //aTimer.AutoReset = true; + aTimer.Start(); + } private int MaxRecord { get @@ -29,7 +71,7 @@ namespace MP.MONO.UI.Pages } } } - + protected int RefreshPeriod { get; set; } = 2000; private int totalCount { get @@ -59,6 +101,10 @@ namespace MP.MONO.UI.Pages protected override async Task OnInitializedAsync() { + if (liveUpdate) + { + StartTimer(); + } await ReloadData(); } @@ -111,6 +157,15 @@ namespace MP.MONO.UI.Pages doSetup = false; await Task.Delay(1); } + protected async Task toggleUpdate() + { + liveUpdate = !liveUpdate; + await Task.Delay(1); + if (!liveUpdate) + { + lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; + } + } #endregion Protected Methods @@ -123,6 +178,7 @@ namespace MP.MONO.UI.Pages private int MachineId = 1; private List? SearchRecords = null; + private static System.Timers.Timer aTimer = null!; #endregion Private Fields diff --git a/MP.MONO.UI/Pages/Info.razor b/MP.MONO.UI/Pages/Info.razor index 9c91c3a..90c4847 100644 --- a/MP.MONO.UI/Pages/Info.razor +++ b/MP.MONO.UI/Pages/Info.razor @@ -55,78 +55,4 @@
      -@code { - private Dictionary biosInfo = new Dictionary(); - private Dictionary cpuInfo = new Dictionary(); - private Dictionary netInfo = new Dictionary(); - private Dictionary osInfo = new Dictionary(); - private Dictionary ramInfo = new Dictionary(); - - private bool showBios = false; - private bool showCpu = false; - private bool showNet = false; - private bool showOs = false; - private bool showRam = false; - private bool showKeyMan = false; - - private bool licOk = false; - - private string licVal { get; set; } = ""; - private string fileName { get; set; } = "InfoData.json"; - - protected override async Task OnInitializedAsync() - { - biosInfo = await MachineInfo.GetInfo("BIOS"); - cpuInfo = await MachineInfo.GetInfo("CPU"); - netInfo = await MachineInfo.GetInfo("NET"); - osInfo = await MachineInfo.GetInfo("OS"); - ramInfo = await MachineInfo.GetInfo("RAM"); - // check licenze - licOk = await MachineDataValidator.testCurrInfo(); - } - - private void ShowAll() - { - showBios = true; - showCpu = true; - showNet = true; - showOs = true; - showRam = true; - } - - private void ToggleKeyMan() - { - showKeyMan = !showKeyMan; - // salvo su disco... - saveInfoData(); - } - - private void saveInfoData() - { - var fullData = biosInfo.Concat(cpuInfo).Concat(netInfo).Concat(osInfo).Concat(ramInfo).GroupBy(ele => ele.Key).OrderBy(x => x.Key).ToDictionary(ele => ele.Key, ele => ele.First().Value); - string filePath = Path.Combine(baseDir, "temp", "InfoData.json"); - File.WriteAllText(filePath, JsonConvert.SerializeObject(fullData, Formatting.Indented)); - } - private string baseDir = $"{Directory.GetCurrentDirectory()}"; - - private async Task SaveLic() - { - //se ho un valore x la licenza... - if (!string.IsNullOrEmpty(licVal)) - { - string filePath = Path.Combine(baseDir, "Conf", "lic.file"); - File.WriteAllText(filePath, licVal); - } - - // check licenze - licOk = await MachineDataValidator.testCurrInfo(); - // se ok --> rivado ad home! - if (licOk) - { - await Task.Delay(1); - // rimando alla home - NavManager.NavigateTo("/", true); - } - } -} diff --git a/MP.MONO.UI/Pages/Info.razor.cs b/MP.MONO.UI/Pages/Info.razor.cs new file mode 100644 index 0000000..7466205 --- /dev/null +++ b/MP.MONO.UI/Pages/Info.razor.cs @@ -0,0 +1,98 @@ +using MP.MONO.Core; +using Newtonsoft.Json; + +namespace MP.MONO.UI.Pages +{ + public partial class Info + { + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + // validatore + var mDV = new MachineDataValidator(); + // dati macchina + biosInfo = MachineDataValidator.biosInfo; + cpuInfo = MachineDataValidator.cpuInfo; + netInfo = MachineDataValidator.netInfo; + osInfo = MachineDataValidator.osInfo; + ramInfo = MachineDataValidator.ramInfo; + // check licenze + licOk = await MachineDataValidator.testCurrInfo(); + } + + #endregion Protected Methods + + #region Private Fields + + private string baseDir = $"{Directory.GetCurrentDirectory()}"; + private Dictionary biosInfo = new Dictionary(); + private Dictionary cpuInfo = new Dictionary(); + private bool licOk = false; + private Dictionary netInfo = new Dictionary(); + private Dictionary osInfo = new Dictionary(); + private Dictionary ramInfo = new Dictionary(); + private bool showBios = false; + private bool showCpu = false; + private bool showKeyMan = false; + private bool showNet = false; + private bool showOs = false; + private bool showRam = false; + + #endregion Private Fields + + #region Private Properties + + private string fileName { get; set; } = "InfoData.json"; + private string licVal { get; set; } = ""; + + #endregion Private Properties + + #region Private Methods + + private void saveInfoData() + { + var fullData = biosInfo.Concat(cpuInfo).Concat(netInfo).Concat(osInfo).Concat(ramInfo).GroupBy(ele => ele.Key).OrderBy(x => x.Key).ToDictionary(ele => ele.Key, ele => ele.First().Value); + string filePath = Path.Combine(baseDir, "temp", "InfoData.json"); + File.WriteAllText(filePath, JsonConvert.SerializeObject(fullData, Formatting.Indented)); + } + + private async Task SaveLic() + { + //se ho un valore x la licenza... + if (!string.IsNullOrEmpty(licVal)) + { + string filePath = Path.Combine(baseDir, "Conf", "lic.file"); + File.WriteAllText(filePath, licVal); + } + + // check licenze + licOk = await MachineDataValidator.testCurrInfo(); + // se ok --> rivado ad home! + if (licOk) + { + await Task.Delay(1); + // rimando alla home + NavManager.NavigateTo("/", true); + } + } + + private void ShowAll() + { + showBios = true; + showCpu = true; + showNet = true; + showOs = true; + showRam = true; + } + + private void ToggleKeyMan() + { + showKeyMan = !showKeyMan; + // salvo su disco... + saveInfoData(); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.MONO.UI/Pages/Parameters.razor.cs b/MP.MONO.UI/Pages/Parameters.razor.cs index c0e5ae2..709b692 100644 --- a/MP.MONO.UI/Pages/Parameters.razor.cs +++ b/MP.MONO.UI/Pages/Parameters.razor.cs @@ -78,7 +78,15 @@ namespace MP.MONO.UI.Pages protected string lastParam { - get => selParams == null || selParams.Count == 0 ? "" : selParams.LastOrDefault(); + get + { + string answ = ""; + if (selParams.Count > 0) + { + answ = $"{selParams.LastOrDefault()}"; + } + return answ; + } } protected void paramRemoved(string paramName) diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 7109e9f..c13df71 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

      Version: 1.2.2206.2217

      +

      Version: 1.2.2209.2116


      Release Note:
      • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 8dd2eb6..d41b03e 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2206.2217 +1.2.2209.2116 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 4d66109..b71336b 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2206.2217 + 1.2.2209.2116 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/appsettings.json b/MP.MONO.UI/appsettings.json index 75e9e38..61255b9 100644 --- a/MP.MONO.UI/appsettings.json +++ b/MP.MONO.UI/appsettings.json @@ -7,7 +7,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=nkc.password", + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", @@ -32,7 +32,8 @@ } }, "OptPar": { - "MaintPendingRefreshVetoMin": 5, + "MaintLimitPerc": 50, + "MaintPendingRefreshVetoMin": 50, "AuthCode": "MultiaxD5" } } diff --git a/MP.MONO.UI/appsettings.multiax.json b/MP.MONO.UI/appsettings.multiax.json new file mode 100644 index 0000000..304485b --- /dev/null +++ b/MP.MONO.UI/appsettings.multiax.json @@ -0,0 +1,39 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "Redis": "localhost:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=user_MONO!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "localhost", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "OptPar": { + "MaintPendingRefreshVetoMin": 5, + "MaintLimitPerc": 90, + "AuthCode": "MultiaxD5" + } +} \ No newline at end of file diff --git a/MP.MONO.UI/appsettings.ufficio.json b/MP.MONO.UI/appsettings.ufficio.json new file mode 100644 index 0000000..0623025 --- /dev/null +++ b/MP.MONO.UI/appsettings.ufficio.json @@ -0,0 +1,38 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", + "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" + }, + "DbConfig": { + "Server": "10.74.82.230", + "nKey": "MONO", + "sKey": "Calcium0xide-CaO" + }, + "maxRecord": 15, + "ExternalProviders": { + "MailKit": { + "SMTP": { + "Address": "smtp.gmail.com", + "Port": "465", + "Account": "steamwarebot@gmail.com", + "Password": "drmfsls16", + "SenderEmail": "steamwarebot@gmail.com", + "SenderName": "Steamware Email BOT" + } + } + }, + "OptPar": { + "MaintPendingRefreshVetoMin": 5, + "AuthCode": "MultiaxD5" + } +} diff --git a/MP.MONO.UI/obfuscar.xml b/MP.MONO.UI/obfuscar.xml index 5a57da7..af04bf8 100644 --- a/MP.MONO.UI/obfuscar.xml +++ b/MP.MONO.UI/obfuscar.xml @@ -1,7 +1,7 @@ - - + + diff --git a/MP.MONO.UI/temp/InfoData.json b/MP.MONO.UI/temp/InfoData.json index 2e76b9d..9089c26 100644 --- a/MP.MONO.UI/temp/InfoData.json +++ b/MP.MONO.UI/temp/InfoData.json @@ -3,54 +3,54 @@ "AddressWidth": "64", "Architecture": "9", "BiosVersion": "_ASUS_ - 1072009", - "BuildNumber": "19044", + "BuildNumber": "19043", "Caption": "Microsoft Windows 10 Pro", "ConfiguredClockSpeed": "2400", "ConfiguredVoltage": "1200", - "CpuVersion": "", - "CurrentClockSpeed": "2208", - "CurrentVoltage": "8", + "CpuVersion": "Modello 1, Stepping 0", + "CurrentClockSpeed": "2200", + "CurrentVoltage": "12", "DataWidth": "64", - "Description": "Intel64 Family 6 Model 158 Stepping 10", + "Description": "AMD64 Family 23 Model 17 Stepping 0", "DeviceLocator": "ChannelA-DIMM0", "ExtClock": "100", - "Family": "198", + "Family": "107", "FormFactor": "12", - "GUID": "{FF6A79F6-DE60-4968-B567-738287074E64}", - "L2CacheSize": "1536", - "L3CacheSize": "9216", - "Level": "6", + "GUID": "{7F313732-DBA3-46E5-9FA7-BEF235B0682E}", + "L2CacheSize": "2048", + "L3CacheSize": "4096", + "Level": "23", "LoadPercentage": "13", - "MACAddress": "04:EA:56:B5:33:EE", + "MACAddress": "4C:ED:FB:D9:78:83", "Manufacturer": "American Megatrends Inc.", "MaxNumberOfProcesses": "4294967295", "MaxProcessMemorySize": "137438953344", "MaxVoltage": "1200", "MinVoltage": "1200", - "Name": "Intel(R) Wireless-AC 9560 160MHz", - "NumberOfCores": "6", - "NumberOfLogicalProcessors": "12", + "Name": "Realtek PCIe GbE Family Controller", + "NumberOfCores": "4", + "NumberOfLogicalProcessors": "8", "OSArchitecture": "64 bit", - "PartNumber": "CT16G4SFD8266.C16FE ", + "PartNumber": "8ATF1G64HZ-2G3E1 ", "PhysicalAdapter": "True", - "ProcessorId": "BFEBFBFF000906EA", + "ProcessorId": "178BFBFF00810F10", "ProcessorType": "3", - "ProductName": "Intel(R) Wireless-AC 9560 160MHz", - "ReleaseDate": "20210127000000.000000+000", - "Revision": "", + "ProductName": "Realtek PCIe GbE Family Controller", + "ReleaseDate": "20190521000000.000000+000", + "Revision": "4352", "Role": "CPU", - "SerialNumber": "00330-80100-10002-AA618", - "ServiceName": "Netwtw08", - "SMBIOSBIOSVersion": "X580GD.324", + "SerialNumber": "00330-80951-85780-AA242", + "ServiceName": "rt640x64", + "SMBIOSBIOSVersion": "X505ZA.311", "SMBIOSMajorVersion": "3", "SMBIOSMemoryType": "26", - "SMBIOSMinorVersion": "2", - "SocketDesignation": "U3E1", - "SoftwareElementID": "X580GD.324", + "SMBIOSMinorVersion": "1", + "SocketDesignation": "FP5", + "SoftwareElementID": "X505ZA.311", "SoftwareElementState": "3", - "Speed": "2667", + "Speed": "2400", "SystemBiosMajorVersion": "5", "SystemBiosMinorVersion": "13", - "SystemName": "W10-DEV-NB01", - "Version": "10.0.19044" + "SystemName": "EGALW-NB-004", + "Version": "10.0.19043" } \ No newline at end of file