Board index FlightGear Development Aircraft Flight dynamics model

Crash detection in JSBSim

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

Crash detection in JSBSim

Postby daveculp » Mon Jan 30, 2023 7:27 am

Hello all,

I recall there was a time, maybe 15 years ago, when Gerard Robin (grtux) developed some crash animation for his models. This crash animation required the model to continue to run even after it struck the ground. Because of this (if I remember correctly) crash detection was left out of JSBSim. The problem we were left with is that after a model crashes the FDM can generate some galactic level forces which spreads NaN's everywhere. Some questions:

1. Is any of this crash animation code still in use?
2. Is there any other reason not to add crash detection (followed by FDM suspension) to JSBSim?


Thanks,
Dave Culp
User avatar
daveculp
 
Posts: 505
Joined: Sun Feb 24, 2013 2:50 am
Location: Las Vegas, USA
Callsign: DCulp
Version: 2017.3.1
OS: Ubuntu 17.10

Re: Crash detection in JSBSim

Postby Thorsten » Mon Jan 30, 2023 7:39 am

JSBSIm has optional crash detection followed by FDM suspension since a handful of years now, you just need to set the property that switches it on. Alternatively you can also create your own branch of crash detection as JSBSIm tags.

Crash animation is a more complicated beast because it requires you to develop an idea of what the damage is, model and detect that and work it into the model.

Generally we're doing fine with crashes and JSBSim - the Shuttle has a ripped-off wing for overstress, flat tires and broken gear struts for hard impacts (I think you can even rip off the wing on impact...), complete destruction for ET detonation or heat shield failure and broken windows for debris impact. There's no particular reason except work why there aren't more damage modes.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Crash detection in JSBSim

Postby wkitty42 » Mon Jan 30, 2023 10:25 am

FWIW: also check out the c172p... there are several items of damage it can take (landing gear breaking, wings being bent or torn off, etc) and the sim will continue to run... in the case of breakage, one then uses the F10->c172p menu to locate and click on the "Repair Damage" option... doing that will place the craft on its landing gear with everything repaired and ready to go where it sits so one may need to taxi or relocate to a place the craft can take off from... we even use this repair option to recharge the battery in case you are sitting in the craft with just the battery turned on listening to the radio(s) for so long that the battery is drained...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Crash detection in JSBSim

Postby Octal450 » Mon Jan 30, 2023 4:17 pm

I did a rather basic one in the PA28. Slam a wing against the ground and it breaks off, etc.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Crash detection in JSBSim

Postby TheEagle » Mon Jan 30, 2023 4:32 pm

Thorsten wrote in Mon Jan 30, 2023 7:39 am:JSBSIm has optional crash detection followed by FDM suspension since a handful of years now, you just need to set the property that switches it on.

/sim/crashed, or which one ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Crash detection in JSBSim

Postby Thorsten » Mon Jan 30, 2023 6:15 pm

The Shuttle has a GUI option to set it, if you set failures to 'hard' JSBSim will quit updating the FDM when it detects a crash, but I don't know offhand what the property was - /sim/crashed seems like an output and isn't inside the JSBSim tree.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Crash detection in JSBSim

Postby seanmcleod » Mon Jan 30, 2023 8:30 pm

JSBSIm has optional crash detection followed by FDM suspension since a handful of years now, you just need to set the property that switches it on


Hmm, the reason for this thread is because I started looking into the crash detection logic in JSBSim, see https://github.com/JSBSim-Team/jsbsim/discussions/819

And the only references to the word 'crash' are a handful in FGLGear, i.e. no property with the word 'crash' in it.

And all JSBSim does is print out a crash message to the console. The call to fdmex->SuspendIntegration() has been commented out since 2014. Hence my assumption that FlightGear might be implementing it's own crash detection logic etc.

Code: Select all
// Crash detection logic (really out-of-bounds detection)

void FGLGear::CrashDetect(void)
{
  if ( (compressLength > 500.0 ||
      vFn.Magnitude() > 100000000.0 ||
      GetMoments().Magnitude() > 5000000000.0 ||
      SinkRate > 1.4666*30 ) && !fdmex->IntegrationSuspended())
  {
    cout << "*CRASH DETECTED* " << fdmex->GetSimTime() << " seconds: " << name;
    // fdmex->SuspendIntegration();
  }
}
seanmcleod
 
Posts: 1
Joined: Mon Jan 30, 2023 8:22 pm

Re: Crash detection in JSBSim

Postby Ysop » Mon Jan 30, 2023 9:03 pm

With reference to FAR § 25.473 ( https://www.ecfr.gov/current/title-14/c ... ion-25.473) 10fps seems to be usable default value (maybe 11fps to add a slim margin).
Landing gear systems are being designed according to Regulations, so this is a valid approach for the majority of cases.

With multiple failure modes and also special type of aircraft it is of course beneficial to be able change this on FDM-side.
Just as a suggestion.

edit: safety factor 1.5 is certainly to be considered as well. 15fps as a suggestion, could be further refined by more research.
User avatar
Ysop
 
Posts: 1348
Joined: Thu Oct 25, 2018 10:06 pm
Version: 2020.3.18
OS: ubuntu 22.04

Re: Crash detection in JSBSim

Postby daveculp » Tue Jan 31, 2023 12:11 am

At one time I added a crash detection "system" to my JSBSim models. I'll have to check if it still works.

Code: Select all
<?xml version="1.0"?>

<system name="crash-detect">

  <channel name="Over-G">

     <switch name="systems/crash-detect/over-g">
          <test value="1">
                accelerations/Nz gt 9.0
          </test>
          <output>systems/crash-detect/crashed</output>
     </switch>

  </channel>

  <channel name="impact-ground">

     <switch name="systems/crash-detect/impact">
          <test logic="AND" value="1">
                position/h-agl-ft lt 1.0
                simulation/sim-time-sec gt 1.0
          </test>
          <output>systems/crash-detect/crashed</output>
     </switch>

  </channel>

  <channel name="freeze">

    <switch name="systems/crash-detect/switch1">
          <default value="3"/>         
          <test value="0">
                systems/crash-detect/crashed eq 1
          </test>
          <output>simulation/integrator/position/rotational</output>
    </switch>
    <switch name="systems/crash-detect/switch2">
          <default value="3"/>         
          <test value="0">
                systems/crash-detect/crashed eq 1
          </test>
          <output>simulation/integrator/position/translational</output>
    </switch>
    <switch name="systems/crash-detect/switch3">
          <default value="3"/>         
          <test value="0">
                systems/crash-detect/crashed eq 1
          </test>
          <output>simulation/integrator/rate/rotational</output>
    </switch>
    <switch name="systems/crash-detect/switch4">
          <default value="3"/>         
          <test value="0">
                systems/crash-detect/crashed eq 1
          </test>
          <output>simulation/integrator/rate/translational</output>
    </switch>

  </channel>

</system>

User avatar
daveculp
 
Posts: 505
Joined: Sun Feb 24, 2013 2:50 am
Location: Las Vegas, USA
Callsign: DCulp
Version: 2017.3.1
OS: Ubuntu 17.10

Re: Crash detection in JSBSim

Postby wlbragg » Tue Jan 31, 2023 12:59 am

There are a few force models for damage in c172p/Systems/ c172p-damage.xml you can look at. I think there are gear, pontoon and wing, maybe propeller.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7587
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Crash detection in JSBSim

Postby Thorsten » Tue Jan 31, 2023 7:38 am

And all JSBSim does is print out a crash message to the console.


I remember bringing the issue of hard failure up on the mailing list, getting a property to switch it on, testing it and implementing it - so as far as I know it's there, I have seen and tested it. It may have been removed since - I usually don't use hard failure mode but prefer the actual simulation of it.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am


Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 1 guest