Board index FlightGear Development Aircraft

timer callback for inverted flamout and delayed brake action

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

timer callback for inverted flamout and delayed brake action

Postby owenpsmith » Mon Aug 12, 2019 8:30 pm

I am looking for what I think will be a similar solution for realism scenarios with both of my current aircraft under development, so I will post them together.

Problem 1: For my Bristol Freighter, I have read that the pneumatic brakes had some delay when applying due to the time required for pressure to build up. As it is a tail-dragger and steering on the ground is accomplished primarily through braking, this caused some difficulties. Pilots apparently resolved this by simply adding more power, dragging both brakes, and releasing the opposite brake when they wanted to turn in a given direction. I am looking to simulate this delay, and preferably only have the delay for application of the brakes and not the releasing of them. Any ideas?

Problem 2: For my Canadair Tutor, I want to simulate a flame-out when the engine is starved for fuel during prolonged inverted or negative-G flight (15s according to the manual, but 35s according to pilots), and the subsequent relight after returning to positive-G. I'd like to have a context based failure for this rather than a manually or randomly created failure via the existing failure system, because it is not random, it occurs under very specific conditions.

Not quite sure how to tackle 1, but for 2 I think can initiate a callback for 35s after G force drops below zero. However I need to ensure that I remain under negative G for the entire 35s before I trigger the flameout. Can I cancel the callback? or restart the callback whenever I enter negative-G condition and check if I am currently negative when the timer expires?

I have only done limited Nasal scripting based on existing scripts, and no callbacks or timers, so any input would be appreciated.

Thanks,

Owen.
Aircraft: Bristol Freighter Mk.31, Canadair CL-41 Tutor

Learn from the mistakes of others, only in FlightGear will you live long enough to make them all yourself.
owenpsmith
 
Posts: 75
Joined: Wed Jan 13, 2010 1:26 am
Location: Port Coquitlam, BC, Canada
Version: 2017.2.1
OS: Windows 10

Re: timer callback for inverted flamout and delayed brake ac

Postby Thorsten » Tue Aug 13, 2019 5:21 am

I am looking to simulate this delay, and preferably only have the delay for application of the brakes and not the releasing of them. Any ideas?


Not sure whether your craft was YaSim or JSBSim, but in aircraft systems a product of a kinematic tag (slowly increases to a target value) and the target value itself probably does what you need:

* when the target is set to 1, it takes a while (specified by the kinematic parameter) to reach 1
* when the target is set to 0, the product is 0 immediately

The Shuttle payload bay floodlights Aircraft/SpaceShuttle/Systems/light.xml are an example for this in JSBSim.

As for problem 2:

You start a monitoring loop when g-force is negative and the loop isn't already running, take a timestamp at loop startup, compare current time against the timestamp inside the loop and check for whether the difference is 35 seconds, you cancel the loop when 35 seconds are reached and trigger the failure, and you cancel the loop when g-force is positive.
Thorsten
 
Posts: 10981
Joined: Mon Nov 02, 2009 8:33 am

Re: timer callback for inverted flamout and delayed brake ac

Postby Octal450 » Tue Aug 13, 2019 5:44 am

@owenpsmith @Thorsten
For problem 1 - If using JSBsim there is a much easier way. Just use actuator. You can have <rate_limit sense="incr"> for the increasing time per second, and then <rate_limit sense="decr"> for decreasing time per second.

For problem 2 - I agree with Thorsten. I have a few examples of such a timer system if you want em. You can also use <switch> and <actuator> to do it in JSBsim really really easily.

Kind Regards,
Josh
Don't ever contact me about FlightGear again.
Octal450
 
Posts: 4391
Joined: Tue Oct 06, 2015 12:51 pm

Re: timer callback for inverted flamout and delayed brake ac

Postby owenpsmith » Tue Aug 13, 2019 6:34 am

Thanks for the input, and sorry for not mentioning the FDM, but both are Yasim.

Any examples for Yasim would be appreciated, even if you just mention the aircraft and the system in which it is implemented. When trying new stuff I usually just do a grep through my local copy of all aircraft for examples but wasn’t sure what to search for in this case.

Thanks,

Owen.
Aircraft: Bristol Freighter Mk.31, Canadair CL-41 Tutor

Learn from the mistakes of others, only in FlightGear will you live long enough to make them all yourself.
owenpsmith
 
Posts: 75
Joined: Wed Jan 13, 2010 1:26 am
Location: Port Coquitlam, BC, Canada
Version: 2017.2.1
OS: Windows 10


Return to Aircraft

Who is online

Users browsing this forum: AndersG, Bing [Bot], BLEXBot [Bot] and 46 guests