0% found this document useful (0 votes)
9 views28 pages

03 Analog Value Processing en

Uploaded by

haiphan712pth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views28 pages

03 Analog Value Processing en

Uploaded by

haiphan712pth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

SITRAIN

Analog Value
Processing

© Siemens AG 2011. All rights reserved.


Objectives

The participant should ...


… be familiar with the principle of analog value processing
... be able to parameterize an analog module
... be able to address an analog module
... be able to interpret the resolution (capability) of a module
… be familiar with the operations for the analog value conversion
… be able to program a simple analog value conversion
... be able to evaluate the diagnostics interrupt of the analog module
… be familiar with the principle of interrupt processing
… be able to generate and program a cyclic interrupt

SITRAIN
TIA-MICRO2 / Analog Value Processing Page 2 Siemens AG © 2011
Task Description

AI module Cyclic Interrupt OB


Simulator

0
10 IW 96
0...10V 0...27648
V

AI1

Weight: 0 ... 500kg

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

Process Analog input module User program

Physical Standardized Reading in the result memory into the process


quantity analog signal image input table (PII) at the beginning of the
cycle
Sensor Transducer Result
memory Direct peripheral access
ADC

• Pressure ± 500mV 27648 27648


• Temperature ± 1V IW64:P #temp IW64 #temp
• Flow ± 5V 0 0
• Speed ± 10V
• pH value ± 20mA
• Viscosity 4 to 20mA Analog output module
• etc. etc.
1000 1000
#temp QW80:P #temp QW80
0 0

Direct peripheral access


Conversion
Physical Analog memory Outputting the process image output table
DAC (PIQ) to the analog output module at the
quantity actuator
end of the cycle

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 No. min. units 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

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

Voltage Current Resistance Temperature


such as: such as: such as: e.g. Pt100 (Standard)
Range
Meas.range Units Meas.range Units Meas.range Units Meas.range Units
± 10V 4 to 20mA 0...300Ohm -200...+850ºC

Overflow ≥ 11.759 32767 ≥ 22.815 32767 ≥ 352.778 32767 ≥ 1000.1 32767

Overrange 11.7589 32511 22.810 32511 352.767 32511 1000.0 10000


: : : : : : : :
10.0004 27649 20.0005 27649 300.011 27649 850.1 8501

10.00 27648 20.000 27648 300.000 27648 850.0 8500


7.50 20736 16.000 20736 225.000 20736 : :
Rated range : : : : : : : :
-7.5 -20736 : : : : : :
-10.00 -27648 4.000 0 0.000 0 -200.0 -2000

Underrange - 10.0004 - 27649 3.9995 -1 -1 - 200.1 - 2001


: : : : Negative : : :
1.1852 - 4864 values - 4864 - 243.0 - 2430
- 11.759 - 32512 not
possible
Underflow ≤ - 11.76 - 32768 ≤ 1.1845 - 32768 - 32768 ≤ - 243.1 - 32768

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

10.0000 5.0000 10.0000 20.000 20.000


20.000
27648 : : : : : :
: 0 1.0000 0 0 4.000 0
0
: 0 : 0 :
Rated range 0.9999 : 3.9995 :
- 6912
: :
- 6913 0 : 0 :
: : :
: 0 0
:
: :
- 27648 : :
-10.0000 -20.000

- 27649 - 10.0004 - 20.007


Underrange : : :
- 32512 - 11.7589 - 23.515

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

MAX = 1.0 MAX = 1.0

Δ
A B
Δ

MIN = 0.0 MIN = 0.0


Value Value
x x+1 x x+1
0 27648 -27648
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 10 Siemens AG © 2011
Scaling Analog Inputs with NORM_X and SCALE_X
(2)

Sensor also supplies negative voltage

A B
OUT

300

Sensor supplies only positive voltages B

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

Example: control valve 0..100%


Normalized signal is scaled to the
corresponding rated range, here 0 to
27648, of the actuator.

Calculated valve position is


normalized in the limits 0 to 100%
to the signal 0.0 to 1.0.
OUT OUT
1.0 27648

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

Hardware OpSy Instance


FC
Cyclic OB1

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

Event class OB No. Number Start event Prio


Cyclic program 1, >=123 >= 1 End of startup or end of last cycle OB 1
OBs

Startup 100, >= 0 STOP-RUN transition 1


>=123
Time delay 20-23, max. 4 Time delay has run out 3
interrupt >=123
Cyclic interrupt 30-38, max. 4 Interval has run out 4
>=123
Hardware 40-47, max. 50 - Rising edge 5
interrupt >=123 - Falling edge
- HSC: FN=FP 6
- HSC: counting direction has changed
- HSC: external reset

Diagnostic error 82 0/1 Module has errors 9


interrupt
Time error 80 0/1 - Maximum cycle time exceeded 26
interrupt - Queue has overflowed
- Interrupt loss through too high interrupt
load
SITRAIN
TIA-MICRO2 / Analog Value Processing Page 15 Siemens AG © 2011
Interruption of the Cyclic Program

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

Execution of cyclic interrupts:


RUN OB200 OB200 OB200 Prio 4
Interval time Interval time Interval time

OB1 OB1 O B1 OB1 OB1 OB1 OB1 O B1 Prio 1

SITRAIN
TIA-MICRO2 / Analog Value Processing Page 17 Siemens AG © 2011
Phase Shifts with Cyclic Interrupts

1000

OB 202

2000

200
OB 204

1000 ms Phase shift

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

Event class with


indication whether
coming or done event

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

1. Set the “part


0V
weight“ on the
potentiometer
-10V +10V
Poti

OB235
Analog value 2. Convert the analog
processing value into weight values

3. Display the set part


weight on the touchpanel
MW36

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

For invalid/valid weight, the bay


indicator lights are off/on and
the conveyor cannot/can be
started

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

Return of reject parts:


when M35.0 = '0' return part to Bay 3 ("Bay3", I 8.7)

SITRAIN
TIA-MICRO2 / Analog Value Processing Page 28 Siemens AG © 2011

You might also like