Supported platforms: CODESYS 3.5
This program is a single-block solution for EC44 unit diagnostics.
Library version 1.4.1.0 and olderLibrary version 1.4.1.0 and older
The program diagnoses:
Reference voltage high and low situations
Unit supply voltage high and low situations
AD converter supply voltage (5VAN) high and low situations
Output group control errors
Microcontroller unit (MCU) and system basis chip (SBC) temperature high and low situations
The program also:
Library version 1.5.2.0 and newerLibrary version 1.5.2.0 and newer
The program diagnoses:
Reference voltage high and low situations
Unit supply voltage high and low situations
AD converter supply voltage (5VAN) high and low situations
Output group control errors
Microcontroller unit (MCU) temperature high and low situations
The program also:
This program is EC44 specific. Do not use it with any other hardware. |
This method is used to initialize the necessary static calculation parameters for the program. The method shall be called at least once before the actual program can be called, i.e. at the application initialization phase.
In case of an initialization error, the diagnostic is not run.
The initialization method has no return value. |
Parameter |
Data type |
Unit |
Range |
Description |
S_i_SupplyVoltageHighLimit |
SAFEDINT |
mV |
> 0 |
High limit of supply voltage value. |
S_i_SupplyVoltageLowLimit |
SAFEDINT |
mV |
>= 0 |
Low limit of supply voltage value. |
S_i_SupplyVoltageDiagDelay |
SAFEUINT |
ms |
0 - 100 |
Diagnostic delay for supply voltage diagnostic. |
S_i_RefControlType5V |
SAFEBOOL |
- | - |
REF type, TRUE=5V, FALSE=10V |
S_i_RefControlDiagDelay |
SAFEUINT |
ms |
0 - 100 |
Diagnostic delay for reference voltage diagnostic. |
S_i_OutputGroup1HighVoltage |
SAFEDINT |
mV |
- |
High voltage limit for output group 1. |
S_i_OutputGroup1LowVoltage |
SAFEDINT |
mV |
- |
Low voltage limit for output group 1. |
S_i_OutputGroup1DiagDelay |
SAFEUINT |
ms |
0 - 100 |
Diagnostic delay for output group 1. |
S_i_5VANHighVoltage |
SAFEDINT |
mV |
- |
High voltage limit for AD converter supply voltage. |
S_i_5VANLowVoltage |
SAFEDINT |
mV |
- |
Low voltage limit for AD converter supply voltage. |
S_i_5VANDiagDelay |
SAFEUINT |
ms |
0 - 100 |
Diagnostic delay for AD converter supply voltage. |
S_i_TemperatureHighLimit |
SAFEDINT |
°C |
- |
Limit for high temperature diagnosis. |
S_i_TemperatureLowLimit |
SAFEDINT |
°C |
- |
Limit for low temperature diagnosis. |
S_i_TemperatureDiagDelay |
SAFEUINT |
ms |
0 - 10000 |
Diagnostic delay temperature diagnostic. |
The running state, which enables library diagnostics, is set TRUE in following conditions:
The program reads diagnostic task status from the firmware.
The following states are considered as OK when diagnostic is running:
EDiagnosticStatusUndervoltage
External 5 V/10 V reference voltage which can be controlled by the application
Ref type is application selectable
One measurement channel
The program uses S_RefControlAndDiagnostics (FB) for diagnostic
The program controls the REF output by using SafeSSeriesIoDriverExt library's SystemControl5Vref
Measured AD value is converted to voltage with S_ADCToVoltageOrCurrent (FB)
The voltage is diagnosed to be between given limits
Internal 5V reference voltage which is always on
One measurement channel
Measured AD value is converted to voltage with S_ADCToVoltageOrCurrent (FB)
The voltage is diagnosed to be between given limits
Output group can be controlled on by the application
Two redundant measurement channels
The program uses S_OutputGroupControlAndDiagnostics (FB) for diagnostics
The program controls output group by using SafeSSeriesIoDriverExt library's PowerSwitchSet
If the firmware diagnostic task status is not considered OK, the output group control status is set FALSE
The program has 2 kind of temperature handling functionality.
MCU and SBC temperatures are already in °C.
In library version 1.5.2.0 and newer: MCU temperature is validated against defined limit. SBC temperature is provided to application without diagnostics.
In library version 1.4.1.0 and older: MCU and SBC temperatures are validated against defined limit.
Two measurement channels
Measured AD values are converted to voltages with S_ADCToVoltageOrCurrent (FB)
Voltages are converted to resistance with S_VoltageToResistance (FB)
Resistances are converted to °C with S_KTYSensor (FUN)
The PCB temperatures have no diagnostics
Input variable name |
Data type |
Unit |
Description |
i_Reset |
BOOL |
- |
Reset flag disables diagnostic blocks' operation. Error statuses are cleared after falling edge of reset input. |
i_RefVoltageControl |
BOOL |
- |
Control request status for reference output. Diagnostic must be in running state before reference can be controller on. |
i_5VRefChannel1 |
DWORD |
- |
Filtered ADC value for reference output |
i_SupplyVoltageInPin |
DWORD |
- |
Filtered ADC value for supply voltage pin |
i_OutputGroup1Control |
BOOL |
- |
Status to control safety switch. |
i_SupplyBeforeSafetySwitch1 |
DWORD |
- |
Filtered ADC value voltage before safety switch |
i_SupplyAfterSafetySwitch1 |
DWORD |
- |
Filtered ADC value voltage after safety switch |
i_5VANChannel1 |
DWORD |
- |
Filtered ADC value for channel 1 for 5VAN measurement |
i_MCUTemperature |
DINT |
0,1 °C |
FW provided °C value for MCU temperature. |
i_SBCTemperature |
DINT |
0,1 °C |
FW provided °C value for SBC temperature. |
i_PCBTemperatureChannel1 |
DWORD |
- |
Filtered ADC value for PCB temperature channel 1 |
i_PCBTemperatureChannel2 |
DWORD |
- |
Filtered ADC value for PCB temperature channel 2 |
Output variable name |
Data type |
Unit |
Description |
S_o_InitReady |
SAFEBOOL |
- |
Initialization ready. |
o_InitError |
BOOL |
- |
Initialization error. |
S_o_Running |
SAFEBOOL |
- |
Diagnostics initialized OK and running. Waits for FW diagnostics to initialize first. |
S_o_DiagStatusOk |
SAFEBOOL |
- |
Diagnostic POU combined status. |
o_RefControlStatus |
Status |
- |
Status for reference output. See Status structure. |
o_RefControl_EC |
EPEC_DITF.EventCode |
- |
Event code for reference output. |
S_o_RefControl |
SAFEBOOL |
- |
Control state for reference output. |
S_o_RefVoltage |
SAFEDINT |
mV |
Scaled voltage for reference output |
o_OutputGroup1ControlStatus |
Status |
- |
Output group 1 voltage control status. See Status structure. |
o_OutputGroup1Control_EC |
EPEC_DITF.EventCode |
- |
Output group 1 voltage control event code. |
S_o_OutputGroup1ControlVoltage |
SAFEDINT |
mV |
Scaled and validated output group 1 voltage. |
S_o_OutputGroup1Control |
SAFEBOOL |
- |
Output group 1 control status. |
o_SupplyVoltageStatus |
EPEC_SC.Status |
- |
Supply voltage measurement status. |
o_SupplyVoltage_EC |
EPEC_DITF.EventCode |
- |
Supply voltage measurement event code. |
S_o_SupplyVoltage |
SAFEDINT |
mV |
Scaled voltage in supply pin |
o_5VANToVoltageCh1Status |
EPEC_SC.Status |
- |
5VAN voltage measurement channel 1 status. |
o_5VAN_EC |
EPEC_DITF.EventCode |
- |
5VAN voltage measurement event code. |
S_o_5VANVoltage |
SAFEDINT |
mV |
Scaled voltage for 5VAN. |
o_MCUTemperatureStatus |
Status |
- |
MCU temperature measurement status. See Status structure. |
o_MCUTemperatureEC |
EPEC_DITF.EventCode |
- |
MCU temperature measurement event code. |
S_o_MCUTemperature |
SAFEDINT |
0,1°C |
Scaled and validated MCU temperature. |
o_SBCTemperatureStatus |
Status |
- |
SBC temperature measurement status. See Status structure. |
o_SBCTemperatureEC |
EPEC_DITF.EventCode |
- |
SBC temperature event code. |
S_o_SBCTemperature |
SAFEDINT |
0,1°C |
Scaled SBC temperature. |
S_o_PCBTemperatureChannel1 |
SAFEDINT |
°C |
PCB temperature channel 1. |
S_o_PCBTemperatureChannel2 |
SAFEDINT |
°C |
PCB temperature channel 2. |
o_PCBTemperatureCh1Status |
EPEC_SC.Status |
- |
PCB temperature channel 1 status. |
o_PCBTemperatureCh2Status |
EPEC_SC.Status |
- |
PCB temperature channel 2 status. |
o_PCBTemperatureCh1_EC |
EPEC_DITF.EventCode |
- |
PCB temperature channel 1 event code. |
o_PCBTemperatureCh2_EC |
EPEC_DITF.EventCode |
- |
PCB temperature channel 2 event code. |
S_o_FWDiagnosticTaskStatus |
EPEC_IODRV. DIAGNOSTIC_ TASK_STATUS |
- |
Firmware diagnostic status. See SafeSSeriesIoDrvExt library’s Data Types. |
The program is included in MultiTool Creator code template. |
S_ValidateAI (FB)
S_KTYSensor (FUN)
SafeSSeriesIoDriverExt library
Source file topic100585.htm
Last updated 19-Dec-2024