Function cached values for aero functions #355
Replies: 4 comments 4 replies
-
To further describe the issue that I am seeing, this works: <function name="aero/force/CDi">
<description> Induced_drag </description>
<quotient>
<pow>
<value> 2 </value>
<value> 3.0 </value>
</pow>
<product>
<value> 2.0 </value>
<value> 2.0 </value>
</product>
</quotient>
</function> This does not: <function name="aero/force/CDi">
<description> Induced_drag </description>
<quotient>
<pow>
<value> 2 </value>
<value> 3.0 </value>
</pow>
<product>
<property> aero/qbar-psf </property> <!-- property here doesn't work -->
<value> 2.0 </value>
</product>
</quotient>
</function> |
Beta Was this translation helpful? Give feedback.
-
The problem happens as the simulation is being initialized. |
Beta Was this translation helpful? Give feedback.
-
I put this same construct in a different, existing, XML file in the aerodynamic portion and it worked just fine. |
Beta Was this translation helpful? Give feedback.
-
Regarding jsbsim/src/math/FGFunction.cpp Lines 28 to 36 in bd905aa I can only guess that the cached value is initialized to -HUGE_VAL to raise an FPE if someone tries to use it before it has been initialized.
Regarding the reason why aerodynamic values are cached, this was committed in May 22, 2016 (commit 18c143a by @bcoconni 😄) and the comment in the code explains that if values are not cached then the aerodynamic values exported by jsbsim/src/models/FGAerodynamics.cpp Lines 189 to 196 in 22d57cd |
Beta Was this translation helpful? Give feedback.
-
I see that FGFunctions have been expanded to include caching of aerodynamic values. I'm not sure what drove this, but I am getting a strange error that causes execution to stop in the first pass. Apparently I am getting an FPE when executing aero function code with a vFNative vector that is somehow set to {-inf, 0.0, 0.0). Various example scripts seem to run just fine so perhaps this is a special case. When looking at the function code I noticed this:
I'm wondering why cachedValue is initialized to -HUGE_VAL.
Beta Was this translation helpful? Give feedback.
All reactions