Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: alter flight dynamics from model script ?  (Read 13514 times)

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
alter flight dynamics from model script ?
« 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 ?
« Last Edit: April 29, 2019, 04:20:45 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: alter flight dynamics from model script ?
« Reply #1 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.
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: alter flight dynamics from model script ?
« Reply #2 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  ;)
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: alter flight dynamics from model script ?
« Reply #3 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;


« Last Edit: May 01, 2019, 11:58:11 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: alter flight dynamics from model script ?
« Reply #4 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.
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: alter flight dynamics from model script ?
« Reply #5 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 !  :)
Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: alter flight dynamics from model script ?
« Reply #6 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.
« Last Edit: July 23, 2019, 06:14:35 pm by bomber »
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: alter flight dynamics from model script ?
« Reply #7 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 ?

Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: alter flight dynamics from model script ?
« Reply #8 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.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: alter flight dynamics from model script ?
« Reply #9 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.
Logged