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

 

S_CurrentRequest (FB)

Description

This function block scales the input control signal -10000 - (+)10000 to current request.

 

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

  • S_i_MinimumCurrent is out of range OR

  • S_i_MaximumCurrent  is out of range OR

  • S_i_MinimumCurrent >= S_i_MaximumCurrent  

 

Initialization parameters

Parameter

Data type

Unit

Range

Description

S_i_MinimumCurrent

SAFEUINT

mA

0-5000  

Minimum current value which is used in scaling.  

S_i_MaximumCurrent

SAFEUINT

mA

0-5000  

Maximum current value which is used in scaling.

S_i_PositiveControlDir

SAFEBOOL

-

-

True = Positive control signals are scaled to current request.

False = Negative control signals are scaled to current request.

i_pEventCode

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

POU scales the input control value S_i_Control to output current request S_o_CurrentRequest based on the given minimum and maximum current request parameters and S_i_PositiveControlDir flag. If S_i_PositiveControlDir is true then positive input control signals are scaled to output current request and negative input signal sets the output S_o_CurrentRequest to 0. 

 

 

 If S_i_PositiveControlDir is false then negative input control signals are scaled to output current request and positive input signal sets the output S_o_CurrentRequest to 0

 

 

The block sets o_Status.OutputValid state TRUE if signals are valid and operation is enabled, i.e. i_Enable is TRUE.

 

 

Inputs

Input variable name

Data type

Unit

Range

Description

i_Enable

BOOL

-

-

Enable POU operation

S_i_Control

SAFEINT

-

-10000 -       (+) 10000

Control value

Outputs

Output variable name

Data type

Unit

Range

Description

S_o_CurrentRequest

SAFEUINT

mA

0-5000

Current request

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_Output value

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

CURRENT_REQUEST  

PARAMETER_ERROR

i_Enable TRUE

AND

init parameter error AND
i_pEventCode NULL

0

FALSE

ParameterError

-

-

i_Enable TRUE

AND

 init parameters ok

scaled current request value

TRUE

-

NO_FUNC

NO_ERROR

i_Enable TRUE

AND

 init parameters ok

AND

S_i_Control > 10000  

0

FALSE

InputHigh

CURRENT_REQUEST

INPUT_TOO_HIGH  

i_Enable TRUE

AND

 parameters ok

AND

S_i_Control <         -10000  

0

FALSE

InputLow

CURRENT_REQUEST

INPUT_TOO_LOW

 

See also

 

 

 

 

Source file topic100406.htm

Last updated 21-Feb-2025