Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TABLE OF CONTENTS
Exercise 7.5 Structured Text....................................................................................................................................................... 7.5-1
7.5.1 General Information....................................................................................................................................................... 7.5-3
7.5.1.1 Objectives................................................................................................................................................................ 7.5-3
7.5.2 Exercise Steps ................................................................................................................................................................ 7.5-3
7.5.2.1 General .................................................................................................................................................................... 7.5-3
7.5.2.2 Create new calculation code page .......................................................................................................................... 7.5-3
7.5.2.3 Create new variables for calculation ...................................................................................................................... 7.5-4
7.5.2.4 Create new variable getting the vessel input and assign it to IO ........................................................................... 7.5-4
7.5.2.5 Write ST code for calculating................................................................................................................................. 7.5-4
7.5.2.6 Download and test the application.......................................................................................................................... 7.5-4
7.5-1
7.5-2
7.5.1.1 Objectives
You will
Learn about the syntax for structured text editor to write simple statements
Write code for a simple calculation to convert the level signal into a mass in kg for
the vessel contents.
Value
Right now the input signal from the vessel is transferred into the variable LT1_In. For
the calculation to the kg unit we have to create a new variable for the vessel input and
transfer the values to the LT1_In variable. The picture below should explain this
better.
Vessel1_In
( liter )
Calculation
( Min, Max, Value, Unit )
LT1_In
( kg )
7.5-3
Type
real
string[10]
Init value
0.5
kg
Description
Per default: 1 liter ==> 0.5 kg
Unit after confersion
7.5.2.4 Create new variable getting the vessel input and assign it to IO
Right now we get the vessel input from the variable LT1_In. Because of the
conversion we need a new variable for the vessel input.
1. Please create a new global application (Tank1) variable:
Name
Type
Description
Vessel1_In
RealIO
The input from the vessel
2. Assign the variable Vessel1_In to channel 1 of the analog input board AI810
(instead of the variable LT1_In).
7.5-4