Execution speed - sim rate at 0.001s and SetProperty/GetProperty speed-up ? #530
Replies: 3 comments 2 replies
-
I profiled some of the code many years ago. In particular I looked closely at the aerodynamics code. Each aerodynamic coefficient may depend on qbar (dynamic pressure), for instance. Initially, when an aerodynamic coefficient was evaluated, the dynamic pressure property would be looked up each time it appeared in an aerodynamic coefficient function. We decided to cache property values for each cycle so that they were only looked up one time. I think that JSBSim currently is fairly well optimized and runs quite fast, so your experience comes as a surprise. What are your thoughts on why execution "consumes so much CPU"? |
Beta Was this translation helpful? Give feedback.
-
Are you writing to a file or the network at 1000Hz or are you specifying a different output rate? Can you provide an example, e.g. using the 737 model in JSBSim with your output element so we can try and reproduce/compare the speed decrease.
How are you calling GetProperty, from your own C++ code, or via the Python wrapper? Again more details would be useful for someone to try and reproduce what you're seeing. |
Beta Was this translation helpful? Give feedback.
-
Properties name parsing is notoriously slow so you should avoid calling property functions that use strings as one of their arguments. DONT: FGPropertyManager* pm = fdm->GetPropertyManager();
FGPropertyNode* root = pm->GetNode();
while (fdm->Run()) {
x = root->GetDouble("my/property/name");
} DO: FGPropertyManager* pm = fdm->GetPropertyManager();
FGPropertyNode* node = pm->GetNode("/my/property/name");
while (fdm->Run()) {
x = node->getDoubleValue();
} Note that in the |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Is anybody facing issues with the JSBSIM execution speed , when we use 1ms update rate (integration) and many calls to the SetProperty/GetProperty functions ?
We want to use 1ms rate because we are cosimulating with other models and the coupled system needs such 1ms to keep numerical stability.
I did a couple of tests with a jsbsim.exe, 1ms on a given plane. This would run faster than real-time, let's say 5x RT.
If we add some outputs writing, or some GetProperty, speed decrease a lot (let's say 10 to 20 times slower, depending on how many properties are requested). I had a look at the GetProperty/SetProperty code and I might have some ideas why its consuming so much CPU.
Did anybody have similar issues ? Did anybody actually investigated how JSBSIM is spending CPU cycles ?
Thanks for feedback.
Lionel.
Beta Was this translation helpful? Give feedback.
All reactions