Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY
This function block is used for protection of a current mode input from over current.
Library versions up to 1.3.2.7Library versions up to 1.3.2.7
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:
|
Parameter |
Data type |
Unit |
Range |
Description |
i_pEventCode |
POINTER TO EventCode |
- |
≠0 |
Pointer to application variable which is type EventCode. |
TRUE: All initialization parameters ok. |
FALSE: Error in initialization parameter(s). |
The block sets o_Status.OutputValid state TRUE if:
• The control is enabled, i.e. i_Enable is TRUE and
• No fault (including initialization) has been diagnosed
If the diagnosed AI pin is set to operate in current mode, and S_i_Current value is over G_AI_OVERCURRENT_LIMIT continuously over G_AI_OVERCURRENT_DIAG_DELAY time, then
• The diagnostic statuses o_Status.OutputValid is set FALSE, o_Status.OverCurrent error is set TRUE and the corresponding EventID is set to i_pEventCode.
If S_i_Current input value is under 0 when i_Enable is TRUE, then
• Immediately the diagnostic statuses o_Status.OutputValid is set FALSE, o_Status.ParameterError error is set TRUE and the corresponding EventID is set to i_pEventCode.
The application must set the pin to voltage mode with FW-provided function. |
Input variable name |
Data type |
Unit |
Range |
Description |
i_Enable |
BOOL |
- |
- |
Enable POU operation |
S_i_Current |
SAFEDINT |
uA |
>=0 |
Measured current of input |
Output variable name |
Data type |
Range |
Description |
o_Status |
Status |
- |
Status of output value. See Status struct. |
See Diagnostic Interface library description of error status and event code functionality.
Conditions |
o_Status. OutputValid |
o_Status error status |
Event code FunctionID |
Event code EventID |
i_Enable TRUE AND i_pEventCode valid AND S_i_Current < 0 |
FALSE |
ParameterError |
AI_OC_PROTECTION |
PARAMETER_ERROR |
i_Enable TRUE AND |
FALSE |
ParameterError |
- |
- |
i_Enable rises AND i_pEventCode valid AND S_i_Current <= G_AI_OVERCURRENT_LIMIT |
TRUE |
- |
NO_FUNC |
NO_ERROR |
i_Enable TRUE AND i_pEventCode valid AND S_i_Current > G_AI_OVERCURRENT_LIMIT |
FALSE |
OverCurrent |
AI_OC_PROTECTION |
INPUT_TOO_HIGH |
When enabling IO configuration on-the-fly, the firmware turns the safety switch off. |
S_AIOverCurrentProtection FB is included for current inputs in Multitool Creator code template. |
Safety Definitions: |
Result: EPEC_SYSTEM.SYSTEM_ERROR_CODES:= EPEC_SYSTEM.SYSTEM_ERROR_CODES.FW_ERR_OK;
PIN_1_03_OC: EPEC_SHWD.S_AIOverCurrentProtection; PIN_1_03_OC_Status: EPEC_SHWD.Status; PIN_1_03_OC_EC: EPEC_DITF.EventCode;
|
Safety Init: |
PIN_1_03_OC_EC.DeviceID := BYTE#1; PIN_1_03_OC_EC.ChannelID := BYTE#3; PIN_1_03_OC_EC.FunctionID := EPEC_DITF.FunctionIDs.NO_FUNC; PIN_1_03_OC_EC.EventID := EPEC_DITF.ErrorIDs.NO_ERROR;
PIN_1_03_OC.Init( i_pEventCode := ADR(PIN_1_03_OC_EC) );
|
Safety Code: |
PIN_1_03_OC( i_Enable := TRUE, S_i_Current := PIN_1_03_Current, (* Mapped to pin current feedback in io_interface *) o_Status => PIN_1_03_OC_Status );
(* Pin overcurrent -> set to voltage mode *) IF PIN_1_03_OC_Status.OverCurrent THEN Result := EPEC_IODRV.IoDrvDOSetConfig(EPEC_HW.IO_Channels.PIN_1_03_DO_TYPE_V_mA,FALSE); END_IF
|
Library versions 1.4.0.0 or laterLibrary versions 1.4.0.0 or later
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:
|
Parameter |
Data type |
Unit |
Range |
Description |
i_pEventCode |
POINTER TO EventCode |
- |
≠0 |
Pointer to application variable which is type EventCode. |
TRUE: All initialization parameters ok. |
FALSE: Error in initialization parameter(s). |
The input value i_ADCValue is always written to output o_ADCValue.
The block sets o_Status.OutputValid state TRUE if:
• The control is enabled, i.e. i_Enable is TRUE and
• No fault (including initialization) has been diagnosed
If the diagnosed AI pin is set to operate in current mode, and i_ADCValue value is at hardware specific AD_MAXIMUM continuously over G_AI_OVERCURRENT_DIAG_DELAY time, then
• The diagnostic statuses o_Status.OutputValid is set FALSE, o_Status.OverCurrent error is set TRUE and the corresponding EventID is set to i_pEventCode.
The application must set the pin to voltage mode with FW-provided function. |
Input variable name |
Data type |
Unit |
Range |
Description |
i_Enable |
BOOL |
- |
- |
Enable POU operation. |
i_ADCValue |
DWORD |
- |
- |
Raw AD converter value. |
Output variable name |
Data type |
Range |
Description |
o_ADCValue |
DWORD |
- |
Raw AD converter value. |
o_Status |
Status |
- |
Status of output value. See Status struct. |
See Diagnostic Interface library description of error status and event code functionality.
Conditions |
o_Status. OutputValid |
o_Status error status |
Event code FunctionID |
Event code EventID |
i_Enable TRUE AND |
FALSE |
ParameterError |
- |
- |
i_Enable rises AND i_pEventCode valid AND i_ADCValue < G_ADC_MAXIMUM_VALUE |
TRUE |
- |
NO_FUNC |
NO_ERROR |
i_Enable TRUE AND i_pEventCode valid AND i_ADCValue >= G_ADC_MAXIMUM_VALUE |
FALSE |
OverCurrent |
AI_OC_PROTECTION |
INPUT_TOO_HIGH |
When enabling IO configuration on-the-fly, the firmware turns the safety switch off. |
S_AIOverCurrentProtection FB is included for current inputs in Multitool Creator code template. |
Safety Definitions: |
Result: EPEC_SYSTEM.SYSTEM_ERROR_CODES:= EPEC_SYSTEM.SYSTEM_ERROR_CODES.FW_ERR_OK;
PIN_1_03_OC: EPEC_SHWD.S_AIOverCurrentProtection; PIN_1_03_OC_Status: EPEC_SHWD.Status; PIN_1_03_OC_EC: EPEC_DITF.EventCode;
|
Safety Init: |
PIN_1_03_OC_EC.DeviceID := BYTE#1; PIN_1_03_OC_EC.ChannelID := BYTE#3; PIN_1_03_OC_EC.FunctionID := EPEC_DITF.FunctionIDs.NO_FUNC; PIN_1_03_OC_EC.EventID := EPEC_DITF.ErrorIDs.NO_ERROR;
PIN_1_03_OC.Init( i_pEventCode := ADR(PIN_1_03_OC_EC) );
|
Safety Code: |
PIN_1_03_OC( i_Enable := TRUE, i_ADCValue := AI_RAW_MAIN_X1_03, o_Status => PIN_1_03_OC_Status );
(* Pin overcurrent -> set to voltage mode *) IF PIN_1_03_OC_Status.OverCurrent THEN Result := EPEC_IODRV.IoDrvDOSetConfig(EPEC_HW.IO_Channels.PIN_1_03_DO_TYPE_V_mA,FALSE); END_IF
|
Source file topic100436.htm
Last updated 19-Dec-2024