diff --git a/BlenderCtrl_MFM Command.scl b/BlenderCtrl_MFM Command.scl new file mode 100644 index 0000000..246a6ea --- /dev/null +++ b/BlenderCtrl_MFM Command.scl @@ -0,0 +1,105 @@ +FUNCTION "BlenderCtrl_MFM Command" : Void +{ S7_Optimized_Access := 'FALSE' } +AUTHOR : 'Author' +FAMILY : TASK2 +NAME : 'Name' +VERSION : 1.0 + VAR_INPUT + mResetWaterTot : Bool; + mResetSyrupTot : Bool; + mResetCO2Tot : Bool; + mResetProductTot : Bool; + END_VAR + + VAR_TEMP + mWaterVFMCtrl : Int; + mSyrupMFMCtrl : Int; + mCO2MFMCtrl : Int; + mProductMFMCtrl : Int; + END_VAR + + +BEGIN + + + IF #mResetWaterTot THEN + #mWaterVFMCtrl := 1 ; + ELSE + #mWaterVFMCtrl := 0 ; + END_IF; + + IF #mResetSyrupTot THEN + #mSyrupMFMCtrl := 1 ; + ELSE + #mSyrupMFMCtrl := 0 ; + END_IF; + + IF #mResetCO2Tot THEN + #mCO2MFMCtrl := 1 ; + ELSE + #mCO2MFMCtrl := 0 ; + END_IF; + + IF #mResetProductTot THEN + #mProductMFMCtrl := 1 ; + ELSE + #mProductMFMCtrl := 0 ; + END_IF; + + CASE #mWaterVFMCtrl OF + 1: "P_FTN301_Tot_Ctrl" := 01; // Reset Totalizer + + 2: "P_FTN301_Tot_Ctrl" := 02 ; // Preset Totalizer + + ELSE: + "P_FTN301_Tot_Ctrl" := 00; + END_CASE; + + + IF "gSyrupRoomEn" THEN + CASE #mSyrupMFMCtrl OF + 1: "P_FTP302_Tot_Ctrl" := 01; (* Reset Totalizer 1*) + + 2: "P_FTP302_Tot_Ctrl" := 02; (* Reset Totalizer 2*) + + 3: "P_FTP302_Tot_Ctrl" := 03; (* Reset Totalizer 1 & 2*) + + 4: "P_FTP302_Tot_Ctrl" := 04; (* Zeropoint Adjust *) + + 5: "P_FTP302_Tot_Ctrl" := 05; (* Positive Zero Return *) + + 6: "P_FTP302_Tot_Ctrl" := 06; (* Negative Zero Return *) + + ELSE: + "P_FTP302_Tot_Ctrl" := 00; + END_CASE; + END_IF; + + CASE #mCO2MFMCtrl OF + 1: "P_FTM303_Tot_Ctrl" := 01; (* Reset Totalizer 1*) + + 2: "P_FTM303_Tot_Ctrl" := 02; (* Reset Totalizer 2 *) + + 3: "P_FTM303_Tot_Ctrl" := 03; (* Reset Totalizer 1 & 2*) + + 4: "P_FTM303_Tot_Ctrl" := 04; (* Zeropoint Adjust *) + + 5: "P_FTM303_Tot_Ctrl" := 05; (* Positive Zero Return *) + + 6: "P_FTM303_Tot_Ctrl" := 06; (* Negative Zero Return *) + ELSE: + "P_FTM303_Tot_Ctrl" := 00; + END_CASE; + + (*CASE mProductMFMCtrl OF + 1: gProductTotCtrl_Node17 := 01; (* Reset Totalizer 1*) + + 2: gProductTotCtrl_Node17 := 02 ; (* Preset Totalizer1 *) + + ELSE + gProductTotCtrl_Node17 := 00; + END_CASE;*) + + +END_FUNCTION + diff --git a/BlenderPIDCtrl__Loop.xml b/BlenderPIDCtrl__Loop.xml new file mode 100644 index 0000000..df42af2 --- /dev/null +++ b/BlenderPIDCtrl__Loop.xml @@ -0,0 +1,1711 @@ + + + + + + false + TASK1 + +
+
+
+
+ + + Time 1 Enable + + + + + Time 2 Enable + + + + + Time 3 Enable + + + + + Time 4 Enable + + + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + +
+
+
+ + Standard + BlenderPIDCtrl__Loop + + 1729 + LAD + false + + + + + + + it-IT + TASK1 PID + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + Read Analoc Inputs + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + Int + 1 + + + + + + + + + + + + + + + Int + 2 + + + + + + + + + + + + + + + Int + 3 + + + + + + + + + + + + + + + Int + 4 + + + + + + + + + + + + + + + Int + 5 + + + + + + + + + + + + + + + Int + 6 + + + + + + + + + + Int + + + + Int + + + + Int + + + + Int + + + + Int + + + + Int + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + PID Control Time Bit (300ms) + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + MIX - OB35 scan counter + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + Water PID +Syrup PID +CO2 PID + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + PID Call + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + PID Product Tank Pressure + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + Pid Call + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + Filling Head + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + CIp Heating PID + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LAD + + + + + + + it-IT + + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + it-IT + Write Analog Outputs + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + + + + + it-IT + PID CTRL LOOP + + + + + de-DE + + + + + + en-US + + + + + + es-ES + + + + + + fr-FR + + + + + + zh-CN + + + + + + ja-JP + + + + + + + + \ No newline at end of file diff --git a/BlenderPIDCtrl__Loop_simplified.json b/BlenderPIDCtrl__Loop_simplified.json new file mode 100644 index 0000000..d821711 --- /dev/null +++ b/BlenderPIDCtrl__Loop_simplified.json @@ -0,0 +1,1222 @@ +{ + "block_name": "BlenderPIDCtrl__Loop", + "block_number": 1729, + "language": "LAD", + "block_comment": "TASK1 PID", + "interface": { + "Static": [ + { + "name": "PID_1_300ms", + "datatype": "Bool" + }, + { + "name": "PID_2_300ms", + "datatype": "Bool" + }, + { + "name": "PID_3_300ms", + "datatype": "Bool" + }, + { + "name": "PID_4_300ms", + "datatype": "Bool" + }, + { + "name": "PID_5_300ms", + "datatype": "Bool" + }, + { + "name": "PID_6_300ms", + "datatype": "Bool" + }, + { + "name": "Flow_Meter_Error_RETVAL", + "datatype": "Real" + }, + { + "name": "PID_FF_Calc", + "datatype": "\"BlenderPID_PIDFFCalc\"" + }, + { + "name": "PID_Blending_Fault", + "datatype": "\"BlenderPID_BlendingFault\"" + }, + { + "name": "PID_Save_Integral", + "datatype": "\"BlenderPIDCtrl_SaveInteg\"" + }, + { + "name": "PID_Monitor", + "datatype": "\"BlenderPIDCtrl_Monitor\"" + }, + { + "name": "Read_AnalogInput", + "datatype": "\"BlenderPIDCtrl_ReadAnIn\"" + } + ] + }, + "networks": [ + { + "id": "9", + "title": "Read Analoc Inputs", + "comment": "", + "logic": [ + { + "instruction_uid": "21", + "uid": "21", + "type": "Call", + "block_name": "BlenderPIDCtrl_ReadAnIn", + "block_type": "FB", + "instance_db": "\"Read_AnalogInput\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "powerrail" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "1A", + "title": "MIX - OB35 scan counter", + "comment": "PID Control Time Bit (300ms)", + "logic": [ + { + "instruction_uid": "40", + "uid": "40", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX TRUE\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "41", + "uid": "41", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "23", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 1 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "42", + "uid": "42", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "41", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_1_300ms\"" + } + }, + "outputs": {} + }, + { + "instruction_uid": "43", + "uid": "43", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "26", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 2 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "44", + "uid": "44", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "43", + "source_pin": "out" + }, + "operand": { + "uid": "27", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_2_300ms\"" + } + }, + "outputs": {} + }, + { + "instruction_uid": "45", + "uid": "45", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "28", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "29", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 3 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "46", + "uid": "46", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "45", + "source_pin": "out" + }, + "operand": { + "uid": "30", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_3_300ms\"" + } + }, + "outputs": {} + }, + { + "instruction_uid": "47", + "uid": "47", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "31", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "32", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 4 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "48", + "uid": "48", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "47", + "source_pin": "out" + }, + "operand": { + "uid": "33", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_4_300ms\"" + } + }, + "outputs": {} + }, + { + "instruction_uid": "49", + "uid": "49", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "34", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "35", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 5 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "50", + "uid": "50", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "49", + "source_pin": "out" + }, + "operand": { + "uid": "36", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_5_300ms\"" + } + }, + "outputs": {} + }, + { + "instruction_uid": "51", + "uid": "51", + "type": "Eq", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "37", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "38", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 6 + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "52", + "uid": "52", + "type": "Coil", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "51", + "source_pin": "out" + }, + "operand": { + "uid": "39", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_6_300ms\"" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "2B", + "title": "PID Call", + "comment": "Water PID\nSyrup PID\nCO2 PID", + "logic": [ + { + "instruction_uid": "27", + "uid": "27", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_1_300ms\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM301\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "29", + "uid": "29", + "type": "Call", + "block_name": "PID_RMM301", + "block_type": "FB", + "instance_db": "\"PID_RMM301_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "28", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "31", + "uid": "31", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMP302\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "32", + "uid": "32", + "type": "Call", + "block_name": "PID_RMP302", + "block_type": "FB", + "instance_db": "\"PID_RMP302_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "31", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "34", + "uid": "34", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM303\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "35", + "uid": "35", + "type": "Call", + "block_name": "PID_RMM303", + "block_type": "FB", + "instance_db": "\"PID_RMM303_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "34", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "37", + "uid": "37", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM304\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "38", + "uid": "38", + "type": "Call", + "block_name": "PID_RMM304", + "block_type": "FB", + "instance_db": "\"PID_RMM304_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "37", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "40", + "uid": "40", + "type": "Call", + "block_name": "BlenderPID_PIDFFCalc", + "block_type": "FB", + "instance_db": "\"PID_FF_Calc\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "42", + "uid": "42", + "type": "Call", + "block_name": "BlenderPID_BlendingFault", + "block_type": "FB", + "instance_db": "\"PID_Blending_Fault\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "44", + "uid": "44", + "type": "Call", + "block_name": "BlenderPID_FlowMeterErro", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "45", + "uid": "45", + "type": "Call", + "block_name": "BlenderPIDCtrl_Monitor", + "block_type": "FB", + "instance_db": "\"PID_Monitor\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "47", + "uid": "47", + "type": "Call", + "block_name": "BlenderPIDCtrl_SaveInteg", + "block_type": "FB", + "instance_db": "\"PID_Save_Integral\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "49", + "uid": "49", + "type": "Call", + "block_name": "BlenderPIDCtrl_SaveValve", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "3C", + "title": "PID Product Tank Pressure", + "comment": "", + "logic": [ + { + "instruction_uid": "23", + "uid": "23", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_2_300ms\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "23", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVM301\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Call", + "block_name": "PID_RVM301", + "block_type": "FB", + "instance_db": "\"PID_RVM301_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Call", + "block_name": "BlenderPIDCtrl_PresRelea", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "4D", + "title": "Pid Call", + "comment": "", + "logic": [ + { + "instruction_uid": "26", + "uid": "26", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_4_300ms\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVM319_PRD\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "Call", + "block_name": "PID_RVM319_PRD", + "block_type": "FB", + "instance_db": "\"PID_RVM319_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "30", + "uid": "30", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVP303\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "31", + "uid": "31", + "type": "Call", + "block_name": "PID_RVP303", + "block_type": "FB", + "instance_db": "\"PID_RVP303_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "30", + "source_pin": "out" + } + }, + "outputs": {} + }, + { + "instruction_uid": "33", + "uid": "33", + "type": "Contact", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVN302\".\"ConfigPID\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "34", + "uid": "34", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "33", + "source_pin": "out" + }, + "operand": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVN302\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "35", + "uid": "35", + "type": "Call", + "block_name": "PID_RVN302", + "block_type": "FB", + "instance_db": "\"PID_RVN302_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "34", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "5E", + "title": "Filling Head", + "comment": "", + "logic": [ + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_BlendFillSystem\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_5_300ms\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "26", + "uid": "26", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"PPM303\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Call", + "block_name": "PID_Filling_Head", + "block_type": "FB", + "instance_db": "\"PID_Filling_Head_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "6F", + "title": "CIp Heating PID", + "comment": "", + "logic": [ + { + "instruction_uid": "23", + "uid": "23", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_6_300ms\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "23", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVS318\".\"Config\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Call", + "block_name": "PID_RVS318", + "block_type": "FB", + "instance_db": "\"PID_RVS318_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + }, + { + "id": "80", + "title": "Write Analog Outputs", + "comment": "", + "logic": [ + { + "instruction_uid": "22", + "uid": "22", + "type": "Contact", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX TRUE\"" + } + }, + "outputs": { + "out": [] + } + }, + { + "instruction_uid": "23", + "uid": "23", + "type": "Call", + "block_name": "BlenderPIDCtrl_WriteAnOu", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "22", + "source_pin": "out" + } + }, + "outputs": {} + } + ], + "language": "LAD" + } + ] +} \ No newline at end of file diff --git a/BlenderPIDCtrl__Loop_simplified_processed.json b/BlenderPIDCtrl__Loop_simplified_processed.json new file mode 100644 index 0000000..211aaed --- /dev/null +++ b/BlenderPIDCtrl__Loop_simplified_processed.json @@ -0,0 +1,1280 @@ +{ + "block_name": "BlenderPIDCtrl__Loop", + "block_number": 1729, + "language": "LAD", + "block_comment": "TASK1 PID", + "interface": { + "Static": [ + { + "name": "PID_1_300ms", + "datatype": "Bool" + }, + { + "name": "PID_2_300ms", + "datatype": "Bool" + }, + { + "name": "PID_3_300ms", + "datatype": "Bool" + }, + { + "name": "PID_4_300ms", + "datatype": "Bool" + }, + { + "name": "PID_5_300ms", + "datatype": "Bool" + }, + { + "name": "PID_6_300ms", + "datatype": "Bool" + }, + { + "name": "Flow_Meter_Error_RETVAL", + "datatype": "Real" + }, + { + "name": "PID_FF_Calc", + "datatype": "\"BlenderPID_PIDFFCalc\"" + }, + { + "name": "PID_Blending_Fault", + "datatype": "\"BlenderPID_BlendingFault\"" + }, + { + "name": "PID_Save_Integral", + "datatype": "\"BlenderPIDCtrl_SaveInteg\"" + }, + { + "name": "PID_Monitor", + "datatype": "\"BlenderPIDCtrl_Monitor\"" + }, + { + "name": "Read_AnalogInput", + "datatype": "\"BlenderPIDCtrl_ReadAnIn\"" + } + ] + }, + "networks": [ + { + "id": "9", + "title": "Read Analoc Inputs", + "comment": "", + "logic": [ + { + "instruction_uid": "21", + "uid": "21", + "type": "Call_FB_sympy_processed", + "block_name": "BlenderPIDCtrl_ReadAnIn", + "block_type": "FB", + "instance_db": "\"Read_AnalogInput\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "powerrail" + } + }, + "outputs": {}, + "scl": "\"Read_AnalogInput\"();" + } + ], + "language": "LAD" + }, + { + "id": "1A", + "title": "MIX - OB35 scan counter", + "comment": "PID Control Time Bit (300ms)", + "logic": [ + { + "instruction_uid": "40", + "uid": "40", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX TRUE\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v0_" + }, + { + "instruction_uid": "41", + "uid": "41", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "23", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 1 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 1)" + }, + { + "instruction_uid": "42", + "uid": "42", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "41", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_1_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_1_300ms\" := Eq(\"MW1968\", 1);" + }, + { + "instruction_uid": "43", + "uid": "43", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "26", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 2 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 2)" + }, + { + "instruction_uid": "44", + "uid": "44", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "43", + "source_pin": "out" + }, + "operand": { + "uid": "27", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_2_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_2_300ms\" := Eq(\"MW1968\", 2);" + }, + { + "instruction_uid": "45", + "uid": "45", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "28", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "29", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 3 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 3)" + }, + { + "instruction_uid": "46", + "uid": "46", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "45", + "source_pin": "out" + }, + "operand": { + "uid": "30", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_3_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_3_300ms\" := Eq(\"MW1968\", 3);" + }, + { + "instruction_uid": "47", + "uid": "47", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "31", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "32", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 4 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 4)" + }, + { + "instruction_uid": "48", + "uid": "48", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "47", + "source_pin": "out" + }, + "operand": { + "uid": "33", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_4_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_4_300ms\" := Eq(\"MW1968\", 4);" + }, + { + "instruction_uid": "49", + "uid": "49", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "34", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "35", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 5 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 5)" + }, + { + "instruction_uid": "50", + "uid": "50", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "49", + "source_pin": "out" + }, + "operand": { + "uid": "36", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_5_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_5_300ms\" := Eq(\"MW1968\", 5);" + }, + { + "instruction_uid": "51", + "uid": "51", + "type": "Eq_sympy_processed", + "template_values": { + "SrcType": "Type" + }, + "negated_pins": {}, + "inputs": { + "pre": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "40", + "source_pin": "out" + }, + "in1": { + "uid": "37", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"MW1968\"" + }, + "in2": { + "uid": "38", + "scope": "LiteralConstant", + "type": "constant", + "datatype": "Int", + "value": 6 + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy EQ: Eq(v18_, 6)" + }, + { + "instruction_uid": "52", + "uid": "52", + "type": "Coil_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Eq", + "source_instruction_uid": "51", + "source_pin": "out" + }, + "operand": { + "uid": "39", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_6_300ms\"" + } + }, + "outputs": {}, + "scl": "\"PID_6_300ms\" := Eq(\"MW1968\", 6);" + } + ], + "language": "LAD" + }, + { + "id": "2B", + "title": "PID Call", + "comment": "Water PID\nSyrup PID\nCO2 PID", + "logic": [ + { + "instruction_uid": "27", + "uid": "27", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_1_300ms\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "IF \"PID_1_300ms\" THEN\n \"PID_FF_Calc\"();\n \"PID_Blending_Fault\"();\n BlenderPID_FlowMeterErro();\n \"PID_Monitor\"();\n \"PID_Save_Integral\"();\n BlenderPIDCtrl_SaveValve();\nEND_IF;" + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM301\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v1_ & v2_" + }, + { + "instruction_uid": "29", + "uid": "29", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RMM301", + "block_type": "FB", + "instance_db": "\"PID_RMM301_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "28", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_1_300ms\" AND \"HMI_PID\".\"RMM301\".\"Config\" THEN\n \"PID_RMM301_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "31", + "uid": "31", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMP302\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v1_ & v3_" + }, + { + "instruction_uid": "32", + "uid": "32", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RMP302", + "block_type": "FB", + "instance_db": "\"PID_RMP302_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "31", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_1_300ms\" AND \"HMI_PID\".\"RMP302\".\"Config\" THEN\n \"PID_RMP302_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "34", + "uid": "34", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM303\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v1_ & v4_" + }, + { + "instruction_uid": "35", + "uid": "35", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RMM303", + "block_type": "FB", + "instance_db": "\"PID_RMM303_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "34", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_1_300ms\" AND \"HMI_PID\".\"RMM303\".\"Config\" THEN\n \"PID_RMM303_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "37", + "uid": "37", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + }, + "operand": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RMM304\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v1_ & v5_" + }, + { + "instruction_uid": "38", + "uid": "38", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RMM304", + "block_type": "FB", + "instance_db": "\"PID_RMM304_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "37", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_1_300ms\" AND \"HMI_PID\".\"RMM304\".\"Config\" THEN\n \"PID_RMM304_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "40", + "uid": "40", + "type": "Call_FB_sympy_processed", + "block_name": "BlenderPID_PIDFFCalc", + "block_type": "FB", + "instance_db": "\"PID_FF_Calc\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + }, + { + "instruction_uid": "42", + "uid": "42", + "type": "Call_FB_sympy_processed", + "block_name": "BlenderPID_BlendingFault", + "block_type": "FB", + "instance_db": "\"PID_Blending_Fault\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + }, + { + "instruction_uid": "44", + "uid": "44", + "type": "Call_FC_sympy_processed", + "block_name": "BlenderPID_FlowMeterErro", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + }, + { + "instruction_uid": "45", + "uid": "45", + "type": "Call_FB_sympy_processed", + "block_name": "BlenderPIDCtrl_Monitor", + "block_type": "FB", + "instance_db": "\"PID_Monitor\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + }, + { + "instruction_uid": "47", + "uid": "47", + "type": "Call_FB_sympy_processed", + "block_name": "BlenderPIDCtrl_SaveInteg", + "block_type": "FB", + "instance_db": "\"PID_Save_Integral\"", + "instance_scope": "LocalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + }, + { + "instruction_uid": "49", + "uid": "49", + "type": "Call_FC_sympy_processed", + "block_name": "BlenderPIDCtrl_SaveValve", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 27)", + "grouped": true + } + ], + "language": "LAD" + }, + { + "id": "3C", + "title": "PID Product Tank Pressure", + "comment": "", + "logic": [ + { + "instruction_uid": "23", + "uid": "23", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_2_300ms\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v6_" + }, + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "23", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVM301\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "IF \"PID_2_300ms\" AND \"HMI_PID\".\"RVM301\".\"Config\" THEN\n \"PID_RVM301_Data\"();\n BlenderPIDCtrl_PresRelea();\nEND_IF;" + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RVM301", + "block_type": "FB", + "instance_db": "\"PID_RVM301_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 24)", + "grouped": true + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Call_FC_sympy_processed", + "block_name": "BlenderPIDCtrl_PresRelea", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "// Logic included in grouped IF (by UID 24)", + "grouped": true + } + ], + "language": "LAD" + }, + { + "id": "4D", + "title": "Pid Call", + "comment": "", + "logic": [ + { + "instruction_uid": "26", + "uid": "26", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_4_300ms\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v8_" + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVM319_PRD\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v8_ & v9_" + }, + { + "instruction_uid": "28", + "uid": "28", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RVM319_PRD", + "block_type": "FB", + "instance_db": "\"PID_RVM319_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "27", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_4_300ms\" AND \"HMI_PID\".\"RVM319_PRD\".\"Config\" THEN\n \"PID_RVM319_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "30", + "uid": "30", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVP303\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v10_ & v8_" + }, + { + "instruction_uid": "31", + "uid": "31", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RVP303", + "block_type": "FB", + "instance_db": "\"PID_RVP303_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "30", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"HMI_PID\".\"RVP303\".\"Config\" AND \"PID_4_300ms\" THEN\n \"PID_RVP303_Data\"();\nEND_IF;" + }, + { + "instruction_uid": "33", + "uid": "33", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": { + "operand": true + }, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + }, + "operand": { + "uid": "24", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVN302\".\"ConfigPID\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v8_ & ~v11_" + }, + { + "instruction_uid": "34", + "uid": "34", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "33", + "source_pin": "out" + }, + "operand": { + "uid": "25", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVN302\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v12_ & v8_ & ~v11_" + }, + { + "instruction_uid": "35", + "uid": "35", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RVN302", + "block_type": "FB", + "instance_db": "\"PID_RVN302_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "34", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"HMI_PID\".\"RVN302\".\"Config\" AND \"PID_4_300ms\" AND NOT \"HMI_PID\".\"RVN302\".\"ConfigPID\" THEN\n \"PID_RVN302_Data\"();\nEND_IF;" + } + ], + "language": "LAD" + }, + { + "id": "5E", + "title": "Filling Head", + "comment": "", + "logic": [ + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_BlendFillSystem\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v13_" + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_5_300ms\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v13_ & v14_" + }, + { + "instruction_uid": "26", + "uid": "26", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "25", + "source_pin": "out" + }, + "operand": { + "uid": "23", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"PPM303\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v13_ & v14_ & v15_" + }, + { + "instruction_uid": "27", + "uid": "27", + "type": "Call_FB_sympy_processed", + "block_name": "PID_Filling_Head", + "block_type": "FB", + "instance_db": "\"PID_Filling_Head_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "26", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"HMI_Blender_Parameters\".\"Processor_Options\".\"Blender_OPT\".\"_BlendFillSystem\" AND \"PID_5_300ms\" AND \"HMI_PID\".\"PPM303\".\"Config\" THEN\n \"PID_Filling_Head_Data\"();\nEND_IF;" + } + ], + "language": "LAD" + }, + { + "id": "6F", + "title": "CIp Heating PID", + "comment": "", + "logic": [ + { + "instruction_uid": "23", + "uid": "23", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "LocalVariable", + "type": "variable", + "name": "\"PID_6_300ms\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v16_" + }, + { + "instruction_uid": "24", + "uid": "24", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "23", + "source_pin": "out" + }, + "operand": { + "uid": "22", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"HMI_PID\".\"RVS318\".\"Config\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v16_ & v17_" + }, + { + "instruction_uid": "25", + "uid": "25", + "type": "Call_FB_sympy_processed", + "block_name": "PID_RVS318", + "block_type": "FB", + "instance_db": "\"PID_RVS318_Data\"", + "instance_scope": "GlobalVariable", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "24", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"PID_6_300ms\" AND \"HMI_PID\".\"RVS318\".\"Config\" THEN\n \"PID_RVS318_Data\"();\nEND_IF;" + } + ], + "language": "LAD" + }, + { + "id": "80", + "title": "Write Analog Outputs", + "comment": "", + "logic": [ + { + "instruction_uid": "22", + "uid": "22", + "type": "Contact_sympy_processed", + "template_values": {}, + "negated_pins": {}, + "inputs": { + "in": { + "type": "powerrail" + }, + "operand": { + "uid": "21", + "scope": "GlobalVariable", + "type": "variable", + "name": "\"AUX TRUE\"" + } + }, + "outputs": { + "out": [] + }, + "scl": "// SymPy Contact: v0_" + }, + { + "instruction_uid": "23", + "uid": "23", + "type": "Call_FC_sympy_processed", + "block_name": "BlenderPIDCtrl_WriteAnOu", + "block_type": "FC", + "inputs": { + "en": { + "type": "connection", + "source_instruction_type": "Contact", + "source_instruction_uid": "22", + "source_pin": "out" + } + }, + "outputs": {}, + "scl": "IF \"AUX TRUE\" THEN\n BlenderPIDCtrl_WriteAnOu();\nEND_IF;" + } + ], + "language": "LAD" + } + ] +} \ No newline at end of file diff --git a/BlenderPIDCtrl__Loop_simplified_processed.scl b/BlenderPIDCtrl__Loop_simplified_processed.scl new file mode 100644 index 0000000..dd941e0 --- /dev/null +++ b/BlenderPIDCtrl__Loop_simplified_processed.scl @@ -0,0 +1,107 @@ +// Block Name (Original): BlenderPIDCtrl__Loop +// Block Number: 1729 +// Original Language: LAD +// Block Comment: TASK1 PID + +FUNCTION_BLOCK "BlenderPIDCtrl__Loop" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + +VAR_STAT_STATIC + PID_1_300ms : Bool; + PID_2_300ms : Bool; + PID_3_300ms : Bool; + PID_4_300ms : Bool; + PID_5_300ms : Bool; + PID_6_300ms : Bool; + Flow_Meter_Error_RETVAL : Real; + PID_FF_Calc : "BlenderPID_PIDFFCalc"; + PID_Blending_Fault : "BlenderPID_BlendingFault"; + PID_Save_Integral : "BlenderPIDCtrl_SaveInteg"; + PID_Monitor : "BlenderPIDCtrl_Monitor"; + Read_AnalogInput : "BlenderPIDCtrl_ReadAnIn"; +END_VAR + +VAR_TEMP +END_VAR + +BEGIN + + // Network 1: Read Analoc Inputs (Original Language: LAD) + + "Read_AnalogInput"(); + + // Network 2: MIX - OB35 scan counter (Original Language: LAD) + // PID Control Time Bit (300ms) + + "PID_1_300ms" := Eq("MW1968", 1); + "PID_2_300ms" := Eq("MW1968", 2); + "PID_3_300ms" := Eq("MW1968", 3); + "PID_4_300ms" := Eq("MW1968", 4); + "PID_5_300ms" := Eq("MW1968", 5); + "PID_6_300ms" := Eq("MW1968", 6); + + // Network 3: PID Call (Original Language: LAD) + // Water PID + // Syrup PID + // CO2 PID + + IF "PID_1_300ms" THEN + "PID_FF_Calc"(); + "PID_Blending_Fault"(); + BlenderPID_FlowMeterErro(); + "PID_Monitor"(); + "PID_Save_Integral"(); + BlenderPIDCtrl_SaveValve(); + END_IF; + IF "PID_1_300ms" AND "HMI_PID"."RMM301"."Config" THEN + "PID_RMM301_Data"(); + END_IF; + IF "PID_1_300ms" AND "HMI_PID"."RMP302"."Config" THEN + "PID_RMP302_Data"(); + END_IF; + IF "PID_1_300ms" AND "HMI_PID"."RMM303"."Config" THEN + "PID_RMM303_Data"(); + END_IF; + IF "PID_1_300ms" AND "HMI_PID"."RMM304"."Config" THEN + "PID_RMM304_Data"(); + END_IF; + + // Network 4: PID Product Tank Pressure (Original Language: LAD) + + IF "PID_2_300ms" AND "HMI_PID"."RVM301"."Config" THEN + "PID_RVM301_Data"(); + BlenderPIDCtrl_PresRelea(); + END_IF; + + // Network 5: Pid Call (Original Language: LAD) + + IF "PID_4_300ms" AND "HMI_PID"."RVM319_PRD"."Config" THEN + "PID_RVM319_Data"(); + END_IF; + IF "HMI_PID"."RVP303"."Config" AND "PID_4_300ms" THEN + "PID_RVP303_Data"(); + END_IF; + IF "HMI_PID"."RVN302"."Config" AND "PID_4_300ms" AND NOT "HMI_PID"."RVN302"."ConfigPID" THEN + "PID_RVN302_Data"(); + END_IF; + + // Network 6: Filling Head (Original Language: LAD) + + IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "PID_5_300ms" AND "HMI_PID"."PPM303"."Config" THEN + "PID_Filling_Head_Data"(); + END_IF; + + // Network 7: CIp Heating PID (Original Language: LAD) + + IF "PID_6_300ms" AND "HMI_PID"."RVS318"."Config" THEN + "PID_RVS318_Data"(); + END_IF; + + // Network 8: Write Analog Outputs (Original Language: LAD) + + IF "AUX TRUE" THEN + BlenderPIDCtrl_WriteAnOu(); + END_IF; + +END_FUNCTION_BLOCK diff --git a/TestLAD_simplified.json b/TestLAD_simplified.json index 2ef1ac5..dcf9034 100644 --- a/TestLAD_simplified.json +++ b/TestLAD_simplified.json @@ -55,7 +55,7 @@ { "instruction_uid": "SCL_9", "type": "RAW_SCL_CHUNK", - "scl": "IF \"Blender_Variables\".gSP_H2O <> 0 THEN\n \"Blender_Variables\".gWaterVFMCalcError := \"Blender_Variables\".gWaterVFMMeasError / 100 * \"Blender_Variables\".gSP_H2O;\nEND_IF;\nIF \"Blender_Variables\".gSP_SYR <> 0 THEN\n \"Blender_Variables\".gSyrupMFMCalcError := (\"Blender_Variables\".gSyrupMFMMeasError / 100 + (\"Blender_Variables\".gSyrupMFMZeroStab / (\"Blender_Variables\".gSP_SYR * 60)) / 100) * \"Blender_Variables\".gSP_SYR;\nEND_IF;\nIF \"Blender_Variables\".gSP_CO2 <> 0 THEN\n \"Blender_Variables\".gCO2MFMCalcError := (\"Blender_Variables\".gCO2MFMMeasError / 100 + (\"Blender_Variables\".gCO2MFMZeroStab / (\"Blender_Variables\".gSP_CO2 * 60 / 1000)) / 100) * \"Blender_Variables\".gSP_CO2;\nEND_IF;\n\"mWaterMaxFlow\" := \"Blender_Variables\".gSP_H2O + \"Blender_Variables\".gWaterVFMCalcError;\n\"mWaterMinFlow\" := \"Blender_Variables\".gSP_H2O - \"Blender_Variables\".gWaterVFMCalcError;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mSyrupMaxFlow\" := (\"Blender_Variables\".gSP_SYR + \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\n \"mSyrupMinFlow\" := (\"Blender_Variables\".gSP_SYR - \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\nEND_IF;\nIF \"mSyrupMaxFlow\" <> 0 THEN\n \"mMinRatio\" := \"mWaterMinFlow\" / \"mSyrupMaxFlow\";\nEND_IF;\nIF \"mSyrupMinFlow\" <> 0 THEN\n \"mMaxRatio\" := \"mWaterMaxFlow\" / \"mSyrupMinFlow\";\nEND_IF;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mBevBrixMax\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMinRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\n \"mBevBrixMin\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMaxRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\nEND_IF;\n\"Blender_Variables\".gBlenderBlendMaxError := \"mBevBrixMax\" - \"mBevBrixMin\";\n\"TestLAD\" := \"Blender_Variables\".gBlenderBlendMaxError;" + "scl": "IF \"Blender_Variables\".gSP_H2O <> 0 THEN\n \"Blender_Variables\".gWaterVFMCalcError := \"Blender_Variables\".gWaterVFMMeasError / 100 * \"Blender_Variables\".gSP_H2O;\nEND_IF;\nIF \"Blender_Variables\".gSP_SYR <> 0 THEN\n \"Blender_Variables\".gSyrupMFMCalcError := (\"Blender_Variables\".gSyrupMFMMeasError / 100 + (\"Blender_Variables\".gSyrupMFMZeroStab / (\"Blender_Variables\".gSP_SYR * 60)) / 100) * \"Blender_Variables\".gSP_SYR;\nEND_IF;\nIF \"Blender_Variables\".gSP_CO2 <> 0 THEN\n \"Blender_Variables\".gCO2MFMCalcError := (\"Blender_Variables\".gCO2MFMMeasError / 100 + (\"Blender_Variables\".gCO2MFMZeroStab / (\"Blender_Variables\".gSP_CO2 * 60 / 1000)) / 100) * \"Blender_Variables\".gSP_CO2;\nEND_IF;\n\"mWaterMaxFlow\" := \"Blender_Variables\".gSP_H2O + \"Blender_Variables\".gWaterVFMCalcError;\n\"mWaterMinFlow\" := \"Blender_Variables\".gSP_H2O - \"Blender_Variables\".gWaterVFMCalcError;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mSyrupMaxFlow\" := (\"Blender_Variables\".gSP_SYR + \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\n \"mSyrupMinFlow\" := (\"Blender_Variables\".gSP_SYR - \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\nEND_IF;\nIF \"mSyrupMaxFlow\" <> 0 THEN\n \"mMinRatio\" := \"mWaterMinFlow\" / \"mSyrupMaxFlow\";\nEND_IF;\nIF \"mSyrupMinFlow\" <> 0 THEN\n \"mMaxRatio\" := \"mWaterMaxFlow\" / \"mSyrupMinFlow\";\nEND_IF;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mBevBrixMax\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMinRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\n \"mBevBrixMin\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMaxRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\nEND_IF;\n\"Blender_Variables\".gBlenderBlendMaxError := \"mBevBrixMax\" - \"mBevBrixMin\";\n\"TestLAD\" := \"Blender_Variables\".gBlenderBlendMaxError;" } ] } diff --git a/TestLAD_simplified_processed.json b/TestLAD_simplified_processed.json index 2ef1ac5..dcf9034 100644 --- a/TestLAD_simplified_processed.json +++ b/TestLAD_simplified_processed.json @@ -55,7 +55,7 @@ { "instruction_uid": "SCL_9", "type": "RAW_SCL_CHUNK", - "scl": "IF \"Blender_Variables\".gSP_H2O <> 0 THEN\n \"Blender_Variables\".gWaterVFMCalcError := \"Blender_Variables\".gWaterVFMMeasError / 100 * \"Blender_Variables\".gSP_H2O;\nEND_IF;\nIF \"Blender_Variables\".gSP_SYR <> 0 THEN\n \"Blender_Variables\".gSyrupMFMCalcError := (\"Blender_Variables\".gSyrupMFMMeasError / 100 + (\"Blender_Variables\".gSyrupMFMZeroStab / (\"Blender_Variables\".gSP_SYR * 60)) / 100) * \"Blender_Variables\".gSP_SYR;\nEND_IF;\nIF \"Blender_Variables\".gSP_CO2 <> 0 THEN\n \"Blender_Variables\".gCO2MFMCalcError := (\"Blender_Variables\".gCO2MFMMeasError / 100 + (\"Blender_Variables\".gCO2MFMZeroStab / (\"Blender_Variables\".gSP_CO2 * 60 / 1000)) / 100) * \"Blender_Variables\".gSP_CO2;\nEND_IF;\n\"mWaterMaxFlow\" := \"Blender_Variables\".gSP_H2O + \"Blender_Variables\".gWaterVFMCalcError;\n\"mWaterMinFlow\" := \"Blender_Variables\".gSP_H2O - \"Blender_Variables\".gWaterVFMCalcError;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mSyrupMaxFlow\" := (\"Blender_Variables\".gSP_SYR + \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\n \"mSyrupMinFlow\" := (\"Blender_Variables\".gSP_SYR - \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\nEND_IF;\nIF \"mSyrupMaxFlow\" <> 0 THEN\n \"mMinRatio\" := \"mWaterMinFlow\" / \"mSyrupMaxFlow\";\nEND_IF;\nIF \"mSyrupMinFlow\" <> 0 THEN\n \"mMaxRatio\" := \"mWaterMaxFlow\" / \"mSyrupMinFlow\";\nEND_IF;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mBevBrixMax\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMinRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\n \"mBevBrixMin\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMaxRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\nEND_IF;\n\"Blender_Variables\".gBlenderBlendMaxError := \"mBevBrixMax\" - \"mBevBrixMin\";\n\"TestLAD\" := \"Blender_Variables\".gBlenderBlendMaxError;" + "scl": "IF \"Blender_Variables\".gSP_H2O <> 0 THEN\n \"Blender_Variables\".gWaterVFMCalcError := \"Blender_Variables\".gWaterVFMMeasError / 100 * \"Blender_Variables\".gSP_H2O;\nEND_IF;\nIF \"Blender_Variables\".gSP_SYR <> 0 THEN\n \"Blender_Variables\".gSyrupMFMCalcError := (\"Blender_Variables\".gSyrupMFMMeasError / 100 + (\"Blender_Variables\".gSyrupMFMZeroStab / (\"Blender_Variables\".gSP_SYR * 60)) / 100) * \"Blender_Variables\".gSP_SYR;\nEND_IF;\nIF \"Blender_Variables\".gSP_CO2 <> 0 THEN\n \"Blender_Variables\".gCO2MFMCalcError := (\"Blender_Variables\".gCO2MFMMeasError / 100 + (\"Blender_Variables\".gCO2MFMZeroStab / (\"Blender_Variables\".gSP_CO2 * 60 / 1000)) / 100) * \"Blender_Variables\".gSP_CO2;\nEND_IF;\n\"mWaterMaxFlow\" := \"Blender_Variables\".gSP_H2O + \"Blender_Variables\".gWaterVFMCalcError;\n\"mWaterMinFlow\" := \"Blender_Variables\".gSP_H2O - \"Blender_Variables\".gWaterVFMCalcError;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mSyrupMaxFlow\" := (\"Blender_Variables\".gSP_SYR + \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\n \"mSyrupMinFlow\" := (\"Blender_Variables\".gSP_SYR - \"Blender_Variables\".gSyrupMFMCalcError) / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity;\nEND_IF;\nIF \"mSyrupMaxFlow\" <> 0 THEN\n \"mMinRatio\" := \"mWaterMinFlow\" / \"mSyrupMaxFlow\";\nEND_IF;\nIF \"mSyrupMinFlow\" <> 0 THEN\n \"mMaxRatio\" := \"mWaterMaxFlow\" / \"mSyrupMinFlow\";\nEND_IF;\nIF \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN\n \"mBevBrixMax\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMinRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\n \"mBevBrixMin\" := \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupBrix / ((\"mMaxRatio\" / \"HMI_Blender_Parameters\".Actual_Recipe_Parameters._SyrupDensity) + 1);\nEND_IF;\n\"Blender_Variables\".gBlenderBlendMaxError := \"mBevBrixMax\" - \"mBevBrixMin\";\n\"TestLAD\" := \"Blender_Variables\".gBlenderBlendMaxError;" } ] } diff --git a/TestLAD_simplified_processed.scl b/TestLAD_simplified_processed.scl index 08b6a4e..e94f0b1 100644 --- a/TestLAD_simplified_processed.scl +++ b/TestLAD_simplified_processed.scl @@ -26,29 +26,29 @@ BEGIN // Network 1: (Original Language: SCL) IF "Blender_Variables".gSP_H2O <> 0 THEN - "Blender_Variables".gWaterVFMCalcError := "Blender_Variables".gWaterVFMMeasError / 100 * "Blender_Variables".gSP_H2O; + "Blender_Variables".gWaterVFMCalcError := "Blender_Variables".gWaterVFMMeasError / 100 * "Blender_Variables".gSP_H2O; END_IF; IF "Blender_Variables".gSP_SYR <> 0 THEN - "Blender_Variables".gSyrupMFMCalcError := ("Blender_Variables".gSyrupMFMMeasError / 100 + ("Blender_Variables".gSyrupMFMZeroStab / ("Blender_Variables".gSP_SYR * 60)) / 100) * "Blender_Variables".gSP_SYR; + "Blender_Variables".gSyrupMFMCalcError := ("Blender_Variables".gSyrupMFMMeasError / 100 + ("Blender_Variables".gSyrupMFMZeroStab / ("Blender_Variables".gSP_SYR * 60)) / 100) * "Blender_Variables".gSP_SYR; END_IF; IF "Blender_Variables".gSP_CO2 <> 0 THEN - "Blender_Variables".gCO2MFMCalcError := ("Blender_Variables".gCO2MFMMeasError / 100 + ("Blender_Variables".gCO2MFMZeroStab / ("Blender_Variables".gSP_CO2 * 60 / 1000)) / 100) * "Blender_Variables".gSP_CO2; + "Blender_Variables".gCO2MFMCalcError := ("Blender_Variables".gCO2MFMMeasError / 100 + ("Blender_Variables".gCO2MFMZeroStab / ("Blender_Variables".gSP_CO2 * 60 / 1000)) / 100) * "Blender_Variables".gSP_CO2; END_IF; "mWaterMaxFlow" := "Blender_Variables".gSP_H2O + "Blender_Variables".gWaterVFMCalcError; "mWaterMinFlow" := "Blender_Variables".gSP_H2O - "Blender_Variables".gWaterVFMCalcError; IF "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN - "mSyrupMaxFlow" := ("Blender_Variables".gSP_SYR + "Blender_Variables".gSyrupMFMCalcError) / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity; - "mSyrupMinFlow" := ("Blender_Variables".gSP_SYR - "Blender_Variables".gSyrupMFMCalcError) / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity; + "mSyrupMaxFlow" := ("Blender_Variables".gSP_SYR + "Blender_Variables".gSyrupMFMCalcError) / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity; + "mSyrupMinFlow" := ("Blender_Variables".gSP_SYR - "Blender_Variables".gSyrupMFMCalcError) / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity; END_IF; IF "mSyrupMaxFlow" <> 0 THEN - "mMinRatio" := "mWaterMinFlow" / "mSyrupMaxFlow"; + "mMinRatio" := "mWaterMinFlow" / "mSyrupMaxFlow"; END_IF; IF "mSyrupMinFlow" <> 0 THEN - "mMaxRatio" := "mWaterMaxFlow" / "mSyrupMinFlow"; + "mMaxRatio" := "mWaterMaxFlow" / "mSyrupMinFlow"; END_IF; IF "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity <> 0 THEN - "mBevBrixMax" := "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupBrix / (("mMinRatio" / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity) + 1); - "mBevBrixMin" := "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupBrix / (("mMaxRatio" / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity) + 1); + "mBevBrixMax" := "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupBrix / (("mMinRatio" / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity) + 1); + "mBevBrixMin" := "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupBrix / (("mMaxRatio" / "HMI_Blender_Parameters".Actual_Recipe_Parameters._SyrupDensity) + 1); END_IF; "Blender_Variables".gBlenderBlendMaxError := "mBevBrixMax" - "mBevBrixMin"; "TestLAD" := "Blender_Variables".gBlenderBlendMaxError; diff --git a/x1_to_json.py b/x1_to_json.py index f594e80..2e5b0e2 100644 --- a/x1_to_json.py +++ b/x1_to_json.py @@ -247,101 +247,120 @@ def parse_call(call_element): def reconstruct_scl_from_tokens(st_node): """ - Reconstruye una cadena SCL a partir de los elementos hijos - de un nodo , manejando Tokens, Access (Variables y Constantes), - saltos de línea, espacios y comentarios. + Reconstruye SCL desde , mejorando el manejo de + variables, constantes literales, tokens básicos, espacios y saltos de línea. """ if st_node is None: return "// Error: StructuredText node not found.\n" scl_parts = [] - # Obtener todos los elementos hijos directos en orden - # Usamos '*' para obtener todos los hijos y luego filtramos por tag children = st_node.xpath("./st:*", namespaces=ns) for elem in children: - # Obtener el nombre local de la etiqueta sin el namespace tag = etree.QName(elem.tag).localname if tag == "Token": scl_parts.append(elem.get("Text", "")) elif tag == "Blank": - scl_parts.append(" " * int(elem.get("Num", 1))) + # Añadir espacios simples, evitar múltiples si ya hay uno antes/después + if not scl_parts or not scl_parts[-1].endswith(' '): + scl_parts.append(" " * int(elem.get("Num", 1))) + elif int(elem.get("Num", 1)) > 1: # Añadir extras si son más de 1 + scl_parts.append(" " * (int(elem.get("Num", 1))-1)) elif tag == "NewLine": + # Limpiar espacios antes del salto de línea real + if scl_parts: + scl_parts[-1] = scl_parts[-1].rstrip() scl_parts.append("\n") elif tag == "Access": scope = elem.get("Scope") - access_str = f"_{scope}_?" # Fallback + access_str = f"/*_ERR_Scope_{scope}_*/" # Fallback más informativo - if scope == "GlobalVariable" or scope == "LocalVariable": + if scope in ["GlobalVariable", "LocalVariable", "TempVariable", "InOutVariable", "InputVariable", "OutputVariable", "ConstantVariable"]: # Tipos comunes de variables symbol_elem = elem.xpath("./st:Symbol", namespaces=ns) if symbol_elem: - components = symbol_elem[0].xpath("./st:Component | ./st:Token[@Text='.']", namespaces=ns) + components = symbol_elem[0].xpath("./st:Component", namespaces=ns) symbol_text_parts = [] - for comp in components: - comp_tag = etree.QName(comp.tag).localname - if comp_tag == "Component": - name = comp.get("Name", "_ERR_COMP_") - # Comprobar si necesita comillas (requiere BooleanAttribute) - # Simplificación: Añadir comillas si el nombre original parece tenerlas - has_quotes_elem = comp.xpath("../st:BooleanAttribute[@Name='HasQuotes']/text()", namespaces=ns) - has_quotes = has_quotes_elem and has_quotes_elem[0].lower() == "true" - - # Heurística: Usar comillas si HasQuotes=true o si es el primer componente y no es TEMP (#) - if has_quotes or (len(symbol_text_parts) == 0 and not name.startswith('#')): - symbol_text_parts.append(f'"{name}"') - else: - symbol_text_parts.append(name) + for i, comp in enumerate(components): + name = comp.get("Name", "_ERR_COMP_") + # Añadir punto si no es el primer componente + if i > 0: + symbol_text_parts.append(".") - # Manejar índices de array (simplificado) - index_access = comp.xpath("./st:Access", namespaces=ns) - if index_access: - indices_text = [reconstruct_scl_from_tokens(idx_node) for idx_node in index_access] # Llamada recursiva - symbol_text_parts.append(f"[{','.join(indices_text)}]") + # Reconstrucción de comillas (heurística) + has_quotes_elem = comp.xpath("../st:BooleanAttribute[@Name='HasQuotes']/text()", namespaces=ns) + has_quotes = has_quotes_elem and has_quotes_elem[0].lower() == "true" + is_temp = name.startswith('#') - elif comp_tag == "Token": # Es un punto - # Asegurarse de no añadir puntos duplicados si ya están en las partes - if symbol_text_parts and symbol_text_parts[-1] != ".": - symbol_text_parts.append(".") - # Limpiar posibles puntos extra al inicio/final o dobles - access_str = "".join(symbol_text_parts).strip('.') - access_str = re.sub(r'\.+', '.', access_str) # Reemplazar múltiples puntos con uno solo + if has_quotes or (i == 0 and not is_temp): # Comillas si HasQuotes o primer componente (no temp) + symbol_text_parts.append(f'"{name}"') + else: + symbol_text_parts.append(name) + # Manejar índices de array (RECURSIVO) + index_access = comp.xpath("./st:Access", namespaces=ns) + if index_access: + # Llama recursivamente para obtener el texto de cada índice + indices_text = [reconstruct_scl_from_tokens(idx_node) for idx_node in index_access] + symbol_text_parts.append(f"[{','.join(indices_text)}]") + + access_str = "".join(symbol_text_parts) elif scope == "LiteralConstant": constant_elem = elem.xpath("./st:Constant", namespaces=ns) if constant_elem: val_elem = constant_elem[0].xpath("./st:ConstantValue/text()", namespaces=ns) - # **CORRECCIÓN CLAVE**: Extraer el valor y usarlo - access_str = val_elem[0] if val_elem else "_ERR_CONSTVAL_" + type_elem = constant_elem[0].xpath("./st:ConstantType/text()", namespaces=ns) + const_type = type_elem[0] if type_elem else "" + const_val = val_elem[0] if val_elem else "_ERR_CONSTVAL_" + + # **CORRECCIÓN CLAVE**: Usar el valor extraído + access_str = const_val + + # Opcional: añadir prefijos T#, L#, etc. si es necesario + # if const_type == "Time": access_str = f"T#{const_val}" + # elif const_type == "LTime": access_str = f"LT#{const_val}" + # ... otros tipos ... else: - access_str = "_ERR_NOCONST_" - # Añadir manejo para otros scopes si es necesario (Address, Call, etc.) - # elif scope == "Call": ... - # elif scope == "Address": ... + access_str = "/*_ERR_NOCONST_*/" + # --- Añadir más manejo de scopes aquí si es necesario --- + # elif scope == "Call": access_str = reconstruct_call(elem) + # elif scope == "Expression": access_str = reconstruct_expression(elem) scl_parts.append(access_str) elif tag == "Comment" or tag == "LineComment": - # Manejo de comentarios (simplificado - asume texto directo) comment_text = "".join(elem.xpath(".//text()")).strip() - if tag == "Comment": # Comentario tipo (* *) + if tag == "Comment": scl_parts.append(f"(* {comment_text} *)") - else: # Comentario tipo // + else: scl_parts.append(f"// {comment_text}") - # else: # Ignorar otros tipos de nodos por ahora - # pass + # else: Ignorar otros nodos - # Unir todas las partes + # Unir partes, limpiar espacios extra alrededor de operadores y saltos de línea full_scl = "".join(scl_parts) - # Limpieza básica de formato (puede necesitar ajustes) - lines = [line.rstrip() for line in full_scl.split('\n')] - cleaned_scl = "\n".join(lines) - # Eliminar múltiples líneas vacías consecutivas (opcional) - # import re - # cleaned_scl = re.sub(r'\n\s*\n', '\n\n', cleaned_scl) - return cleaned_scl.strip() # Quitar espacios/saltos al inicio/final + + + # Re-indentar líneas después de IF/THEN, etc. (Simplificado) + output_lines = [] + indent_level = 0 + for line in full_scl.split('\n'): + line = line.strip() + if not line: continue # Saltar líneas vacías + + # Reducir indentación antes de procesar END_IF, ELSE, etc. (simplificado) + if line.startswith(('END_IF', 'END_WHILE', 'END_FOR', 'END_CASE', 'ELSE', 'ELSIF')): + indent_level = max(0, indent_level - 1) + + output_lines.append(" " * indent_level + line) # Aplicar indentación + + # Aumentar indentación después de IF, WHILE, FOR, CASE, ELSE, ELSIF (simplificado) + if line.endswith('THEN') or line.endswith('DO') or line.endswith('OF') or line == 'ELSE': + indent_level += 1 + # Nota: Esto no maneja bloques BEGIN/END dentro de SCL + + return "\n".join(output_lines) # STL (Statement List) Parser