User fault – Generates a user fault
Table of Contents
The User fault block is used to stop the converter operation from the user model. It makes the controller enters the FAULT state (user fault) and PWM outputs are blocked when the block input signal is larger than 0. The controller goes back to BLOCKED state when the input signal is smaller or equal to 0.
As further explained in Programming and operating imperix controllers, the different controller states (aka Core states) are:
Core states | Description |
---|---|
CONFIG | The system is being configured (typically at startup). |
FAULT | A fault occurred, due to one of the following reasons: * HARDWARE: a protection threshold of the analog frontend was crossed (B-Box only) * SOFTWARE: the interrupt execution failed to meet the real-time constraints * USER: the user code has returned an error * CONFIG: an erroneous configuration was detected |
BLOCKED | The system is configured correctly and waits for the PWM outputs to be enabled. |
OPERATING | The PWM outputs are enabled and the system is operating without error. |
Unlike the other sources of fault, the user fault is generated from the user code. When a user fault is triggered, a red banner appears in Cockpit and a user-defined message is shown in the log module:
Simulink block
Signal specification
- The input signal is a trigger signal. A user fault is generated as soon as the input signal is strictly larger than zero. The user fault is cleared when the input signal falls back to zero.
Parameters
Displayed message
is the message that is displayed in the Cockpit logs when the user fault is triggered. If multiple User fault blocks trigger a fault, only the message of the first block to trigger the fault is displayed.
PLECS block
Signal specification
- The input signal is a trigger signal. A user fault is generated as soon as the input signal is strictly larger than zero. The user fault is cleared when the input signal falls back to zero.
Parameters
Displayed message
is the message that is displayed in the Cockpit logs when the user fault is triggered. If multiple User fault blocks trigger a fault, only the message of the first block to trigger the fault is displayed.
C++ functions
When using CPP SDK, if the user interrupt returns UNSAFE
, a user fault is automatically triggered. For example, the following code triggers a user fault if the measured voltage exceeds a defined threshold:
float V_max = 800.0;
float V_meas = 0.0;
boolean user_fault = false;
tUserSafe UserInterrupt1(void)
{
//...
if(V_meas > V_max){
user_fault = true;
}
//...
if(user_fault)
return UNSAFE;
else
return SAFE;
}
Code language: C++ (cpp)