Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY, CODESYS 3.5 SP19 SAFETY
This function block monitors internal temperature of the controller.
|
The function block cannot be disabled. To be used only for monitoring purposes. |
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 |
S_i_HighTemperatureLimit |
SAFEDINT |
°C |
- |
Limit for high temperature diagnosis. |
S_i_LowTemperatureLimit |
SAFEDINT |
°C |
- |
Limit for low temperature diagnosis. |
S_i_DiagnosticDelay |
SAFEUINT |
ms |
0 - 10000 |
Delay time for diagnostics. |
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 function block is always enabled. If i_Temperature value is out of given limits, corresponding error status bit and event code are set.
Input variable name |
Data type |
Unit |
Range |
Description |
i_Temperature |
DINT |
0,1 °C |
- |
Measured temperature. |
Output variable name |
Data type |
Unit |
Range |
Description |
S_o_Temperature |
SAFEDINT |
0,1 °C |
- |
Validated temperature. |
o_Status |
Status |
- |
- |
Status of output value. See Status struct. |
See Diagnostic Interface library description of error status and event code functionality.
Conditions |
S_o_Temperature |
o_Status. OutputValid |
o_Status error status |
Event code FunctionID |
Event code EventID |
i_pEventCode NULL |
i_Temperature |
FALSE |
ParameterError |
- |
- |
S_i_TemperatureHighLimit =< S_i_TemperatureLowLimit OR S_i_DiagnosticDelay > 10000 |
i_Temperature |
FALSE |
ParameterError |
INTERNAL_TEMP |
PARAMETER_ERROR |
init parameters ok AND S_i_TemperatureHighLimit > i_Temperature > S_i_TemperatureLowLimit |
i_Temperature |
TRUE |
- |
NO_FUNC |
NO_ERROR |
init parameters ok AND i_Temperature > S_i_TemperatureHighLimit |
i_Temperature |
FALSE |
OutputHigh |
INTERNAL_TEMP |
OUTPUT_TOO_HIGH |
init parameters ok AND i_Temperature < S_i_TemperatureLowLimit |
i_Temperature |
FALSE |
OutputLow |
INTERNAL_TEMP |
OUTPUT_TOO_LOW |
|
The location of the POU instance depends on the application: Non-safe instances are handled in non-safe context, safe instances are handled in safe context. The example code applies to both. |
|
Function block is included in hardware specific diagnostic program. It is automatically generated to code template when MultiTool Creator is used. |
Definitions: |
VAR_INPUT i_SBCTemperature: DINT := DINT#0; // SBController temperature (0,1°C)
END_VAR
VAR_OUTPUT (* Temperature *) o_SBCTemperatureStatus: EPEC_SHWD.Status; // FB status o_SBCTemperatureEC: EPEC_DITF.EventCode; // Event code S_o_SBCTemperature: SAFEDINT; // SBController temperature (0,1°C)
END_VAR
VAR init_ok: BOOL; // Initialization status SBCTemperature: EPEC_SHWD.S_InternalTempMonitoring; // POU instance
END_VAR
|
Init: |
(* SBController temperature monitoring *) init_ok := SBCTemperature.Init( S_i_HighTemperatureLimit := G_IO.SBC_TEMP_HIGH_LIMIT, // Temperature high limit (°C) S_i_LowTemperatureLimit := G_IO.SBC_TEMP_LOW_LIMIT, // Temperature low limit (°C) S_i_DiagnosticDelay := G_IO.TEMPERATURE_DIAGNOSTIC_DELAY, // Diagnostic delay (ms) i_pEventCode := ADR(o_SBCTemperatureEC) // Event code pointer for FB );
|
Code: |
(* SBController temperature monitoring *) SBCTemperature( i_Temperature := i_SBCTemperature, // SBController temperature (0,1°C) o_Status => o_SBCTemperatureStatus, // Temperature status S_o_Temperature => S_o_SBCTemperature // SBController temperature (0,1°C) );
|
S_SC52_Diagnostic (PRG)
Source file topic100435.htm
Last updated 21-Feb-2025