From 48467ac7ea3a4c49ca3365e05f149ada256048bc Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 18 Apr 2025 17:53:02 +0200 Subject: [PATCH] Itentando con llamadas a Funciones --- BlenderCtrl_ProdModeInit_simplified.json.txt | 61 + BlenderRun_ProdTime.scl | 136 -- ...Run_ProdTime_simplified_scl_processed.json | 1225 ----------------- x1_to_json.py | 4 +- x2_process.py | 2 +- 5 files changed, 64 insertions(+), 1364 deletions(-) create mode 100644 BlenderCtrl_ProdModeInit_simplified.json.txt delete mode 100644 BlenderRun_ProdTime.scl delete mode 100644 BlenderRun_ProdTime_simplified_scl_processed.json diff --git a/BlenderCtrl_ProdModeInit_simplified.json.txt b/BlenderCtrl_ProdModeInit_simplified.json.txt new file mode 100644 index 0000000..8481c8a --- /dev/null +++ b/BlenderCtrl_ProdModeInit_simplified.json.txt @@ -0,0 +1,61 @@ +{ + "block_name": "BlenderCtrl_ProdModeInit", + "block_number": 2012, + "language": "LAD", + "block_comment": "", + "interface": { + "Return": [ + { + "name": "Ret_Val", + "datatype": "Void" + } + ] + }, + "networks": [ + { + "id": "9", + "title": "PID Reset Integral", + "comment": "", + "logic": [] + }, + { + "id": "1A", + "title": "Ctrl Init Errors", + "comment": "", + "logic": [] + }, + { + "id": "2B", + "title": "RunOut Counter", + "comment": "", + "logic": [ + { + "instruction_uid": "23", + "type": "Move", + "inputs": { + "en": { + "type": "powerrail" + }, + "in": { + "uid": "21", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Real", + "value": 0.0 + } + }, + "outputs": { + "out1": [ + { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Variables_Status\".\"Analog_Values\".\"TP301RunOutCount\"" + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/BlenderRun_ProdTime.scl b/BlenderRun_ProdTime.scl deleted file mode 100644 index 518002a..0000000 --- a/BlenderRun_ProdTime.scl +++ /dev/null @@ -1,136 +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 - - // Cond: "Blender_Variables_Pers"."gProdSec" = 60 - "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 - - // Cond: "Blender_Variables_Pers"."gProdMin" = 60 - "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; - // Cond: "MOD60" = DINT#0 - // 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; - // Edge PBox 41 -> P_TRIG_FUNC(CLK := (("MOD60" = DINT#0 AND "Procedure_Variables"."Blender_Run"."Running") AND "CLK_1.0S"), M := "M19012") - "mRunMin" := P_TRIG_FUNC(CLK := (("MOD60" = DINT#0 AND "Procedure_Variables"."Blender_Run"."Running") AND "CLK_1.0S"), M := "M19012"); - - // 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; - // Cond: "MOD60" = DINT#0 - 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/BlenderRun_ProdTime_simplified_scl_processed.json b/BlenderRun_ProdTime_simplified_scl_processed.json deleted file mode 100644 index e1f3930..0000000 --- a/BlenderRun_ProdTime_simplified_scl_processed.json +++ /dev/null @@ -1,1225 +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", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "27", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "26", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "type": "Add_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "27", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gSLIM_Sec\"" - }, - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - } - }, - "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", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"SLIM_Variables\".\"ResetHour\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"SLIM_Variables\".\"ResetHour\"" - }, - { - "instruction_uid": "25", - "type": "Move_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "24", - "source_instruction_type": "Contact", - "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", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderBlending\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderBlending\"" - }, - { - "instruction_uid": "27", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "26", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderBlending\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "type": "Add_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "27", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - }, - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - } - }, - "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", - "type": "Eq_scl", - "inputs": { - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdSec\"" - }, - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// Cond: \"Blender_Variables_Pers\".\"gProdSec\" = 60" - }, - { - "instruction_uid": "25", - "type": "Coil_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "24", - "source_instruction_type": "Eq", - "source_pin": "out" - }, - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - } - }, - "outputs": {}, - "scl": "\"m1MinONS\" := \"Blender_Variables_Pers\".\"gProdSec\" = 60;" - } - ] - }, - { - "id": "4D", - "title": "Minute Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "27", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1MinONS\"" - } - }, - "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", - "type": "Move_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "27", - "source_instruction_type": "Contact", - "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", - "type": "Add_scl", - "inputs": { - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - }, - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_uid": "27", - "source_instruction_type": "Contact", - "source_pin": "out" - } - }, - "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", - "type": "Eq_scl", - "inputs": { - "in1": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdMin\"" - }, - "in2": { - "uid": "22", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 60 - }, - "pre": { - "type": "powerrail" - } - }, - "outputs": {}, - "scl": "// Cond: \"Blender_Variables_Pers\".\"gProdMin\" = 60" - }, - { - "instruction_uid": "25", - "type": "Coil_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "24", - "source_instruction_type": "Eq", - "source_pin": "out" - }, - "operand": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - } - }, - "outputs": {}, - "scl": "\"m1HourONS\" := \"Blender_Variables_Pers\".\"gProdMin\" = 60;" - } - ] - }, - { - "id": "6F", - "title": "Hour Counter", - "comment": "", - "logic": [ - { - "instruction_uid": "30", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"m1HourONS\"" - } - }, - "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", - "type": "Move_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "30", - "source_instruction_type": "Contact", - "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", - "type": "Add_scl", - "inputs": { - "in1": { - "uid": "24", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gProdHour\"" - }, - "in2": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_uid": "30", - "source_instruction_type": "Contact", - "source_pin": "out" - } - }, - "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", - "type": "Add_scl", - "inputs": { - "in1": { - "uid": "27", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gBlendingMaintHour\"" - }, - "in2": { - "uid": "28", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - }, - "en": { - "type": "connection", - "source_instruction_uid": "30", - "source_instruction_type": "Contact", - "source_pin": "out" - } - }, - "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", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderCIPMode\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderCIPMode\"" - }, - { - "instruction_uid": "30", - "type": "Contact_scl", - "inputs": { - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"gBlenderRinseMode\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"gBlenderRinseMode\"" - }, - { - "instruction_uid": "31", - "type": "O_scl", - "inputs": { - "in1": { - "type": "connection", - "source_instruction_uid": "29", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "in2": { - "type": "connection", - "source_instruction_uid": "30", - "source_instruction_type": "Contact", - "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", - "type": "Move_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "31", - "source_instruction_type": "O", - "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", - "type": "Move_scl", - "inputs": { - "in": { - "uid": "25", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - }, - "en": { - "type": "connection", - "source_instruction_uid": "31", - "source_instruction_type": "O", - "source_pin": "out" - } - }, - "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", - "type": "Move_scl", - "inputs": { - "in": { - "uid": "27", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 0 - }, - "en": { - "type": "connection", - "source_instruction_uid": "31", - "source_instruction_type": "O", - "source_pin": "out" - } - }, - "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", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "27", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "26", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "operand": { - "uid": "22", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"Procedure_Variables\".\"Blender_Run\".\"Running\" AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "28", - "type": "Add_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "27", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "in1": { - "uid": "23", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningSeconds\"" - }, - "in2": { - "uid": "24", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - } - }, - "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", - "type": "Convert_scl", - "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", - "type": "Mod_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "35", - "source_instruction_type": "Convert", - "source_pin": "eno" - }, - "in1": { - "uid": "23", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_sec\"" - }, - "in2": { - "uid": "24", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - } - }, - "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", - "type": "Eq_scl", - "inputs": { - "in1": { - "uid": "26", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "in2": { - "uid": "27", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "pre": { - "type": "connection", - "source_instruction_uid": "36", - "source_instruction_type": "Mod", - "source_pin": "eno" - } - }, - "outputs": {}, - "scl": "// Cond: \"MOD60\" = DINT#0" - }, - { - "instruction_uid": "38", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "37", - "source_instruction_type": "Eq", - "source_pin": "out" - }, - "operand": { - "uid": "28", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Procedure_Variables\".\"Blender_Run\".\"Running\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\"" - }, - { - "instruction_uid": "39", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "38", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "operand": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"CLK_1.0S\"" - } - }, - "outputs": {}, - "scl": "// RLO: (\"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\") AND \"CLK_1.0S\"" - }, - { - "instruction_uid": "40", - "type": "Add_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "39", - "source_instruction_type": "Contact", - "source_pin": "out" - }, - "in1": { - "uid": "30", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMinutes\"" - }, - "in2": { - "uid": "31", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - } - }, - "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", - "type": "PBox_scl", - "inputs": { - "bit": { - "uid": "33", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"M19012\"" - } - }, - "outputs": {}, - "scl": "// Edge PBox 41 -> P_TRIG_FUNC(CLK := ((\"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\") AND \"CLK_1.0S\"), M := \"M19012\")" - }, - { - "instruction_uid": "42", - "type": "Coil_scl", - "inputs": { - "in": { - "type": "connection", - "source_instruction_uid": "41", - "source_instruction_type": "PBox", - "source_pin": "out" - }, - "operand": { - "uid": "34", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - } - }, - "outputs": {}, - "scl": "\"mRunMin\" := P_TRIG_FUNC(CLK := ((\"MOD60\" = DINT#0 AND \"Procedure_Variables\".\"Blender_Run\".\"Running\") AND \"CLK_1.0S\"), M := \"M19012\");" - } - ] - }, - { - "id": "B3", - "title": "Running Hours for Maintenance", - "comment": "", - "logic": [ - { - "instruction_uid": "32", - "type": "Contact_scl", - "inputs": { - "in": { - "type": "powerrail" - }, - "operand": { - "uid": "21", - "scope": "LocalVariable", - "type": "variable", - "name": "\"mRunMin\"" - } - }, - "outputs": {}, - "scl": "// RLO: \"mRunMin\"" - }, - { - "instruction_uid": "33", - "type": "Convert_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "32", - "source_instruction_type": "Contact", - "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", - "type": "Mod_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "33", - "source_instruction_type": "Convert", - "source_pin": "eno" - }, - "in1": { - "uid": "24", - "scope": "LocalVariable", - "type": "variable", - "name": "\"I_DIRunning_min\"" - }, - "in2": { - "uid": "25", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#60" - } - }, - "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", - "type": "Eq_scl", - "inputs": { - "in1": { - "uid": "27", - "scope": "LocalVariable", - "type": "variable", - "name": "\"MOD60\"" - }, - "in2": { - "uid": "28", - "scope": "TypedConstant", - "type": "constant", - "datatype": "TypedConstant", - "value": "DINT#0" - }, - "pre": { - "type": "connection", - "source_instruction_uid": "34", - "source_instruction_type": "Mod", - "source_pin": "eno" - } - }, - "outputs": {}, - "scl": "// Cond: \"MOD60\" = DINT#0" - }, - { - "instruction_uid": "36", - "type": "Add_scl", - "inputs": { - "en": { - "type": "connection", - "source_instruction_uid": "35", - "source_instruction_type": "Eq", - "source_pin": "out" - }, - "in1": { - "uid": "29", - "scope": "GlobalVariable", - "type": "variable", - "name": "\"Blender_Variables_Pers\".\"gRunningMaintHour\"" - }, - "in2": { - "uid": "30", - "scope": "LiteralConstant", - "type": "constant", - "datatype": "Int", - "value": 1 - } - }, - "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", - "type": "Move_scl", - "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/x1_to_json.py b/x1_to_json.py index 0a68b7d..92cc6e8 100644 --- a/x1_to_json.py +++ b/x1_to_json.py @@ -434,6 +434,6 @@ def convert_xml_to_json(xml_filepath, json_filepath): # --- Punto de Entrada Principal --- if __name__ == "__main__": - xml_file = 'BlenderRun_ProdTime.xml' - json_file = 'BlenderRun_ProdTime_simplified.json' + xml_file = 'BlenderCtrl_ProdModeInit.xml' + json_file = 'BlenderCtrl_ProdModeInit_simplified.json' convert_xml_to_json(xml_file, json_file) \ No newline at end of file diff --git a/x2_process.py b/x2_process.py index 01edaa9..1da9fa5 100644 --- a/x2_process.py +++ b/x2_process.py @@ -854,5 +854,5 @@ def process_json_to_scl(json_filepath): # --- Ejecución --- if __name__ == "__main__": - input_json_file = "BlenderRun_ProdTime_simplified.json" # Asegúrate que este es el generado por x1_to_json.py MODIFICADO + input_json_file = "BlenderCtrl_ProdModeInit_simplified.json" # Asegúrate que este es el generado por x1_to_json.py MODIFICADO process_json_to_scl(input_json_file)