OSCAT BASIC DeviceDriver - RWTH-EBC/AixOCAT GitHub Wiki

24. Device Driver

24.1. DRIVER_1

Type Function module
Input SET: BOOL (asynchronous set input)
IN: BOOL (switch input)
RST: BOOL (asynchronous reset input)
Setup TOGGLE_MODE: BOOL (mode of the input IN)
TIMEOUT: TIME (maximum duty cycle of the outputs)
Output Q0: BOOL (output)
DRIVER_1 a driver module whose output Q can be set by the input IN is
when TOGGLE_MODE = FALSE. The output is then held to TRUE until it is
either set to FALSE by an asynchronous reset (RST) or until expiry of the
maximum switching time (TIMEOUT). Further impulses at the input IN the-
reby extend the TRUE period by the output whereas each rising edge at
the IN the Timeout begins again. If TOGGLE_MODE = TRUE, the output Q
switches with each rising edge on the IN state between TRUE and FALSE.
Also in TOGGLE_MODE the TIMEOUT limits the maximum TRUE phase at
the output Q. TIMEOUT is set to T#0s ( Default ) Then no Timeout active.
The asynchronous SET and RST inputs sets the output Q to TRUE or FALSE.
The module DRIVER_4 provides the same functionality with 4 switching
outputs.

24.2. DRIVER_4

Type Function module
Input SET: BOOL (asynchronous set input)
IN0...IN3: BOOL (switching inputs)
RST: BOOL (asynchronous reset input)
Setup TOGGLE_MODE: BOOL (mode of the input IN)
TIMEOUT: TIME (Maximum Ontime of outputs)
Output Q0 .. Q3: BOOL (outputs)
DRIVER_1 is a driver module whose outputs Q can be switched by the in-
puts IN. a detailed description of the module can be read under DRIVER_1.
DRIVER_4, as opposed to DRIVER_1 has 4 switching outputs, but otherwise
has the same functionality.

24.3. DRIVER_4C

Type Function module
Input IN: BOOL (switch input)
RST: BOOL (asynchronous reset input)
Setup TIMEOUT: TIME (Maximum Switch of the module)
SX: ARRAY [1..7] OF BYTE:= 1,2,4,8,0,0,0;
(Default setting of the switching sequence)
Output Q0 .. Q3: BOOL (outputs)
DRIVER_4C is a driver circuit whose output states are switched with a ri-
sing edge of IN. The output states are predefned in the Setup array SX
and may be changed at any time by the user. The array SX [1..6] defnes
the output states for each switching state SN individually bitwise. Bit 0 of
an element switch Q0, Bit1 turns Q1, Bit2 Q2 and Bit3 Q3, the upper 4 bits
are respectively ignored. The array is initialized with Bit0 = TRUE for SN =
1, bit 1 for SN = 2. Bit2 for SN = 3 and Bit3 for SN = 4. Thus, the output
go through the sequence (0000,0001,0010,0100,1000,0000) for (Q3, Q2,
Q1, Q0). If the element SX[SN] is of array 0 so the SN will automatically
jump back to 0, so that an empty element terminates the sequence. At the
end of the timeout the module automatically jumps back into the conditi-
on SN = 0. The timeout is only active if the variable TIMEOUT > t#0s is.
Example:
SX = 1,3,7,15,7,3,1 generates the following sequence:
Q3,Q2,Q1,Q0 = 0000,0001,0011,0111,1111,0111,0011,0001,0000,......

24.4. FLOW_CONTROL

Type Function module
Input IN: BOOL (control input)
REQ: BOOL ( Request for automatic mode)
ENQ: BOOL ( Enable for output Q)
RST: BOOL (asynchronous reset input)
Setup T_AUTO: TIME (valve switch time in automatic mode)
T_DELAY: TIME(valve disable Time in automatic mode)
Output Q: BOOL (switching output for valve)
STATUS: BYTE (ESR compliant status output)
FLOW_CONTROL switches a valve at the output Q when the input IN =
TRUE. In addition, the valve can also be switched via the input RE. REQ =
TRUE turns the valve on for the time T_AUTO and will be locked for the
time T_DELAY. after the time T_DELAY the valve can be turned on again on
REQ. During this lock period T_DELAY the valve may be controlled by the
input IN. An ESR compatible status output STATUS indicates the status of
the module. Both the REQ and IN can only switch the output Q when the
input ENQ is set to True.
Status = 100 Ready
Status = 101 Valve on by a TRUE at IN
Status = 102 Valve on by a TRUE at REQ
Status = 103 Reset is executed
The diagram illustrates the structure of inferential FLOW_CONTROL:

24.5. FT_PROFILE

Type Function module
Input K: REAL (multiplier)
O: REAL (ofset)
M: REAL (time multiplier)
E: BOOL (start signal)
Output Y: REAL (signal output)
RUN: BOOL (TRUE, if the output signal is generated)
ET: TIME (time since start of the initial profle)
Setup VALUE_0: REAL (output value of the output to start)
TIME_1: TIME (time when the ramp reaches VALUE_1)
VALUE_1: REAL (value of the ramp at the time TIME_1)
TIME_2: TIME (time when the ramp reaches VALUE_2)
VALUE_2: REAL (value of the ramp at the time TIME_2)
TIME_3: TIME (time when the ramp reaches VALUE_3)
VALUE_3: REAL (value of the ramp at the time TIME_3)
TIME_10: TIME (time when the ramp reaches VALUE_10)
VALUE_10: REAL (value of the ramp at the time TIME_10)
TIME_11: TIME (time when the ramp reaches VALUE_11)
VALUE_11: REAL (value of the ramp at the time TIME_11)
TIME_12: TIME (time when the ramp reaches VALUE_12)
VALUE_12: REAL (value of the ramp at the time TIME_12)
TIME_13: TIME (time when the ramp reaches VALUE_13)
VALUE_13: REAL (value of the ramp at the time TIME_13)
FT_PROFILE generates a time-dependent output signal. The output signal
is defned by time - value pairs. FT_PROFILE generate a output signal Y by
the value pairs are connected by ramps. A typical application for FT_PRO-
FILE is to generate a temperature profle for a furnace, but also every app-
lication which requires a time-dependent control signal provides an appli-
cation. The time-dependent output signal is initiated by a rising edge at E
and then runs automatically. After the pair of values (TIME_10, VALUE_10)
the output signal remains to VALUE_10, until the input E = FALSE. With an
edge to E the signal can be started and additionally, the input E will also
used to extend the signal indefnitely. This makes it possible to create a
course to the value VALUE_3, to stretch it with E and after the falling edge
of E again to create a course back to baseline. With the inputs K, M and O,
the output signal can be stretched and scaled dynamically.
Y = value generated * K + O
The input M is used for stretching of the signal over time. The actual time
course is consistent with the defned time course through the setup over
time multiplied by M. In order to ensure linear ramp, a time extension by
M works only after completion of an edge. The output RUN is set with a ri-
sing edge of E to TRUE and is only after the time profle FALSE again. At
the output of ET, the time elapsed since start time can be read.
The following graphs show the output for the values:
VALUE_0 = 0
TIME_1, VALUE_1 = 1s, 50
TIME_2, VALUE_2 = 3s, 50
TIME_3, VALUE_3 = 4s, 100
TIME_10, VALUE_10 = 6s, 100
TIME_11, VALUE_11 = 7s, 50
TIME_12, VALUE_12 = 9s, 50
TIME_13, VALUE_13 = 10s, 0
The graphs represent the output of both phase 3 is stretched by E, and wi-
thout stretching.

24.6. INC_DEC

Type Function module
Input CHA: BOOL (channel A of sender)
CHB: BOOL (channel B of sender)
RST: BOOL (Reset)
Output DIR: BOOL (rotation)
CNT: INT (counter value)
INC_DEC is a decoder for incremental encoder. Encoder (rotation encoder)
deliver two overlapping pulses, channel A and channel B. By the two chan-
nels, the direction and angle of rotation is decoded. INC_DEC detect each
edge of the encoder, so 4 times the resolution is achieved. The output DIR
shows the direction of rotation, and at the output CNT is an integer value
provided, which outputs the number of counted pulses. For a full rotation
of an encoder with 100 pulses CNT counts to 400, because each edge is
counted at both channels, so 4 times the resolution is achieved. A RST in-
put allows any time to set the counter to 0. The counter counts up when
DIR = TRUE, and down if DIR = FALSE.
In the following Example a pattern generator GEN_BIT is used to simulate
a rotary encoder, which is always makes just 3 steps clockwise and 3
counterclockwise. In the Trace RECORDING is shown how the INC_DEC
split the movement in 12 steps and decodes the direction.

24.7. INTERLOCK

Type Function module
Input I1: BOOL (input 1)
I2: BOOL (input 2)
TL: TIME (lock time)
Output Q1: BOOL (output 1)
Q2: BOOL (output 2)
The module INTERLOCK has 2 inputs I1 and I2 which passes to each of the
outputs Q1 and Q2. Q1 and Q2, however, are interlocked so that only one
output is set to TRUE. The time TL sets a dead time between the two out-
puts. An output can only be true if the other output was at least for the
time TL FALSE.
I1 I2 Q1 Q2
0 0 0 0
0 1 0 1
1 0 1 0
1 1 0 0

24.8. INTERLOCK_4

Type Function module
Input I0: BOOL (Input 0)
I1: BOOL (input signal 1)
I2: BOOL (input signal 2)
I3: BOOL (input signal 3)
E: BOOL ( Enable Input)
MODE: INT (operating mode)
Output OUT: BOOL (output)
TP: BOOL (TRUE if the departure has changed)
INTERLOCK_4 stores the 4 input values I0..I3 in the bits (0..3) of the output
OUT. With every change of the output the output TP is for one cycle TRUE
so that additional modules can be triggered for processing. If the input E =
FALSE, all outputs remain to 0 or FALSE. The input MODE adjust the dife-
rent operating modes of the module.
MODE Meaning
0 Inputs are directly passed to the output byte.
z.B. I0, I2 = TRUE OUT = 2#0000_0101
1 Only the input with the highest input number is issued, the others are
ignored.
z.B. I0,I1,I2 = TRUE: OUT = 2#0000_0100
2 Only the most recently activated input is passed.
3 An enabled input disables all other inputs.

24.9. MANUAL

Type Function: BOOL
Input IN: BOOL (Input)
ON: BOOL (manual mode on)
OFF: BOOL (manual mode of)
Output BOOL (output)
MANUAL can override an input signal IN with TRUE or FALSE.
IN ON OFF Q
0 0 0 0
1 0 0 1
    • 1 0 Manual operation position OFF
  • 1 0 1 Manual operation position ON
The typical use of MANUAL by means of a switch with 3 positions (OFF,
AUTO, ON) where the connections are OFF at OFF and On at On and AUTO
of the switch remains open.
The following diagram shows the possible connection of a switch with 3
positions:

24.10. MANUAL_1

Type Function module
Input IN: BOOL (Input)
MAN: BOOL (manual override)
M_i: BOOL (signal level in manual mode)
SET: BOOL (Asynchronous set in manual mode)
RST: BOOL (Asynchronous reset for manual operation)
Output Q: BOOL (output)
STATUS: BYTE (ESR compliant status output)
MANUAL_1 can override a digital signal in the manual mode. As long as
MAN = FALSE the output Q follows the input IN directly. Once MAN = TRUE,
the output follows the state of the input M_I. With the inputs of SET and
RST in manual mode, an asynchronous set and clear the output can be
produced. SET and RST are active only during manual operation. Is in ma-
nual mode at SET or RST a rising edge, the output follows not longer the
input M_I but remains on the state of the rising edge of SET (output =
TRUE) or RST (output = FALSE). Once the input MAN is back on FALSE the
output Q follows the input IN again.

24.11. MANUAL_2

Type Function module
Input IN: BOOL (Input)
ENA: BOOL (block Enable Input)
ON: BOOL (Forces the output to TRUE)
OFF: BOOL (Forces the output to FALSE)
MAN: BOOL (starting mode in manual mode)
Output Q: BOOL (output)
STATUS: BYTE (ESR compliant status output)
MANUAL_2 , a digital signal and override switches between manual and
automatic operation. The module is designed so that a 3-position switch
switches between of and auto. In the automatic the signal mode is set to
IN, in the case of enforced of, the OFF is set to TRUE and in the case of
enforced on, tho ON set to TRUE. If the two inputs ON and OFF are FALSE
switch the input IN directly to the output Q. However, are both inputs ON
and OFF simultaneously set to TRUE, the state of the input MAN is swit-
ched to the output. The input MAN can also be used to defne a priority for
ON or OFF which passes the value of the MAN is always on the output if
both inputs ON and OFF are simultaneously true. Is the input ENA set to
FALSE, the output is always set to FALSE, the module is disabled. The follo-
wing table defnes the operating modes of the module. The STATUS output
is ESR compatible and reports on the status of the module to correspon-
ding ESR components.
IN ENA ON OFF MAN Q STATUS
  • L - - - L 104 Disabled X H L L - X 100 Auto Mode

  • H H L - H 101 force High

  • H L H - L 102 force Low

  • H H H X X 103 Manual Input

  • H H H L L 103 Force with Priority for OFF

  • H H H H H 103 Force with Priority for ON

24.12. MANUAL_4

Type Function module
Input I0..I3: BOOL (inputs)
MAN: BOOL (manual override)
M0..M3: BOOL (input signals in manual mode)
STP: BOOL (Asynchronous Step in manual mode)
Output Q0..Q3: BOOL (output signals)
STATUS: BYTE (ESR compliant status output)
MANUAL_4 can override 4 digital signal in manual mode. As long as MAN =
FALSE the outputs Q follows direct the input I. As soon as the inputs MAN
= TRUE, the outputs follow the states of the inputs M. The STP input follow
is in manual mode, a rotating set of outputs are generated. STP is active
only during manual operation. When in manual operation of STP registered
a rising edge, then the outputs follow not the inputs MX but are switched
cyclically with STP. At the frst rising edge of STP, only the output Q0 gets
active and the next edge of STP the module switch to the output Q1 and
so on. Once the input MAN goes back to FALSE the outputs Q follows again
the input I. The ESR compliant status output passes the switching states.
STATUS Condition
100 Automatic Mode MAN = FALSE, Q0 = I0, Q1 = I1, Q2 = I2, Q3 = I3
101 Manual Mode MAN = TRUE, Q0 = M0, Q1 = M1, Q2 = M2, Q3 = M3
110,111,112,1
13
Step Mode for Output Q0, Q1, Q2, Q3

24.13. Parset

Type Function module
Input A0: BOOL (selection input 0)
A1: BOOL (selection input 1)
Setup X01, X11, X21, X31: REAL (values for parameters P1)
X02, X12, X22, X32: REAL (values for parameters P2)
X03, X13, X23, X33: REAL (values for parameters P3)
X04, X14, X24, X34: REAL (values for parameters P4)
TC: TIME (ramp time to a new value of the)
Output P1: REAL (parameter 1 out)
P2: REAL (Parameter 2 Output)
P3: REAL (Parameter 3 Output)
P4: REAL (Parameter 4 Output)
Parset selects from up to 4 sets of parameters each one and returns the
values at the outputs P1 to P4. The values for the parameter sets are def-
ned with the setup variables. If the TC setup variable to a value > 0 is set,
the outputs do not change abruptly to a new value, but run in a ramp to
the new value so that the fnal value is reached after time TC. This allows
the smooth transition between diferent sets of parameters. The choice of
parameters is controlled by inputs A0 and A1.
A1,A0 P1 P2 P3 P4
00 X01 X02 X03 X04
01 X11 X12 X13 X14
10 X21 X22 X23 X24
11 X31 X32 X33 X34

24.14. PARSET2

Type Function module
Input X: REAL (input)
Setup X01, X11, X21, X31: REAL (values for parameters P1)
X02, X12, X22, X32: REAL (values for parameters P2)
X03, X13, X23, X33: REAL (values for parameters P3)
X04, X14, X24, X34: REAL (values for parameters P4)
L1, L2, L3: REAL ( Limits for the parameter switching
TC: TIME (ramp time at the outputs P)
Output P1: REAL (parameter 1 out)
P2: REAL (Parameter 2 Output)
P3: REAL (Parameter 3 Output)
P4: REAL (Parameter 4 Output)
Parset selects from up to 4 sets of parameters one and returns the values
at the outputs P1 to P4. The values for the parameter sets are defned
with the setup variables. If the TC setup variable to a value > 0 is set, the
outputs do not change abruptly to a new value, but run in a ramp to the
new value so that the fnal value is reached after time TC. This allows the
smooth transition between diferent sets of parameters. The choice of pa-
rameters is the controlled variable X and the thresholds L1 to L3 set.
X P1 P2 P3 P4
X < L1 X01 X02 X03 X04
L1 < X < L2 X11 X12 X13 X14
L2 < X < L3 X21 X22 X23 X24
X >= L3 X31 X32 X33 X34

24.15. SIGNAL

Type Function module
Input IN: BOOL (enable input)
SIG: BYTE (Bitpattern)
TS: TIME (switching time)
Output Q: BOOL (output)
SIGNAL generates an output signal Q that corresponds to the bit pattern in
SIG. This is Bitpattern is passed in TS long steps. By diferent bit patterns
in SIG, various output signals are generated. If the input IN connected to
TRUE, the module begins to put on output Q in accordance with the SIG
provided Bitpattern. By adapting the Bitpattern diferent output signals
are generated. A Pattern of 10101010, generates an output signal with
50% Duty Cycle and a frequency that is 1/2*S. A Pattern 11110000 by con-
trast, generates an output signal of 50% and a frequency of 1/8*TS. The
start of an output signal is random. The Bit sequence starts at any bit
when the input IN goes to TRUE. If at the input TS no time given then the
module internally uses a default of 1024ms per cycle (a cycle is the cycle
of all 8 bits of a sequence). Typical applications for SIGNAL is the signal ge-
neration for sirens or signal lamps.
The following graph illustrates the functioning of signal for
SIG = 2#1111_0000:

24.16. SIGNAL_4

Type Function module
Input IN1..IN4: BOOL (input for Bitpattern S1..S4)
TS: TIME (switching time)
Setup S1.. S4: BYTE (Bitpattern S1 .. S4)
Output Q: BOOL (output)
SIGNAL_4 generates an output signal Q that is equivalent the one of 4 Bit-
pattern (S1.. S4). This is Bitpattern is passed in TS long steps. The inputs
IN1..IN4 inputs are prioritized. A TRUE at IN1 overrides all other inputs, IN2
overwrite IN3 and IN4 has the lowest priority. A detailed description of the
function of SIGNAL_4 is under SIGNAL. The 4 diferent Bitpattern are in se-
tup variables are in S1.. S4 and can be adjusted by the user at any time.
The module has the following default by Bitpattern, but can be changed by
the user if required:
S1 = 2#1111_1111
S2 = 2#1111_0000
S3 = 2#1010_1010
S4 = 2#1010_0000

24.17. SRAMP

Type Function module
Input X: REAL (input)
A_UP: REAL (Maximum acceleration Up)
A_DN: REAL (Maximum acceleration down)
VU_MAX: REAL (Maximum speed Up)
VD_MAX: REAL (Maximum Speed Down)
LIMIT_HIGH: REAL (Output Limit High )
LIMIT_LOW: REAL (Output Limit Low )
RST: BOOL (Asynchronous Reset)
Output Y: REAL (output signal)
V: REAL (current speed of the output signal)
SRAMP generates an output signal which is is limited by the adjustable pa-
rameters. The output follows the input signal and is limited by maximum
speed (VU_MAX and VD_MAX), upper and lower limit (LIMIT_LOW and LI-
MIT_HIGH), and maximum acceleration (A_UP and A_DN). SRAMP is used to
drive motors, for example. The output V passes the current speed of the
output.
In following diagram, the internal process of SRAMP is shown. A ramp ge-
nerator X2, sets the speed of the output change, and a second ramp gene-
rator X3 controls the output.
The Trace Recording shows an example of SRAMP. The input (green) increa-
ses from 0 to 20 and then immediately to 10 while the output increases
with the maximum acceleration to maximum speed. Then is shown that
the Input during the course may change. In this example, it slowed down
in time, so that the output stops exactly at 10. After reaching the end va-
lue 10 of the input switches to -3 and the output Y follows accordingly.
The input values for A_UP and VU_MAX must be specifed with a positive
sign, A_DN and VD_MAX need a negative sign.

24.18. TUNE

Type Function module
Input SET: BOOL (Asynchronous set input)
SU, SD: BOOL (inputs for up and down)
RST: BOOL (asynchronous reset input)
Setup SS: REAL (step size for small step)
SS: REAL (step size for small step)
Limit_H: REAL (upper limit)
RST_VAL: REAL (initial value after reset)
RST_VAL: REAL (initial value after reset)
T1: TIME (time after the frst ramp starts)
T1: TIME (time in which the second ramp starts)
S1: REAL (speed for frst ramp)
S2: REAL (speed for second ramp)
Output Y: REAL (output signal)
TUNE sets, using up and down buttons, an output signal Y. By correspon-
ding setup variables, the increment will be programmed individually. An
upper and lower limit for the output Y can be specifed by LIMIT_L and LI-
MIT_H. with the buttons SU and SD up or down steps are generated. If a
key is held down longer than the time T1, then the output Y is continuously
adjusted up or down. The speed, which with the output is adjusted here, is
given by S1. S1 and S2 indicate the units per second. Is a button held
down longer than the time T2, the device automatically switches to a se-
cond speed S2. With the inputs RST and SET the output can at any time be
adjusted by RST_VAL resp. SET_VAL to a predetermined value.

24.19. TUNE2

Type Function module
Input SET: BOOL (Asynchronous set input)
SU, SD: BOOL (inputs for up and down in small increments)
FU, FD: BOOL (inputs for up and down in large increments)
RST: BOOL (asynchronous reset input)
Setup SS: REAL (step size for small steps)
FS: REAL (step size for big steps)
SS: REAL (step size for small step)
Limit_H: REAL (upper limit)
RST_VAL: REAL (initial value after reset)
RST_VAL: REAL (initial value after reset)
TR: TIME (time in which the ramp starts)
S1: REAL (speed for small ramp)
S2: REAL (speed for large ramp)
Output Y: REAL (output signal)
TUNE2 sets an output signal Y using up and down buttons. By correspon-
ding setup variables, the step size for small and large steps are program-
med individually. An upper and lower limit for the output Y can be speci-
fed by LIMIT_L and LIMIT_H. with the SU and SD keys small steps can be
generated up or down. The buttons FU and FD respectively produce large
steps at the output Y. If a key is held down longer than TR, then the output
Y continuously adjusted up or down. The speed which with the output here
is adjusted, is for the two pairs of keys S1 and S2 set individually. S1 and
S2 indicate the units per second. S1 is the speed of the button SU and SD,
and S2 according to FU and FD. With the inputs of the RST and SET the
Output can be set at any time, on a value predetermined by RST_VAL
SET_VAL.