Comments (8)
@Mike402
Thanks for this proposal but instead of implementing these functions in C++, I'd rather extend the concept of "template" functions that have been designed for unit conversion (see scripts/unitconversions.xml).
Your functions could then be provided in a kind of library just as the unit conversion functions are.
For that to happen, there is some C++ code to write but that is not on the top of my priorities. If someone volunteer for that, I can provide guidance however.
from jsbsim.
Thanks, that seems reasonable. Can I try it out right away by inserting the snippets in unitconversions.xml or does it depend on C++ in other way than loading an extra xml that would be the new "library"?
from jsbsim.
does it depend on C++ in other way than loading an extra xml that would be the new "library"?
Yes, it needs additional C++ code. At the moment, if you would update unitconversions.xml
then you would be unable to use the functions anywhere else than in <output>
elements.
from jsbsim.
Also it would be nice to have a "stair" function with adjustable step and transition slope -- which could be used e.g. to represent Geneva drives:
<fcs_function name="fcs/NPK/instr/UVO[0]/counter/H-100m[1]">
<function>
<!-- Geneva drive -->
<!-- JSBBUG Moves sharply for negative values, because there is no <floor>, and <integer> is used instead! -->
<sum>
<!-- Simple step -->
<integer>
<product>
<!-- lower digit -->
<p>fcs/NPK/instr/UVO[0]/counter/H-100m[0]</p>
<!-- = 1 / base -->
<v>0.1</v>
</product>
</integer>
<!-- Transition -->
<min>
<v>1.0</v>
<max>
<v>0.0</v>
<product>
<difference>
<product>
<!-- lower digit -->
<p>fcs/NPK/instr/UVO[0]/counter/H-100m[0]</p>
<!-- = 1 / base -->
<v>0.1</v>
</product>
<integer>
<product>
<!-- lower digit -->
<p>fcs/NPK/instr/UVO[0]/counter/H-100m[0]</p>
<!-- = 1 / base -->
<v>0.1</v>
</product>
</integer>
<!-- transition length, 0.0 to 1.0 -->
<v>0.9</v>
</difference>
<!-- = 1 / transition length -->
<v>10.0</v>
</product>
</max>
</min>
</sum>
</function>
</fcs_function>
Please note that I have used <integer>
instead of the correct <ceiling>
, because it is absent in JSBSim -- which makes it work incorrectly for negative inputs. What is intended with <ceiling>
is, the transition between -2 and -1 of the output should be between -1.0 and -1.1 of the output and such -- just like 1 and 2 transition between 1.9 and 2.0. That is the function should go on the same way into negative domain, instead of being antisymmetric.
from jsbsim.
From @Mike402 suggested in issue #124 that has been marked as a duplicate of the current issue:
<floor>
,<ceiling>
and<fmod>
would have been very convenient, because their equivalents are very bulky and typo-prone.
from jsbsim.
<floor>
,<ceiling>
and<fmod>
would have been very convenient, because their equivalents are very bulky and typo-prone.
These 3 functions have just been added to <function>
via the commit f0d67c8.
from jsbsim.
These 3 functions have just been added to
<function>
via the commit f0d67c8.
And they are now pushed to FlightGear as well.
from jsbsim.
Wow, thank you, I will try them!
About the requests with sawtooth and stair function: maybe it would be easier to have them in C++, at least for now?
from jsbsim.
Related Issues (20)
- JSBSim Simulink Function HOT 36
- Rust HOT 13
- Can autopilot feature come to jsbsim- unreal engine 5? HOT 2
- MSVC: toupper is not a member of std HOT 1
- Missing target_include_directories in libJSBSim
- JSBSIM_ prefix in CMake options
- Cython warnings about 'tp_print' which is deprecated
- Wrong calculation of vPQRdot in FGAccelerations class HOT 4
- Fixing the mixture for JSBSim piston aircraft HOT 54
- Request: turbine spindown table or property support HOT 2
- Aircraft crashed on air when rolling consecutively HOT 15
- How Jsbsim models the "+" shaped tail fins of missiles and rockets. HOT 1
- JSBSimFlightDynamicsModel could not be loaded in Unreal Engine HOT 4
- AugmentCmd should be clamped to [0.0..1.0] HOT 5
- Trim succeeds and results in NaN values HOT 1
- JSBSim and s-function have different results and different reactivity themselves HOT 1
- Building for Unreal 5 on Linux not working HOT 7
- Javascript alternative? HOT 2
- Linearization and simplex trim from console executable and xml script HOT 16
- FGTurbine Shutdown Spin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbsim.