10 application instructions api 200-249 – Delta Electronics Programmable Logic Controller DVP-PLC User Manual
Page 575
![background image](/manuals/75807/575/background.png)
10 Application Instructions API 200-249
DVP-PLC Application Manual
10-1
API Mnemonic
Operands
Function
202
SCAL P
Proportional Value Calculation
Controllers
ES/EX/SS SA/SX/SC EH/SV
Bit Devices
Word Devices
Program Steps
Type
OP
X Y M S K H
KnX KnY KnM KnS T
C
D
E
F
S
1
*
*
*
S
2
*
*
*
S
3
*
*
*
D
*
SCAL, SCALP: 9 steps
PULSE 16-bit 32-bit
ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands:
S
1
: Source value S
2
: Slope S
3
: Offset D: Destination device
Explanations:
1. Range of S1, S2, S3: -32,768 ~ 32,767
2. Unit of S2: 0.001
3. See the specifications of each model for their range of use.
4. Operation
equation
in the instruction: D = (S
1
× S
2
) ÷ 1000 + S
3.
Users have to obtain S
2
and S
3
(decimals are rounded up into 16-bit integers) by using the slope and offset
equations below.
Slope equation: S
2
= [(max. destination value – min. destination value) ÷ (max. source value – min. source value)]
× 1,000
Offset equation: S
3
= min. destination value – min. source value × S
2
÷ 1,000
The output curve is shown as the figure:
D
1
Min. destination value
Max. Destination value
Destination value
Source value
Max.
source value
Min.
source value
Program Example 1:
1. Assume
S
1
= 500, S
2
= 168, S
3
= -4. When X0 = On, SCAL instruction will be executed and obtain the proportional
value at D0.
2. Equation: D0 = (500 Ч 168) ч 1,000 + (-4) = 80
X0
SCAL
K500
K168
K-4
D0