Set y Reset agregados

This commit is contained in:
Miguel 2025-04-19 02:37:45 +02:00
parent 607e3105b5
commit 4a30e6d9fd
15 changed files with 1189 additions and 3096 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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");
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"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -330,45 +330,368 @@
</MultilingualText>
</ObjectList>
</SW.Blocks.CompileUnit>
<MultilingualText ID="2B" CompositionName="Title">
<SW.Blocks.CompileUnit ID="2B" CompositionName="CompileUnits">
<AttributeList>
<NetworkSource><StructuredText xmlns="http://www.siemens.com/automation/Openness/SW/NetworkSource/StructuredText/v3">
<Token Text="IF" UId="21" />
<Blank UId="22" />
<Access Scope="GlobalVariable" UId="23">
<Symbol UId="24">
<Component Name="AUX FALSE" UId="25" />
</Symbol>
</Access>
<Blank UId="26" />
<Token Text="THEN" UId="27" />
<NewLine UId="28" />
<Blank Num="4" UId="29" />
<Access Scope="LocalVariable" UId="30">
<Symbol UId="31">
<Component Name="Block_Move_Err" UId="32" />
</Symbol>
</Access>
<Blank UId="33" />
<Token Text=":=" UId="34" />
<Blank UId="35" />
<Access Scope="Call" UId="36">
<Instruction Name="BLKMOV" UId="37">
<Token Text="(" UId="38" />
<Parameter Name="SRCBLK" UId="39">
<Blank UId="40" />
<Token Text=":=" UId="41" />
<Blank UId="42" />
<Access Scope="GlobalVariable" UId="43">
<Symbol UId="44">
<Component Name="HMI_PID" UId="45">
<BooleanAttribute Name="HasQuotes" UId="46">true</BooleanAttribute>
</Component>
<Token Text="." UId="47" />
<Component Name="PPM303" UId="48" />
</Symbol>
</Access>
</Parameter>
<Token Text="," UId="49" />
<Blank UId="50" />
<Parameter Name="DSTBLK" UId="51">
<Blank UId="52" />
<Token Text="=&gt;" UId="53" />
<Blank UId="54" />
<Access Scope="GlobalVariable" UId="55">
<Symbol UId="56">
<Component Name="Filler_Head_Variables" UId="57">
<BooleanAttribute Name="HasQuotes" UId="58">true</BooleanAttribute>
</Component>
<Token Text="." UId="59" />
<Component Name="FillerHead" UId="60" />
</Symbol>
</Access>
</Parameter>
<Token Text=")" UId="62" />
</Instruction>
</Access>
<Token Text=";" UId="63" />
<NewLine UId="64" />
<Token Text="END_IF" UId="65" />
<Token Text=";" UId="66" />
</StructuredText></NetworkSource>
<ProgrammingLanguage>SCL</ProgrammingLanguage>
</AttributeList>
<ObjectList>
<MultilingualTextItem ID="2C" CompositionName="Items">
<MultilingualText ID="2C" CompositionName="Comment">
<ObjectList>
<MultilingualTextItem ID="2D" CompositionName="Items">
<AttributeList>
<Culture>it-IT</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="2D" CompositionName="Items">
<MultilingualTextItem ID="2E" CompositionName="Items">
<AttributeList>
<Culture>de-DE</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="2E" CompositionName="Items">
<MultilingualTextItem ID="2F" CompositionName="Items">
<AttributeList>
<Culture>en-US</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="2F" CompositionName="Items">
<MultilingualTextItem ID="30" CompositionName="Items">
<AttributeList>
<Culture>es-ES</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="30" CompositionName="Items">
<MultilingualTextItem ID="31" CompositionName="Items">
<AttributeList>
<Culture>fr-FR</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="31" CompositionName="Items">
<MultilingualTextItem ID="32" CompositionName="Items">
<AttributeList>
<Culture>zh-CN</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="32" CompositionName="Items">
<MultilingualTextItem ID="33" CompositionName="Items">
<AttributeList>
<Culture>ja-JP</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
</ObjectList>
</MultilingualText>
<MultilingualText ID="34" CompositionName="Title">
<ObjectList>
<MultilingualTextItem ID="35" CompositionName="Items">
<AttributeList>
<Culture>it-IT</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="36" CompositionName="Items">
<AttributeList>
<Culture>de-DE</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="37" CompositionName="Items">
<AttributeList>
<Culture>en-US</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="38" CompositionName="Items">
<AttributeList>
<Culture>es-ES</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="39" CompositionName="Items">
<AttributeList>
<Culture>fr-FR</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="3A" CompositionName="Items">
<AttributeList>
<Culture>zh-CN</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="3B" CompositionName="Items">
<AttributeList>
<Culture>ja-JP</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
</ObjectList>
</MultilingualText>
</ObjectList>
</SW.Blocks.CompileUnit>
<SW.Blocks.CompileUnit ID="3C" CompositionName="CompileUnits">
<AttributeList>
<NetworkSource><FlgNet xmlns="http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v4">
<Parts>
<Access Scope="GlobalVariable" UId="21">
<Symbol>
<Component Name="AUX FALSE" />
</Symbol>
</Access>
<Access Scope="GlobalVariable" UId="22">
<Symbol>
<Component Name="HMI_Variables_Status" />
<Component Name="Meters" />
<Component Name="QTM3012_PRD_Fault" />
</Symbol>
</Access>
<Access Scope="GlobalVariable" UId="23">
<Symbol>
<Component Name="gmPDS2000_Error_Fault" />
</Symbol>
</Access>
<Access Scope="GlobalVariable" UId="24">
<Symbol>
<Component Name="HMI_Variables_Status" />
<Component Name="Meters" />
<Component Name="QTM3012_PRD_Run" />
</Symbol>
</Access>
<Part Name="Contact" UId="25">
<Negated Name="operand" />
</Part>
<Part Name="SCoil" UId="26" />
<Part Name="Coil" UId="27">
<Negated Name="operand" />
</Part>
<Part Name="RCoil" UId="28" />
</Parts>
<Wires>
<Wire UId="29">
<Powerrail />
<NameCon UId="25" Name="in" />
</Wire>
<Wire UId="30">
<IdentCon UId="21" />
<NameCon UId="25" Name="operand" />
</Wire>
<Wire UId="31">
<NameCon UId="25" Name="out" />
<NameCon UId="26" Name="in" />
<NameCon UId="27" Name="in" />
<NameCon UId="28" Name="in" />
</Wire>
<Wire UId="32">
<IdentCon UId="22" />
<NameCon UId="26" Name="operand" />
</Wire>
<Wire UId="33">
<IdentCon UId="23" />
<NameCon UId="27" Name="operand" />
</Wire>
<Wire UId="34">
<IdentCon UId="24" />
<NameCon UId="28" Name="operand" />
</Wire>
</Wires>
</FlgNet></NetworkSource>
<ProgrammingLanguage>LAD</ProgrammingLanguage>
</AttributeList>
<ObjectList>
<MultilingualText ID="3D" CompositionName="Comment">
<ObjectList>
<MultilingualTextItem ID="3E" CompositionName="Items">
<AttributeList>
<Culture>it-IT</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="3F" CompositionName="Items">
<AttributeList>
<Culture>de-DE</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="40" CompositionName="Items">
<AttributeList>
<Culture>en-US</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="41" CompositionName="Items">
<AttributeList>
<Culture>es-ES</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="42" CompositionName="Items">
<AttributeList>
<Culture>fr-FR</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="43" CompositionName="Items">
<AttributeList>
<Culture>zh-CN</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="44" CompositionName="Items">
<AttributeList>
<Culture>ja-JP</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
</ObjectList>
</MultilingualText>
<MultilingualText ID="45" CompositionName="Title">
<ObjectList>
<MultilingualTextItem ID="46" CompositionName="Items">
<AttributeList>
<Culture>it-IT</Culture>
<Text>Error Faults</Text>
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="47" CompositionName="Items">
<AttributeList>
<Culture>de-DE</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="48" CompositionName="Items">
<AttributeList>
<Culture>en-US</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="49" CompositionName="Items">
<AttributeList>
<Culture>es-ES</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="4A" CompositionName="Items">
<AttributeList>
<Culture>fr-FR</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="4B" CompositionName="Items">
<AttributeList>
<Culture>zh-CN</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="4C" CompositionName="Items">
<AttributeList>
<Culture>ja-JP</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
</ObjectList>
</MultilingualText>
</ObjectList>
</SW.Blocks.CompileUnit>
<MultilingualText ID="4D" CompositionName="Title">
<ObjectList>
<MultilingualTextItem ID="4E" CompositionName="Items">
<AttributeList>
<Culture>it-IT</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="4F" CompositionName="Items">
<AttributeList>
<Culture>de-DE</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="50" CompositionName="Items">
<AttributeList>
<Culture>en-US</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="51" CompositionName="Items">
<AttributeList>
<Culture>es-ES</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="52" CompositionName="Items">
<AttributeList>
<Culture>fr-FR</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="53" CompositionName="Items">
<AttributeList>
<Culture>zh-CN</Culture>
<Text />
</AttributeList>
</MultilingualTextItem>
<MultilingualTextItem ID="54" CompositionName="Items">
<AttributeList>
<Culture>ja-JP</Culture>
<Text />

View File

@ -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": {}
}
]
}
]
}

View File

@ -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;"
}
]
}
]
}

View File

@ -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

0
parsed_data.json Normal file
View File

145
x0_main.py Normal file
View File

@ -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)

View File

@ -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)
# 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)

View File

@ -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"]
@ -1273,15 +1358,17 @@ def process_json_to_scl(json_filepath):
base_processors = [
process_convert,
process_mod,
process_blkmov,
process_eq,
process_contact,
process_o,
process_edge_detector, # Usar la nueva función unificada
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)
@ -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)

View File

@ -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()
# 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)