diff --git a/BlenderCtrl__Main_simplified.json b/BlenderCtrl__Main_simplified.json index a4d5006..eaa9973 100644 --- a/BlenderCtrl__Main_simplified.json +++ b/BlenderCtrl__Main_simplified.json @@ -115,17 +115,17 @@ }, "negated_pins": {}, "inputs": { - "SRCBLK": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"HMI_PID\".\"PPM303\"" - }, "en": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "SRCBLK": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"PPM303\"" } }, "outputs": { @@ -180,17 +180,17 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19000\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "24", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19000\"" } }, "outputs": {} @@ -250,6 +250,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -362,6 +365,12 @@ "operand": true }, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "O", + "source_instruction_uid": "33", + "source_pin": "out" + }, "operand": { "uid": "26", "scope": "GlobalVariable", @@ -455,15 +464,15 @@ }, "negated_pins": {}, "inputs": { + "en": { + "type": "powerrail" + }, "in": { "uid": "21", "scope": "LiteralConstant", "type": "constant", "datatype": "Int", "value": 0 - }, - "en": { - "type": "powerrail" } }, "outputs": { @@ -639,6 +648,12 @@ }, "negated_pins": {}, "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + }, "in": { "uid": "23", "scope": "LiteralConstant", @@ -715,6 +730,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "23", "scope": "GlobalVariable", @@ -731,6 +752,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -747,6 +774,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "25", "scope": "GlobalVariable", @@ -839,6 +872,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -1207,6 +1243,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "31", + "source_pin": "out" + }, "operand": { "uid": "26", "scope": "GlobalVariable", @@ -1801,17 +1843,17 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19001\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19001\"" } }, "outputs": {} @@ -1895,6 +1937,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -2001,17 +2046,17 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19002\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19002\"" } }, "outputs": {} @@ -2095,17 +2140,17 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19003\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19003\"" } }, "outputs": {} @@ -2736,6 +2781,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -2901,6 +2949,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3088,6 +3139,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3253,6 +3307,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3592,17 +3649,17 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19011\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "26", "source_pin": "out" + }, + "bit": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19011\"" } }, "outputs": {} @@ -3630,6 +3687,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -3738,6 +3801,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "33", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -3754,6 +3823,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "25", "scope": "GlobalVariable", @@ -3858,6 +3930,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "31", "scope": "GlobalVariable", diff --git a/BlenderCtrl__Main_simplified_processed.json b/BlenderCtrl__Main_simplified_processed.json index c555ee5..eb63373 100644 --- a/BlenderCtrl__Main_simplified_processed.json +++ b/BlenderCtrl__Main_simplified_processed.json @@ -112,23 +112,23 @@ { "instruction_uid": "26", "uid": "26", - "type": "BLKMOV", + "type": "BLKMOV_scl", "template_values": { "blk_type": "Type" }, "negated_pins": {}, "inputs": { - "SRCBLK": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"HMI_PID\".\"PPM303\"" - }, "en": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "SRCBLK": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"PPM303\"" } }, "outputs": { @@ -148,7 +148,8 @@ "name": "\"Block_Move_Err\"" } ] - } + }, + "scl": "IF \"AUX FALSE\" THEN\n \"Block_Move_Err\" := BLKMOV(SRCBLK := \"HMI_PID\".\"PPM303\", DSTBLK => \"Filler_Head_Variables\".\"FillerHead\"); // ADVERTENCIA: BLKMOV usado directamente, probablemente no compile!\nEND_IF;" } ] }, @@ -180,29 +181,31 @@ { "instruction_uid": "25", "uid": "25", - "type": "NBox", + "type": "NBox_scl", "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19000\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "24", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19000\"" } }, - "outputs": {} + "outputs": {}, + "_edge_mem_update_scl": "\"M19000\" := \"gIN_VoltageOk\"; // N_TRIG(\"gIN_VoltageOk\")", + "scl": "// Logic moved to Coil 26" }, { "instruction_uid": "26", "uid": "26", - "type": "Coil", + "type": "Coil_scl", "template_values": {}, "negated_pins": {}, "inputs": { @@ -219,7 +222,8 @@ "name": "\"gEmergencyPressed\"" } }, - "outputs": {} + "outputs": {}, + "scl": "\"gEmergencyPressed\" := NOT \"gIN_VoltageOk\" AND \"M19000\";\n\"M19000\" := \"gIN_VoltageOk\"; // N_TRIG(\"gIN_VoltageOk\")" } ] }, @@ -255,6 +259,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -372,6 +379,12 @@ "operand": true }, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "O", + "source_instruction_uid": "33", + "source_pin": "out" + }, "operand": { "uid": "26", "scope": "GlobalVariable", @@ -380,7 +393,7 @@ } }, "outputs": {}, - "scl": "// RLO: (NOT \"Disable_Bit\")" + "scl": "// RLO: (\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND (NOT \"Disable_Bit\")" }, { "instruction_uid": "36", @@ -405,7 +418,7 @@ } }, "outputs": {}, - "scl": "// Logic O 36: ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (NOT \"Disable_Bit\")" + "scl": "// Logic O 36: ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND (NOT \"Disable_Bit\")" }, { "instruction_uid": "37", @@ -428,7 +441,7 @@ } }, "outputs": {}, - "scl": "// RLO: ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (NOT \"Disable_Bit\") AND \"gIN_VoltageOk\"" + "scl": "// RLO: ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND (NOT \"Disable_Bit\") AND \"gIN_VoltageOk\"" }, { "instruction_uid": "38", @@ -451,7 +464,7 @@ } }, "outputs": {}, - "scl": "\"gBlenderSuppliesOk\" := ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (NOT \"Disable_Bit\") AND \"gIN_VoltageOk\";" + "scl": "\"gBlenderSuppliesOk\" := ((\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND \"HMI_Digital\".\"_PAL_S11\".\"Filtered\") OR (\"gIN_LinePressCO2Ok\" OR (\"gWorkshopTest\" AND (NOT \"gWorkshop_Co2_Presence\")) AND (NOT \"gWorkshop_CIP_Signals\")) AND (NOT \"Disable_Bit\") AND \"gIN_VoltageOk\";" } ] }, @@ -469,15 +482,15 @@ }, "negated_pins": {}, "inputs": { + "en": { + "type": "powerrail" + }, "in": { "uid": "21", "scope": "LiteralConstant", "type": "constant", "datatype": "Int", "value": 0 - }, - "en": { - "type": "powerrail" } }, "outputs": { @@ -659,6 +672,12 @@ }, "negated_pins": {}, "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + }, "in": { "uid": "23", "scope": "LiteralConstant", @@ -677,7 +696,7 @@ } ] }, - "scl": "\"HMI_Variables_Status\".\"Procedures\".\"BlenderStateNum\" := 19;" + "scl": "IF (NOT \"HMI_Variables_Status\".\"System\".\"Blender_Prod_CIP\") THEN\n \"HMI_Variables_Status\".\"Procedures\".\"BlenderStateNum\" := 19;\nEND_IF;" } ] }, @@ -737,6 +756,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "23", "scope": "GlobalVariable", @@ -753,6 +778,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -769,6 +800,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "25", "scope": "GlobalVariable", @@ -864,6 +901,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -1248,6 +1288,12 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "31", + "source_pin": "out" + }, "operand": { "uid": "26", "scope": "GlobalVariable", @@ -1256,7 +1302,7 @@ } }, "outputs": {}, - "scl": "// RLO: \"gBlenderCIPMode\"" + "scl": "// RLO: (\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND \"gBlenderCIPMode\"" }, { "instruction_uid": "36", @@ -1279,7 +1325,7 @@ } }, "outputs": {}, - "scl": "// RLO: \"gBlenderCIPMode\" AND \"gIN_CIP_CIPRunning\"" + "scl": "// RLO: ((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND \"gBlenderCIPMode\") AND \"gIN_CIP_CIPRunning\"" }, { "instruction_uid": "37", @@ -1302,7 +1348,7 @@ } }, "outputs": {}, - "scl": "// RLO: (\"gBlenderCIPMode\" AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\"" + "scl": "// RLO: (((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND \"gBlenderCIPMode\") AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\"" }, { "instruction_uid": "38", @@ -1327,7 +1373,7 @@ } }, "outputs": {}, - "scl": "// Logic O 38: ((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND (NOT \"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_FastChangeOverEnabled\") AND \"Procedure_Variables\".\"FTP302Line_Preparation\".\"Done\") AND (NOT \"Procedure_Variables\".\"Syr_RunOut\".\"Done\") OR ((\"gBlenderCIPMode\" AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\")" + "scl": "// Logic O 38: ((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND (NOT \"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_FastChangeOverEnabled\") AND \"Procedure_Variables\".\"FTP302Line_Preparation\".\"Done\") AND (NOT \"Procedure_Variables\".\"Syr_RunOut\".\"Done\") OR ((((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND \"gBlenderCIPMode\") AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\")" }, { "instruction_uid": "39", @@ -1350,7 +1396,7 @@ } }, "outputs": {}, - "scl": "\"gHVP301_Open\" := ((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND (NOT \"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_FastChangeOverEnabled\") AND \"Procedure_Variables\".\"FTP302Line_Preparation\".\"Done\") AND (NOT \"Procedure_Variables\".\"Syr_RunOut\".\"Done\") OR ((\"gBlenderCIPMode\" AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\");" + "scl": "\"gHVP301_Open\" := ((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND (NOT \"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_FastChangeOverEnabled\") AND \"Procedure_Variables\".\"FTP302Line_Preparation\".\"Done\") AND (NOT \"Procedure_Variables\".\"Syr_RunOut\".\"Done\") OR ((((\"gSyrupRoomEn\" AND (NOT \"gIN_HVP301_Aux\")) AND \"gBlenderCIPMode\") AND \"gIN_CIP_CIPRunning\") AND \"Procedure_Variables\".\"Blender_Run\".\"Running\");" } ] }, @@ -1866,21 +1912,22 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19001\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19001\"" } }, "outputs": {}, - "scl": "// // PBox 26 - Passing memory bit: \"M19001\"" + "_edge_mem_update_scl": "\"M19001\" := \"gBlenderProdMode\"; // P_TRIG(\"gBlenderProdMode\")", + "scl": "// PBox Logic moved to consumer Coil" }, { "instruction_uid": "27", @@ -1905,7 +1952,7 @@ } }, "outputs": {}, - "scl": "// RLO: \"M19001\" AND (NOT \"mDelayPowerOnTmr\")" + "scl": "// RLO: (\"gBlenderProdMode\" AND NOT \"M19001\") AND (NOT \"mDelayPowerOnTmr\")" }, { "instruction_uid": "28", @@ -1928,7 +1975,7 @@ } }, "outputs": {}, - "scl": "\"gProductionONS\" := \"M19001\" AND (NOT \"mDelayPowerOnTmr\");" + "scl": "\"gProductionONS\" := (\"gBlenderProdMode\" AND NOT \"M19001\") AND (NOT \"mDelayPowerOnTmr\");" } ] }, @@ -1964,6 +2011,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -2075,21 +2125,22 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19002\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19002\"" } }, "outputs": {}, - "scl": "// // PBox 26 - Passing memory bit: \"M19002\"" + "_edge_mem_update_scl": "\"M19002\" := \"HMI_Variables_Status\".\"System\".\"Blender_Prod_CIP\"; // P_TRIG(\"HMI_Variables_Status\".\"System\".\"Blender_Prod_CIP\")", + "scl": "// PBox Logic moved to consumer Coil" }, { "instruction_uid": "27", @@ -2114,7 +2165,7 @@ } }, "outputs": {}, - "scl": "// RLO: \"M19002\" AND (NOT \"mDelayPowerOnTmr\")" + "scl": "// RLO: (\"HMI_Variables_Status\".\"System\".\"Blender_Prod_CIP\" AND NOT \"M19002\") AND (NOT \"mDelayPowerOnTmr\")" }, { "instruction_uid": "28", @@ -2137,7 +2188,7 @@ } }, "outputs": {}, - "scl": "\"gRinseONS\" := \"M19002\" AND (NOT \"mDelayPowerOnTmr\");" + "scl": "\"gRinseONS\" := (\"HMI_Variables_Status\".\"System\".\"Blender_Prod_CIP\" AND NOT \"M19002\") AND (NOT \"mDelayPowerOnTmr\");" } ] }, @@ -2173,21 +2224,22 @@ "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19003\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "25", "source_pin": "out" + }, + "bit": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19003\"" } }, "outputs": {}, - "scl": "// // PBox 26 - Passing memory bit: \"M19003\"" + "_edge_mem_update_scl": "\"M19003\" := \"gBlenderCIPMode\"; // P_TRIG(\"gBlenderCIPMode\")", + "scl": "// PBox Logic moved to consumer Coil" }, { "instruction_uid": "27", @@ -2212,7 +2264,7 @@ } }, "outputs": {}, - "scl": "// RLO: \"M19003\" AND (NOT \"mDelayPowerOnTmr\")" + "scl": "// RLO: (\"gBlenderCIPMode\" AND NOT \"M19003\") AND (NOT \"mDelayPowerOnTmr\")" }, { "instruction_uid": "28", @@ -2235,7 +2287,7 @@ } }, "outputs": {}, - "scl": "\"gCIPONS\" := \"M19003\" AND (NOT \"mDelayPowerOnTmr\");" + "scl": "\"gCIPONS\" := (\"gBlenderCIPMode\" AND NOT \"M19003\") AND (NOT \"mDelayPowerOnTmr\");" } ] }, @@ -2843,6 +2895,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3012,6 +3067,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3203,6 +3261,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3372,6 +3433,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "22", "scope": "GlobalVariable", @@ -3718,29 +3782,31 @@ { "instruction_uid": "27", "uid": "27", - "type": "NBox", + "type": "NBox_scl", "template_values": {}, "negated_pins": {}, "inputs": { - "bit": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19011\"" - }, "in": { "type": "connection", "source_instruction_type": "Contact", "source_instruction_uid": "26", "source_pin": "out" + }, + "bit": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"M19011\"" } }, - "outputs": {} + "outputs": {}, + "_edge_mem_update_scl": "\"M19011\" := (\"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Command\" AND \"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Enable\"); // N_TRIG((\"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Command\" AND \"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Enable\"))", + "scl": "// NBox Logic moved to consumer Coil" }, { "instruction_uid": "28", "uid": "28", - "type": "Call", + "type": "Call_FC_scl", "block_name": "BlenderCtrl_All Auto", "block_type": "FC", "inputs": { @@ -3751,15 +3817,22 @@ "source_pin": "out" } }, - "outputs": {} + "outputs": {}, + "scl": "IF NOT (\"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Command\" AND \"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Enable\") AND \"M19011\" THEN\n BlenderCtrl_All_Auto();\nEND_IF;" }, { "instruction_uid": "29", "uid": "29", - "type": "Coil", + "type": "Coil_scl", "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -3767,7 +3840,8 @@ "name": "\"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Light\"" } }, - "outputs": {} + "outputs": {}, + "scl": "\"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Light\" := \"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Command\" AND \"HMI_Variables_Cmd\".\"Commands_From_HMI\".\"F7_DeviceControl\".\"Enable\";" } ] }, @@ -3868,10 +3942,16 @@ { "instruction_uid": "36", "uid": "36", - "type": "Coil", + "type": "Coil_scl", "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "33", + "source_pin": "out" + }, "operand": { "uid": "24", "scope": "GlobalVariable", @@ -3879,7 +3959,8 @@ "name": "\"mFP_Recip_Main_Page\"" } }, - "outputs": {} + "outputs": {}, + "scl": "\"mFP_Recip_Main_Page\" := \"HMI_Variables_Cmd\".\"Recipe\".\"Main_Page\";" }, { "instruction_uid": "37", @@ -3888,6 +3969,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "25", "scope": "GlobalVariable", @@ -3994,6 +4078,9 @@ "template_values": {}, "negated_pins": {}, "inputs": { + "in": { + "type": "powerrail" + }, "operand": { "uid": "31", "scope": "GlobalVariable", diff --git a/BlenderCtrl__Main_simplified_processed.scl b/BlenderCtrl__Main_simplified_processed.scl index 854cf71..d96e2fe 100644 --- a/BlenderCtrl__Main_simplified_processed.scl +++ b/BlenderCtrl__Main_simplified_processed.scl @@ -38,10 +38,16 @@ BEGIN // Network 3: Filler Head // RLO: "AUX FALSE" + IF "AUX FALSE" THEN + "Block_Move_Err" := BLKMOV(SRCBLK := "HMI_PID"."PPM303", DSTBLK => "Filler_Head_Variables"."FillerHead"); // ADVERTENCIA: BLKMOV usado directamente, probablemente no compile! + END_IF; // Network 4: Emergency Pressed // RLO: "gIN_VoltageOk" + // Logic moved to Coil 26 + "gEmergencyPressed" := NOT "gIN_VoltageOk" AND "M19000"; + "M19000" := "gIN_VoltageOk"; // N_TRIG("gIN_VoltageOk") // Network 5: Air and CO2 pressure ok and auxiliary ok @@ -50,9 +56,9 @@ BEGIN // RLO: "gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence") // RLO: ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals") // RLO: ("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered" - // RLO: (NOT "Disable_Bit") - // RLO: (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR (NOT "Disable_Bit") AND "gIN_VoltageOk" - "gBlenderSuppliesOk" := (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR (NOT "Disable_Bit") AND "gIN_VoltageOk"; + // RLO: ("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND (NOT "Disable_Bit") + // RLO: (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR ("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND (NOT "Disable_Bit") AND "gIN_VoltageOk" + "gBlenderSuppliesOk" := (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR ("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND (NOT "Disable_Bit") AND "gIN_VoltageOk"; // Network 6: Blender State Num @@ -71,7 +77,9 @@ BEGIN // RLO: (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP") "gBlenderCIPMode" := (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP"); - "HMI_Variables_Status"."Procedures"."BlenderStateNum" := 19; + IF (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP") THEN + "HMI_Variables_Status"."Procedures"."BlenderStateNum" := 19; + END_IF; // Network 10: Error Faults @@ -106,10 +114,10 @@ BEGIN // RLO: ("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") // RLO: ("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done" // RLO: (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done") AND (NOT "Procedure_Variables"."Syr_RunOut"."Done") - // RLO: "gBlenderCIPMode" - // RLO: "gBlenderCIPMode" AND "gIN_CIP_CIPRunning" - // RLO: ("gBlenderCIPMode" AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running" - "gHVP301_Open" := (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done") AND (NOT "Procedure_Variables"."Syr_RunOut"."Done") OR (("gBlenderCIPMode" AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running"); + // RLO: ("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND "gBlenderCIPMode" + // RLO: (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND "gBlenderCIPMode") AND "gIN_CIP_CIPRunning" + // RLO: ((("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND "gBlenderCIPMode") AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running" + "gHVP301_Open" := (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done") AND (NOT "Procedure_Variables"."Syr_RunOut"."Done") OR (((("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND "gBlenderCIPMode") AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running"); // Network 15: Manual Syrup Drain Valve Open - Operator Alarm @@ -172,9 +180,9 @@ BEGIN // Network 25: Production ONS // RLO: "gBlenderProdMode" - // // PBox 26 - Passing memory bit: "M19001" - // RLO: "M19001" AND (NOT "mDelayPowerOnTmr") - "gProductionONS" := "M19001" AND (NOT "mDelayPowerOnTmr"); + // PBox Logic moved to consumer Coil + // RLO: ("gBlenderProdMode" AND NOT "M19001") AND (NOT "mDelayPowerOnTmr") + "gProductionONS" := ("gBlenderProdMode" AND NOT "M19001") AND (NOT "mDelayPowerOnTmr"); // Network 26: Blender Prod Mode Init @@ -188,16 +196,16 @@ BEGIN // Network 27: Rinse ONS // RLO: "HMI_Variables_Status"."System"."Blender_Prod_CIP" - // // PBox 26 - Passing memory bit: "M19002" - // RLO: "M19002" AND (NOT "mDelayPowerOnTmr") - "gRinseONS" := "M19002" AND (NOT "mDelayPowerOnTmr"); + // PBox Logic moved to consumer Coil + // RLO: ("HMI_Variables_Status"."System"."Blender_Prod_CIP" AND NOT "M19002") AND (NOT "mDelayPowerOnTmr") + "gRinseONS" := ("HMI_Variables_Status"."System"."Blender_Prod_CIP" AND NOT "M19002") AND (NOT "mDelayPowerOnTmr"); // Network 28: CIP ONS // RLO: "gBlenderCIPMode" - // // PBox 26 - Passing memory bit: "M19003" - // RLO: "M19003" AND (NOT "mDelayPowerOnTmr") - "gCIPONS" := "M19003" AND (NOT "mDelayPowerOnTmr"); + // PBox Logic moved to consumer Coil + // RLO: ("gBlenderCIPMode" AND NOT "M19003") AND (NOT "mDelayPowerOnTmr") + "gCIPONS" := ("gBlenderCIPMode" AND NOT "M19003") AND (NOT "mDelayPowerOnTmr"); // Network 29: CIp Mode Init @@ -359,6 +367,11 @@ BEGIN // RLO: "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command" // RLO: "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command" AND "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Enable" + // NBox Logic moved to consumer Coil + IF NOT ("HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command" AND "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Enable") AND "M19011" THEN + BlenderCtrl_All_Auto(); + END_IF; + "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Light" := "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command" AND "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Enable"; // Network 65: Ctrl HMI Manual Active @@ -369,6 +382,7 @@ BEGIN // RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" // RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" AND (NOT "mFP_Recip_Main_Page") "mAux_FP_M700_1" := "HMI_Variables_Cmd"."Recipe"."Main_Page" AND (NOT "mFP_Recip_Main_Page"); + "mFP_Recip_Main_Page" := "HMI_Variables_Cmd"."Recipe"."Main_Page"; // RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" // RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" AND "HMI_Variables_Cmd"."Recipe"."Edit" // RLO: "mAux_FP_M700_1" diff --git a/BlenderRun_ProdTime_simplified.json b/BlenderRun_ProdTime_simplified.json deleted file mode 100644 index 4863c15..0000000 --- a/BlenderRun_ProdTime_simplified.json +++ /dev/null @@ -1,1368 +0,0 @@ -{ - "block_name": "BlenderRun_ProdTime", - "block_number": 2040, - "language": "LAD", - "block_comment": "", - "interface": { - "Temp": [ - { - "name": "m1MinONS", - "datatype": "Bool" - }, - { - "name": "m1HourONS", - "datatype": "Bool" - }, - { - "name": "Buffer", - "datatype": "Bool" - }, - { - "name": "mRunMin", - "datatype": "Bool" - }, - { - "name": "mRunHr", - "datatype": "Bool" - }, - { - "name": "I_DIRunning_sec", - "datatype": "DInt" - }, - { - "name": "I_DIRunning_min", - "datatype": "DInt" - }, - { - "name": "MOD60", - "datatype": "DInt" - } - ], - "Return": [ - { - "name": "Ret_Val", - "datatype": "Void" - } - ] - }, - "networks": [ - { - "id": "9", - "title": "Seconds", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - ] - } - } - ] - }, - { - "id": "1A", - "title": "Reset Hours", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"SLIM_Variables\".\"ResetHour\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "24", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - ] - } - } - ] - }, - { - "id": "2B", - "title": "Seconds Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderBlending\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - } - } - ] - }, - { - "id": "3C", - "title": "Minute", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Eq", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Coil", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "24", - "source_pin": "out" - } - }, - "outputs": {} - } - ] - }, - { - "id": "4D", - "title": "Minute Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - } - }, - { - "instruction_uid": "29", - "uid": "29", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - } - } - ] - }, - { - "id": "5E", - "title": "Hour", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Eq", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Coil", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "24", - "source_pin": "out" - } - }, - "outputs": {} - } - ] - }, - { - "id": "6F", - "title": "Hour Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "30", - "uid": "30", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "31", - "uid": "31", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - } - }, - { - "instruction_uid": "32", - "uid": "32", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - ] - } - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "28", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "uid": "27", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gBlendingMaintHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gBlendingMaintHour\"" - } - ] - } - } - ] - }, - { - "id": "80", - "title": "Counter reset", - "comment": "", - "logic": [ - { - "instruction_uid": "29", - "uid": "29", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderCIPMode\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "30", - "uid": "30", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderRinseMode\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "31", - "uid": "31", - "type": "O", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "29", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "32", - "uid": "32", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "23", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - } - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - } - }, - { - "instruction_uid": "34", - "uid": "34", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "27", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "28", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - ] - } - } - ] - }, - { - "id": "91", - "title": "Running Seconds", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - ] - } - } - ] - }, - { - "id": "A2", - "title": "Running Minutes", - "comment": "", - "logic": [ - { - "instruction_uid": "35", - "uid": "35", - "type": "Convert", - "template_values": { - "SrcType": "Type", - "DestType": "Type" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "powerrail" - }, - "in": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - }, - "outputs": { - "out": [ - { - "uid": "22", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_sec\"" - } - ] - } - }, - { - "instruction_uid": "36", - "uid": "36", - "type": "Mod", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - }, - "en": { - "type": "connection", - "source_instruction_type": "Convert", - "source_instruction_uid": "35", - "source_pin": "eno" - }, - "in1": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_sec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - } - ] - }, - "eno_logic": [ - { - "target_pin": "pre", - "target_type": "instruction", - "target_uid": "37", - "target_name": "Eq" - } - ] - }, - { - "instruction_uid": "37", - "uid": "37", - "type": "Eq", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "27", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "in1": { - "uid": "26", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "pre": { - "type": "connection", - "source_instruction_type": "Mod", - "source_instruction_uid": "36", - "source_pin": "eno" - } - }, - "outputs": {} - }, - { - "instruction_uid": "38", - "uid": "38", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "28", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "37", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "39", - "uid": "39", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "38", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "40", - "uid": "40", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "31", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "39", - "source_pin": "out" - }, - "in1": { - "uid": "30", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - }, - "outputs": { - "out": [ - { - "uid": "32", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - ] - } - }, - { - "instruction_uid": "41", - "uid": "41", - "type": "PBox", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "bit": { - "uid": "33", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19012\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "37", - "source_pin": "out" - } - }, - "outputs": {} - }, - { - "instruction_uid": "42", - "uid": "42", - "type": "Coil", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "34", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "PBox", - "source_instruction_uid": "41", - "source_pin": "out" - } - }, - "outputs": {} - } - ] - }, - { - "id": "B3", - "title": "Running Hours for Maintenance", - "comment": "", - "logic": [ - { - "instruction_uid": "32", - "uid": "32", - "type": "Contact", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {} - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Convert", - "template_values": { - "SrcType": "Type", - "DestType": "Type" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "32", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - }, - "outputs": { - "out": [ - { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_min\"" - } - ] - } - }, - { - "instruction_uid": "34", - "uid": "34", - "type": "Mod", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - }, - "en": { - "type": "connection", - "source_instruction_type": "Convert", - "source_instruction_uid": "33", - "source_pin": "eno" - }, - "in1": { - "uid": "24", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_min\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - } - ] - }, - "eno_logic": [ - { - "target_pin": "pre", - "target_type": "instruction", - "target_uid": "35", - "target_name": "Eq" - } - ] - }, - { - "instruction_uid": "35", - "uid": "35", - "type": "Eq", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "28", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "in1": { - "uid": "27", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "pre": { - "type": "connection", - "source_instruction_type": "Mod", - "source_instruction_uid": "34", - "source_pin": "eno" - } - }, - "outputs": {} - }, - { - "instruction_uid": "36", - "uid": "36", - "type": "Add", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "30", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "35", - "source_pin": "out" - }, - "in1": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "31", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - ] - } - } - ] - }, - { - "id": "C4", - "title": "Running Hours for Maintenance", - "comment": "", - "logic": [ - { - "instruction_uid": "23", - "uid": "23", - "type": "Move", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "powerrail" - }, - "in": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - }, - "outputs": { - "out1": [ - { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"HMI_Variables_Status\".\"System\".\"BlendingMaintHour\"" - } - ] - } - } - ] - } - ] -} \ No newline at end of file diff --git a/BlenderRun_ProdTime_simplified_processed.json b/BlenderRun_ProdTime_simplified_processed.json deleted file mode 100644 index 93ab33c..0000000 --- a/BlenderRun_ProdTime_simplified_processed.json +++ /dev/null @@ -1,1419 +0,0 @@ -{ - "block_name": "BlenderRun_ProdTime", - "block_number": 2040, - "language": "LAD", - "block_comment": "", - "interface": { - "Temp": [ - { - "name": "m1MinONS", - "datatype": "Bool" - }, - { - "name": "m1HourONS", - "datatype": "Bool" - }, - { - "name": "Buffer", - "datatype": "Bool" - }, - { - "name": "mRunMin", - "datatype": "Bool" - }, - { - "name": "mRunHr", - "datatype": "Bool" - }, - { - "name": "I_DIRunning_sec", - "datatype": "DInt" - }, - { - "name": "I_DIRunning_min", - "datatype": "DInt" - }, - { - "name": "MOD60", - "datatype": "DInt" - } - ], - "Return": [ - { - "name": "Ret_Val", - "datatype": "Void" - } - ] - }, - "networks": [ - { - "id": "9", - "title": "Seconds", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - ] - }, - "scl": "IF \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\" THEN\n \"Blender_Variables_Pers\".\"gSLIM_Sec\" := \"Blender_Variables_Pers\".\"gSLIM_Sec\" + 1;\nEND_IF;" - } - ] - }, - { - "id": "1A", - "title": "Reset Hours", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"SLIM_Variables\".\"ResetHour\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"SLIM_Variables\".\"ResetHour\"" - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "24", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - } - ] - }, - "scl": "IF \"SLIM_Variables\".\"ResetHour\" THEN\n \"Blender_Variables_Pers\".\"gSLIM_Sec\" := 0;\nEND_IF;" - } - ] - }, - { - "id": "2B", - "title": "Seconds Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderBlending\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderBlending\"" - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderBlending\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - }, - "scl": "IF \"gBlenderBlending\" AND \"CLK_1.0S\" THEN\n \"Blender_Variables_Pers\".\"gProdSec\" := \"Blender_Variables_Pers\".\"gProdSec\" + 1;\nEND_IF;" - } - ] - }, - { - "id": "3C", - "title": "Minute", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Eq_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// Comparison Eq 24: \"Blender_Variables_Pers\".\"gProdSec\" = 60" - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Coil_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "24", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "\"m1MinONS\" := \"Blender_Variables_Pers\".\"gProdSec\" = 60;" - } - ] - }, - { - "id": "4D", - "title": "Minute Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "IF \"m1MinONS\" THEN\n \"Blender_Variables_Pers\".\"gProdSec\" := 0;\n \"Blender_Variables_Pers\".\"gProdMin\" := \"Blender_Variables_Pers\".\"gProdMin\" + 1;\nEND_IF;" - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 27)", - "grouped": true - }, - { - "instruction_uid": "29", - "uid": "29", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 27)", - "grouped": true - } - ] - }, - { - "id": "5E", - "title": "Hour", - "comment": "", - "logic": [ - { - "instruction_uid": "24", - "uid": "24", - "type": "Eq_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// Comparison Eq 24: \"Blender_Variables_Pers\".\"gProdMin\" = 60" - }, - { - "instruction_uid": "25", - "uid": "25", - "type": "Coil_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "24", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "\"m1HourONS\" := \"Blender_Variables_Pers\".\"gProdMin\" = 60;" - } - ] - }, - { - "id": "6F", - "title": "Hour Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "30", - "uid": "30", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "IF \"m1HourONS\" THEN\n \"Blender_Variables_Pers\".\"gProdMin\" := 0;\n \"Blender_Variables_Pers\".\"gProdHour\" := \"Blender_Variables_Pers\".\"gProdHour\" + 1;\n \"Blender_Variables_Pers\".\"gBlendingMaintHour\" := \"Blender_Variables_Pers\".\"gBlendingMaintHour\" + 1;\nEND_IF;" - }, - { - "instruction_uid": "31", - "uid": "31", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 30)", - "grouped": true - }, - { - "instruction_uid": "32", - "uid": "32", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 30)", - "grouped": true - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "28", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "uid": "27", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gBlendingMaintHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gBlendingMaintHour\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 30)", - "grouped": true - } - ] - }, - { - "id": "80", - "title": "Counter reset", - "comment": "", - "logic": [ - { - "instruction_uid": "29", - "uid": "29", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderCIPMode\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderCIPMode\"" - }, - { - "instruction_uid": "30", - "uid": "30", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderRinseMode\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderRinseMode\"" - }, - { - "instruction_uid": "31", - "uid": "31", - "type": "O_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "30", - "source_pin": "out" - }, - "in1": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "29", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "IF \"gBlenderCIPMode\" OR \"gBlenderRinseMode\" THEN\n \"Blender_Variables_Pers\".\"gProdSec\" := 0;\n \"Blender_Variables_Pers\".\"gProdMin\" := 0;\n \"Blender_Variables_Pers\".\"gProdHour\" := 0;\nEND_IF;" - }, - { - "instruction_uid": "32", - "uid": "32", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "23", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 31)", - "grouped": true - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "26", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 31)", - "grouped": true - }, - { - "instruction_uid": "34", - "uid": "34", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "O", - "source_instruction_uid": "31", - "source_pin": "out" - }, - "in": { - "uid": "27", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - } - }, - "outputs": { - "out1": [ - { - "uid": "28", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - } - ] - }, - "scl": "// Logic included in grouped IF (by UID 31)", - "grouped": true - } - ] - }, - { - "id": "91", - "title": "Running Seconds", - "comment": "", - "logic": [ - { - "instruction_uid": "26", - "uid": "26", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "27", - "uid": "27", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "26", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "uid": "28", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "27", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - ] - }, - "scl": "IF \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\" THEN\n \"Blender_Variables_Pers\".\"gRunningSeconds\" := \"Blender_Variables_Pers\".\"gRunningSeconds\" + 1;\nEND_IF;" - } - ] - }, - { - "id": "A2", - "title": "Running Minutes", - "comment": "", - "logic": [ - { - "instruction_uid": "35", - "uid": "35", - "type": "Convert_scl", - "template_values": { - "SrcType": "Type", - "DestType": "Type" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "powerrail" - }, - "in": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - } - }, - "outputs": { - "out": [ - { - "uid": "22", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_sec\"" - } - ] - }, - "scl": "\"I_DIRunning_sec\" := \"Blender_Variables_Pers\".\"gRunningSeconds\";" - }, - { - "instruction_uid": "36", - "uid": "36", - "type": "Mod_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "24", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - }, - "en": { - "type": "connection", - "source_instruction_type": "Convert", - "source_instruction_uid": "35", - "source_pin": "eno" - }, - "in1": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_sec\"" - } - }, - "outputs": { - "out": [ - { - "uid": "25", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - } - ] - }, - "eno_logic": [ - { - "target_pin": "pre", - "target_type": "instruction", - "target_uid": "37", - "target_name": "Eq" - } - ], - "scl": "\"MOD60\" := \"I_DIRunning_sec\" MOD DINT#60;" - }, - { - "instruction_uid": "37", - "uid": "37", - "type": "Eq_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "27", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "in1": { - "uid": "26", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "pre": { - "type": "connection", - "source_instruction_type": "Mod", - "source_instruction_uid": "36", - "source_pin": "eno" - } - }, - "outputs": {}, - "scl": "// Comparison Eq 37: \"MOD60\" = DINT#0" - }, - { - "instruction_uid": "38", - "uid": "38", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "28", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "37", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "// RLO: \"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "39", - "uid": "39", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "38", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "// RLO: (\"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\") AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "40", - "uid": "40", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "31", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "39", - "source_pin": "out" - }, - "in1": { - "uid": "30", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - }, - "outputs": { - "out": [ - { - "uid": "32", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - ] - }, - "scl": "IF (\"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\") AND \"CLK_1.0S\" THEN\n \"Blender_Variables_Pers\".\"gRunningMinutes\" := \"Blender_Variables_Pers\".\"gRunningMinutes\" + 1;\nEND_IF;" - }, - { - "instruction_uid": "41", - "uid": "41", - "type": "PBox_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "bit": { - "uid": "33", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19012\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "37", - "source_pin": "out" - } - }, - "outputs": {}, - "_edge_mem_update_scl": "\"M19012\" := (\"MOD60\" = DINT#0);", - "scl": "// Logic moved to Coil 42" - }, - { - "instruction_uid": "42", - "uid": "42", - "type": "Coil_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "34", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - }, - "in": { - "type": "connection", - "source_instruction_type": "PBox", - "source_instruction_uid": "41", - "source_pin": "out" - } - }, - "outputs": {}, - "scl": "\"mRunMin\" := (\"MOD60\" = DINT#0) AND NOT \"M19012\";\\n\"M19012\" := (\"MOD60\" = DINT#0); // P_TRIG((\"MOD60\" = DINT#0)) (Mem update handled by consumer)" - } - ] - }, - { - "id": "B3", - "title": "Running Hours for Maintenance", - "comment": "", - "logic": [ - { - "instruction_uid": "32", - "uid": "32", - "type": "Contact_scl", - "template_values": {}, - "negated_pins": {}, - "inputs": { - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - }, - "in": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// RLO: \"mRunMin\"" - }, - { - "instruction_uid": "33", - "uid": "33", - "type": "Convert_scl", - "template_values": { - "SrcType": "Type", - "DestType": "Type" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "32", - "source_pin": "out" - }, - "in": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - } - }, - "outputs": { - "out": [ - { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_min\"" - } - ] - }, - "scl": "IF \"mRunMin\" THEN\n \"I_DIRunning_min\" := \"Blender_Variables_Pers\".\"gRunningMinutes\";\nEND_IF;" - }, - { - "instruction_uid": "34", - "uid": "34", - "type": "Mod_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "25", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - }, - "en": { - "type": "connection", - "source_instruction_type": "Convert", - "source_instruction_uid": "33", - "source_pin": "eno" - }, - "in1": { - "uid": "24", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_min\"" - } - }, - "outputs": { - "out": [ - { - "uid": "26", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - } - ] - }, - "eno_logic": [ - { - "target_pin": "pre", - "target_type": "instruction", - "target_uid": "35", - "target_name": "Eq" - } - ], - "scl": "IF \"mRunMin\" THEN\n \"MOD60\" := \"I_DIRunning_min\" MOD DINT#60;\nEND_IF;" - }, - { - "instruction_uid": "35", - "uid": "35", - "type": "Eq_scl", - "template_values": { - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "28", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "in1": { - "uid": "27", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "pre": { - "type": "connection", - "source_instruction_type": "Mod", - "source_instruction_uid": "34", - "source_pin": "eno" - } - }, - "outputs": {}, - "scl": "// Comparison Eq 35: \"MOD60\" = DINT#0" - }, - { - "instruction_uid": "36", - "uid": "36", - "type": "Add_scl", - "template_values": { - "Card": "Cardinality", - "SrcType": "Type" - }, - "negated_pins": {}, - "inputs": { - "in2": { - "uid": "30", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_type": "Eq", - "source_instruction_uid": "35", - "source_pin": "out" - }, - "in1": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - }, - "outputs": { - "out": [ - { - "uid": "31", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - ] - }, - "scl": "IF \"MOD60\" = DINT#0 THEN\n \"Blender_Variables_Pers\".\"gRunningMaintHour\" := \"Blender_Variables_Pers\".\"gRunningMaintHour\" + 1;\nEND_IF;" - } - ] - }, - { - "id": "C4", - "title": "Running Hours for Maintenance", - "comment": "", - "logic": [ - { - "instruction_uid": "23", - "uid": "23", - "type": "Move_scl", - "template_values": { - "Card": "Cardinality" - }, - "negated_pins": {}, - "inputs": { - "en": { - "type": "powerrail" - }, - "in": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - } - }, - "outputs": { - "out1": [ - { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"HMI_Variables_Status\".\"System\".\"BlendingMaintHour\"" - } - ] - }, - "scl": "\"HMI_Variables_Status\".\"System\".\"BlendingMaintHour\" := \"Blender_Variables_Pers\".\"gRunningMaintHour\";" - } - ] - } - ] -} \ No newline at end of file diff --git a/BlenderRun_ProdTime_simplified_processed.scl.txt b/BlenderRun_ProdTime_simplified_processed.scl.txt deleted file mode 100644 index b8cd676..0000000 --- a/BlenderRun_ProdTime_simplified_processed.scl.txt +++ /dev/null @@ -1,132 +0,0 @@ -// Block Name (Original): BlenderRun_ProdTime -// Block Number: 2040 -// Original Language: LAD - -FUNCTION_BLOCK "BlenderRun_ProdTime" -{ S7_Optimized_Access := 'TRUE' } -VERSION : 0.1 - -VAR_INPUT -END_VAR - -VAR_OUTPUT -END_VAR - -VAR_IN_OUT -END_VAR - -VAR_TEMP - m1MinONS : Bool; - m1HourONS : Bool; - Buffer : Bool; - mRunMin : Bool; - mRunHr : Bool; - I_DIRunning_sec : DInt; - I_DIRunning_min : DInt; - MOD60 : DInt; -END_VAR - -BEGIN - - // Network 1: Seconds - - // RLO: "Procedure_Variables"."Blender_Run"."Running" - // RLO: "Procedure_Variables"."Blender_Run"."Running" AND "CLK_1.0S" - IF "Procedure_Variables"."Blender_Run"."Running" AND "CLK_1.0S" THEN - "Blender_Variables_Pers"."gSLIM_Sec" := "Blender_Variables_Pers"."gSLIM_Sec" + 1; - END_IF; - - // Network 2: Reset Hours - - // RLO: "SLIM_Variables"."ResetHour" - IF "SLIM_Variables"."ResetHour" THEN - "Blender_Variables_Pers"."gSLIM_Sec" := 0; - END_IF; - - // Network 3: Seconds Counter - - // RLO: "gBlenderBlending" - // RLO: "gBlenderBlending" AND "CLK_1.0S" - IF "gBlenderBlending" AND "CLK_1.0S" THEN - "Blender_Variables_Pers"."gProdSec" := "Blender_Variables_Pers"."gProdSec" + 1; - END_IF; - - // Network 4: Minute - - "m1MinONS" := "Blender_Variables_Pers"."gProdSec" = 60; - - // Network 5: Minute Counter - - IF "m1MinONS" THEN - "Blender_Variables_Pers"."gProdSec" := 0; - "Blender_Variables_Pers"."gProdMin" := "Blender_Variables_Pers"."gProdMin" + 1; - END_IF; - // Logic included in grouped IF (by UID 27) - // Logic included in grouped IF (by UID 27) - - // Network 6: Hour - - "m1HourONS" := "Blender_Variables_Pers"."gProdMin" = 60; - - // Network 7: Hour Counter - - IF "m1HourONS" THEN - "Blender_Variables_Pers"."gProdMin" := 0; - "Blender_Variables_Pers"."gProdHour" := "Blender_Variables_Pers"."gProdHour" + 1; - "Blender_Variables_Pers"."gBlendingMaintHour" := "Blender_Variables_Pers"."gBlendingMaintHour" + 1; - END_IF; - // Logic included in grouped IF (by UID 30) - // Logic included in grouped IF (by UID 30) - // Logic included in grouped IF (by UID 30) - - // Network 8: Counter reset - - // RLO: "gBlenderCIPMode" - // RLO: "gBlenderRinseMode" - IF "gBlenderCIPMode" OR "gBlenderRinseMode" THEN - "Blender_Variables_Pers"."gProdSec" := 0; - "Blender_Variables_Pers"."gProdMin" := 0; - "Blender_Variables_Pers"."gProdHour" := 0; - END_IF; - // Logic included in grouped IF (by UID 31) - // Logic included in grouped IF (by UID 31) - // Logic included in grouped IF (by UID 31) - - // Network 9: Running Seconds - - // RLO: "Procedure_Variables"."Blender_Run"."Running" - // RLO: "Procedure_Variables"."Blender_Run"."Running" AND "CLK_1.0S" - IF "Procedure_Variables"."Blender_Run"."Running" AND "CLK_1.0S" THEN - "Blender_Variables_Pers"."gRunningSeconds" := "Blender_Variables_Pers"."gRunningSeconds" + 1; - END_IF; - - // Network 10: Running Minutes - - "I_DIRunning_sec" := "Blender_Variables_Pers"."gRunningSeconds"; - "MOD60" := "I_DIRunning_sec" MOD DINT#60; - // RLO: "MOD60" = DINT#0 AND "Procedure_Variables"."Blender_Run"."Running" - // RLO: ("MOD60" = DINT#0 AND "Procedure_Variables"."Blender_Run"."Running") AND "CLK_1.0S" - IF ("MOD60" = DINT#0 AND "Procedure_Variables"."Blender_Run"."Running") AND "CLK_1.0S" THEN - "Blender_Variables_Pers"."gRunningMinutes" := "Blender_Variables_Pers"."gRunningMinutes" + 1; - END_IF; - // Logic moved to Coil 42 - "mRunMin" := ("MOD60" = DINT#0) AND NOT "M19012";\n"M19012" := ("MOD60" = DINT#0); // P_TRIG(("MOD60" = DINT#0)) (Mem update handled by consumer) - - // Network 11: Running Hours for Maintenance - - // RLO: "mRunMin" - IF "mRunMin" THEN - "I_DIRunning_min" := "Blender_Variables_Pers"."gRunningMinutes"; - END_IF; - IF "mRunMin" THEN - "MOD60" := "I_DIRunning_min" MOD DINT#60; - END_IF; - IF "MOD60" = DINT#0 THEN - "Blender_Variables_Pers"."gRunningMaintHour" := "Blender_Variables_Pers"."gRunningMaintHour" + 1; - END_IF; - - // Network 12: Running Hours for Maintenance - - "HMI_Variables_Status"."System"."BlendingMaintHour" := "Blender_Variables_Pers"."gRunningMaintHour"; - -END_FUNCTION_BLOCK diff --git a/TestLAD.xml b/TestLAD.xml index 1b377cb..5c3eeea 100644 --- a/TestLAD.xml +++ b/TestLAD.xml @@ -330,45 +330,368 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + SCL + - + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + Error Faults + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT - + de-DE - + en-US - + es-ES - + fr-FR - + zh-CN - + ja-JP diff --git a/TestLAD_simplified.json b/TestLAD_simplified.json index b4c364d..0dcad1d 100644 --- a/TestLAD_simplified.json +++ b/TestLAD_simplified.json @@ -75,17 +75,17 @@ }, "negated_pins": {}, "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "25", - "source_pin": "out" - }, "SRCBLK": { "uid": "22", "scope": "GlobalVariable", "type": "variable", "name": "\"HMI_PID\".\"PPM303\"" + }, + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" } }, "outputs": { @@ -108,6 +108,102 @@ } } ] + }, + { + "id": "3C", + "title": "Error Faults", + "comment": "", + "logic": [ + { + "instruction_uid": "25", + "uid": "25", + "type": "Contact", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX FALSE\"" + }, + "in": { + "type": "powerrail" + } + }, + "outputs": {} + }, + { + "instruction_uid": "26", + "uid": "26", + "type": "SCoil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Fault\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Coil", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"gmPDS2000_Error_Fault\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "RCoil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Run\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {} + } + ] } ] } \ No newline at end of file diff --git a/TestLAD_simplified_processed.json b/TestLAD_simplified_processed.json index b2aaa83..1efaaac 100644 --- a/TestLAD_simplified_processed.json +++ b/TestLAD_simplified_processed.json @@ -76,17 +76,17 @@ }, "negated_pins": {}, "inputs": { - "en": { - "type": "connection", - "source_instruction_type": "Contact", - "source_instruction_uid": "25", - "source_pin": "out" - }, "SRCBLK": { "uid": "22", "scope": "GlobalVariable", "type": "variable", "name": "\"HMI_PID\".\"PPM303\"" + }, + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" } }, "outputs": { @@ -110,6 +110,106 @@ "scl": "IF \"AUX FALSE\" THEN\n \"Block_Move_Err\" := BLKMOV(SRCBLK := \"HMI_PID\".\"PPM303\", DSTBLK => \"Filler_Head_Variables\".\"FillerHead\"); // ADVERTENCIA: BLKMOV usado directamente, probablemente no compile!\nEND_IF;" } ] + }, + { + "id": "3C", + "title": "Error Faults", + "comment": "", + "logic": [ + { + "instruction_uid": "25", + "uid": "25", + "type": "Contact_scl", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX FALSE\"" + }, + "in": { + "type": "powerrail" + } + }, + "outputs": {}, + "scl": "// RLO: (NOT \"AUX FALSE\")" + }, + { + "instruction_uid": "26", + "uid": "26", + "type": "SCoil_scl", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Fault\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF (NOT \"AUX FALSE\") THEN\n \"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Fault\" := TRUE;\nEND_IF;" + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Coil_scl", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"gmPDS2000_Error_Fault\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "\"gmPDS2000_Error_Fault\" := (NOT \"AUX FALSE\");" + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "RCoil_scl", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Run\"" + }, + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF (NOT \"AUX FALSE\") THEN\n \"HMI_Variables_Status\".\"Meters\".\"QTM3012_PRD_Run\" := FALSE;\nEND_IF;" + } + ] } ] } \ No newline at end of file diff --git a/TestLAD_simplified_processed.scl b/TestLAD_simplified_processed.scl index 724eee4..ba90e2a 100644 --- a/TestLAD_simplified_processed.scl +++ b/TestLAD_simplified_processed.scl @@ -34,4 +34,15 @@ BEGIN "Block_Move_Err" := BLKMOV(SRCBLK := "HMI_PID"."PPM303", DSTBLK => "Filler_Head_Variables"."FillerHead"); // ADVERTENCIA: BLKMOV usado directamente, probablemente no compile! END_IF; + // Network 2: Error Faults + + // RLO: (NOT "AUX FALSE") + IF (NOT "AUX FALSE") THEN + "HMI_Variables_Status"."Meters"."QTM3012_PRD_Fault" := TRUE; + END_IF; + "gmPDS2000_Error_Fault" := (NOT "AUX FALSE"); + IF (NOT "AUX FALSE") THEN + "HMI_Variables_Status"."Meters"."QTM3012_PRD_Run" := FALSE; + END_IF; + END_FUNCTION_BLOCK diff --git a/parsed_data.json b/parsed_data.json new file mode 100644 index 0000000..e69de29 diff --git a/x0_main.py b/x0_main.py new file mode 100644 index 0000000..b82e9d2 --- /dev/null +++ b/x0_main.py @@ -0,0 +1,145 @@ +import argparse +import subprocess +import os +import sys +import locale +import glob # <--- Importar glob para buscar archivos + +# (Función get_console_encoding y variable CONSOLE_ENCODING como en la respuesta anterior) +def get_console_encoding(): + """Obtiene la codificación preferida de la consola, con fallback.""" + try: + return locale.getpreferredencoding(False) + except Exception: + return 'cp1252' + +CONSOLE_ENCODING = get_console_encoding() +# Descomenta la siguiente línea si quieres ver la codificación detectada: +# print(f"Detected console encoding: {CONSOLE_ENCODING}") + +# (Función run_script como en la respuesta anterior, usando CONSOLE_ENCODING) +def run_script(script_name, xml_arg): + """Runs a given script with the specified XML file argument.""" + script_path = os.path.join(os.path.dirname(__file__), script_name) + command = [sys.executable, script_path, xml_arg] + print(f"\n--- Running {script_name} with argument: {xml_arg} ---") + try: + result = subprocess.run(command, + check=True, + capture_output=True, + text=True, + encoding=CONSOLE_ENCODING, + errors='replace') # 'replace' para evitar errores + + # Imprimir stdout y stderr + # Eliminar saltos de línea extra al final si existen + stdout_clean = result.stdout.strip() + stderr_clean = result.stderr.strip() + if stdout_clean: + print(stdout_clean) + if stderr_clean: + print("--- Stderr ---") + print(stderr_clean) + print("--------------") + print(f"--- {script_name} finished successfully ---") + return True + except FileNotFoundError: + print(f"Error: Script '{script_path}' not found.") + return False + except subprocess.CalledProcessError as e: + print(f"Error running {script_name}:") + print(f"Return code: {e.returncode}") + stdout_decoded = e.stdout.decode(CONSOLE_ENCODING, errors='replace').strip() if isinstance(e.stdout, bytes) else (e.stdout or "").strip() + stderr_decoded = e.stderr.decode(CONSOLE_ENCODING, errors='replace').strip() if isinstance(e.stderr, bytes) else (e.stderr or "").strip() + if stdout_decoded: + print("--- Stdout ---") + print(stdout_decoded) + if stderr_decoded: + print("--- Stderr ---") + print(stderr_decoded) + print("--------------") + return False + except Exception as e: + print(f"An unexpected error occurred while running {script_name}: {e}") + return False + +# --- NUEVA FUNCIÓN PARA SELECCIONAR ARCHIVO --- +def select_xml_file(): + """Busca archivos .xml, los lista y pide al usuario que elija uno.""" + print("No XML file specified. Searching for XML files in current directory...") + # Buscar archivos .xml en el directorio actual (.) + xml_files = sorted(glob.glob('*.xml')) # sorted para orden alfabético + + if not xml_files: + print("Error: No .xml files found in the current directory.") + sys.exit(1) + + print("\nAvailable XML files:") + for i, filename in enumerate(xml_files, start=1): + print(f" {i}: {filename}") + + while True: + try: + choice = input(f"Enter the number of the file to process (1-{len(xml_files)}): ") + choice_num = int(choice) + if 1 <= choice_num <= len(xml_files): + selected_file = xml_files[choice_num - 1] + print(f"Selected: {selected_file}") + return selected_file + else: + print("Invalid choice. Please enter a number from the list.") + except ValueError: + print("Invalid input. Please enter a number.") + except EOFError: # Manejar si la entrada se cierra inesperadamente + print("\nSelection cancelled.") + sys.exit(1) +# --- FIN NUEVA FUNCIÓN --- + + +if __name__ == "__main__": + xml_filename = None + + # Comprobar si se pasó un argumento de línea de comandos + # sys.argv[0] es el nombre del script, sys.argv[1] sería el primer argumento + if len(sys.argv) > 1: + # Si hay argumentos, usar argparse para parsearlo (permite -h, etc.) + parser = argparse.ArgumentParser( + description="Run the Simatic XML processing pipeline." + ) + parser.add_argument( + "xml_file", + # Ya no necesitamos nargs='?' ni default aquí porque sabemos que hay un argumento + help="Path to the XML file to process.", + ) + # Parsear solo los argumentos conocidos, ignorar extras si los hubiera + args, unknown = parser.parse_known_args() + xml_filename = args.xml_file + print(f"XML file specified via argument: {xml_filename}") + else: + # Si no hay argumentos, llamar a la función interactiva + xml_filename = select_xml_file() + + # --- El resto del script continúa igual, usando xml_filename --- + + # Verificar si el archivo XML de entrada (seleccionado o pasado) existe + if not os.path.exists(xml_filename): + print(f"Error: Selected or specified XML file not found: {xml_filename}") + sys.exit(1) + + print(f"\nStarting pipeline for: {xml_filename}") + + # Run scripts sequentially (asegúrate que los nombres son correctos) + script1 = "x1_to_json.py" + script2 = "x2_process.py" + script3 = "x3_generate_scl.py" + + if run_script(script1, xml_filename): + if run_script(script2, xml_filename): + if run_script(script3, xml_filename): + print("\nPipeline completed successfully.") + else: + print("\nPipeline failed at script:", script3) + else: + print("\nPipeline failed at script:", script2) + else: + print("\nPipeline failed at script:", script1) \ No newline at end of file diff --git a/x1_to_json.py b/x1_to_json.py index 3f84c79..1acd06c 100644 --- a/x1_to_json.py +++ b/x1_to_json.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import json +import argparse import os from lxml import etree import traceback @@ -520,7 +521,34 @@ def convert_xml_to_json(xml_filepath, json_filepath): # --- Punto de Entrada Principal --- if __name__ == "__main__": - xml_filename_base = "TestLAD" - xml_file = f"{xml_filename_base}.xml" - json_file = f"{xml_filename_base}_simplified.json" - convert_xml_to_json(xml_file, json_file) \ No newline at end of file + # Imports necesarios solo para la ejecución como script principal + import argparse + import os + import sys + + parser = argparse.ArgumentParser(description="Convert Simatic XML LAD/FBD to simplified JSON.") + parser.add_argument( + "xml_filepath", + nargs="?", # Argumento opcional + default="TestLAD.xml", # Valor por defecto si se ejecuta sin argumentos + help="Path to the input XML file (default: TestLAD.xml)" + ) + args = parser.parse_args() + + xml_input_file = args.xml_filepath + + # Verificar si el archivo de entrada existe + if not os.path.exists(xml_input_file): + print(f"Error Crítico: Archivo XML no encontrado: '{xml_input_file}'") + sys.exit(1) # Salir si el archivo no existe + + # Derivar nombre base para archivo de salida JSON + # os.path.basename obtiene el nombre del archivo de la ruta + # os.path.splitext divide el nombre y la extensión + xml_filename_base = os.path.splitext(os.path.basename(xml_input_file))[0] + # Construir la ruta de salida en el mismo directorio que el script o el XML + output_dir = os.path.dirname(xml_input_file) # O usar os.path.dirname(__file__) para el directorio del script + json_output_file = os.path.join(output_dir, f"{xml_filename_base}_simplified.json") + + # Llamar a la función principal con los nombres de archivo derivados + convert_xml_to_json(xml_input_file, json_output_file) \ No newline at end of file diff --git a/x2_process.py b/x2_process.py index ba0c6c6..505447c 100644 --- a/x2_process.py +++ b/x2_process.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import json +import argparse import os import copy import traceback @@ -387,6 +388,90 @@ def process_coil(instruction, network_id, scl_map, access_map): instruction["type"] = instr_type + SCL_SUFFIX return True +# EN x2_process.py, junto a otras funciones process_xxx + +def process_scoil(instruction, network_id, scl_map, access_map): + """Genera SCL para Set Coil (SCoil): IF condition THEN variable := TRUE; END_IF;""" + instr_uid = instruction["instruction_uid"] + instr_type = instruction["type"] + if instr_type.endswith(SCL_SUFFIX) or "_error" in instr_type: + return False # Ya procesado o con error + + # Obtener condición de entrada (RLO) + in_info = instruction["inputs"].get("in") + condition_scl = get_scl_representation(in_info, network_id, scl_map, access_map) + + # Obtener operando (variable a poner a TRUE) + operand_info = instruction["inputs"].get("operand") + variable_scl = get_scl_representation(operand_info, network_id, scl_map, access_map) + + # Verificar dependencias + if condition_scl is None or variable_scl is None: + return False # Dependencias no listas + + # Verificar que el operando sea una variable + if not (operand_info and operand_info.get("type") == "variable"): + print(f"Error: SCoil {instr_uid} operando no es variable o falta info (Tipo: {operand_info.get('type')}).") + instruction["scl"] = f"// ERROR: SCoil {instr_uid} operando no es variable." + instruction["type"] += "_error" + return True # Procesado con error + + # Formatear nombre de variable + variable_name_formatted = format_variable_name(variable_scl) + + # Generar SCL + scl_core = f"{variable_name_formatted} := TRUE;" + scl_final = ( + f"IF {condition_scl} THEN\n {scl_core}\nEND_IF;" if condition_scl != "TRUE" else scl_core + ) + + # Actualizar instrucción + instruction["scl"] = scl_final + instruction["type"] = instr_type + SCL_SUFFIX + # SCoil no genera salida 'out' ni 'eno' significativas para propagar + return True + +def process_rcoil(instruction, network_id, scl_map, access_map): + """Genera SCL para Reset Coil (RCoil): IF condition THEN variable := FALSE; END_IF;""" + instr_uid = instruction["instruction_uid"] + instr_type = instruction["type"] + if instr_type.endswith(SCL_SUFFIX) or "_error" in instr_type: + return False # Ya procesado o con error + + # Obtener condición de entrada (RLO) + in_info = instruction["inputs"].get("in") + condition_scl = get_scl_representation(in_info, network_id, scl_map, access_map) + + # Obtener operando (variable a poner a FALSE) + operand_info = instruction["inputs"].get("operand") + variable_scl = get_scl_representation(operand_info, network_id, scl_map, access_map) + + # Verificar dependencias + if condition_scl is None or variable_scl is None: + return False # Dependencias no listas + + # Verificar que el operando sea una variable + if not (operand_info and operand_info.get("type") == "variable"): + print(f"Error: RCoil {instr_uid} operando no es variable o falta info (Tipo: {operand_info.get('type')}).") + instruction["scl"] = f"// ERROR: RCoil {instr_uid} operando no es variable." + instruction["type"] += "_error" + return True # Procesado con error + + # Formatear nombre de variable + variable_name_formatted = format_variable_name(variable_scl) + + # Generar SCL + scl_core = f"{variable_name_formatted} := FALSE;" + scl_final = ( + f"IF {condition_scl} THEN\n {scl_core}\nEND_IF;" if condition_scl != "TRUE" else scl_core + ) + + # Actualizar instrucción + instruction["scl"] = scl_final + instruction["type"] = instr_type + SCL_SUFFIX + # RCoil no genera salida 'out' ni 'eno' significativas para propagar + return True + def process_eq(instruction, network_id, scl_map, access_map): instr_uid = instruction["instruction_uid"] instr_type = instruction["type"] @@ -1271,19 +1356,21 @@ def process_json_to_scl(json_filepath): # Lista y mapa de procesadores base base_processors = [ - process_convert, - process_mod, - process_blkmov, - process_eq, - process_contact, - process_o, - process_edge_detector, # Usar la nueva función unificada - process_add, - process_move, - process_call, - process_coil, - # ... otros procesadores base ... - ] + process_convert, + process_mod, + process_eq, + process_contact, + process_o, + process_edge_detector, + process_add, + process_move, + process_call, + process_coil, + process_scoil, # <--- Añadir aquí + process_rcoil, # <--- Añadir aquí + process_blkmov, # El que añadimos antes + # ... otros procesadores base ... + ] # Crear mapa por nombre de tipo original (en minúsculas) processor_map = {} for func in base_processors: @@ -1299,6 +1386,10 @@ def process_json_to_scl(json_filepath): processor_map["nbox"] = func elif type_name == "blkmov": processor_map[type_name] = process_blkmov # Usar la nueva función BLKMOV + elif type_name == "scoil": + processor_map[type_name] = func + elif type_name == "rcoil": + processor_map[type_name] = func else: processor_map[type_name] = func @@ -1478,16 +1569,35 @@ def process_json_to_scl(json_filepath): # --- Ejecución --- if __name__ == "__main__": - # Asegúrate de que el nombre base del archivo XML sea correcto - xml_filename_base = "TestLAD" # Cambia esto si tu XML se llama diferente - input_json_file = f"{xml_filename_base}_simplified.json" + # Imports necesarios solo para la ejecución como script principal + import argparse + import os + import sys + + parser = argparse.ArgumentParser(description="Process simplified JSON to embed SCL logic.") + # Acepta el nombre del XML original como referencia para derivar nombres + parser.add_argument( + "source_xml_filepath", + nargs="?", + default="TestLAD.xml", + help="Path to the original source XML file (used to derive JSON input name, default: TestLAD.xml)" + ) + args = parser.parse_args() + + # Derivar el nombre del archivo JSON de entrada esperado + xml_filename_base = os.path.splitext(os.path.basename(args.source_xml_filepath))[0] + input_dir = os.path.dirname(args.source_xml_filepath) # Directorio del XML original + input_json_file = os.path.join(input_dir, f"{xml_filename_base}_simplified.json") if not os.path.exists(input_json_file): print( f"Error Fatal: El archivo de entrada JSON simplificado no existe: '{input_json_file}'" ) print( - "Asegúrate de haber ejecutado 'x1_to_json.py' primero sobre el archivo XML correcto." + f"Asegúrate de haber ejecutado 'x1_to_json.py' primero sobre '{args.source_xml_filepath}'." ) + sys.exit(1) # Salir si el archivo de entrada no existe else: + # Llamar a la función principal con el nombre del JSON de entrada + # La función process_json_to_scl ya deriva el nombre de salida (_processed.json) process_json_to_scl(input_json_file) diff --git a/x3_generate_scl.py b/x3_generate_scl.py index 726ebdf..ae9d662 100644 --- a/x3_generate_scl.py +++ b/x3_generate_scl.py @@ -2,6 +2,7 @@ import json import os import re +import argparse # --- Helper Functions --- @@ -196,13 +197,35 @@ def generate_scl(processed_json_filepath, output_scl_filepath): # --- Ejecución --- if __name__ == "__main__": + # Imports necesarios solo para la ejecución como script principal + import argparse + import os + import sys - xml_file = "TestLAD.xml" # CAMBIAR AL NUEVO ARCHIVO XML - input_json_file = xml_file.replace( - ".xml", "_simplified_processed.json" - ) # Nombre de salida dinámico - output_scl_file = input_json_file.replace( - ".json", ".scl" - ) # Nombre de salida dinámico + parser = argparse.ArgumentParser(description="Generate final SCL file from processed JSON.") + # Acepta el nombre del XML original como referencia para derivar nombres + parser.add_argument( + "source_xml_filepath", + nargs="?", + default="TestLAD.xml", + help="Path to the original source XML file (used to derive input/output names, default: TestLAD.xml)" + ) + args = parser.parse_args() - generate_scl(input_json_file, output_scl_file) \ No newline at end of file + # Derivar nombres de archivos de entrada y salida + xml_filename_base = os.path.splitext(os.path.basename(args.source_xml_filepath))[0] + input_dir = os.path.dirname(args.source_xml_filepath) # Directorio del XML original + + # Nombre del JSON procesado (entrada para este script) + input_json_file = os.path.join(input_dir, f"{xml_filename_base}_simplified_processed.json") + # Nombre del SCL final (salida de este script) + output_scl_file = os.path.join(input_dir, f"{xml_filename_base}_simplified_processed.scl") + + # Verificar si el archivo JSON procesado de entrada existe + if not os.path.exists(input_json_file): + print(f"Error: Processed JSON file not found: '{input_json_file}'") + print(f"Ensure 'x2_process.py' ran successfully for '{args.source_xml_filepath}'.") + sys.exit(1) # Salir si el archivo de entrada no existe + else: + # Llamar a la función principal con los nombres derivados + generate_scl(input_json_file, output_scl_file) \ No newline at end of file