S7-1200 Basic Controller
PID Control: HandsOn Exercise 1
Basic Learning Path
Hands-on Exercise 1: Control Greenhouse Lighting
Outdoor Sensors HANDS ON 15 min
Indoor Sensors
1. Add and configure PID Compact V2
Technology Object
2. Add and configure LSim_PT1 simulation
Block
3. Commission PID Compact with user P,I,D
values
4. Perform PID Compact Tunning
5. Observe lighting Level in the Trace window
Control Cabinet
Page 2 Unrestricted | © Siemens 2021 – 2022
S7-1200 Basic Controller
PID Control: Sample Solution
Basic Learning Path
Hands-on Exercise 1: Create Cyclic interrupt OB
2
1 3
Page 4 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Add Global Library
4 2
1 Crete new watch table
5
3
1 Select library task card
4 Select library to open
2 Open Global Library
5 Open global library
3 Select compressed libraries
Page 5 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Add Simulation FB from Library
Drag the LSim_PT1
Function Block in the Cyclic
Interrupt OB from the Global
Library
3
1
Page 6 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Create Scale Function FC
Create a Scale Function FC
and program it as shown
Page 7 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Add the Scale Function
Add the Scale Function inside the
CycleInterrupt OB30
Page 8 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Add the PID_Compact Function
Add the PID_Compact inside
the CycleInterrupt OB30
Page 9 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Configure PID_Compact Technology Object
Follow the
configuration
1 parameters in
3
steps 2 to 7
Click on the TO
Configuration 4
Icon
Page 10 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Configure PID_Compact Technology Object
Page 11 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Create PID_Control DB
Create a PID_Control DB
and add the variables as
shown
Page 12 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Programming
Program the 3 FBs in the Cyclic
1
Interrupt OB as shown in the pictures
Compile the project and download to
2
the PLC
Page 13 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Commissioning before PID Tunning
1 Crete new watch table
2 Rename the watch table
3 Specify a setpoint of 1000.0
Page 14 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Commissioning before PID Tunning
Page 15 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: Commissioning before PID Tunning
System not stable,
oscillation occurs with
PID values not tuned
Page 16 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: PID Tunning (Pretuning)
Start Pretuning to tune
1
the PID parameters
Page 17 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: PID Tunning (Pretuning)
The system behavior is
greatly improved – no
oscillation, small steady
state error
Page 18 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: PID Tunning
To futher improve the
1
system response start
Finetuning
Page 19 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: PID Tunning
Page 20 Unrestricted | © Siemens 2021 – 2022
Hands-on Exercise 1: PID Tunning
The system behavior is
further improved – no
oscillation, minimal
steady state error
Page 21 Unrestricted | © Siemens 2021 – 2022