03 Analog Value Processing en
03 Analog Value Processing en
Analog Value
Processing
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 2 Siemens AG © 2011
Task Description
0
10 IW 96
0...10V 0...27648
V
AI1
Evaluate fault on
the analog channel
Weight display on
the touchpanel
Act. Weight
285 MW36 0 ... 500 kg
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 3 Siemens AG © 2011
Principle of Analog Value Processing
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 4 Siemens AG © 2011
Properties of Analog Input Modules
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 5 Siemens AG © 2011
Properties of Analog Output Modules
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 6 Siemens AG © 2011
Analog Value Representation and
Measured Value Resolution
Bit Value Dec. Hex. Sign 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
8 128 80 * * * * * * * * * 0 0 0 0 0 0 0
9 64 40 * * * * * * * * * * 0 0 0 0 0 0
10 32 20 * * * * * * * * * * * 0 0 0 0 0
Reso-
lution
11 16 10 * * * * * * * * * * * * 0 0 0 0
in bits
+ sign
12 8 8 * * * * * * * * * * * * * 0 0 0
13 4 4 * * * * * * * * * * * * * * 0 0
14 2 2 * * * * * * * * * * * * * * * 0
15 1 1 * * * * * * * * * * * * * * * *
* = 0 or 1
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 7 Siemens AG © 2011
Analog Value Representation of Different Measuring
Ranges
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 8 Siemens AG © 2011
Analog Value Representation for the Analog Outputs
Voltage Current
Range Units Output ranges: Output ranges:
0 to 10V 1 to 5V ± 10V 0 to 20mA 4 to 20mA ± 20mA
Overflow ≥ 32512 0 0 0 0 0 0
32511 11.7589 5.8794 11.7589 23.515 22.81 23.515
Overrange : : : : : : :
27649 10.0004 5.0002 10.0004 20.0007 20.005 20.0007
Underflow ≤ -32513 0 0
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 9 Siemens AG © 2011
Scaling Analog Inputs with NORM_X and SCALE_X
(1)
NORM_X normalizes
A B the input signal at input
“Value“ in the limits “MIN
and MAX“ to the signal
range 0.0 to 1.0.
Sensor supplies only positive voltages Sensor also supplies negative voltage
OUT OUT
Δ
A B
Δ
A B
OUT
300
OUT
300 0
VALUE
0.0 1.0
0 -300
VALUE
0.0 1.0
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 11 Siemens AG © 2011
Controlling Analog Outputs with NORM_X and
SCALE_X
0.0
VALUE 0 VALUE
0 100 0.0 1.0
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 12 Siemens AG © 2011
Comparator Operations: IN_RANGE, OUT_RANGE
“Value“
“Result“
100 500
IN_RANGE
OUT_RANGE
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 13 Siemens AG © 2011
Organization Blocks: Overview
FB FC
FC
Global
Startup OB
Interrupt Processing 10x
FC
Time OB Global
20x
Hardware OB FB FC
20x
Instance
Diagnostic OB FC
82
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 14 Siemens AG © 2011
Events which Start an OB
Write
PIQ
Read
Hardware OpSy PII
Begin
OB1
Interruption
Begin
OB2xy
End
Interrupt Processing
Continue
.
OB1
Interruption
Begin
OB2xy
Begin
OB80
.
End
Continue
OB2xy
End
Begin
OB2xy
End
Continue
OB1
End
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 16 Siemens AG © 2011
Cyclic Interrupts
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 17 Siemens AG © 2011
Phase Shifts with Cyclic Interrupts
1000
OB 202
2000
200
OB 204
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 18 Siemens AG © 2011
Task Description:
Fault Evaluation on the Analog Channel
Analog module
Simulator
0
5
IW 96
V ≥ 5.879 V
V
AI0
Weight: 0 to 500kg
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 19 Siemens AG © 2011
Exercise 1:
Parameterizing the Analog Module SM 1234
2xL
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 20 Siemens AG © 2011
Exercise 2: Hardware Diagnostics in case of
Diagnostics Interrupt
1xL
1xL
2xL
Next page
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 21 Siemens AG © 2011
Exercise 3:
Evaluating the Diagnostics Buffer of the CPU
Error details
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 22 Siemens AG © 2011
Task Description: Converting the Analog Value and
Outputting It on the Touchpanel
OB235
Analog value 2. Convert the analog
processing value into weight values
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 23 Siemens AG © 2011
Exercise 4 :
Inserting "OB_Cyclic_interrupt" (OB235)
2xL
1xL
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 24 Siemens AG © 2011
Exercise 5: Programming Analog Value Processing
and Lock Outs (FC14, FC16)
OB235
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 25 Siemens AG © 2011
Exercise 6: Downloading Blocks into the CPU and
Testing the Display on the Touch Panel
1xR Download
in CPU
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 26 Siemens AG © 2011
Supplements
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 27 Siemens AG © 2011
Additional Exercise: Return of Reject Parts
0V
-10V +10V
Potentiometer to set (simulate) the weight: Good part when weight OK (M35.0 = '1')
0 to 10V 0 to 500kg 100kg <= Weight <= 400kg
Removal point?????
Reject parts Good parts
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 28 Siemens AG © 2011