Board index FlightGear Development Aircraft Flight dynamics model

We can start with the landing gear retracted

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

We can start with the landing gear retracted

Postby abassign » Fri Nov 22, 2019 12:04 am

I would like to start the flight with a different landing gear configuration, for example if the plane is in flight I would like to start with the landing gear retracted, it is possible with JSBSim to give this configuration.
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby wlbragg » Fri Nov 22, 2019 2:08 am

Yes
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5873
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: We can start with the landing gear retracted

Postby Richard » Fri Nov 22, 2019 9:42 am

abassign wrote in Fri Nov 22, 2019 12:04 am:I would like to start the flight with a different landing gear configuration, for example if the plane is in flight I would like to start with the landing gear retracted, it is possible with JSBSim to give this configuration.


Yes; both the F-14 and F-15 will put the gear down when initialising position less than 500ftAGL
Richard
 
Posts: 786
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: We can start with the landing gear retracted

Postby abassign » Fri Nov 22, 2019 11:01 pm

My problem is to initialize the landing gear in the open or closed position if you start from the ground or in flight (approach phase). This means that the first JSBSim activity cycle must determine whether the landing gears are on the ground (or a few inches from it, sometimes the odds may not match) or detached from the ground for the purpose of permetetre the proper handling of the flight. This would be important to be able to have it even when the aircraft is relocated, somewhere there is a testimony of the type of phase in which the plane begins the phase of activity?
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby V12 » Sat Nov 23, 2019 5:51 am

What about property WOW (Weight On the Weel) for gear ?
Fly high, fly fast - fly Concorde !
User avatar
V12
 
Posts: 2114
Joined: Thu Jan 12, 2017 4:27 pm
Location: LZIB
Callsign: BAWV12

Re: We can start with the landing gear retracted

Postby abassign » Sat Nov 23, 2019 6:58 am

V12 wrote in Sat Nov 23, 2019 5:51 am:What about property WOW (Weight On the Weel) for gear ?


Wow would be a good solution, but if the plane has the landing gear closed Wow intervenes after the plane has sunk into the runway. The simplest thing would be to know the context, or if the aircraft was positioned by the program on the runway or in the air, in order to activate the relative configurations.

I find this link in the wiki:

http://wiki.flightgear.org/Initial_Starting_Positions

The problem is that the starting position is entered as a parameter, but I don't know if there is a reference of the event in the property tree. It would be very useful to know it in order to configure the plane before it is visible at the FDM level. It is useless to do this at NASAL level as this is done a long time after the FDM and therefore you risk seeing the plane impact on the runway or have an absurd attitude if the plane start in flight.
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby Thorsten » Sat Nov 23, 2019 7:13 am

It is useless to do this at NASAL level as this is done a long time after the FDM and therefore you risk seeing the plane impact on the runway or have an absurd attitude if in flight.


If you would have bothered to study Richard's examples you'd know that it's far from useless.
Thorsten
 
Posts: 11765
Joined: Mon Nov 02, 2009 8:33 am

Re: We can start with the landing gear retracted

Postby wlbragg » Sat Nov 23, 2019 10:22 am

The c172p, Cessna 182 and J3Cub all have "state" examples which is another method to efficiently achieve what your after as well. Following is the state set for "On Approach" for the Cub. All that is missing from it is the retract gear command property because none of those three aircraft examples have retractable gear.

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

<PropertyList>

  <name type="string">approach</name>

  <overlay>
    <sim>
      <freeze>
         <master type="bool">0</master>
         <clock type="bool">0</clock>
      </freeze>
      <presets>
         <speed-set type="string">knots</speed-set>
         <airspeed-kt type="int">100</airspeed-kt>
        <pitch-deg type="double">-6.0</pitch-deg>
        <roll-deg type="double">0</roll-deg>
        <uBody-fps type="double">163</uBody-fps>
        <vBody-fps type="double">0</vBody-fps>
        <wBody-fps type="double">0</wBody-fps>
        <glideslope-deg type="double">-6</glideslope-deg>
        <trim type="bool">true</trim>
        <onground type="bool">false</onground>
      </presets>
      <model>
         <j3cub>
            <brake-parking type="bool">0</brake-parking>
         </j3cub>
      </model>
    </sim>
    <fdm>
      <jsbsim>
         <running type="bool">0</running>
      </jsbsim>
    </fdm>
    <!--consumables>
      <fuel>
         <tank n="0">
            <selected type="bool">true</selected>
         </tank>
         <tank n="1">
            <selected type="bool">true</selected>
         </tank>
         <tank n="2">
            <selected type="bool">true</selected>
         </tank>
      </fuel>
    </consumables-->
    <engines>
        <active-engine>
            <running type="bool">0</running>
            <auto-start type="bool">1</auto-start>
            <cranking type="bool">0</cranking>
       </active-engine>
    </engines>
    <controls>
      <circuit-breakers>
          <master type="bool">1</master>
          <pitot-heat type="bool">1</pitot-heat>
          <instr type="bool">1</instr>
          <intlt type="bool">1</intlt>
          <avionics type="bool">1</avionics>
          <navlt type="bool">1</navlt>
          <landing type="bool">1</landing>
          <bcnlt type="bool">1</bcnlt>
          <strobe type="bool">1</strobe>
          <turn-coordinator type="bool">1</turn-coordinator>
          <gear-select type="bool">1</gear-select>
          <gear-advisory type="bool">1</gear-advisory>
          <hydraulic-pump type="bool">1</hydraulic-pump>
      </circuit-breakers>
      <flight>
         <flaps type="double">1</flaps>
        <elevator-trim type="double">-0.03</elevator-trim>
      </flight>
      <gear>
         <gear-down-command type="bool">true</gear-down-command>
      </gear>
      <!--lighting>
        <nav-lights type="bool">1</nav-lights>
        <strobe-lights type="bool">1</strobe-lights>
        <beacon-light type="bool">1</beacon-light>
        <landing-light type="bool">1</landing-light>
        <instruments-norm type="bool">1</instruments-norm>
        <taxi-light type="bool">1</taxi-light>
      </lighting-->
      <switches>
         <!--magnetos type="int">4</magnetos>
         <master-bat type="bool">1</master-bat>
         <master-alt type="bool">1</master-alt>
         <master-avionics type="bool">1</master-avionics-->
         <starter type="bool">1</starter>
      </switches>
      <engines>
          <engine n="0">
               <primer type="double">3</primer>
               <primer-lever type="bool">0</primer-lever>
          </engine>
          <current-engine>
             <throttle type="double">0.2</throttle>
            <mixture type="double">0.88</mixture>
          </current-engine>
      </engines>
    </controls>
  </overlay>

</PropertyList>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5873
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: We can start with the landing gear retracted

Postby Richard » Sat Nov 23, 2019 12:04 pm

abassign wrote in Sat Nov 23, 2019 6:58 am:It is useless to do this at NASAL level as this is done a long time after the FDM and therefore you risk seeing the plane impact on the runway or have an absurd attitude if the plane start in flight.


You are completely wrong about that; please verify your facts before posting incorrect statements.

Setting a listener on either /sim/fdm-initialized or /sim/signals/fdm-initialized will result in your Nasal code being called immediately after JSBSim has finished initializing and it is the perfect time to do this. Refer to F-15/Nasal/instruments.nas lines 283 to 353.

Code: Select all
var common_init = func
{
    print("Setting replay medium res to 50hz");
    setprop("sim/hud/visibility[0]",0);
    setprop("sim/hud/visibility[1]",0);
    aoa_max.setDoubleValue(0);

    setprop("sim/replay/buffer/medium-res-sample-dt", 0.02);
    setprop("controls/flight/SAS-roll",0);
    setprop("sim/model/f15/controls/AFCS/engage",0);
    setprop("autopilot/locks/altitude","");
    setprop("autopilot/locks/heading","");
    setprop("autopilot/locks/speed","");

    if (getprop("sim/model/f15/controls/windshield-heat") != nil)
      setprop("fdm/jsbsim/systems/ecs/windshield-heat",getprop("sim/model/f15/controls/windshield-heat"));

    #
    # this is just to ensure that we start with pressure in the util hyds
    setprop("fdm/jsbsim/systems/hydraulics/util-system-preload-input",-500);
    settimer(func {
        setprop("fdm/jsbsim/systems/hydraulics/util-system-preload-input",0);
    }, 4);
    if (getprop("fdm/jsbsim/position/h-agl-ft") != nil) {
        if (getprop("fdm/jsbsim/position/h-agl-ft") < 500) {
            print("Starting with gear down as below 500 ft");
            setprop("controls/gear/gear-down", 1);
            setprop("fdm/jsbsim/fcs/gear/gear-dmd-norm",1);

            if (getprop("fdm/jsbsim/position/h-agl-ft") < 50) {
                setprop("controls/gear/brake-parking",1);
                print("--> Set parking brake as below 50 ft");
            }
        } else {
            print("Starting with gear up as above 500 ft");
            setprop("controls/gear/gear-down", 0);
            setprop("fdm/jsbsim/fcs/gear/gear-dmd-norm",0);
            setprop("controls/gear/brake-parking",0);
        }
    }
}

# Init ####################
var init = func {
   print("Initializing f15 Systems");
    var modelNotification = emesary.Notification.new("F15Model", nil);
    modelNotification.root_node = props.globals;
    emesary.GlobalTransmitter.NotifyAll(modelNotification);
    emesary.GlobalTransmitter.NotifyAll(emesary.Notification.new("F15Init", 1));
   ext_loads_init();
   init_fuel_system();
   aircraft.data.load();
   f15_net.mp_network_init(1);
   weapons_init();
   tacan_switch_init();
   radardist.init();
   awg_9.init();
#   an_arc_182v.init();
#   an_arc_159v1.init();
    aircraft.setup_als_lights(getprop("fdm/jsbsim/systems/electrics/dc-essential-bus1-powered"));

   setprop("controls/switches/radar_init", 0);

    common_init();
     main_loop_launched = 1;
    var prop = "/instrumentation/radar";
    var actuator_radar = compat_failure_modes.set_unserviceable(prop);
    FailureMgr.add_failure_mode(prop, "Radar", actuator_radar);
}

setlistener("sim/signals/fdm-initialized", init);
Richard
 
Posts: 786
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: We can start with the landing gear retracted

Postby abassign » Sat Nov 23, 2019 9:30 pm

Richard wrote in Sat Nov 23, 2019 12:04 pm:
abassign wrote in Sat Nov 23, 2019 6:58 am:It is useless to do this at NASAL level as this is done a long time after the FDM and therefore you risk seeing the plane impact on the runway or have an absurd attitude if the plane start in flight.
You are completely wrong about that; please verify your facts before posting incorrect statements.
:shock:

Hi, honestly I did not think of offending anyone by pointing out that JSBS reaction times are shorter than NASAL ones and so I would like to solve the problem with JSBSim and not with NASAL ... it is clear that my experience on RT systems has a different sensitivity in priority management.

Therefore I consider the incident closed :D and we go to the problem that I posed and for which I had not found solutions:
Thank you for the code you use for the position of the landing gear and especially for the switch that warns when JSBSim is actually operational ("/sim/signals/fdm-initialized").

To know the initial configurations of the simulation I found this branch of the property-tree that shows everything I needed for the correct configuration in flight or on the ground of the plane.

Code: Select all
/sim/preset
...
/sim/preset/onground
/sim/preset/airspeed-kt
/sim/preset/altitude-ft
/sim/preset/offset-distance-nm
...
etc


As I wrote before, mine is a different operational sensitivity that tends not to use certain solutions to the advantage instead of others.


At the end activate the cart with the classic command:

Code: Select all
setprop("controls/gear/gear-down", 1);


I try to do it in JSBSim, as in this example, but it doesn't work. I saw that "/controls/gear/gear-down" is binary, while JSBSim only works with Double types ... do you think this is the problem? If your answer is affirmative, do you know if there is a way to bypass the problem?

Thanks

Code: Select all
 
        <switch>
            <default value="/controls/gear/gear-down"/>
            <test logic="AND" value="1">
                context/simulation/is-starting == 1
            </test>
            <output>/controls/gear/gear-down</output>
        </switch>


P.S:
Thanks also to @wlbragg for highlighting the solution used by the c172p
Last edited by abassign on Sat Nov 23, 2019 11:01 pm, edited 1 time in total.
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby Thorsten » Sat Nov 23, 2019 9:53 pm

If your answer is affirmative, do you know if there is a way to bypass the problem?


Once again you're in the position of someone who is complaining that hammering a nail with the screwdriver isn't working properly - so you ask for tips how to use the screwdriver better - but the correct answer is - use the hammer!
Thorsten
 
Posts: 11765
Joined: Mon Nov 02, 2009 8:33 am

Re: We can start with the landing gear retracted

Postby abassign » Sat Nov 23, 2019 10:44 pm

Thorsten wrote in Sat Nov 23, 2019 9:53 pm:
...


Yes sure to get it over your head and make you shut up :D

As always, I would like to keep the discussion on a technical level, so please do not participate in this discussion if you have not made any contributions.
Grazie
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby Thorsten » Sun Nov 24, 2019 6:17 am

I believe 'use the appropriate tool rather than trying to force a tool that's not suitable' is a technical comment (which echoes pretty much any other comment in the thread) - it's rejection on the other hand is ideology. :D

honestly I did not think of offending anyone by pointing out that JSBS reaction times are shorter than NASAL ones


Honestly, that is still nonsense - what about the word 'immediately' in Setting a listener on either /sim/fdm-initialized or /sim/signals/fdm-initialized will result in your Nasal code being called immediately after JSBSim has finished initializing was unclear to you?

You've been given a number of working examples as well as explanations - you've so far ignored every one of them, claiming your superior experience:

it is clear that my experience on RT systems has a different sensitivity in priority management.


But since you apparently believe you know best how to use a screwdriver and are convinced that it's so far superior to a hammer - happy hammering!

Translation: You're not trying to have a technical discussion yourself - so don't be surprised if people don't follow you on your tangents.
Thorsten
 
Posts: 11765
Joined: Mon Nov 02, 2009 8:33 am

Re: We can start with the landing gear retracted

Postby abassign » Sun Nov 24, 2019 8:41 am

@Th,
Apparently the hammer couldn't make you shut up, it's clear that you really have a very hard head. However, it's a good thing, at least you're fun... but how much time do you waste your life writing nonsense.

However you can't answer the question: JSBsim do can change a boolean property ? ... If you don't know, it's not a problem, there are more beautiful things in life ... :P
abassign
 
Posts: 847
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: We can start with the landing gear retracted

Postby Thorsten » Sun Nov 24, 2019 9:07 am

Changing a boolean property in JSBSim isn't your real problem though - the approach to let JSBSim create an output node in /controls/ is conceptually pretty messed up anyway.

Given that you're apparently the expert here - why don't you solve the problem yourself when the answers of all the people who already have successfully solved the problem you're trying to solve don't satisfy you?

Apparently the hammer couldn't make you shut up, it's clear that you really have a very hard head.


You trying to have a technical discussion?

Please refrain from using depictions of violence against other forum members in your posts, or I'll flag you for moderation.
Thorsten
 
Posts: 11765
Joined: Mon Nov 02, 2009 8:33 am

Next

Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 1 guest