Outerra forum

User mods, screenshots & videos => Aircraft => Topic started by: fly77 on April 29, 2019, 02:42:49 am

Title: alter flight dynamics from model script ?
Post by: fly77 on April 29, 2019, 02:42:49 am
I'd like to simulate damage or mass changes of a plane through a javascript model file. Is it possible to set the JBSIM parameters programmatically from a script to modify the flight physics during the game ?
Or is it possible in another way to apply extra forces on a plane model ? The this.extra_force  command does not seem to work on planes. Any possible hack ?
Title: Re: alter flight dynamics from model script ?
Post by: cameni on April 29, 2019, 06:28:02 am
There's a jsb() method that returns jsb interface. That one only accepts jsbsim property access, see for example ah64.js script.
Title: Re: alter flight dynamics from model script ?
Post by: fly77 on April 29, 2019, 08:27:59 am
wow ! Thanks ! I managed to shut off the engine through the script ! Will have to study JSBSIM now  ;)
Title: Re: alter flight dynamics from model script ?
Post by: fly77 on May 01, 2019, 11:55:23 am
I am trying to disable possibility to start the engine inside the script... to model a heavily damaged plane..
In update frame I tried to set to zero everything that seems related with engine and propulsion...and when on ground set wheelspeed to zero....nothing else is there in update frame ...but still when I press "E" key the plane briefly sets on to move. The "b" key for brake works still but how to set "brake" in the script for the plane...there seems to be no "brake" property in the FDM files

   
Code: [Select]
jsb['propulsion/engine[0]/set-running']=0;   
    jsb['propulsion/starter_cmd']=0;   
    jsb['fcs/starter-cmd-norm[0]']=0;       
    jsb['fcs/throttle-cmd-norm']=0;   
    jsb['fcs/throttle-pos-norm[0]']=0;   
    jsb['fcs/mixture-cmd-norm']=0;   
    jsb['propulsion/engine[0]/engine-rpm']=0;
    jsb['propulsion/engine[0]/propeller-rpm']=0;
    jsb['propulsion/engine[0]/thrust-lbs']=0;
   
    jsb['gear/unit[0]/wheel-speed-fps']=0;
    jsb['gear/unit[1]/wheel-speed-fps']=0;
    jsb['gear/unit[2]/wheel-speed-fps']=0;


Title: Re: alter flight dynamics from model script ?
Post by: cameni on May 03, 2019, 02:25:19 am
You probably need to handle events like "air/engines/on", otherwise the default handlers will set jsbsim properties on their own.
Title: Re: alter flight dynamics from model script ?
Post by: fly77 on May 03, 2019, 10:22:10 am
Yes just by registering explicitly the "air/engines/on" event the default handler is disabled and engine no longer switches on automatically. Thanks !  :)
Title: Re: alter flight dynamics from model script ?
Post by: bomber on July 23, 2019, 06:07:25 pm
Sorry, since the advent of grass I've been away for a while...

The best way to damage an engine would be to adjust the cooling effect on the engine, like an oil or coolant leak...

This can be done in real time via a jsbsim property.... If you build a flight model with both coolant and oil tanks and then removed their content over time based on their damage level and adjusted the cooling value based on their fill percentage you'd have a very realistic outcome.

"cooling-factor (Advanced)   this number models how efficient the aircraft cooling system is."

Regards

Simon.
Title: Re: alter flight dynamics from model script ?
Post by: fly77 on July 23, 2019, 06:20:47 pm
Thanks for the suggestion bomber. I  guess   the JSBSIM property   "propulsion/engine[0]/oil-pressure-psi"   could be one such parameter.
But how to edit the Heinkel FDM to include oil-pressure-psi    effect ? Do you know where and how it should be included ?
In
propulsion.xml ?

Title: Re: alter flight dynamics from model script ?
Post by: bomber on July 23, 2019, 06:58:27 pm
The property to use would be

propulsion/engine[0]/cooling-factor

Just reduce it to zero at full damage and let jsbsim internal code sieze the engine up.
Title: Re: alter flight dynamics from model script ?
Post by: fly77 on July 24, 2019, 02:18:20 pm
OK will try to implement this and other ideas ...such as aerodynamic damage to wings....in a future version of the Heinkel  or maybe Potez : any other suggestions are wellcome.