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.

How does serviceable and failures work?

Postby Necolatis » Sun Jan 19, 2014 4:02 pm

Each system seems to have a property called serviceable.

Is that property somehow automatically used for something, or is it up to the system designer to make use of it and make the instrument etc. depend on it?
Last edited by Necolatis on Sun Jan 19, 2014 8:10 pm, edited 2 times in total.
"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 servicable work?  

Postby Hooray » Sun Jan 19, 2014 4:07 pm

hard coded instruments generally use this to enable/disable the update() method (function) - sometimes, there's additional support for certain types of 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 servicable work?

Postby Necolatis » Sun Jan 19, 2014 4:16 pm

Alright, 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 servicable work?

Postby Hooray » Sun Jan 19, 2014 4:31 pm

For a more in-depth answer, see these related discussions (you may want to copy things over to the wiki, for future reference):

https://www.mail-archive.com/flightgear ... 08301.html
https://www.mail-archive.com/flightgear ... 10495.html
https://www.mail-archive.com/flightgear ... 21071.html
https://www.mail-archive.com/flightgear ... 07550.html
https://www.mail-archive.com/flightgear ... 08297.html
https://www.mail-archive.com/flightgear ... 09747.html


These should give you a fairly comprehensive picture and should only take 5-10 minutes to read :D
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 servicable work?

Postby Necolatis » Sun Jan 19, 2014 6:04 pm

Alright, will do that when I get a better overview of the system.

I seem to have found a bug in flaps failure:

/sim/failure-manager works fine, sets flaps to not servicable

/controls/flight/flaps-serviceable keeps being true when the flaps fail.
"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 work?

Postby Necolatis » Sun Jan 19, 2014 8:10 pm

And is it possible to add custom failures to the GUI panel? That also can fail when random failures is enabled..
"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 work?

Postby Hooray » Sun Jan 19, 2014 8:11 pm

I suggest to search for "MTBF", here on the forum, but also in the devel list archives.
Basically anythign is possible - and many things are pretty straightforward using Nasal/XML.
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 » Sun Jan 19, 2014 8:26 pm

I searched and it seems it is not possible, unless I copy the default script disable it. But then my plane won't be forward compatible with future versions changing that script.
"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 » Sun Jan 19, 2014 8:27 pm

I am not even sure if it's being maintained currently - so you could just as well adopt it temporarily and contribute directly to the script, to add the features you're missing.
Just tell us exactly what you need, so that we can provide some pointers. You probably don't even need to be able to use gitorious for this.
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 » Sun Jan 19, 2014 9:01 pm

Alright.

To start with I would like the HUD to able to fail. That's pretty easy to include in the script, but that won't disable the default HUD, nor add it to the menu (in case some want to enable it after it fails randomly), as that stuff do not seem to be coded in Nasal. Will that be alright? People can still use the property to disable/enable their custom HUDs (like I intend to).
"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 Philosopher » Sun Jan 19, 2014 9:07 pm

Or we could try hot-loading code ! ;) I think that would be doable – just overwrite some symbols, but it wouldn't be the best option if the failures.nas script changes, depending on what's being changed.

Looking at failures.nas, it seems possible to add items to breakHash via an aircraft script, but the problem is that the dialog is hard-coded, so it wouldn't be reflected there. It would be nice to generate the dialog procedurally instead... :P

@Necolatis: certainly that's easy to include in the aforementioned breakHash, but it won't show up in the dialog.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: How does serviceable and failures work?

Postby Necolatis » Sun Jan 19, 2014 9:37 pm

> Looking at failures.nas, it seems possible to add items to breakHash via an aircraft script,

What would be the namespace for that?
"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 Philosopher » Sun Jan 19, 2014 9:42 pm

Code: Select all
failures.breakHash["/sim/some/property"] = {
    type: type.MTBF, failure: "/sim/uncheck-to-fail", desc: "HUD"
};


See failures.nas for more on the objects.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: How does serviceable and failures work?

Postby Necolatis » Sun Jan 19, 2014 11:58 pm

Got it working for HUD and instrumentation lights:

Code: Select all
# random failure code:

  var fail = { SERVICEABLE : 1, JAM : 2, ENGINE: 3};
  var type = { MTBF : 1, MCBF: 2 };
  var failure_root = "/sim/failure-manager";
  var prop = "/instrumentation/head-up-display";

  failures.breakHash[prop] = {
    type: type.MTBF, failure: fail.SERVICEABLE, desc: "Head up display"};

  var o = failures.breakHash[prop];
  var t = "/mtbf";
  props.globals.initNode(failure_root ~ prop ~ t, 0);
  props.globals.initNode(prop ~ "/serviceable", 1, "BOOL");

  prop = "/instrumentation/instrumentation-light";

  failures.breakHash[prop] = {
    type: type.MTBF, failure: fail.SERVICEABLE, desc: "Instrumentation light"};

  props.globals.initNode(failure_root ~ prop ~ t, 0);
  props.globals.initNode(prop ~ "/serviceable", 1, "BOOL");

  setprop("/sim/failure-manager/display-on-screen", 1);
  setprop("/sim/failure-manager/global-mtbf-0", 0);
  setprop("/sim/failure-manager/global-mtbf-60", 1);
  setprop("/sim/failure-manager/global-mtbf", 86400);

  failures.setAllMCBF(86400);
  failures.setAllMTBF(86400);


Will put this example up on the wiki page when I write it.

No idea how to fail brakes or parking brakes 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 Hooray » Mon Jan 20, 2014 10:24 am

just briefly, I think galvedro was interested in working out some scripting-space failure system - you may want to get in touch with him. That said, I do agree with Philosopher that the dialog should be turned into a Nasal submodule so that it can be created procedurally.
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

Next

Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest