Curve_20XY_Real_Real

Curve_20XY_Real_Real (FB)

FUNCTION_BLOCK Curve_20XY_Real_Real

Short description

Input of 20 value pairs (support points each with an X and Y value) Boundary conditions:\

  1. The X values must be consecutive either strictly increasing or strictly decreasing

  2. Each X value may only appear once

  3. Two adjacent support points are each connected by a straight line Typical application: Calculation of the performance of a heat pump depending on the outside temperature

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

rInputValue

REAL

0

Current value of the input variable

Outputs

Name
Data type
Value range
Initial value
Function

rOutputValue

REAL

0.0

Current value of the output variable

eOrderXValues

eCurve_20XY_Real_Real_Order

eCurve_20XY_Real_Real_Order.Invalid

Order of the X values (increasing / decreasing)

eError

eCurve_20XY_Real_Real_Error

eCurve_20XY_Real_Real_Error.No_Error

Cause of error

xError

BOOL

FALSE

Error state ( TRUE = error )

Setpoints / parameters

Name
Data type
Value range
Initial value
Function

rOutputValue_Subst

REAL

-1000

Substitute value of the output variable in case of error

rOutputValue_Min

REAL

0

Absolute minimal value of the output variable

rOutputValue_Max

REAL

100

Absolute maximal value of the output variable

rSP1_X

REAL

1

Support point 1 - X value

rSP1_Y

REAL

2

Support point 1 - Y value

rSP2_X

REAL

2

Support point 2 - X value

rSP2_Y

REAL

4

Support point 2 - Y value

rSP3_X

REAL

3

Support point 3 - X value

rSP3_Y

REAL

6

Support point 3 - Y value

rSP4_X

REAL

4

Support point 4 - X value

rSP4_Y

REAL

8

Support point 4 - Y value

rSP5_X

REAL

5

Support point 5 - X value

rSP5_Y

REAL

10

Support point 5 - Y value

rSP6_X

REAL

6

Support point 6 - X value

rSP6_Y

REAL

12

Support point 6 - Y value

rSP7_X

REAL

7

Support point 7 - X value

rSP7_Y

REAL

14

Support point 7 - Y value

rSP8_X

REAL

8

Support point 8 - X value

rSP8_Y

REAL

16

Support point 8 - Y value

rSP9_X

REAL

9

Support point 9 - X value

rSP9_Y

REAL

18

Support point 9 - Y value

rSP10_X

REAL

10

Support point 10 - X value

rSP10_Y

REAL

20

Support point 10 - Y value

rSP11_X

REAL

11

Support point 11 - X value

rSP11_Y

REAL

22

Support point 11 - Y value

rSP12_X

REAL

12

Support point 12 - X value

rSP12_Y

REAL

24

Support point 12 - Y value

rSP13_X

REAL

13

Support point 13 - X value

rSP13_Y

REAL

26

Support point 13 - Y value

rSP14_X

REAL

14

Support point 14 - X value

rSP14_Y

REAL

28

Support point 14 - Y value

rSP15_X

REAL

15

Support point 15 - X value

rSP15_Y

REAL

30

Support point 15 - Y value

rSP16_X

REAL

16

Support point 16 - X value

rSP16_Y

REAL

32

Support point 16 - Y value

rSP17_X

REAL

17

Support point 17 - X value

rSP17_Y

REAL

34

Support point 17 - Y value

rSP18_X

REAL

18

Support point 18 - X value

rSP18_Y

REAL

36

Support point 18 - Y value

rSP19_X

REAL

19

Support point 19 - X value

rSP19_Y

REAL

38

Support point 19 - Y value

rSP20_X

REAL

20

Support point 20 - X value

rSP20_Y

REAL

40

Support point 20 - Y value

Function description

The output variable 'rOutputValue' is calculated cyclically based on the input variable 'rInputValue' and the characteristic curve defined by the 20 support points, provided no error is present ( xError = FALSE ). It is limited by the configurable absolute minimum ( rOutputValue_Min ) and maximum values ( rOutputValue_Max ). In case of error ( xError = TRUE ) the fixed substitute value 'rOutputValue_Subst' is output on the output variable 'rOutputValue'. The X values of the 20 support points must meet the following boundary conditions: 1) The X values must be consecutive either strictly increasing or strictly decreasing 2) Each X value may only appear once 3) Two adjacent support points are each connected by a straight line The update of the characteristic curve is performed once immediately after initialization or once after every change of the support points. In case of error (identical X values, X values not strictly increasing / decreasing) a corresponding cause of error is indicated at the output 'eError'. At the same time the fixed substitute value 'rOutputValue_Subst' is output on the output variable 'rOutputValue'. The output 'xError' is active ( = TRUE ) if an error is signaled at the output 'eError'.\

Representation of an example characteristic curve

CODESYS

InOut:

Scope
Name
Type
Initial

Input

rInputValue

REAL

0

Output

rOutputValue

REAL

0

Output

eOrderXValues

eCurve_20XY_Real_Real_Order

eCurve_20XY_Real_Real_Order.Invalid

Output

eError

eCurve_20XY_Real_Real_Error

eCurve_20XY_Real_Real_Error.No_Error

Output

xError

BOOL

FALSE

Input Const

rSP20_Y

REAL

40

Input Const

rSP20_X

REAL

20.0

Input Const

rSP19_Y

REAL

38.0

Input Const

rSP19_X

REAL

19.0

Input Const

rSP18_Y

REAL

36.0

Input Const

rSP18_X

REAL

18.0

Input Const

rSP17_Y

REAL

34.0

Input Const

rSP17_X

REAL

17.0

Input Const

rSP16_Y

REAL

32.0

Input Const

rSP16_X

REAL

16.0

Input Const

rSP15_Y

REAL

30.0

Input Const

rSP15_X

REAL

15.0

Input Const

rSP14_Y

REAL

28.0

Input Const

rSP14_X

REAL

14.0

Input Const

rSP13_Y

REAL

26.0

Input Const

rSP13_X

REAL

13.0

Input Const

rSP12_Y

REAL

24.0

Input Const

rSP12_X

REAL

12.0

Input Const

rSP11_Y

REAL

22.0

Input Const

rSP11_X

REAL

11.0

Input Const

rSP10_Y

REAL

20.0

Input Const

rSP10_X

REAL

10.0

Input Const

rSP9_Y

REAL

18.0

Input Const

rSP9_X

REAL

9.0

Input Const

rSP8_Y

REAL

16.0

Input Const

rSP8_X

REAL

8.0

Input Const

rSP7_Y

REAL

14.0

Input Const

rSP7_X

REAL

7.0

Input Const

rSP6_Y

REAL

12.0

Input Const

rSP6_X

REAL

6.0

Input Const

rSP5_Y

REAL

10.0

Input Const

rSP5_X

REAL

5.0

Input Const

rSP4_Y

REAL

8.0

Input Const

rSP4_X

REAL

4.0

Input Const

rSP3_Y

REAL

6.0

Input Const

rSP3_X

REAL

3.0

Input Const

rSP2_Y

REAL

4.0

Input Const

rSP2_X

REAL

2.0

Input Const

rSP1_Y

REAL

2.0

Input Const

rSP1_X

REAL

1.0

Input Const

rOutputValue_Max

REAL

100.0

Input Const

rOutputValue_Min

REAL

0.0

Input Const

rOutputValue_Subst

REAL

-1000.0

Last updated