Difficulty in starting all engine types consistently #1264
Replies: 6 comments 1 reply
-
Hmm, so it turns out jsbsim/src/models/FGPropulsion.cpp Lines 332 to 341 in 2006648 Plus, there is no issue with What seems to happen is that after So I guess the question is whether instead of setting |
Beta Was this translation helpful? Give feedback.
-
So as a quick test, this does fix the issue with the C172p. for (unsigned int i=0; i<GetNumEngines(); i++) {
in.ThrottleCmd[i] = in.ThrottlePos[i] = 1; // Set the throttle command and position
in.MixtureCmd[i] = in.MixturePos[i] = 1; // Set the mixture command and position
FDMExec->GetFCS()->SetMixturePos(i, 1); // Also set FCS values
FDMExec->GetFCS()->SetMixtureCmd(i, 1);
GetEngine(i)->InitRunning();
} Also confirmed it doesn't cause an issue with the C172x, by reporting the mixture command value after <use aircraft="c172p" initialize="reset02"/>
<run start="0.0" end="20" dt="0.00833333">
<property value="-1"> propulsion/set-running </property>
<property value="0.8"> fcs/mixture-cmd-norm </property> Any comments, suggestions before I submit a pull request along these lines? |
Beta Was this translation helpful? Give feedback.
-
Good catch ! Yes, I have a few questions:
|
Beta Was this translation helpful? Give feedback.
-
So say the user had a script along these lines for the C172p (no system element for automatically controlling the mixture), then when The <use aircraft="c172p" initialize="reset02"/>
<run start="0.0" end="20" dt="0.00833333">
<property value="-1"> propulsion/set-running </property>
<property value="0.8"> fcs/mixture-cmd-norm </property>
<event name="Trim">
<condition>simulation/sim-time-sec ge 0.50</condition>
<set name="simulation/do_simple_trim" value="1"/> Thinking about it now in typing this up, there is the issue that if the user swaps the order around to: <property value="0.8"> fcs/mixture-cmd-norm </property>
<property value="-1"> propulsion/set-running </property> Then the user supplied mixture command will be lost/overwritten to 1. So maybe I should modify the code to query the current FCS value for the mixture and if it's non-zero (can't tell if user set it to 0) then reset the FCS to this value after calling the engine specific |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answers, that's clear to me now.
I would refrain from doing that. The order in which the properties are set is meaningful in JSBSim1 so I would suggest we keep it this way. Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Okay I've refrained from adding the additional logic to check the FCS value first etc. Created a pull request - #1266 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I added an example Python script to the repo a while ago to generate a trim envelope. It defaults to using the 737 model in the repo but should be applicable to any aircraft, ideally by simply changing the aircraft type in the script.
jsbsim/examples/python/TrimEnvelope.py
Line 30 in 2006648
One of the first things it needs to do is to ensure that all the engines of the aircraft are running before asking for trim solutions. This is currently how it starts the engines.
jsbsim/examples/python/TrimEnvelope.py
Lines 42 to 44 in 2006648
There are 2 things that aren't ideal in terms of this engine start procedure. It needs to be edited based on the number of engines, and secondly it fails for piston engines.
The property
propulsion/engine[x]/set-running
ends up simply calling:jsbsim/src/models/propulsion/FGEngine.h
Line 158 in 2006648
Which is fine for turbine engines but not for piston engines.
So I switched to using:
Which is better since you can pass -1 to specify all engines and it ends up calling into engine type specific
InitRunning()
methods, e.g.jsbsim/src/models/propulsion/FGPiston.cpp
Lines 540 to 548 in 2006648
But in testing this with piston engine aircraft I noticed an issue between the C172x model and the C172p model. For the C172x model it worked as expected, but for the C172p model it failed, even though they use the exact same engine.
I tracked the difference down to the C172x having an automatic mixture control which the C172p model doesn't have.
jsbsim/aircraft/c172x/c172x.xml
Lines 305 to 328 in 2006648
I could get the C172p engine to run with this combination in the script:
My guess at the moment, will need to debug, is that when
FGPiston::InitRunning()
is calledin.PressureRatio
is 0 or unitialised which results in mixture command setting that prevents the engine from running?Beta Was this translation helpful? Give feedback.
All reactions