Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY, CODESYS 3.5 SP19 SAFETY

 

S_EndAttenuation (FB)

Description

This function block limits proportional control value when movement is near the end position.

 

Initialization

Init method is used to initialize the necessary static calculation parameters for the function block instance.

The method shall be called at least once before the actual function block can be called, i.e. at the application initialization phase.

The method checks the validity of input parameters. However, none of the function block outputs are affected by the initialization.

 

A parameter error is diagnosed if:

  • Init method is not called before the main FB call OR

  • i_pEventCode = 0 OR

  • i_pEventCodePosDirAtt = 0 OR

  • i_pEventCodeNegDirAtt = 0 OR

  • S_i_PosDirAttenuationLimit is out of range OR

  • S_i_NegDirAttenuationLimit  is out of range   

 

Initialization parameters

Parameter

Data type

Unit

Range

Description

S_i_PosDirAttenuationLimit  

SAFEUINT

%

0-100

Attenuated positive direction maximum control value. Percent from value 10000.   

S_i_NegDirAttenuationLimit

SAFEUINT

%

0-100

Attenuated negative direction minimum control value. Percent from value  -10000.

i_pEventCode

POINTER TO EventCode

-

≠0

Pointer to application variable which is type EventCode.

i_pEventCodePosDirAtt

POINTER TO EventCode

-

≠0

Pointer to application variable which is type EventCode.

i_pEventCodeNegDirAtt

POINTER TO EventCode

-

≠0

Pointer to application variable which is type EventCode.

 

 

Initialization method return value

TRUE: All initialization parameters ok.

FALSE: Error in initialization parameter(s).

 

Operation

The output value S_o_Control is limited to the given percentage (S_i_PosDirAttenuationLimit) of the positive max control value if the S_i_Control value is higher than limited value and the corresponding end attenuation flag S_i_PosDirAttenuationOn is true. S_o_Control is limited to given percentage (S_i_NegDirAttenuationLimit) of negative min control value if the S_i_Control value is lower than limited value and the corresponding end attenuation flag S_i_NegDirAttenuationOn is true. Otherwise S_o_Control follows the input value S_i_Control.  

 

See figure below where S_i_PosDirAttenuationLimit = 70 and S_i_NegDirAttenuationLimit = 60 and the corresponding end attenuation input is true when end attenuation limit is reached.

 

 

 

Inputs

Input variable name

Data type

Unit

Range

Description

i_Enable

BOOL

-

-

Enable POU operation

S_i_Control

SAFEINT

-

-10000 - (+)10000

Control value

S_i_PosDirAttenuationOn

SAFEBOOL

-

-

Positive direction end attenuation is active

S_i_PosDirAttenuationOn

SAFEBOOL

-

-

Negative direction end attenuation is active

Outputs

Output variable name

Data type

Unit

Range

Description

S_o_Control

SAFEINT

-

-10000 - (+)10000

Attenuated control value

o_Status

Status

-

 

Status of output value. See Status structure.

Error diagnostic

See Diagnostic Interface library description of error status and event code functionality.

 

Conditions

S_o_

Control

o_Status. OutputValid

o_Status error status

Event code FunctionID

Event code EventID

i_Enable TRUE AND

init parameter error AND

 i_pEventCode valid

0

FALSE

ParameterError

END_ATTENUATION

PARAMETER_ERROR

i_Enable TRUE AND

init parameter error AND
i_pEventCode NULL

0

FALSE

ParameterError

-

-

i_Enable TRUE AND

 init parameters ok AND

S_i_Control within range

Attenuated control value

TRUE

-

NO_FUNC

NO_ERROR

i_Enable TRUE AND

 init parameters ok AND

S_i_Control > 10000  

0

FALSE

InputHigh

END_ATTENUATION

INPUT_TOO_HIGH

i_Enable TRUE AND

 parameters ok AND

S_i_Control <  -10000  

0

FALSE

InputLow

END_ATTENUATION

 INPUT_TOO_LOW

 

See also

 

 

 

 

Source file topic100405.htm

Last updated 21-Feb-2025