PS4 Suscosoft S40 Function Block Reference Manual h1365g

background image

Function Block Reference Manual

APP-RTT-B-GB
Sucosoft S

40

Application Software
Closed-Loop Control Toolbox, Basic Version

03/99 AWB 2700-1365 GB

1st published 1999, edition 03/99

© Moeller GmbH, Bonn

Author:

Rainer Tenhagen

Production: Ingo Meyer

Translators: Baker & Harrison, Terence Osborn

background image

1

03/

99 AW

B

2700-

1365 G

B

Contents

1 Basic Information and Technical Data

3

General 3
Philosophy of the RTT

5

Technical data and other technical information 7
Additional tools for the RTT

9

2 Controllers

11

PID controller

11

PD three-step controller

15

Two-step controller

21

Three-step controller

24

3 Pulse Duration Modulator (PDM)

29

PDM 29

4 Miscellaneous Function Blocks

33

PT1 signal smoothing filter

33

Ramp function

36

Two-point interpolation (scaling)

41

PLC cycle time setpoint value
(equidistant PLC cycle times)

44

Index

47

background image

2

03/

99 AW

B

2700-

1365 G

B

background image

3

03/

99 AW

B

2700-

1365 G

B

1

Basic Information and Technical Data

General

The basic version of the closed-loop control toolbox
(RTT) is a tool for programming with Sucosoft S 40 to
the IEC 1131-3 standard. Once installed, the toolbox
provides 9 function blocks under the menu item
“Symbols/User-defined function blocks”, each in
German and English. The basic version of the
toolbox covers the basic requirements for closed-
loop control such as a PID controller in conjunction
with a pulse duration modulator.

Should the user require further functions, the full
versions of the RTT are available in German and
English. The full versions contain approximately
100 function blocks from the following areas:

Mathematical and logical function blocks

Trigonometric functions

Exponentiation, root extraction

Interpolation

Basic blocks of closed-loop control

Integrator

DT1 system

Sinus oscillation

Hysteresis

background image

Basic Information and
Technical Data

4

03/

99 AW

B

2700-

1365 G

B

Controllers

PID controller

PID split-range controller (heating/cooling)

Autotuning controller

PD three-step controller

Two-step controller

Three-step controller

Pulse duration modulation (PDM)

Conventional PDM

Dynamic PDM

Split-range PDM

Noise-shape PDM (suitable only for solid states)

Signal filters, processing and limitation

Tolerance limit monitors

Limit monitors

PT1 filters

PT3 filters

System simulation

Oscillatory PTn system simulation

Fuzzy systems

Fuzzy function blocks with 2 to 4 input variables
and 2, 3 or 5 terms per input variable

Which PLCs can be used with the RTT?

The RTT can be used on all PLCs that can be
programmed with Sucosoft S 40, e. g. PS 4-201,
PS 416 and PS 4-341.

background image

Philosophy of the RTT

5

03/

99 AW

B

2700-

1365 G

B

Philosophy of the RTT

Hierarchical structure of the toolbox

The RTT is modular in structure and consists of
several hierarchical levels (see Figure 1). The function
blocks of the 1st level have basic functions such as
limiters or mathematical functions. Function blocks
of the 2nd level provide basic functions for closed-
loop control such as integrators or differentiating
elements. The 3rd level covers higher functions for
closed-loop control. In the example of the PID
controller (see Figure 1), you can see how function
blocks of the higher levels can access function
blocks of the lower levels.

The hierarchical, modular structure of the RTT
affords the following advantages:

Self-contained functions can be selectively
tested and optimized.

Since function blocks of the upper levels may
access function blocks of the lower levels
multiple times, relatively small code sizes arise in
comparison with non-modular programs.

Complex algorithms can be implemented very
quickly by combining the modular functions.
Because only tested function blocks are used, the
number of programming errors is relatively low.

background image

Basic Information and
Technical Data

6

03/

99 AW

B

2700-

1365 G

B

Figure 1: Hierarchical arrangement of RTT function blocks
in multiple levels in the example of the PID controller

Self-explanatory variable and block names

The chosen variable and function block names of the
RTT are described in detail and are self-explanatory
so that programmers can use the RTT without
lengthy familiarisation. Most of the function blocks
can be integrated into the user program and
assigned parameters without the aid of the
documentation.

Parameter assignment instead of programming

Using the RTT means that the user’s task is one of
assigning parameters rather than creating a program.
This considerably reduces programming effort.

Level 3

Level 2

Level 1

D controller

Type conversion

Multiplication

I controller

Clock

generator

Addition

Limitation

P controller

PID

controller

background image

Technical data and other
technical information

7

03/

99 AW

B

2700-

1365 G

B

Utilisation effort as low as possible, functionality
as high as possible

The effort of utilising the RTT function blocks should
be as low as possible for the user. As much
functionality as possible should be processed
automatically within the function block. The PID
controller, for example, has the follows functions:

anti-windup procedure

effective D computation (differentiation)

standardised control response

automatic definition of internal scanning time by
integrator and differentiator

smooth acceptance of manual setpoint

Technical data and
other technical
information

General information on code sizes and cycle time
requirements of RTT function blocks

Code is generated only once for each declared
function block. Where function blocks are instanced
(declared again with other instance names), only one
additional data field is created for each instance.

Because of the considerable code sizes in some
cases, the cycle time requirement of the RTT function
blocks is relatively large if PS 4-200 series PLCs are
used. A PID controller, for example, requires
approx. 10 ms PLC cycle time. If, for example,
30 control zones are necessary, long PLC cycle
times arise and/or the maximum cycle time is
exceeded.

background image

Basic Information and
Technical Data

8

03/

99 AW

B

2700-

1365 G

B

In such cases, the program can be segmented so
that the controller is called for one zone only per PLC
cycle. The cycle time requirement when using a
PS 416 or PS 4-300 PLC is approx. 15 to 20 times
smaller.

Technical data

The data apply to the PS 4-200 PLC types (subject to
change). The code sizes for the PS 416 and
PS 4-300 PLC types are approx. 20 % larger and the
cycle time requirement is approx. 15 to 20 times
smaller.

*

Function block stores data until the next call.
Multiple instancing is therefore required if the
function block is used multiple times.

Function block name

Code
size
[bytes]

Data
size
[bytes]

Function
sub-
blocks

Instances Instance

depth

Cycle
time
[ms]

U_2_STEP_CONTROLLER*

758

132

2

2

1

1.29

U_3_STEP_CONTROLLER*

1058

144

2

2

1

2.11

U_IP2_INT_INTERPOLATION

3690

88

4

4

1

10.51

U_PD_THREE_STEP_CONTROLLER*

14754

431

17

29

3

8.19

U_PID_CONTROLLER*

17016

419

14

28

3

12.4

U_PT1_FILTER*

6674

152

11

12

2

1.77

U_PDM_CONTACTOR*

3582

68

4

4

1

0.43

U_RMS_RAMP*

10098

121

9

9

2

11.01

U_CYCS_CYCLETIME_SETPOINT_VALUE

418

104

2

2

1

0.73

background image

Additional tools for the RTT

9

03/

99 AW

B

2700-

1365 G

B

Additional tools for
the RTT

Visualisation and parameter assignment tool

A visualisation and parameter assignment tool is a
useful addition to the RTT. Please refer to the
relevant readme file for more detailed information.

Visualisation:
A marker word area of the PLC can be read via the
Sucom A interface or EPC card (maximum 32 words).
The data can be processed as follows:

Numerical display

Graphic display (visualisation)

Storage in a file

Parameter assignment:
A marker word area of the PLC can be written via the
Sucom A interface or EPC card (maximum 32 words).
This function can be used for assigning parameters
to closed-loop controllers, for example.

background image

10

03/

99 AW

B

2700-

1365 G

B

background image

11

03/

99 AW

B

2700-

1365 G

B

2

Controllers

PID controller

U_PID_controller
PID controller

Prototype of the function block

U_PID_controller

Inputs

Outputs

UINT

Setpoint_value_12Bit_UINT

Manipulated_variable_12Bit_UINT

UINT

UINT

Actual_value_12Bit_UINT

Parameters

Monitor outputs

BOOL

P_activate_BOOL

Manipulated_variable_P_13Bit_INT

INT

BOOL

I_activate_BOOL

Manipulated_variable_I_13Bit_INT

INT

BOOL

D_activate_BOOL

Manipulated_variable_D_13Bit_INT

INT

BOOL

Accept_manual_manipulated_variable_BOOL

UINT

Proportional_rate_P_percent_UINT

UINT

Reset_time_10ths_UINT

UINT

Derivate_action_time_10ths_UINT

UINT

Manual_manipulated_variable_12Bit_UINT

background image

Controllers

12

03/

99 AW

B

2700-

1365 G

B

Meaning of the operands

Description

The components of the controller can be individually
activated (= enables the controller) or deactivated
with the BOOL variables “P_activate_BOOL”,
“I_activate_BOOL” and “D_activate_BOOL”. A reset
is automatically started when I or D components are
deactivated. The parameter assignment of the
controller is effected by means of the standard
variables proportional_rate [%], reset_time [0.1 s]
and derivate_action_time [0.1 s].

Designation

Meaning

Value range

Inputs

Setpoint_value_12Bit_UINT

Setpoint value

0 to 4095

Actual_value_12Bit_UINT

Actual value

0 to 4095

Parameters

P_activate_BOOL

Activates P component

0/1

I_activate_BOOL

Activates I component

0/1

D_activate_BOOL

Activates D component

0/1

Accept_manual_manipulated_
variable_BOOL

“Smooth” acceptance of manual
manipulated variable

0/1

Proportional_rate_P_percent_UINT Proportional rate Kp [%]

0 to 65535

Reset_time_10ths_UINT

Reset timeTn [0.1 s]

0 to 65535

Derivate_action_time_10ths_UINT

Derivative action time [0.1 s]

0 to 65535

Manual_manipulated_variable_
12Bit_UINT

Manual manipulated variable

0 to 4095

Outputs

Manipulated_variable_12Bit_UINT

Manipulated variable (analog, 12 bits)

0 to 4095

Monitor outputs

Manipulated_variable_P_13Bit_INT P manipulated variable component

–4095 to 4095

Manipulated_variable_I_13Bit_INT

I manipulated variable component

–4095 to 4095

Manipulated_variable_D_13Bit_INT D manipulated variable component

–4095 to 4095

background image

PID controller

13

03/

99 AW

B

2700-

1365 G

B

The controller outputs the analog value
“manipulated_variable_12Bit_UINT”. The PID
components of the manipulated variable (from which
the total manipulated variable is obtained by addition)
are available as separate monitor outputs to allow
selective (remote) diagnosis of the control response.

Manual operation:
An “override” of the controller in manual operation
can be done with the corresponding BOOL and UINT
variables. If the status of
“accept_manual_manipulated_variable_BOOL”
goes to “1”, the controller outputs the variable
“manual_manipulated_variable_12Bit_UINT” to
“manipulated_variable_12Bit_UINT”. If the status of
“accept_manual_manipulated_variable_BOOL”
changes back to “0”, the controller accepts the
manual manipulated variable and continues the
control operation smoothly with this manipulated
variable.

Example program:
In the example program “zone2”, a PID controller is
called with the parameters:
Proportional rate = 1.2
Reset time = 30 s
Derivative action time = 3 s

background image

Controllers

14

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_PID_controller” in the program “zone2”

PROGRAM zone2

VAR

pid_controller_zone2 : U_PID_CONTROLLER;
setpoint_value_zone2 : UINT :=2500;
actual_value_zone2 : UINT;
enable_pid_controller : BOOL :=0;
enable_manual_manipulated_variable : BOOL := 0;
manual_manipulated_variable : UINT :=1000;
manipulated_variable_zone2 : UINT;
manipulated_variable_P_zone2 : INT;
manipulated_variable_I_zone2 : INT;
manipulated_variable_D_zone2 : INT;

END_VAR

CAL pid_controller_zone2(

setpoint_value_12Bit_UINT :=setpoint_value_zone2,
actual_value_12Bit_UINT :=actual_value_zone2,
P_activate_BOOL :=enable_pid_controller,
I_activate_BOOL :=enable_pid_controller,
D_activate_BOOL :=enable_pid_controller,
accept_manual_manipulated_variable_BOOL :=enable_manual_manipulated_variable,
proportional_rate_percent_UINT :=120,
reset_time_10ths_UINT :=300,
derivate_action_10ths_UINT :=30,
manual_manipulated_variable_12Bit_UINT :=manual_manipulated_variable_zone2
|
manipulated_variable_zone2 :=manipulated_variable_12Bit_UINT,
manipulated_variable_P_zone2 :=manipulated_variable_P_13Bit_INT,
manipulated_variable_I_zone2 :=manipulated_variable_I_13Bit_INT,
manipulated_variable_D_zone2 :=manipulated_variable_D_13Bit_INT

)

END_PROGRAM

background image

PD three-step controller

15

03/

99 AW

B

2700-

1365 G

B

PD three-step
controller

U_PD_three_step_controller
PD controller with three-step action for
“opening” and “closing” valves

Prototype of the function block

U_PD_three_step_controller

Inputs

Outputs

UINT

Setpoint_value_12Bit_UINT

Open_BOOL

BOOL

UINT

Actual_value_12Bit_UINT

Close_BOOL

BOOL

Manipulated_variable_open_12Bit_UINT

UINT

Manipulated_variable_close_12Bit_UINT

UINT

Parameters

Monitor outputs

BOOL

P_activate_BOOL

Manipulated_variable_bipolar_13Bit_INT

INT

BOOL

D_activate_BOOL

Manipulated_variable_P_13Bit_INT

INT

BOOL

Accept_manual_manipulated_variable_BOOL

Manipulated_variable_D_13Bit_INT

INT

UINT

Proportional_rate_P_percent_UINT

UINT

Proportional_rate_D_percent_UINT

UINT

Derivate_action_time_10ths_UINT

UINT

Length_of_period_PDM_ms_UINT

UINT

Minimum_switch_on_time_PDM_ms_UINT

INT

Manual_manipulated_variable_13_Bit_INT

background image

Controllers

16

03/

99 AW

B

2700-

1365 G

B

Meaning of the operands

Designation

Meaning

Value range

Inputs

Setpoint_value_12Bit_UINT

Setpoint value

0 to 4095

Actual_value_12Bit_UINT

Actual value

0 to 4095

Parameter

P_activate_BOOL

Activates P component

0/1

D_activate_BOOL

Activates D component

0/1

Accept_manual_manipulated_variable_BOOL Smooth acceptance of manual

manipulated variable

0/1

Proportional_rate_P_percent_UINT

P component proportional rate [%]

0 to 65535

Proportional_rate_D_percent_UINT

D component proportional rate [%]

0 to 65535

Derivate_action_time_10ths_UINT

Derivative action time [0.1 s]

0 to 65535

Length_of_period_PDM_ms_UINT

Length of period PDM [ms]

0 to 65535

Minimum_switch_on_time_PDM_ms_UINT

Minimum switch-on time PDM [ms]

0 to 65535

Manual_manipulated_variable_13_Bit_INT

Manual manipulated variable

–4095 to 4095

Outputs

Open_BOOL

Opens a valve, for example

0/1

Close_BOOL

Closes a valve, for example

0/1

Manipulated_variable_open_12Bit_UINT

Analog manipulated variable “open”

0 to 4095

Manipulated_variable_close_12Bit_UINT

Analog manipulated variable “close”

0 to 4095

Monitor outputs

Manipulated_variable_bipolar_13Bit_INT

Bipolar manipulated variable

–4095 to 4095

Manipulated_variable_P_13Bit_INT

P manipulated variable component

–4095 to 4095

Manipulated_variable_D_13Bit_INT

D manipulated variable component

–4095 to 4095

background image

PD three-step controller

17

03/

99 AW

B

2700-

1365 G

B

Description

The controller is suitable for “integrating systems”,
i. e. systems without self-regulation where an I
component is unnecessary, e. g. for flow control with
a valve, whereby the following actions are possible:

open
close
pause (neither open nor close)

The P and D components of the controller can be
individually activated (= enables the controller) or
deactivated by the BOOL variables
“P_activate_BOOL” and “D_activate_BOOL”. A reset
of the D component is automatically started when
the D component is deactivated.
If “accept_manual_manipulated_variable_BOOL”
goes to “1”, the controller outputs
“manual_manipulated_variable_12Bit_INT” to
“manipulated_variable_12Bit_UINT”.
Parameter setting for the controller is done with the
variables proportional_rate_P_percent_UINT [%],
proportional_rate_D_percent_UINT [%] and
derivate_action_time_10ths_UINT [0.1 s]. For the
calculation of the D manipulated variable
component, a scanning time (

t) is defined with the

derivative action time (see Figure 1). The actual value
changes are multiplied with the D proportional rate
parameter.

background image

Controllers

18

03/

99 AW

B

2700-

1365 G

B

The following equation applies:
D manipulated variable component = D proportional
rate

X

X = current_actual_value –previous_actual_value

~ derivate_action_time
=> D manipulated variable component ~ derivative
action time

⫻ D proportional rate

Figure 2: Relationship of actual value changes to
derivative action time T

V

Example:
Derivative action time T

V

= 10 s

Proportional rate D = 500 %
Over a period of 10 s, the actual value has changed
by 100 increments
=> D manipulated variable = 100

⫻ 5 = 500

If you reduce derivate_action_time by a factor of 2
(5 s) and increase the D component rate by a factor
of 2 (1000 %), then the result in the above example is
an identical D manipulated variable, as follows:
=> D manipulated variable = 50

⫻ 10 = 500

The following points should be noted:

The smaller the derivative action time chosen, the
smaller the maximum change in the actual value
within this time.
=> The resolution of the D value calculation
decreases. => The D manipulated variable
become discontinuous.
The smaller the derivative action time chosen, the
faster must a current D value be calculated.
=> The D value calculation is delayed by the
derivative action time.

X

T

t

v

x

background image

PD three-step controller

19

03/

99 AW

B

2700-

1365 G

B

For the digital outputs, “open_BOOL” and
“close_BOOL”, you must specify the period length and
minimum switch-on time of a pulse duration modulator
(PDM). The controller still provides the analog values
“manipulated_variable_close_12Bit_UINT” and
“manipulated_variable_close_12Bit_UINT” as output
variables. The PD components of the manipulated
variable (from which the total manipulated variable is
obtained by addition) are available as separate monitor
outputs to allow selective (remote) diagnosis of the
control response.

Minimum switch-on time

The ratio of “Period length/minimum switch-on time”
(“P/M”) determines which percentage manipulated
variables are not effective. As low a minimum switch-on
time as possible should be selected so that the “P/M”
is as high as possible. If, however, a very short switch-
on time is still not effective with the connected
actuators, these short switch-on phases should be
suppressed in order to save the hardware. The period
length should not be set too low.

Example:
The assignment of parameters to proportional_rate_D
and derivate_action_time causes the change in the
control deviation that establishes itself within 2000 s to
be factorised by 5 when calculating the D manipulated
variable component. The P manipulated variable
component is calculated from the control variance
multiplied by 0.8. The resulting “total manipulated
variable” (manipulated_variable_ bipolar_13Bit_INT)
acts as input signal of a pulse duration modulator with
a period length of one minute and a minimum switch-
on time of 3 s.

The ratio of “Period length/Minium switch-on
time” must not be too low since relatively large
manipulated variables may be suppressed.

H1365g.fm Seite 19 Mittwoch, 29. November 2000 3:08 15

background image

Controllers

20

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_PD_three_step_controller”
in the program “valve1“

PROGRAM valve1

VAR

valve_1 : U_PD_three_step_controller;
setpoint_value_valve1 : UINT :=2000;
actual_value_valve1 AT %IAW0.0.0.4 : WORD;
enable_controller_valve1 : BOOL;
enable_manual_variable_valve1 : BOOL;
manual_manipulated_variable_valve1 : INT :=1500;
open_valve1 AT %Q0.0.0.0.0 : BOOL;
close_valve1 AT %Q0.0.0.0.1 : BOOL;

END_VAR

ld

actual_value_valve1

WORD_TO_UINT
st

valve_1.actual_value_12Bit_UINT

CAL valve_1(

setpoint_value_12Bit_UINT :=setpoint_value_valve1,
actual_value_12Bit_UINT :=,
P_activate_BOOL :=enable_controller_valve1,
D_activate_BOOL :=enable_controller_valve1,
accept_manual_manipulated_variable_BOOL :=enable_manual_variable_valve1,
proportional_rate_P_percent_UINT :=80,
proportional_rate_D_percent_UINT :=500,
derivate_action_time_10ths_UINT :=20000,
length_of_period_PDM_ms_UINT :=60000,
minimum_switch_on_timePDM_ms_UINT :=3000,
manual_manipulated_variable_13_Bit_INT :=manual_manipulated_variable_valve1
|
open_valve1 :=open_BOOL,
close_valve1 :=close_BOOL,
:=manipulated_variable_open_12Bit_UINT,
:=manipulated_variable_close_12Bit_UINT,
:=manipulated_variable_bipolar_13Bit_INT,
:=manipulated_variable_P_13Bit_INT,
:=manipulated_variable_D_13Bit_INT

)

END_PROGRAM

background image

Two-step controller

21

03/

99 AW

B

2700-

1365 G

B

Two-step controller

U_2_step_controller
Two-step controller

Prototype of the function block

Meaning of the operands

U_2_step_controller

Inputs

Outputs

INT

Setpoint_value_INT

Control_signal_bottom_BOOL

BOOL

INT

Actual_value_INT

Control_signal_top_BOOL

BOOL

Parameters

Monitor outputs

BOOL

Activate_BOOL

Lower_switchover_point_INT

INT

INT

Switchover_point_offset_bottom_INT

Upper_switchover_point_INT

INT

INT

Switchover_point_offset_top_INT

Designation

Meaning

Value range

Inputs

Setpoint_value_INT

Setpoint value

–16383 to 16383

Actual_value_INT

Actual value

–16383 to 16383

Parameters

Activate_BOOL

Activates the controller

0/1

Switchover_point_offset_bottom_INT Relative offset of bottom switchover point

–16383 to 16383

Switchover_point_offset_top_INT

Relative offset of top switchover point

–16383 to 16383

Outputs

Control_signal_bottom_BOOL

Control signal for undershoot of bottom
switchover point

0/1

Control_signal_top_BOOL

Control signal for overshoot of top
switchover point

0/1

background image

Controllers

22

03/

99 AW

B

2700-

1365 G

B

Description

The function block is activated with
“activate_BOOL=1” (= enables the controller). On
deactivation, the value “0” is output by both control
signal outputs. The function block calculates the
lower and upper switchover points by adding the
setpoint value and the respective switchover point
offsets (see Figure 3).
If the upper switchover point is exceeded,
“control_signal_top_BOOL” goes to “1” and if the
lower switchover point is undershot,
“control_signal_bottom_BOOL” goes to “1”. The
other control signal in each case goes to “0”.

Figure 3: Switchover of the 2-step controller with
hysteresis

Monitor outputs

Lower_switchover_point_INT

Lower switchover point

–32768 to 32767

Upper_switchover_point_INT

Upper switchover point

–32768 to 32767

Designation

Meaning

Value range

Setpoint

Actual
value

Control_signal_top

Control_signal_bottom

Lower switchover
point

Switchover point [SPOFF]
offset bottom

SPOFF top

Upper switchover
point

background image

Two-step controller

23

03/

99 AW

B

2700-

1365 G

B

Example:
The following switchover points are assigned for the
2-step controller with the parameters shown below:
Lower switchover point = 2000 – 200 = 1800
Upper switchover point = 2000 + 300 = 2300

Use of the function block
“U_2_step_controller” in the program “two_step”

PROGRAM two_step

VAR

Two_step_controller: U_2_step_controller;
setpoint : INT :=2000;
actual AT %IAW0.0.0.4 : WORD;
enable_controller : BOOL;
digital_output_0_0 AT %Q0.0.0.0.0 : BOOL;
digital_output_0_1 AT %Q0.0.0.0.1 : BOOL;

END_VAR

ld

actual

WORD_TO_INT
st

Two_step_controller.actual_value_INT

CAL Two_step_controller(

setpoint_value_INT :=setpoint,
actual_value_INT :=,
activate_BOOL :=enable_controller,
switchover_point_offset_bottom_INT :=-200,
switchover_point_offset_top_INT :=300
|
digital_output_0_0 :=control_signal_bottom_BOOL,
digital_output_0_1 :=control_signal_top_BOOL,
:=lower_switchover_point_INT,
:=top_switchover_point_INT)

END_PROGRAM

background image

Controllers

24

03/

99 AW

B

2700-

1365 G

B

Three-step controller

U_3_step_controller
Three_step controller

Prototype of the function block

Meaning of the operands

U_3_step_controller

Inputs

Outputs

INT

Setpoint_value_INT

Control_signal_bottom_BOOL

BOOL

INT

Actual_value_INT

Control_signal_Mitte_BOOL

BOOL

Control_signal_top_BOOL

BOOL

Parameters

Monitor outputs

BOOL

Activate_BOOL

Lower_switchover_point_INT

INT

INT

Switchover_point_offset_ bottom_INT

Intermediate_switchover_point_INT

INT

INT

Switchover_point_offset_middle_INT

Upper_switchover_point_INT

INT

INT

Switchover_point_offset_top_INT

Designation

Meaning

Value range

Inputs

Setpoint_value_INT

Setpoint value

–16383 to 16383

Actual_value_INT

Actual value

–16383 to 16383

Parameters

Activate_BOOL

Activation of controller

0/1

Switchover_point_offset_bottom_INT Relative offset of lower switchover point

–16383 to 16383

Switchover_point_offset_middle_INT Relative offset of intermediate switchover point –16383 to 16383

Switchover_point_offset_top_INT

Relative offset of upper switchover point

–16383 to 16383

background image

Three-step controller

25

03/

99 AW

B

2700-

1365 G

B

Description

The function block is activated with
“activate_BOOL=1” (= enables the controller). On
deactivation, the value “0” is output by the three
control signal outputs. The function block calculates
the lower, intermediate and upper switchover points
by adding the setpoint value and the respective
switchover point offsets (see Figure 4).
If the top switchover point is overshot,
“control_signal_top_BOOL” goes to “1” and if the
lower switchover point is undershot,
“control_signal_bottom_BOOL” goes to “1”.

Outputs

Control_signal_bottom_BOOL

Control signal for undershoot of lower
switchover point

0/1

Control_signal_middle_BOOL

Control signal for overshoot of intermediate
switchover point and
“control_signal_bottom_BOOL=1 or
undershoot of intermediate switchover point
and “control_signal_top_BOOL=1”

0/1

Control_signal_top_BOOL

Control signal for overshoot of upper
switchover point

0/1

Monitor outputs

Lower_switchover_point_INT

Lower switchover point

–32768 to 32767

Intermediate_switchover_point_INT

Intermediate switchover point

–32768 to 32767

Upper_switchover_point_INT

Upper switchover point

–32768 to 32767

Designation

Meaning

Value range

background image

Controllers

26

03/

99 AW

B

2700-

1365 G

B

“control_signal_middle_BOOL” goes to “1” in the
following cases:

The intermediate switchover point is exceeded
and “control_signal_bottom_BOOL=1”

The intermediate switchover point is undershot
and “control_signal_top_BOOL=1”

The other control signals in each case go to “0”.

Figure 4: Switchover of 3-step controller with hysteresis

Example:
The following switchover points are assigned for the
3-step controller with the parameters shown below:
Lower switchover point = 2000 – 200 = 1800
Intermediate switchover point= 2000 – 50= 1950
Upper switchover point = 2000 + 100 = 2100

Actual
value

SPOFF
middle

Control_signal_middle

Control_signal_bottom

Control_signal_top

Setpoint

Lower switchover
point

Middle switchover
point

Upper switchover
point

Switchover point [SPOFF]
offset bottom

SPOFF
top

background image

Three-step controller

27

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_3_step_controller” in the program “threestep”

PROGRAM threestep

VAR

three_step_controller : U_3_step_controller;
setpoint : INT :=2000;
actual AT %IAW0.0.0.4 : WORD;
enable_controller : BOOL;
digital_output_0_0 AT %Q0.0.0.0.0 : BOOL;
digital_output_0_1 AT %Q0.0.0.0.1 : BOOL;
digital_output_0_2 AT %Q0.0.0.0.2 : BOOL;

END_VAR

ld

actual

WORD_TO_INT
st

three_step_controller.actual_value_INT

CAL three_step_controller(

setpoint_value_INT :=setpoint,
actual_value_INT :=,
activate_BOOL :=enable_controller,
switchover_point_offset_bottom_INT :=-200,
switchover_point_offset_middle_INT :=-50,
switchover_point_offset_top_INT :=100
|
digital_output_0_0 :=control_signal_bottom_BOOL,
digital_output_0_1 :=control_signal_middle_BOOL,
digital_output_0_2 :=control_signal_top_BOOL,
:=lower_switchover_point_INT,
:=intermediate_switchover_point_INT,
:=top_switchover_point_INT)

END_PROGRAM

background image

28

03/

99 AW

B

2700-

1365 G

B

background image

29

03/

99 AW

B

2700-

1365 G

B

3

Pulse Duration Modulator (PDM)

PDM

U_PDM_contactor
Pulse duration modulator suitable for contactors

Prototype of the function block

Meaning of the operands

U_PDM_contactor

Inputs

Outputs

UINT

Manipulated_variable_12Bit_UINT

Output_BOOL

BOOL

Parameters

BOOL

Activate_BOOL

UINT

Length_of_period_ms_UINT

UINT

Minimum_switch_on_time_ms_UINT

Designation

Meaning

Value range

Inputs

Manipulated_variable_12Bit_UINT

12-bit input variable of the PDM
(usually the output variable of a controller)

0 to 4095

Parameters

Activate_BOOL

Enables the PDM

0/1

Length_of_period_ms_UINT

Period length [ms]

0 to 65535

Minimum_switch_on_time_ms_UINT Minimum switch-on time [ms]

0 to 65535

Outputs

Output_BOOL

Digital output of the PDM

0/1

background image

Pulse Duration Modulator
(PDM)

30

03/

99 AW

B

2700-

1365 G

B

Description

The function block “U_PDM_contactor” is suitable
for connecting to mechanically switched contactors.
The PDM is normally logically combined with the
12-bit manipulated variable (4095 = 100 %) of a
controller. The variable “manipulated_variable
_12Bit_UINT” is provided for this reason in the input
section.
When “activate_BOOL=1”, the PDM is started and
one pulse duration is output with “output_BOOL=1”
(see Figure 5) if the specified minimum switch-on
time is exceeded. When “activate_BOOL=0”, the
output signal is set to zero and a reset of the current
actions is performed. In the event of reactivation, a
new period length starts. The period length and
minimum switch-on time can be specified in ms. The
maximum value of 65535 thus corresponds to a time
of 65.535 s..

Minimum switch-on time

The ratio of “Period length/minimum switch-on time”
(“P/M”) determines which percentage manipulated
variables are not effective. As low a minimum switch-
on time as possible should be selected so that the
“P/M” is as high as possible. If, however, a very short
switch-on time is still not effective with the
connected actuators, these short switch-on phases
should be suppressed in order to save the hardware.
The period length should not be set too low.

The ratio of “Period length/Minium switch-on
time” must not be too low since relatively large
manipulated variables may be suppressed.

background image

PDM

31

03/

99 AW

B

2700-

1365 G

B

Examples:
Heater/Contactor
=> Minimum switch-on time = 1 s
=> Period length = 40 s
=> Manipulated variables less than 2.5 % are
suppressed

Heater/Solid state relay
=> Minimum switch-on time = 0 s
=> Period length = 20 s
=> No manipulated variables suppressed

Fan/contactor or solid state relay
=> Minimum switch-on time = 2 s
=> Period length = 40 s
=> Manipulated variables less than 5 % suppressed

Figure 5: Pulse duration modulation in dependency on the
manipulated variable of a controller

1

0

20 40 60 80 100

[%]

t [s]

t [s]

0

20

40

60

80

100

PWM
Output

PWM
period length

Manipulated
variable [%]

PWM
period length

background image

Pulse Duration Modulator
(PDM)

32

03/

99 AW

B

2700-

1365 G

B

Example:
In the example program, a pulse duration modulator
is connected to a PID controller of the same zone by
connecting the 12-bit manipulated variable of the
controller to the input of the PDM. The period length
is set to 60 s and the minimum switch-on time is set
to 3 s.

Use of the function block
“U_PDM_contactor” in the program “zone1pdm”

PROGRAM zone1pdm

VAR

puls_duration_modulator : U_PDM_CONTACTOR ;
manipulated_variable_PID_controller1 : UINT ;
enable_zone1 AT %I0.0.0.0.0 : BOOL ;
digital_output_zone1 AT %Q0.0.0.0.0 : BOOL ;

END_VAR

CAL pulse_duration_modulator(

manipulated_variable_12Bit_UINT

:=manipulated_variable_PID_controller1

activate_BOOL :=enable_zone1,
length_of_period_PDM_ms_UINT :=60000,
minimum_switch_on_time_PDM_ms_UINT :=3000
|
digital_output_zone1 :=output_BOOL

)

END_PROGRAM

background image

33

03/

99 AW

B

2700-

1365 G

B

4

Miscellaneous Function Blocks

PT1 signal smoothing
filter

U_PT1_filter
PT1 filter for signal smoothing

Prototype of the function block

Meaning of the operands

U_PT1_filter

Inputs

Outputs

UINT

Input_value_12Bit_UINT

Delay_value_12Bit_UINT

UINT

Parameters

BOOL

Activate_BOOL

UINT

Delay_time_Tg_10thsec_UINT

Designation

Meaning

Value range

Inputs

Input_value_12Bit_UINT

Input value

0 to 4095

Parameters

Activate_BOOL

Activates the function block

0/1

Delay_time_Tg_10thsec_UINT

Delay time Tg

0 to 65535

Outputs

Delay_value_12Bit_UINT

PT1-delayed output value

0 to 4095

background image

Miscellaneous Function
Blocks

34

03/

99 AW

B

2700-

1365 G

B

Description

The function block can be used to smooth noisy
signals. The time period over which the smoothing
process takes place is set with
“delay_time_Tg_10thsec_UINT” (see Figure 6). The
delay time should not be set longer than necessary
since the signals will be delayed more than is
necessary for smoothing (unavoidable side-effect of
signal smoothing). The function block is started with
“activate_BOOL=1”. A reset is effected with
“activate_BOOL=0”. In order to accelerate the PT1
startup behaviour, the first call of the function block
after a reset (or the first PLC cycle) causes
“delay_value_12Bit_UINT” to be initialised with the
input value (the PT1 delay does not start at zero).

Figure 6: PT1 delay of the filter in dependence on T

g

and

the input step X

e

Example:
In the example program “pt1smooth”, the “noisy”
actual value is smoothed over a time period of half a
second.

X

e

x

t

g

T

background image

PT1 signal smoothing filter

35

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_PT1_filter” in the program “pt1smooth”

PROGRAM pt1smooth

VAR

pt1_filter : U_pt1_filter ;
actual_value_high_noise at %IW0.0.0.0 : UINT ;
actual_value_smoothed: UINT ;

END_VAR

CAL pt1_filter(

input_value_12Bit_UINT :=actual_value_high_noise,
activate_BOOL :=1,
delay_time_Tg_10thsec_UINT :=5
|
actual_value_smoothed :=delay_value_12Bit_UINT

)

END_PROGRAM

background image

Miscellaneous Function
Blocks

36

03/

99 AW

B

2700-

1365 G

B

Ramp function

U_RMS_ramp
Ramp with millisecond input value

Prototype of the function block

Meaning of the operands

U_rms_ramp

Outputs

Ramp_value_INT

INT

Parameters

Monitor outputs

BOOL

Activate_BOOL

End_value_attained_BOOL

BOOL

BOOL

Interrupt_BOOL

Ramp_sequence_time_ms_UINT

UINT

INT

Start_value_INT

Ramp_time_overshoot_ms_UINT

UINT

INT

End_value_INT

UINT

Ramp_time_ms_UINT

Designation

Meaning

Value range

Parameters

Activate_BOOL

Activates ramp generation

0/1

Interrupt_BOOL

Interrupts ramp generation

0/1

Start_value_INT

Start value of ramp

–32768 to 32767

End_value_INT

End value of ramp

–32768 to 32767

Ramp_time_ms_UINT

Ramp time from start value to end value

0 to 65535

Outputs

Ramp_value_INT

Ramp value

–32768 to 32767

background image

Ramp function

37

03/

99 AW

B

2700-

1365 G

B

Description

When the function block is enabled by a rising edge
on “activate_BOOL”, it generates a ramp specified
by a start value, an end value and a ramp time
specified in ms (see Figure 7). The parameters are
accepted with the rising edge on “activate_BOOL”.
The ramp is interrupted if “interrupt_BOOL=1”.
When the end of the ramp is reached, a BOOL
variable is set on the monitor output. The variable
“ramp_sequence_time_ms_UINT” specifies the
amount of the specified ramp time that has elapsed.
An overshoot of the specified ramp time
(the maximum is the PLC cycle time) is indicated by
the variable “ramp_time_overshoot_ms_UINT”.

Monitor outputs

End_value_attained_BOOL

Message: End of ramp has been reached

0/1

Ramp_sequence_time_ms_UINT

Currently expired ramp time

0 to 65535

Ramp_time_overshoot_ms_UINT

Amount of time by which the specified ramp
time has been exceeded

0 to 65535

Designation

Meaning

Value range

background image

Miscellaneous Function
Blocks

38

03/

99 AW

B

2700-

1365 G

B

Figure 7: Generation of ramps in conjunction with the
command bits “activate” and “interrupt”

Example program:
The example program generates a ramp which has
two sections with different slopes. In the first ramp
phase, the ramp increases from 500 to 4000 with
a ramp time of 20 s. In the second ramp phase,
the ramp increases from 4000 to 6000 with a ramp
time of 5 s.

t

End value

Start value

Ramp value

Activate

Interrupt

background image

Ramp function

39

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_rms_ramp” in the program “ramps”

PROGRAM Ramps

VAR

RMS_RAMP : U_RMS_RAMP ;
Reset_BOOL at %I0.0.0.0.0 : BOOL ;
Initialize_ramp1_BOOL : BOOL ;
Initialize_ramp2_BOOL : BOOL ;
End_value_reached_ramp1_BOOL : BOOL ;
Ramp_value_1_2_INT : INT ;
Rising_edge_end_value_ramp1 : R_TRIG ;
Rising_edge_reset : R_TRIG ;

END_VAR

CAL Rising_edge_reset(

CLK :=Reset_BOOL

)
ld

Rising_edge_reset.Q

jmpcn

NO_RESET
ld

1

st

Initialize_ramp1_BOOL

stn

End_value_reached_ramp1_BOOL

NO_RESET:

ld

Initialize_ramp1_BOOL

jmpcn

INITIALIZE_RAMP1
ld

0

st

RMS_RAMP.activate_BOOL

Cal

RMS_RAMP

ld

500

st

RMS_RAMP.Start_value_INT

ld

4000

st

RMS_RAMP.End_value_INT

ld

20000

st

RMS_RAMP.Ramp_time_ms_UINT

ld

1

st

RMS_RAMP.activate_BOOL

ld

0

st

Initialize_ramp1_BOOL

INITIALIZE_RAMP1:

background image

Miscellaneous Function
Blocks

40

03/

99 AW

B

2700-

1365 G

B

ld

Initialize_ramp2_BOOL

jmpcn

INITIALIZE_RAMP2
ld

0

st

RMS_RAMP.activate_BOOL

Cal

RMS_RAMP

ld

4000

st

RMS_RAMP.Start_value_INT

ld

6000

st

RMS_RAMPE.End_value_INT

ld

5000

st

RMS_RAMPE.Ramp_time_ms_UINT

ld

1

st

RMS_RAMP.activate_BOOL

ld

0

st

Initialize_ramp2_BOOL

INITIALIZE_RAMP2:

CAL RMS_RAMP

ld

RMS_RAMP.End_value_attained_BOOL

s

End_value_reached_ramp1_BOOL

CAL Rising_edge_end_value_ramp1(

CLK :=End_value_reached_ramp1_BOOL

)
ld

Rising_edge_end_value_ramp1.Q

st

Initialize_ramp2_BOOL

ld

RMS_RAMP.Ramp_value_INT

st

Ramp_value_1_2_INT

END_PROGRAM

background image

Two-point interpolation
(scaling)

41

03/

99 AW

B

2700-

1365 G

B

Two-point interpolation
(scaling)

U_IP2_INT_interpolation
Interpolation with 2 X/Y interpolation points
and integer values

Prototype of the function block

Meaning of the operands

U_IP2_INT_interpolation

Inputs

Outputs

INT

X_INT

Y_INT

INT

Parameters

BOOL

Suppress_extrapolation_BOOL

INT

X1_INT

INT

X2_INT

INT

Y1_INT

INT

Y2_INT

Designation

Meaning

Value range

Inputs

X_INT

Known x value

–32768 to 32767

Parameters

Suppress_extrapolation_BOOL

For x values outside the interpolation limits,
the following can be set:

0/1

0 =>
1 =>

Extrapolation
Extrapolation is suppressed.
The interpolation limits are output

background image

Miscellaneous Function
Blocks

42

03/

99 AW

B

2700-

1365 G

B

Description

Between the X/Y interpolation points, a linearly
interpolated Y value is calculated for the X value
present at the input. Outside the X/Y interpolation
points, a linearly extrapolated Y value is calculated if
“suppress_extrapolation_BOOL=0”. If
“suppress_extrapolation_BOOL=1”, the Y
interpolation limits are output instead.

Example program:
For the input parameters shown in the example
program below, the input value
“analog_value_4_till_20_mA :=1500” results in the
output value “actual_value :=852”.

X1_INT

X value 1

–32768 to 32767

X2_INT

X value 2

–32768 to 32767

Y1_INT

Y value 1

–32768 to 32767

Y2_INT

Y value 2

–32768 to 32767

Outputs

Y_INT

Interpolated (or extrapolated) Y value

–32768 to 32767

Designation

Meaning

Value range

background image

Two-point interpolation
(scaling)

43

03/

99 AW

B

2700-

1365 G

B

Use of the function block
“U_IP2_INT_interpolation”
in the program “scaling1”

PROGRAM scaling1

VAR

scaling : U_IP2_INT_INTERPOLATION ;
analog_value_4_till_20_mA AT %IAW0.0.0.4 : WORD ;
actual_value : INT ;

END_VAR

ld

analog_value_4_till_20_mA

WORD_TO_INT
st

scaling.X_INT

CAL scaling(

X_INT :=,
suppress_extrapolation_BOOL :=1,
X1_INT :=819,
X2_INT :=4095,
Y1_INT :=0,
Y2_INT :=4095
|
actual_value :=Y_INT)

END_PROGRAM

background image

Miscellaneous Function
Blocks

44

03/

99 AW

B

2700-

1365 G

B

PLC cycle time setpoint
value
(equidistant PLC cycle
times)

U_CYCS_cycletime_setpoint_value
Specify a (constant) required cycle time

Prototype of the function block

Meaning of the operands

Description

The function block enables you to specify a set cycle
time. This cycle time is used if the maximum cycle
times of the user program are smaller than this.

U_CYCS_cycletime_setpoint_value

Inputs

UINT

Cycletime_ms_UINT

Parameters

BOOL

Activate_BOOL

Designation

Meaning

Value range

Inputs

Cycletime_ms_UINT

Required cycle time to be established

1 to 250

Parameters

Activate_BOOL

Activates the function block

0/1

If the PLC cycle time exceeds the specified cycle
time, this does not have any consequences
(the PLC does not switch to Halt).
It merely means that the set cycle time cannot
be achieved.

background image

PLC cycle time setpoint
value (equidistant PLC
cycle times)

45

03/

99 AW

B

2700-

1365 G

B

Example program:
In the example program below, the instructions and
function block calls result in an average cycle time of
approx. 22 ms (± 4 ms). Setting the cycle time to
30 ms then results in a constant cycle time.

Use of the function block
“U_CYCS_cycletime_setpoint_value”
in the program “ms_30”

PROGRAM ms30

VAR

setpoint_cycle_time : U_CYCS_cycletime_setpoint_value ;

END_VAR

(*The calling of other function blocks causes average PLC cycle times of a maximum of
26 ms. The function block “U_CYCS_cycletime_setpoint_value” should be called at the end
of the program*)

CAL setpoint_cycle_time(

activate_BOOL :=1,
cycletime_ms_UINT :=30)

END_PROGRAM

background image

46

03/

99 AW

B

2700-

1365 G

B

background image

47

03/

99 AW

B

2700-

1365 G

B

Index

F
Function blocks

U_2_step_controller ................................................... 21
U_3_step_controller ................................................... 24
U_CYCS_cycletime_setpoint_value ........................... 44
U_IP2_INT_interpolation ............................................. 41
U_PD_three_step_controller ....................................... 15
U_PDM_contactor ...................................................... 29
U_PID_controller ........................................................ 11
U_PT1_filter ................................................................ 33
U_RMS_ramp ............................................................. 36

I
Interpolation ................................................................... 41

M
Mindesteinschaltdauer ................................................... 30

P
PID controller ................................................................. 11
PT1 filter ......................................................................... 33
Pulse duration modulation ............................................. 29

R
Ramp .............................................................................. 36

S
Scaling ........................................................................... 41
Signal smoothing ........................................................... 33

T
Three-step action ........................................................... 15
Three-step controller ..................................................... 24
Two-step controller ........................................................ 21


Document Outline


Wyszukiwarka

Podobne podstrony:
[ebook] Assembler Intel Architecture Optimization Reference Manual [pdf]
PostHaste for GibbsCAM Format Reference Manual 50408g
Bash Reference Manual [EN]
PostHASTE for GibbsCAM 2005 Format Reference Manual
( SPC ) STASTICAL PROCESS CONTROL REFERENCE MANUAL
The GNU C Reference Manual
Lean Excel Top Functions Quick Reference Guide with 500 Examples! by Scott Ratliff
PostHASTE Formatting Reference Manual
operator reference manual kongsberg maritime sdp
alesis dm5 instrukcja reference manual 163339
Modern Electornic Circuits Reference Manual John Markus
OpenGL Reference Manual
PS4 Sucosoft S40 Library Manager h1366g
C Reference Manual

więcej podobnych podstron