Comments (16)
This is happening because both FGFDMExec.dT
and FGFDMExec.saved_dT
are being set to 0.0 during the Linearization process.
It's like void FGFDMExec::SuspendIntegration(void) {saved_dT = dT; dT = 0.0;}
is called twice in a row.FGLinearization
is interacting FGStateSpace
, and FGStateSpace adjusts dT quite a bit during assembly - it's hard to pinpoint the exact culprit. I'll have to revisit later.
This workaround allows the simulation to proceed:
void FGFDMExec::DoLinearization(int)
{
double dt0 = this->GetDeltaT();
FGLinearization lin(this);
lin.WriteScicoslab();
this->Setdt(dt0);
}
from jsbsim.
Thanks for the suggestion, @agodemar. I just submitted pull request #991.
from jsbsim.
Linearization from console executable and xml script feature is merged via #991. I appreciate the team's helpful and fast inputs on this.
I thought enabling simplex trim at the same time as linearization might be easy, but it turned out to be more involved. The standard trim capability is working OK for me, so I'll close this issue.
from jsbsim.
@vtpasquale thank you for reaching out and for the detailed feature request.
Please have a look at this discussion: Update FGTrimAnalysis wrt latest JSBSim Release #988, where a user is working on something similar.
from jsbsim.
Thanks for the quick response, @agodemar . It's interesting to see the parallel work. The trim feature ('simulation/do_simple_trim'
) being used by @rishi1906 is currently accessible from the console executable and with xml scripts. That specific trim feature has been working OK for me. I don't believe resolution of #988 will simultaneously resolve my request.
I'm most interested in the Linearization feature becoming available through the console executable and xml scripts, as it was previously. That feature is currently accessible through Python.
I think the alternative simplex trim capability is also currently available through Python. I don’t currently need the simplex trim capability, since the standard trim capability is working OK for me, but it might make sense to add console executable access to the simplex trim capability at the same time as the Linearization feature (since console executable access was removed simultaneously for both features).
from jsbsim.
I think the required changes may be quite small. You can see the diff of my attempt here:
master...vtpasquale:jsbsim:dev
The build is failing
/home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp: In constructor ‘JSBSim::FGFDMExec::FGFDMExec(JSBSim::FGPropertyManager*, std::shared_ptr<unsigned int>)’:
/home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp:164:16: error: no matching function for call to ‘JSBSim::FGPropertyManager::Tie(const char [28], JSBSim::FGFDMExec*, void (JSBSim::FGFDMExec::*)(int))’
164 | instance->Tie("simulation/do_linearization", this, &FGFDMExec::DoLinearization);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/aricciar/projects/jsbsimFork/jsbsim/src/input_output/FGPropertyReader.h:44,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/math/FGModelFunctions.h:40,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/models/FGModel.h:44,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/models/FGPropagate.h:43,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.h:46,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp:47:
I added a &FGFDMExec::DoLinearization
function (modified from earlier versions), but I think there may be an issue with the input arguments lining up with what FGPropertyManager::Tie
is specifying, and my inexperience is showing.
from jsbsim.
You're close, use the same setup as you have for do_simplex_trim
, i.e.
instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
Basically you left out the argument for the getter.
The setter is optional, but the getter isn't.
template <class T, class V> void
Tie (const std::string &name, T * obj, V (T::*getter)() const,
void (T::*setter)(V) = nullptr)
from jsbsim.
Thanks, @seanmcleod. I made some updates:
master...vtpasquale:jsbsim:dev
But I'm still getting a similar error:
/home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp: In constructor ‘JSBSim::FGFDMExec::FGFDMExec(JSBSim::FGPropertyManager*, std::shared_ptr<unsigned int>)’:
/home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp:164:16: error: no matching function for call to ‘JSBSim::FGPropertyManager::Tie(const char [28], JSBSim::FGFDMExec*, int (JSBSim::FGFDMExec::*)() const, void (JSBSim::FGFDMExec::*)())’
164 | instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/aricciar/projects/jsbsimFork/jsbsim/src/input_output/FGPropertyReader.h:44,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/math/FGModelFunctions.h:40,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/models/FGModel.h:44,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/models/FGPropagate.h:43,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.h:46,
from /home/aricciar/projects/jsbsimFork/jsbsim/src/FGFDMExec.cpp:47:
Any suggestions?
from jsbsim.
I made some updates
Too many updates? 😉
I see you also changed the setter to take no/void arguments?
There are no compile issues with your DoSimplexTrim(int)
right?
from jsbsim.
To start off I suggest keeping it simpler. Comment out the simplex trim stuff. You had mentioned your primary goal was the linearization.
So you need:
instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
void FGFDMExec::DoLinearization(int)
{
...
}
And confirm whether you can get that to compile and link.
from jsbsim.
I did a quick test and was able to compile and link without any issues.
instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
void FGFDMExec::DoLinearization(int)
{
FGLinearization lin(this);
lin.WriteScicoslab();
}
from jsbsim.
Nice! I'll give that a shot. Was that without the simplex trim code included?
I had not tried commenting out this line:
// instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
The previous error is passed over when that line is commented out (I'll try updating the function as you did instead). I get to linking errors, but after starting to chase those down it was seeming like the simplex trim option is not maintained and will be a harder fix.
from jsbsim.
Correct, I haven't done anything to try and add in the simplex trim code.
The only other line I added to FGFDMExec.cpp
was:
#include "initialization/FGLinearization.h"
from jsbsim.
Awesome! That complies for me and let's me generate the _lin.sc
file with the linearized matrices using the desired workflow. I'll run some check cases to confirm the matrices match what I expect.
This is the test xml script
This is the latest master...vtpasquale:jsbsim:dev
One thing: JSBSim is locking up and not completing the simulation following the linearization. That's probably fine for the linearization workflow (mission accomplished), but I don't think that is the expected or desired behavior. Would you expect the typical simulation to continue after the linearized matrices are exported?
from jsbsim.
Yep, I wouldn't expect the linearization to crash or hang JSBSim.
from jsbsim.
@vtpasquale if your tests give reasonable results it would be great if you could:
- make a pull request with the revamped code, including the additions to the compilation workflow,
- provide a script with an example of linearization using one of the publicly available aircraft models in our current distribution.
I'm sure many users will benefit from this feature, which somehow has been buried in the codebase so far.
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
- CMAKE Configure Error on MacOS (M1 aarch64) HOT 2
- After changing pitch and long initial conditions the yaw angle changes also for no reason HOT 1
- JSBSim interface to Matlab on Windows: throttle command from joystick doesn't work 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
- 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.