In STEP 7 Micro/WIN, the PID controller created by the instruction wizard does not work sporadically; is this due to the switching of the enable bit "EN" of the initialization subprogram "PIDx_INIT" (see Fig. 01).
To ensure proper working of the PID controller, the initialization program "PIDx_INIT" must be called from the main program in each cycle using the special marker 0.0 (SM0.0) (see Fig. 03, Network 2).
The "PIDx_INIT" block configures the PID controller by initializing via the special marker 0.1 (SM0.1) the required variables that are used by the logic and starting the PID interrupt program "PID_EXE", which is called cyclically according to the PID sampling time.
Manual operation of the PID controller:
If the PID controller is only to be activated at specific times or events, you can implement this via the manual mode in the "Instruction Wizard PID" (see Fig. 02).
When the manual mode is activated, the "PIDx_INIT" block must be reinserted in the main program, because the "Auto_Manual" and "ManualOutput" parameters have been added (see Fig. 03, Network 2).
The conditions for activating the PID controller are adopted in Network 1 (Fig. 03) according to the specifications in Fig. 01.
The PID calculation is not executed in manual mode ("Auto_Manual" = "0") and standardized REAL value (0.00 to 1.00) at the "ManualOutput" input is converted as follows according to the limit specifications (see Fig. 04) into the value "Output" (data type: INTEGER):
Output = ManualOutput * (upper limit - lower limit) + lower limit value