Board index FlightGear Development Aircraft Systems

How does serviceable and failures work?  Topic is solved

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

Re: How does serviceable and failures work?

Postby Necolatis » Fri Jun 13, 2014 2:53 am

I have tested most of it.

New failures:
McbfTrigger, TimeoutTrigger, MtbfTrigger, AltitudeTrigger, set_unserviceable, set_readonly all works.

Old failures:
Engine, gear, flaps, electrical, aileron, rudder, elevator, asi, altimeter, attitude still works.

I have yet to write a custom trigger or actuator, but I would say this system seems good designed, and very powerful.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Re: How does serviceable and failures work?

Postby Hooray » Fri Jun 13, 2014 6:18 am

thanks for taking the time to test and for providing feedback!
Given that you are probably going to be among the early adopters, it seems likely that you may get to shape the system to some degree, so that your own ideas can be accommodated by it over time.
Ideally, for the system to evolve, we'd have many different types of aircraft adopt and use the system, with very little aircraft-specific code residing in $FG_AIRCRAFT itself.
In fact, whenever possible, I'd suggest to add to the existing library of failures and trigger, and if that's not feasible, extend those classes, or maybe even use constructors/generators to create more tailored failures
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How does serviceable and failures work?

Postby galvedro » Fri Jun 13, 2014 9:06 am

Thanks for the feedback Necolatis! And for the testing run, of course! I am glad you have good feelings about the overhauled module.

Hooray wrote in Fri Jun 13, 2014 6:18 am:with very little aircraft-specific code residing in $FG_AIRCRAFT itself.


Well, yes and no, with some caveats :D. We will talk about this a bit later on when the FGUK guys have played with the module as well. But one thing that aircraft developers are demanding in one way or another, is to go one step further and do a more complex system damage/wearing, where failures influence each other, i.e. a structural failure here produces a system failure there and so on.

This kind of modeling is likely to be fairly aircraft specific, but we will see. I have given some thinking to a next evolutionary step in this direction, and it is quite tricky to organize in a clean way actually.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: How does serviceable and failures work?

Postby Necolatis » Fri Jun 13, 2014 6:22 pm

What happens to a trigger after it has fired?

If I make a custom trigger for gear and it triggers, and I then go into the GUI and repair gear, it then do not triggers afterwards. Does it get replaced by the default trigger?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Re: How does serviceable and failures work?

Postby galvedro » Fri Jun 13, 2014 9:31 pm

A fired triggerd remains fired until removed, or rearmed by using trigger.reset()

Custom triggers will not play well with the gui at the moment. For this first release I just squeezed the new engine underneath the existing gui, and the compatibility layer responds to it by emulating the former behavior (if it doesn't, it is a bug). That means that only Mtbf and Mcbf triggers are currently supported through the gui.

But you make me wander how rearming worked previously...
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: How does serviceable and failures work?

Postby Hooray » Fri Jun 13, 2014 10:09 pm

galvedro wrote in Fri Jun 13, 2014 9:31 pm:Custom triggers will not play well with the gui at the moment.


TheTom and Zakalawe have been working on a new Canvas/GUI dialog called "Aircraft Center", this includes additional GUI/layout management support, including new widgets (e.g. checkboxes), so a procedurally created Canvas GUI dialog/window should be fairly doable after 3.2:

http://wiki.flightgear.org/Aircraft_Center
Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How does serviceable and failures work?

Postby Necolatis » Fri Jun 13, 2014 10:30 pm

Ah, yes the reset works, thanks. :)
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Re: How does serviceable and failures work?

Postby Necolatis » Fri Jun 13, 2014 11:03 pm

That dialog looks awesome, really like that styling.

I have been thinking about how to layout the failure GUI, I will look at it after the aircraft freeze.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Gear fail at too high speed

Postby Necolatis » Sat Jun 14, 2014 8:12 pm

Here is a speed trigger and a value actuator:

Code: Select all
##
    # Trigger object that will fire when aircraft air-speed is over
    # min, specified in knots. Probability of failing will
    # be 0% at min speed and 100% at max speed and beyond.
    # When the specified property is 0 there is zero chance of failing.
    var SpeedTrigger = {

        parents: [FailureMgr.Trigger],
        requires_polling: 1,

        new: func(min, max, prop) {
            if(min == nil or max == nil)
                die("SpeedTrigger.new: min and max must be specified");

            if(min >= max)
                die("SpeedTrigger.new: min must be less than max");

            if(min < 0 or max <= 0)
                die("SpeedTrigger.new: min must be positive or zero and max larger than zero");

            if(prop == nil or prop == "")
                die("SpeedTrigger.new: prop must be specified");

            var m = FailureMgr.Trigger.new();
            m.parents = [SpeedTrigger];
            m.params["min-speed-kt"] = min;
            m.params["max-speed-kt"] = max;
            m.params["property"] = prop;
            m._speed_prop = "/velocities/airspeed-kt";
            return m;
        },

        to_str: func {
            sprintf("Increasing probability of fails between %d and %d kt air-speed",
                int(me.params["min-speed-kt"]), int(me.params["max-speed-kt"]))
        },

        update: func {
            if(getprop(me.params["property"]) != 0) {
                var speed = getprop(me._speed_prop);
                var min = me.params["min-speed-kt"];
                var max = me.params["max-speed-kt"];
                var speed_d =  0;
                if(speed > min) {
                    speed_d = speed-min;
                    var delta_factor = 1/(max - min);
                    var factor = speed <= max ? delta_factor*speed_d : 1;
                    if(rand() < factor) {
                        return 1;
                    }
                }
            }
            return 0;
        }
    };


    ##
    # Returns an actuator object that will set a property at
    # a value when triggered.
    var set_value = func(path, value) {

        var default = getprop(path);

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


And a jsbsim example of how to use it on individual gears:

Code: Select all
#front gear locking mechanism might fail when deployed at too high speeds

    var prop = "gear/gear[0]/position-norm";
    var trigger_gear0 = SpeedTrigger.new(350, 500, prop);
    var actuator_gear0 = set_value("fdm/jsbsim/gear/unit[0]/z-position", 0.001);
    FailureMgr.add_failure_mode("controls/gear0", "Front gear locking mechanism", actuator_gear0);
    FailureMgr.set_trigger("controls/gear0", trigger_gear0);


Not so much fun to try and land with only 1 gear left..
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Re: How does serviceable and failures work?

Postby galvedro » Sat Jun 14, 2014 10:13 pm

I can see that you have already mastered the new module! :wink:

My only suggestion would be to rename the trigger to something like RandSpeedTrigger or similar. I would expect a SpeedTrigger to fire at the specified speed range, i.e. deterministically.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: How does serviceable and failures work?

Postby Hooray » Sat Jun 14, 2014 10:31 pm

yeah, congrats - that's looking really good. I think Necolatis once mentioned that he had extensive Java experience, so no wonder he's so quick using the new module :D

BTW: Instead of just posting the code snippets here, I'd suggest to move them over to the wiki, either as dedicated articles/tutorials, or preferably to help improve the existing article: http://wiki.flightgear.org/A_Failure_Ma ... colatis.29
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How does serviceable and failures work?

Postby galvedro » Sun Jun 15, 2014 7:28 am

Not yet, please! :D

I have not written a comprehensive article in the wiki yet on purpose. I'd rather prefer to have a controlled introduction with some users first, in case we need to change interfaces.

We can open the doors later on, when these trials had given us more insight.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: How does serviceable and failures work?

Postby Necolatis » Sun Jun 15, 2014 8:35 am

Only thing that confuses me is when it writes failures on the screen. That something is 0% failed, instead of condition is 100%. I will get used to it though. :)
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

Re: How does serviceable and failures work?

Postby galvedro » Sun Jun 15, 2014 11:25 am

I agree, I am not very happy with that either.

I have prepared the code to handle continuous failure "levels", but they are not very well integrated yet. On a second iteration I would like to integrate aircraft provided "wear and damage" models. Failure "levels" will hopefully make much more sense then.
galvedro
 
Posts: 145
Joined: Mon Oct 07, 2013 12:55 pm
Location: Sweden

Re: How does serviceable and failures work?

Postby Necolatis » Mon Jun 30, 2014 2:38 pm

How about a repair and reset all function?

And could the interface have a category string? like

func(id, description, actuator, category)

The category could be "instrumentation", "system", "control-surface" or something along those lines.
Then I can put the failures into different tabs depending on category.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1907
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2018.3.2
OS: Windows 10

PreviousNext

Return to Systems

Who is online

Users browsing this forum: No registered users and 0 guests