#1055 PLCgen: Construct POUs for input and/or output on request.
Changes made:
- First splits input processing from output processing by refactoring to 2 separate methods.
- Then adds the new option.
- Add code to generate input/output code in a POU instead of always in the main program.
- Add the possibility to add a POU to code storage. (Apparently generated transition POUs are added by passing them in with the code storage finishing call so they didn't need adding a POU.)
- Create a new test case (original button_lamp, but now with the new option set to "both-func").
- Update test output.
- Clarify
org.eclipse.escet.common.app.framework.options.Option
JavaDocs: linkparseValue
withgetCmdLine
in both directions.
End-user visible changes:
- PLCgen: 'Simplify values' option command line description typo fixed.
- PLCgen: Added a new option to specify the input/output code form.
- PLCgen: Improved the documentation of several of the generator's options.
- PLCgen: Improved the command line and GUI option descriptions of the 'PLC maximum iterations' option.
For the test output, the diff between the two tests is
diff -u button_lamp_s7-300/MAIN.scl button_lamp_xio_funcs_s7-300/MAIN.scl
--- button_lamp_s7-300/MAIN.scl 2024-11-04 11:44:28.464616084 +0100
+++ button_lamp_xio_funcs_s7-300/MAIN.scl 2024-11-14 15:09:31.204941556 +0100
@@ -16,6 +16,7 @@
current_timer: BOOL;
current_timer_1: BOOL;
current_timer_t: REAL;
+ dummyResult: BOOL;
edge_hw_button: BOOL;
edge_hw_lamp: BOOL;
edge_sup: BYTE;
@@ -101,12 +102,7 @@
*------------------------------------------------------ *)
(* --- Read PLC inputs. ---------------------------------------------------- *)
- (* Read PLC input and write it to input variable "hw_button.bit". *)
- "DB".hw_button_bit := in_hw_button_bit;
- (* Read PLC input and write it to input variable "hw_button.bot". *)
- "DB".hw_button_bot := in_hw_button_bot;
- (* Read PLC input and write it to input variable "hw_button.bat". *)
- "DB".hw_button_bat := in_hw_button_bat;
+ dummyResult := processInputs(TRUE);
(* --- Initialize state or update continuous variables. -------------------- *)
IF "DB".firstRun THEN
@@ -634,6 +630,5 @@
END_WHILE;
(* --- Write PLC outputs. -------------------------------------------------- *)
- (* Write algebraic variable "hw_lamp.bit" to PLC output. *)
- out_hw_lamp_bit := "DB".hw_lamp = hw_lamp_On;
+ dummyResult := processOutputs(TRUE);
END_ORGANIZATION_BLOCK
Also, there are new files:
Only in button_lamp_xio_funcs_s7-300: processInputs.scl
Only in button_lamp_xio_funcs_s7-300: processOutputs.scl
This matches expectations.
Closes #1055 (closed)
Edited by Dennis Hendriks