Board index FlightGear Development Aircraft Systems

FailureMgr in 2017.3.1  Topic is solved

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

FailureMgr in 2017.3.1

Postby benih » Sat Jan 20, 2018 2:49 pm

i currently try to enhance the FailureManager to also include custom aircraft failures.
Despite reading the wiki and some forum entries, i cannot get this to work.

How can i extend failure handling to also use my custom properties?

For example:
- i have a property "/systems/fuel/fuel-pump-aux-serviceable"
- i want the FailureManager to also handle this with for example MTBF and MCBF triggers
- i also want to show it in the systems-failure dialog so the user can fail it instantly by unchecking the box

How do i do that?

I currently try to do it in a custom nasal integrated in -set.xml:
Code: Select all
# Simple actuator that disables a property (set to 0)
var set_unserviceable = func(path) {

    var prop = path;

    if (props.globals.getNode(prop) == nil)
        props.globals.initNode(prop, 1, "BOOL");

    return {
        parents: [FailureMgr.FailureActuator],
        set_failure_level: func(level) setprop(prop, level > 0 ? 0 : 1),
        get_failure_level: func { getprop(prop) ? 0 : 1 }

# add Aux fuel pump to failureManager
    "Aux fuel pump",

This does not call any visible error in the log, but still i cannot see it in the GUI...

How is this FailiureManager meant to be used by aircraft developers?
Posts: 139
Joined: Tue Aug 15, 2017 9:34 am

Re: FailureMgr in 2017.3.1

Postby Necolatis » Sun Jan 21, 2018 3:58 am

The GUI dialogs are fixed. If you want to show your custom failures, you have to make your own dialog.

For example to add a HUD to the manager all you have to do is: (it will auto create an /instrumentation/head-up-display/serviceable property)

Code: Select all
var prop = "/instrumentation/head-up-display";
var actuator_hud = compat_failure_modes.set_unserviceable(prop);
FailureMgr.add_failure_mode(prop, "Head Up Display", actuator_hud);

But to fail it you have to add a trigger. Look in compat_failure_modes.nas to see some examples.

The JA-37 has some examples also.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Posts: 2107
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: FailureMgr in 2017.3.1

Postby benih » Sun Jan 21, 2018 9:34 am

Thank you for the hints, that will help!
Posts: 139
Joined: Tue Aug 15, 2017 9:34 am

Re: FailureMgr in 2017.3.1  

Postby benih » Fri Apr 20, 2018 7:48 am

Just to make life easier for others,
the links helped alot and it is quite easy to use the failure manager API.
As a result, the c182s can fail most things now, and as a gimmick supports two random failure modes that even fail the default compat systems (like basic instruments etc).
Posts: 139
Joined: Tue Aug 15, 2017 9:34 am

Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest