Training Curriculum: TIA Portal Module 009
Training Curriculum: TIA Portal Module 009
285
TIA Portal Module 009
Table of contents
1 Goal................................................................................................................................................. 287
2 Prerequisite...................................................................................................................................... 287
3 Required hardware and software..................................................................................................... 288
4 Theory.............................................................................................................................................. 289
4.1 Analog signals......................................................................................................................... 289
4.2 Measuring transducers............................................................................................................ 289
4.3 Analog modules – A/D converter............................................................................................. 289
4.4 Data types of the SIMATIC S7-1500........................................................................................290
4.5 Reading/outputting analog values............................................................................................ 291
4.6 Normalizing analog values....................................................................................................... 292
5 Task................................................................................................................................................. 292
6 Planning........................................................................................................................................... 292
6.1 Analog control of the conveyor speed......................................................................................292
6.2 Technology diagram................................................................................................................ 293
6.3 Reference list........................................................................................................................... 293
7 Structured step-by-step instructions................................................................................................. 295
7.1 Retrieve an existing project...................................................................................................... 295
7.2 Create the "MOTOR_SPEEDCONTROL" function..................................................................296
7.3 Configuration of the analog output channel.............................................................................303
7.4 Expand the tag table to include analog signals........................................................................304
7.5 Call the block in the organization block....................................................................................305
7.6 Save and compile the program................................................................................................ 307
7.7 Download the program............................................................................................................. 308
7.8 Monitor program blocks........................................................................................................... 308
8 Checklist.......................................................................................................................................... 310
286
TIA Portal Module 009
2 Prerequisite
This chapter builds on the chapter IEC Timers and Counters with the SIMATIC S7 CPU1516F-
3 PN/DP. You can use the following project for this chapter, for example: 032-300 IEC Timers
and Counters.zap13
287
TIA Portal Module 009
2 SIMATIC STEP 7
Professional (TIA
1 Engineering station
Portal) as of V13
4 Ethernet connection
Control panel
3 SIMATIC S7-1500 controller
288
TIA Portal Module 009
4 Theory
4.1 Analog signals
In contrast to a binary signal, which can assume only two signal states (“Voltage present +24
V” and “Voltage not present 0 V”), analog signals can assume any value within a defined
range. A typical example of an analog sensor is a potentiometer. Depending on the position of
the knob, any resistance can be set, up to the maximum value.
0V +10V
+10 V
289
TIA Portal Module 009
1: Analog value
2. Digital value
With 8 bits you have 256 individual ranges, while 11 bits provide a resolution of 2048
individual ranges.
0A/0V 20mA/10V
10 V: 2048 = 0.0048828
Voltage differences of <5 mV can be
11-bit detected
2048
Note: The 'INT' and 'REAL' data types play a large role in analog value processing. This is
because read-in analog values exist as 16-bit integers in the 'INT' format, and in order to
290
TIA Portal Module 009
ensure exact further processing only 'REAL' floating-point numbers should be used due to
rounding errors in the case of 'INT'.
Each analog value (“channel”) occupies one input or output word. The format is ‘Int’, an
integer.
The addressing of input and output words conforms to the addressing in the device overview.
For example:
Here, the address of the first analog input would be %IW 64, that of the second analog input
%IW 66, that of the third analog input %IW68, that of the fourth analog input %IW70, that of
the fifth analog input %IW72, that of the sixth analog input %IW74, that of the seventh analog
input %IW 76 and that of the eighth analog input %IW78.
The address of the first analog output would be %QW64, that of the second analog output
%QW66, that of the third analog output %QW 68 and that of the fourth analog output %QW70.
291
TIA Portal Module 009
The analog value transformation for further processing in the PLC is the same for analog
inputs and analog outputs.
The digitized value ranges are as follows:
Often, these digitized values still have to be normalized by further processing them in the PLC
in an appropriate manner.
If an analog input value exists as a digitized value in the range +/- 27648, it must usually still
be normalized so that the numerical values correspond to the physical quantities in the
process.
Likewise, the analog output usually results from setting of a normalized value that then still has
to be scaled to the output value +/- 27648.
In the TIA Portal, ready-made blocks or arithmetic operations are used for normalizing and
scaling.
For this to be carried out as exactly as possible, the values for the normalizing must be
converted to the REAL data type to minimize rounding errors.
5 Task
In this chapter, a function for analog control of the conveyor speed will be added to the
program from chapter "SCE_EN_032-300 IEC Timers and Counters".
6 Planning
The analog control of the conveyor speed will be programmed in the
"MOTOR_SPEEDCONTROL" [FC10] function as an expansion of the "SCE_EN_032-300 IEC
Timers and Counters" project. This project must be retrieved from the archive in order to add
this function. The "MOTOR_ SPEEDCONTROL" [FC10] function will be called in the "Main“
[OB1]" organization block and wired. The control of the conveyor motor must be changed
to - Q3 (conveyor motor -M1 variable speed).
292
TIA Portal Module 009
If the speed setpoint is outside the range +/- 50 rpm, the value 0 with data type 16-bit integer
(Int) will be output at the output. The return value of the function (Ret_Val) will then be
assigned the value TRUE (1).
If the speed setting is within the range +/- 50 rpm, this value will first be normalized to the
range 0…1 and then scaled to +/- 27648 with data type 16-bit integer (Int) for output as the
speed manipulated value at the analog output.
The output will then be connected with signal U1 (manipulated value speed of the motor in 2
directions +/- 10V corresponds to +/- 50 rpm).
293
TIA Portal Module 009
DI Digital Input
DO Digital Output
AI Analog Input
AO Analog Output
I Input
Q Output
NC Normally Closed
NO Normally Open
294
TIA Portal Module 009
The next step is to select the target directory where the retrieved project will be stored.
Confirm your selection with "OK".
( Target directory OK)
295
TIA Portal Module 009
Select in the next dialog and rename your new block to:
"MOTOR_SPEEDCONTROL". Set the language to FBD and manually assign the number
"10". Select the "Add new and open" check box. Click "OK".
296
TIA Portal Module 009
297
TIA Portal Module 009
Create the local tags with their comments as shown here and change the data type of the
'Return' tag from 'Void' to 'Bool'.
( Bool)
Insert an Assignment ' ' in the first network and an 'And' ' in front of it. Then use
drag-and-drop to move the 'Comparator operation' 'Less or equal' from the 'Basic
298
TIA Portal Module 009
Next use drag-and-drop to move the 'Comparator operation' 'Greater or equal' onto the
Connect the contacts in Network 1 with the constants and local tags as shown here. The
data types in the comparator operations are automatically adapted to 'Real'.
299
TIA Portal Module 009
Use drag-and-drop to move the 'Conversion operation' 'NORM_X' into Network 2 in order
to normalize the speed setpoint of +/- 50 rpm to +/- 1.
( Basic instructions Conversion operations NORM_X)
Connect the contacts in Network 2 with the constants and local tags as shown here. The
data types in 'NORM_X' are automatically adapted to 'Real'.
300
TIA Portal Module 009
Use drag-and-drop to move the 'Conversion operation' 'SCALE_X' into Network 3 in order
to scale the speed setpoint from the normalized +/- 1 onto the range for the analog output
+/- 27468.
( Basic instructions Conversion operations SCALE_X)
Connect the contacts with the constants and local tags in Network 3 as well, as shown
here. The data types in 'SCALE_X' are automatically changed to 'Real' or 'Int'.
301
TIA Portal Module 009
Insert an Assignment ' ' in the fourth network. Use drag-and-drop to move the 'Move'
command from the 'Move operations' folder under 'Basic instructions' in front of the
Assignment.
The contacts in Network 4 will now be connected with constants and local tags as shown
here. If the speed setpoint is not within the range +/- 50 rpm, the value '0' is output at the
analog output and the value TRUE is assigned to the return value (Return) of the
"MOTOR_SPEEDCONTROL“ function.
302
TIA Portal Module 009
303
TIA Portal Module 009
Check the address setting and the configuration of the analog output channel 0.
( Q address: 64…71 Properties General Output 0 - 3 Outputs Channel 0
Output type: Voltage Output range: +/- 10 V Reaction to CPU STOP: Shutdown)
304
TIA Portal Module 009
Add the global tags for the analog value processing to the "Tag table_sorting station". An
analog input B8 and an analog output U1 must be added.
( U1 %QW64 B8 %IW64)
305
TIA Portal Module 009
Add the temporary tag 'Motor_speed_monitoring_Ret_Val' to the local tags of OB1. These
will be needed in order to interconnect the return value of the
"MOTOR_SPEEDCONTROL" function.
( Temp Motor_speed_monitoring_Ret_Val Bool)
Select the block title of OB1 and then click ' ' to insert a new Network 1 in front of the
other networks
( )
306
TIA Portal Module 009
Connect the contacts with the constants and global and local tags here as shown.
307
TIA Portal Module 009
To save your project, select the button in the menu. To compile all blocks,
click the "Program blocks" folder and select the icon for compiling in the menu.
( Program blocks )
The "Info", "Compile" area shows which blocks were successfully compiled.
308
TIA Portal Module 009
( )
( Main [OB1] )
309
TIA Portal Module 009
310
TIA Portal Module 009
8 Checklist
No. Description Completed
311