Sunteți pe pagina 1din 46

SIEMENS

Content
Pulse Width Modulation (PMW)
PID Controfler
Ctosed Loop Controlled System
Controller Bufid
Add Cyclic Interrupt OB
Add PID Controller
Compact and Expanded View
Formal Parameter - Input
Formal parameter- Output
Formal Parameter - Slate
Define Variable
Configuration
Input Scaling
Input Monitoring
Set PWM Hysteresis
Output Limits
Manual PID parameter
Variable for Warning Limits
Commissioning - Workflow
Commissioning
Commissioning - Kind of Commissioning
Commissioning - Online
PID Exercise ....................................................................................................................................
Exercise - PID Controller
Exercise 8-1: Add Ne~v Project with Hardware
Exercise 8-1: Setup PLC tags
Exercise 8-1: Add program and OB
Exercise 8-1: Add P]D Controller
Exercise 8-1: Parametefize PID Controller
Exercise 8-1: Scale the Inputs
Exercise 8-1: Download whole project
Exercise 8-1: Commissioning PID Controfler
Page
3
6
7
9
12
13
14
15
16
18
21
22
23
24
25
26
27
34
35
38
39
4O
42
43
44
45
46
47
SIT R A IN T r a i n i n g f o r
$7-1200 T IA System
A u to ma ti o n a n d In d u str i a l So l u ti o n s
P a g e 1
P u l se W i d th Mo d u l a ti o n & P ID C o n tr o l l er
PID Controller
Exercise PID
SITRAIN Training for $7-1200 TIA System
Automation and Industrial Solutions Page 2
Pulse Width Modulation & PID Controller
P u l se W i d th Mo d u l a ti o n (P W M)
SIEMENS
C T R L_P W M In str u cti o n
The CTRL_PWM Pulse Width Modulation (PWM) instruction provides a fixed cycle time output with a
variable duty cycle. The PWM output runs continuously after being started at the specified frequency
(cycle time). The pulse width is varied as required to effect the desired control. Duty cycle can be
expressed as a percentage of the cycle time (0 - 100%), as thousandths (0 - 1000), as ten thousandths
(0 - 10000), or as $7 analog format. The pulse width can vary from 0 (no pulse, always off) to full scale
(no pulse, always on).
Since the PWM output can be varied from 0 to full scale, it provides a digital output that in many ways is
the same as an analog output. For example, the PWM output can be used to control the speed of a motor
from stop to full speed, or it can be used to control position of a valve from closed to fully opened.
$7-1200 TIA System
SITRAIN Training for Page 3 Pulse Width Modulation & PID Controller
Automation and industrial Solutions
P u l se W i d th Mo d u l a ti o n (P W M)
SIEMENS
Two pulse generators are available for controlling high-speed pulse output functions: PWM and Pulse
train output (PTO). PTO is used by the motion contro~ instructions. You can assign each pulse generator
to either PWM or PTO, but not both at the same time.
The two pulse generators are mapped to specific digital outputs as shown in the above table. You can
use onboard CPU outputs, oryou can use the optional signal board outputs. The output point numbers
are shown in the above table (assuming the default output configuration). If you have changed the output
point numbering, then the output point numbers will be those you assigned. Regardless, PTOI/PWM1
uses the first two digital outputs, and PTO2/PWM2 uses the next two digital outputs, either on the CPU or
on the attached signal board. Note that PWM requires only one output, while PTO can optionally use two
outputs per channel. If an output is not required for a pulse function, it is available for other uses.
$7-1200 TIA Syste[n
SITRAIN Training for
Automation and Indus~al Solutions
Page 4 Pulse W~dth Modulation & PID Controller
P ID C o n tr o l l er
SIEMENS
, P u l se W i d th Mo d u l a ti o n (P W M)
P ID C o n tr o l l er
, Exer ci se P ID
$7-1200 TIA System
SlTRAIN Training for Page 5 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
C l o sed Lo o p C o n tr o l l ed System
Controller
w e
actuator
Controller PWM
SIEMENS
Controlled
(disturbanCe)
z
Fan
High Speed Counter
A block diagram showing a PID closed loop control implementation where the measured feedback is
compared with the setpoint to determine the error. The error is then used by the PID loop algorithm to
adjust the PID output to eliminate the error.
$7-1200 TIA System
SITRAIN Training for Page 6 Pulse W~dth Modulation & PID Controller
Automation and Industrial Solutions
C l o sed Lo o p C o n tr o l l ed System
SIEMENS
actuator
(disturbance)
Z
Controlled
Controller PWM Fan
High Speed Counter
The PID controller is implemented in the 1200 CPU by the PID Compact instruction box located in the
Extended Instruction Task Card. This PID control loop will use-a PWM instruction and a High Speed
Counter instruction to control the speed of the fan motor on the training simulator.
$7-1200 TIA System
S TRAIN Tra n ng for
Page 7 Pulse Width Modulation & PID Controller
Automation and ndustda~ Solutons
SIEMENS
C o n tr o l l er Bu i l d
P ID Lo o p C o n tr o l l er
The PID Compact instruction provides the CPU 1200 user with a PID loop control algorithm that has
automati~ and manual mode available along with self tuning optimization The pID_Compact instruction
box has inputs where the setpoint and process variable (actual value) are connected. The input
connections provide process data for the PID algorithm which then drives the output to the final element.
$7-1200 TIA System
Pulse Width Modulation & PID Controller
SITRAIN Train ng for
Page 8
Automation and Industrial So utions
C o n tr o l l er Bu i l d
SIEMENS
The PiD Compact instruction is programmed in a Cyclic Interrupt OB for execution which executes at a
specifie~-cycle time. The cycle time can be viewed or changed in the prope[ties of the Cyclic Interrupt
OB. During the programming of the PID_Compact instruction a data block is created and automatically
placed in the Technological Object folder.
$7-1200 TIA System
SITRAIN Training for Page 9 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
A d d C ycl i c In ter r u pt OB
SIEMENS
Adding and configuring the Cyclic Interrupt OB through the Add new block prompt in the Program blocks
folder. When the Add new block dialog box opens, the OB button is selected followed by selecting the
Cyclic interrupt, the program language, the OB number, and cyclic execution time; click OK to complete
the configuration.
S7-1200 TIA System
S TRAIN Tra n ng for Page 10 Pulse W]dth Modulation & PID Controller
Automation and ndustdal So utons
A d d P ID C o n tr o l l er
SIEMENS
Open the Cyclic Interrupt OB to view the LAD networks, then open the Extended Instructions and drag
and drop the PID Compact instruction on to the open LAD network. A dialog box will open where an
instance data bloc-k will be configured and be attached to the pID_Compact instruction box.
$7-1200 TIA System
SlTRAIN Training for Page t 1 Pulse Width Modulation & PID Controller
Automat[on and Industrial Sotutlons
C o mpa ct a n d Expa n d ed Vi ew
SIEMENS
PID Compact instruction box can be expanded or collapsed by clicking on the little arrow head at the
bottom of the PID_Compact instruction box. tn the expanded state, additional inputs/outputs are exposed
and connections can be made then the instruction box can be collapsed to conserve space.
$7-1200 TIA System
SlTRA~N Training for page 12 Pulse W~dth Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
i n pu t:
" Automatic Mode"
.= from the user program
Analog Input
:= " Manual mode"
~dable for Manuat Mode"
restart counter
:= " inactive Mode"
The PID Compact instruction inputs not only provide connection points for the controlled process
setpoint-~nd measured feedback, it also provides an input connection to change the state of the
controller mode. 1he PID controller can be in manual mode, which is the default mode, or auto mode.
When the PID controller is in auto mode, the P[D controller automatically adjusts the loop output to
maintains the loops setpoint value, such as a desired temperature.
$7-1200 TIA System
SlTRAIN Training for Page 13 Pulse Width Modulation & PID Controller
Automation and Industrial So~utlons
The PID Compact instruction outputs not only provides a connection point for the controlled process final
element-~ut it also provides different types of output connections to match what it is driving, such as an
output for pWM or an output as a Real number data type. Limit and warning alarm bits can be
configured along with locations that record the mode of the controller and displays error codes in the
event of an error condition which makes troubleshooting easier.
$7-1200 TIA System
SITRAIN Training for Page 14 Pulse ~Mdth Modulation & PID Controller
Automation and Industrial Solutions
Fo r ma l P a r a meter - Sta te
SIEMENS
The chart above shows the numerical codes that are displayed in the State output which describes the
Status of the PID controller. A memory location must be configured to State output in order for the
numerical codes to be displayed.
$7-1200 TIA System
SITRAIN Training for Page 15 Pulse W~dth Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
D ef i n e Va r i a bl e
Symbolic programming provides an advantage, you will find the program much clearer and easier to read
if you use symbols (for example fan) instead of the absolute addresses. To allow the use of symbols, you
can enter a name, the absolute address, the data type and a comment for every address used. Once
you have defined a symbol, it can be used throughout the entire user program of a programmable
module; symbolic names are entered in the PLC tags folder.
$7-1200 TIA System
SlTRAIN Tra n ng for Page 16 Pulse Width Modulation & PID Controller
Automation and Industrial So u ons
Clicking on the Configuration button in the upper right hand corner of the pID_Compact instruction box
opens to the configuration topics such as Basic parameters, Input scaling, and Advanced settings which
stores the loop tuning parameters for the pID_Compact box instruction.
$7-1200 TIA System
SITRAIN Training for Page 17 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
In pu t Sca l i n g
Configuring the Input/Output fields in the dialog box is made easier by the following special features,
The Intellisence feature aids in configuration by providing a list of
Intellisense and automatic connection, slide
only valid possible connection variables (symbolic names) like the Input value input shown in the
above. The automatically connection feature then connects that symbolic variable to the correct input or
output of the pID_Compact box instruction.
$7-1200 TIA System
SITRAIN Training for Page 18 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
In pu t Sca l i n g
T h e i n pu t sca l i n g ta kes th e r a w d a ta va l u e f r o m th e a n a l o g i n pu t si g n a l su ch a s 0 to 27648 o r -27648 to
+ 27648 a n d a ssi g n s th e d esi r ed en g i n eer i n g u n i ts. So th a t th e va l u e en ter ed a t th e u pper l i mi t i s n o w
a sso ci a ted wi th th e ma x r a w d a ta va l u e o f 27648 a n d th e va l u e en ter ed a t th e l o wer l i mi t i s n o w
a sso ci a ted wi th th e mi n i mu m r a w d a ta va l u e o f 0 o r -27648. T h i s i s d epen d en t o n th e type o f a n a l o g
si g n a l en ter i n g th e a n a l o g ca r d .
S7-1200 T IA System
SITRAIN T r a i n i n g f o r P a g e t9 P u l se W i d th Mo d u l a ti o n & PID C o n tr o l l er
A u to ma ti o n a n d In d u str i a l So l u ti o n s
In pu t Mo n i to r i n g
SIEMENS
Nu mer i ca l a l a r m wa r n i n g po i n ts a r e en ter ed i n to th e i n pu t mo n i to r i n g men u pr o mpt a n d wi l l be u sed to
set a l a r m bi ts th a t ca n be co n f i g u r ed o n th e pID _C o mpa ct i n str u cti o n bo x.
$7-1200 TIA System
SITRAIN T r a i n i n g f o r P a g e 20 P u l se W i d th Mo d u l a ti o n & PID C o n tr o l l er
A u to ma ti o n a n d In d u str i a l So l u ti o n s
Set P W M Hyster esi s
SIEMENS
Edit the PWM limits menu prompt to enter the minimum on time and the minimum off time of the output
signal of the piD_Compact instruction. PID_Compact instruction will not change the signal Time-on or
the signal Time-off past these limits.
$7-1200 TIA System
SITRAIN Training for Page 21 Pulse W~dth Modulation & PID Controller
Automation and Industrial Solutions
Edit the Output limit menu prompt to enter an upper limit and a low limit for the PID_Compact instruction
to use in the function calculation.
$7-1200 TIA System
SITRAIN Train ng for
Page 22
Pulse W~dth ModuLation & PID Controller
Automation and Industrial So utions
SIEMENS
If the PID tuning parameters are known, the PID tuning parameters values can be set manually through
this configuration dialog box and then the check box should be checked in order to utilize those
parameters, as shown in the slide. The PID tuning parameters can be determined by using the auto-tune
feature.
$7-1200 TIA System
SITp~&.IN Training for Page 23 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
Optional warning alarm bit variable can be configured in the piD_Compact instruction box to provide
inputs to logic operation and/or drive animation on the HML
$7-1200 TIA System
SlTRA N Train ng for Page 24 Pulse Width Modulation & PID Controller
Automation and Indus dal So utions
SIEMENS
C o mmi ssi o n i n g - W o r kf l o w
Download Projected controller
+
technological object
start commissioning
start scope
, Run " Startup Tuning"
(turn-over tangent method)
Run " Tuning in Run"
(Step response)
Upload PiD-parameter
to project
activate automatic mode
Set [oPID_comp
act-DBsReti-Mde]
to mode 3
After the PID Compact instruction box has been configured and compiled, the program can be download
to the 1200 C-PU then tested through the Commissioning function as listed in the slide.
$7-1200 TIA System
SlTRAIN Training for Page 25
Pulse Width ModuLation & PID Controller
Automation and Indus~a! Solutions
Invoke the Commissioning function by clicking the Commissioning button in the upper right hand corner
of pID_Compact instruction box,
$7-1200 TIA System
SlTRAIN Training for Page 26 Pulse Width Modulation & PID Controller
Automation and In6ustda~ Solutions
The Scope has buttons where you can start/stop the measurement and the ability to select the sample
time in ms through the provided sample time field.
$7-1200 TIA System
SITRAIN Training for Page 27 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
The Commissioning scope has several very useful features such as fix scale.
$7-1200 TIA System
SITRA N Train ng for Page 28 Pulse W~dth Modulation & PID Controller
Automation and Indus dal So u ions
The Commissioning scope has several very useful features such as the tool to Zoom in.
S7-1200 TiA System
SITRAIN Training for Page 29 Pulse W~dth Modulation & PID Controller
AulornalJ on and Industrial Solutions
The Commissioning scope has several ve~ useful features such as the too[ to Zoom out.
$7-1200 TIA System
SITRAIN Training for Page 30 Pulse V~dth Modulation & PID Controller
Automat(on and Industrial Solutions
SIEMENS
The Commissioning scope has several very useful features such as a window that displays the current
values.
$7-1200 TIA System
SITRAIN Training for Page 31 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
C o mmi ssi o n i n g
The Commissioning Scope has several features such as the auto tuner function which calculates the PiD
loop tuning parameter then uploads them to the PID loop controller, Clicking the button in the
optimization window begins the process.
$7-1200 TIA System
SITRAIN Training for Page 32 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
C o mmi ssi o n i n g - Ki n d o f C o mmi ssi o n i n g
SIEMENS
]he auto tuner creates a step change in the process them monitors the response of the process to
determine to determine the PID loop tuning parameters. The step change causes the process to oscillate
as illustrated in the graphic above and illustrated in the slides that follow.
$7-1200 TIA System
SITRAIN Training for
Page 33 Pulse Width Modulation & PID Controller
Automation and Industda! Solutions
The auto tuner creates a step change in the process them monitors the response of the process to
determine the PID loop tuning parameters. After looking at the setpoint, input, and output, in the graph
you notice that the PID setpoint was changed and the PID input and PID output react to the change. A
progress bar displays the progress time until the function is completed.
$7-1200 TIA System
SITRAIN Training for Page 34 Pulse V~dth Modulation & PID Controller
Automation and In(~ustdal Solutions
" The step change causes the process to oscillate as illustrated in the graphic above.
$7-1200 TIA System
SlTRAIN Training for Page 35 Pulse W~dth Modulation & PID Controller
Automation and Industrial Solutions
SIEMENS
C o mmi ssi o n i n g - On l i n e
The auto tuner calculates the PID tuning parameters then it stores them in PID_Compact data block that
has been associated with PID instruction.
$7-1200 TIA System
S TRA N Tra n ng for
Page 36 Pulse V~dth Modulation & PID Controller
Automation and Indus dal So u ons
P ID Exer ci se
SIEMENS
, P u l se W i d th Mo d u l a ti o n (P W M)
,, P ID C o n tr o l l er

Exer ci se P ID
$7-1200 T IA Systen ~
Sl T R A IN T r a i n i n g f o r
A u to ma ti o n a n d In d u str i a l So ~u l i o n s
P a g e 37 P u l se W ~d th Mo d u l a ti o n & P ID C o n tr o l l er
Exer ci se - P ID C o n tr o l l er
SIEMENS
Ha n d s-o n
Lets ju st d o i t . . . . .
th e l a b f o r yo u
$7-1200 TIA System
SITRAIN Training for
Page 38 Pulse V~dth Modulation & PID Controller
Automation and Industrial Solutions
Task
Process
Add new project
2.
3.
4.
5.
Click in the Task menu Project > New
Name the project ,,Project_exemise_PID_loop"
Start " Add new device"
Add " Unspecific CPU"
Detect (upload) " hardware configuration"
S7-1200 TIA System
SITRAIN Training for
Page 39 Pulse Width Modulation & PID Controller
Automation and Industrial Solutions
Task
P r o ceSs
Define variable
6.
Start Tag-Editor with a double click
7,
Set up the displayed tags.
$7-1200 TIA System
S TRAIN Tra n ng for
Page 40 Pulse Width Modulation & PID Controller
Automation and ndustdal So u ions
Hands-on
T a sk
P r o cess
Implement program code n Man and add cyclc OB
9,
10.
11.
12,
13.
14.
15.
Open "Main" (OB1)
Add program code like displayed
Add new block out of the project tree
Select "cyclic interrupt OB"
Type in the name "cyclic interrupt._PID controlleF
Give the OB the manual block number " 300"
Define the scan time with "lOOms"
Hit the Checkbox "Add new and open"
SITRAIN Training for
$7-1200 TIA System
Automatlon and Industrial Solutions
Page 41
Pulse Width Modulation & PID Controller
Task
Process
Add PID Controller
16.
17.
18.
Add "PID_C ompact" block out of the extended instructions
in the "cyclic interrupt_PID controller (OB300).
Give the " InstanceDB / Technological object" a name.
Add " Instance DB/Technological object" by hitting OK Button.
$7-1200 TIA System
SlTRAIN Training for
Automation and industrial Solutions
Page 42 Pulse W~dth Modulation & PID Controller
Task
Process
Parameterize the PID Controller
19.
20.
21.
22.
23.
24.
25.
26.
Mark the " PID_Compact" block
Select the point basic settings"
Select as controller type " Temperature"
Select as unit " C
"
.
Activate the checkbox " Invert PID-Controller output."
Set the Set-point to " 85."
Select " Input_PER" for the Input value and
type in the variable " heat_sensor" (IW66),
Select " OutpuLPER" for the Output value and
type in the variable " fan" (QWS0) an.
SITRAIN Training for $7-1200 TIA System
Automation and Industrial Solullons Page 43
Pulse Width Modulation & PID Controller
Exer ci se 8-1: Sca l e th e In pu ts
SIEMENS
Task Input scaling
P r o cess 27.
28.
29.
30.
Select the point " input scaling" .
Select for the Scaled upper value " 100C.

Select for the Scaled lower value " 0C.


"
Select for the analog/d{gital converter the values
" 0" for the lower limit and " 27648" for the upper limit.
SITRAIN Training for
$7-1200 T]A System
Automation and Industrial Solutions
Page 44 Pulse Width Modulation & PID Controller
SIEMENS
Exer ci se 8-1: D o wn l o a d wh o l e pr o ject
Ha n d s-o ~}
Task Download the whole project
P r o cess 31.
32.
"Save" the project.
Download " All" to the PLC
SITRAIN Training for
S7-1200 TIA System
Automation and Industrial Solutions Page 45
Pulse Width Modulation & PID Controller
SIEMENS
Task Commissioning the PID Controller
Process 33.
34.
35.
36.
Start the "C ommissioning"
Start the scope.
Select " Tuning in run" and hit the " Start tuning" button
After successful commissioning hit the button
" Upload PID parameters to project" and save the project.
SITRAIN Training for
$7-1200 TIA System
Automation and industrial Solutions Page 46
Pulse Width Modulation & PID Controller

S-ar putea să vă placă și