Voltage failure generation
This demonstration is devoted to a tool for forming the logic of finite automata using the Chart block. This block has its own special library of elements containing states, nodes, and transitions. It is shown in the picture below.

To demonstrate the capabilities of the tool, we will consider a voltage fault generation system.
In this example, we compare the voltage across the sensor windings (U+, U-) with a THRESHOLD value. When the voltage is lower, we form a failure. The upper level of the system is shown in the figure below.
.png)
If we consider the logic of the state machine itself, then note that there are two winding voltages. When a certain voltage becomes less than the THRESHOLD value, the fault confirmation process is started (CNTR_START, CNTR_STOP states). This process lasts 1 sec (1 sec – 0.01 sec is the calculation step). If, at the end of the fault detection process, the fault condition persists, then we confirm the failure and switch to the FAULT state. The figure below shows the logic implemented in Chart.
.png)
Now let's run the model itself and analyze the results of its execution.
# Enabling the auxiliary model launch function.
function run_model( name_model, path_to_folder )
Path = path_to_folder * "/" * name_model * ".engee"
if name_model in [m.name for m in engee.get_all_models()] # Checking the condition for loading a model into the kernel
model = engee.open( name_model ) # Open the model
model_output = engee.run( model, verbose=true ); # Launch the model
else
model = engee.load( Path, force=true ) # Upload a model
model_output = engee.run( model, verbose=true ); # Launch the model
engee.close( name_model, force=true ); # Close the model
end
return model_output
end
run_model("Voltage_failure_generation",@__DIR__) # Launching the model.
As we can see from the simulation result, three signals were saved:
- v = validity – a sign of the validity of the signals,
- cf = check_flag – internal counter variable,
- res – indicates that one of the voltages has become less than the threshold.
Let's plot these signals.
# Reading signals from simout
v = simout["Voltage_failure_generation/v"];
v = collect(v);
check_flag = simout["Voltage_failure_generation/Chart.check_flag"];
check_flag = collect(check_flag);
res = simout["Voltage_failure_generation/res"];
res = collect(res);
plot(v.time, [v.value, check_flag.value, res.value], layout = (3,1), title=["v" "check_flag" "res"])
As we can see from the graph, our system worked correctly when an error condition appeared.
Conclusion
In this example, we have analyzed the possibilities of using Chart in Engee using the example of a voltage fault generation system.