I started to implement new fault messages.
I discovered failures that are implemented and I wasnt even aware of , what a sim !!
First, I just changed the fault message placement and added a " type" argument for the function ( that allows to specify better the fault, I found a whole doc about that, so lets go)
- Code: Select all
var create_fault_message = func (sys_string, type, gpc_id, class, sw = "ALL"){
#MET displayed for fault
var time_string = getprop("/fdm/jsbsim/systems/timer/MET-string");
var time_string_minimised = substr(time_string, 4);
var backup_marker = " ";
if (class == 2) {backup_marker = "*";}
var msg_string = sys_string~type~" "~backup_marker~" "~gpc_id~" "~time_string_minimised;
var msg_string_long = sys_string~type~" "~backup_marker~" "~gpc_id~" "~time_string;
The logic coded by Thorsten is already very accurate ( PASS , BFS or Both)
I just have to adjust some messages, and to add inspection groups ( APU, HYD, THERMAL faults etc)
I started with electrical group, just to confirm the logic there and to go with the elec panel rework
Here the example of a drop in ac voltage
Either we are in OPS 2 and fault is detected by the SM GPC
The type_test will show for an ac low voltage where is located the fault ( AC bus 1, 2 or 3)
- Code: Select all
var cws_inspect_fc_electric = func {
var init_phase = getprop("/fdm/jsbsim/systems/electrical/init-electrical-on");
var major_mode = getprop("/fdm/jsbsim/systems/dps/major-mode");
if (init_phase > 0.0) {init_phase = 1.0;} else {init_phase = 0.0;}
var voltage_ac1 = getprop("/fdm/jsbsim/systems/electrical/ac/voltage");
var voltage_ac2 = getprop("/fdm/jsbsim/systems/electrical/ac[1]/voltage");
var voltage_ac3 = getprop("/fdm/jsbsim/systems/electrical/ac[2]/voltage");
#If OPS 2, PASS SM GPC 4
if ((major_mode == 201) or (major_mode == 202))
{
if (((voltage_ac1 < 115.0) or (voltage_ac2 < 115.0) or (voltage_ac3 < 115.0)) and (init_phase == 0.0))
{
if (cws_msg_hash.acvolt == 0)
{
var type_test = "";
if (voltage_ac1 < 115.0){type_test = "1 ";}
else if (voltage_ac2 < 115.0){type_test = "2 ";}
else if (voltage_ac3 < 115.0){type_test = "3 ";}
create_fault_message("S67 AC VOLTS ", type_test, 4, 2, "PASS");
cws_msg_hash.acvolt = 1;
}
}
}
#If not in OPS 2, BFS SM only GPC 5
else
{
if (((voltage_ac1 < 115.0) or (voltage_ac2 < 115.0) or (voltage_ac3 < 115.0)) and (init_phase == 0.0))
{
if (cws_msg_hash.acvolt == 0)
{
var type_test = "";
if (voltage_ac1 < 115.0){type_test = "1 ";}
else if (voltage_ac2 < 115.0){type_test = "2 ";}
else if (voltage_ac3 < 115.0){type_test = "3 ";}
create_fault_message("SM1 AC VOLTS ", "1 ", 5, 2, "BFS");
cws_msg_hash.acvolt = 1;
}
}
}
Which gives for a failure in Orbit that layout
And in OPS 1,6,3 with BFS doing the SM task:
When fault is cleared, or an input/output performed, the loop can detect a fault in other ac systems
I was thinking of the possibility to have multiple messages in the same time if 2 ac where out at the same time, but that would require 3 hash.ac volt functions.
So it might be too heavy, especially if we do the same logic for several parameters ( Main Bus, FC, APU etc )
Is the Logic above ok ?