Supported platforms: CODESYS 3.5

 

S_EC44_Diagnostic (PRG)

Description

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:


The program also:

 

 

Library version 1.5.2.0 and newerLibrary version 1.5.2.0 and newer

The program diagnoses:


The program also:

 

 

Limitations

This program is EC44 specific. Do not use it with any other hardware.

 

 

Initialization

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.

 

 

Operation

The running state, which enables library diagnostics, is set TRUE in following conditions:

 

FW diagnostic task status

The program reads diagnostic task status from the firmware.

The following states are considered as OK when diagnostic is running:

 

Reference output voltage

 

Unit supply voltage

 

AD converter supply voltage (5VAN)

 

Output group control

 

Temperature measurements

The program has 2 kind of temperature handling functionality.

 

MCU and SBC temperatures

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.

 

PCB temperature

 

Inputs

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

Outputs

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.

 

Example code

The program is included in MultiTool Creator code template.

 

 

See also

 

 

 

 

Source file topic100585.htm

Last updated 13-Jun-2024