-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSBSim Simulink Function #1010
Comments
Are you sure the aircraft should be trimmable at the initial conditions you're specifying for the trim? Or there could be an issue with the FDM file you've created. If you share the FDM file and the conditions you're using for trim others could potentially take a look and help. |
I have attached the flight data, script, and initial conditon for your reference. aircraft is StratoSurfer, Scipts/Test_StratoSurfer_Cruise, and the Initial condition is initCruise. |
Just had a very quick glance. Is the engine definitely on and running? I see the throttle being advanced, but it's not 100% clear that the engine is running. What is the output in terms of thrust and power and h-agl-ft below? <event name="Trim">
<condition> simulation/frame gt 1 </condition>
<set name="simulation/do_simple_trim" value="1"/>
<notify>
<property>velocities/vtrue-kts</property>
<property>position/h-agl-ft</property>
<property>aero/alpha-deg </property>
<property>aero/beta-deg </property>
<property>propulsion/engine[0]/thrust-lbs</property>
<property>propulsion/engine[0]/power-hp</property>
<property>attitude/phi-rad</property>
<property>attitude/theta-rad</property>
<property>attitude/psi-rad</property>
</notify>
</event> |
The trim routine will adjust the throttle while trying to calculate a trim solution. So it doesn't matter what you set the throttle position to. But as I mentioned, I'm not sure that the engine is on/running, in which case it doesn't matter what the trim routine does in terms of setting the throttle command, if the engine isn't on it will produce 0 thrust. Look at the output you produced just above, it shows the thrust as being 0. |
Thanks for the response. How do you make sure the engine is on or not? |
Take a look at this example of using the jsbsim/aircraft/737/rudder_kick_init.xml Line 11 in 4b3ec67
The -1 means all engines that the aircraft has. |
Well then there is something wrong with your engine, thruster model etc. With that sort of maximum thrust and a vehicle with a mass of only 3lbf, the trim routine probably can't find a small enough throttle command like 0.000001 to us to get a trim solution. |
No, no, no.... As I mentioned, the trim routine will try different throttle commands when trying to calculate a trim solution, so it doesn't matter what you set the throttle command to in the Motor Start event! The point is it appears the engine power is way too high for this sort of vehicle. And the trim routine has probably some minimum throttle increment that it tries when trying to find a solution which is way too much in terms of thrust. Think about it in terms of a rough sanity check, should a 3lbf vehicle have a motor of 350W, producing some enormous amount of thrust? |
Compare the amount of thrust you're seeing to the thrust measured for this engine for different propellers etc. https://www.innov8tivedesigns.com/images/specs/Cobra_2217-8_Specs.htm |
Yes, it is very high compared to the tabulated value. |
Step through the JSBSim code where it calculates the thrust and see if you spot what input is making it so large. |
But the 737 and c172x are working fine with the Simulink. |
The aircraft file, script, and initial condition we use are created for the FlightGear module. Is there any problem with Simulink? Can we please tell me how to run JSBSim standalone and visualize the results in FG. |
So run JSBSim stand-alone with your script, look at the command line arguments for JSBSim and see if there is any difference with the trim stand-alone versus with Simulink. |
How to run JSBSim stand-alone I tried but the application now opening. Can you please send me some documentation for that? |
Did you look at the Quick Start section of the README? https://github.com/JSBSim-Team/jsbsim?tab=readme-ov-file#quick-start |
Take a look at - https://www.technewstoday.com/fix-command-prompt-access-denied/ |
I have corrected the model. Working on the controls, here I want to change the control based on the altitude to demonstrate the dynamic soring "S" patter. |
@seanmcleod |
Do you see any error message when the input properties are processed? jsbsim/matlab/JSBSim_SFunction.cpp Lines 459 to 473 in 6f0c4d8
|
Hi, |
So in what way can't you use it? |
Rather than posting screenshots of your XML etc. rather put them in a triple back tick ` block with xml as the type. Means they're easier for other users to find via a search in future etc. In terms of running this in Simulink, are you sure you have enabled the auto-pilot? Most auto-pilot implementations have a separate property that you have to set to enable them. So maybe you're updating the altitude and heading setpoints, but if the autopilot isn't enabled then the autopilot will ignore the setpoints. For your script example, it looks to me like you haven't set the |
Then you'll need to look at improving the heading controller. |
In the initial stages of the simulation, a predefined crosswind, characterized by a specified magnitude and direction, is introduced to the model. The simulation accurately captures the model's initial response, manifesting in dynamic changes to its trajectory and behavior. However, as the simulation progresses, a noticeable reduction in the visual impact of the crosswind becomes evident. This observation indicates a diminishing influence over time. <?xml version="1.0"?>
<initialize name="reset03">
<vc unit="KTS"> 38.87689112646 </vc>
<longitude unit="DEG"> 0 </longitude>
<latitude unit="DEG"> 0 </latitude>
<phi unit="DEG"> 0.0 </phi> <!-- Roll -->
<theta unit="DEG"> 0.0 </theta> <!-- Pitch -->
<psi unit="DEG"> 0.0 </psi> <!-- Yaw -->
<altitude unit="FT"> 100 </altitude>
<winddir unit="DEG"> 90.0 </winddir>
<hwind unit="FT/SEC"> 20 </hwind>
</initialize>
<event name="Wind aloft">
<condition>simulation/sim-time-sec ge 0.01</condition>
<set name="atmosphere/psiw-rad" value="1.57" />
<set name="atmosphere/wind-mag-fps">
<description>Change_of_wind_magnitute_wrt_altitute</description>
<function>
<table>
<independentVar lookup="row">position/h-agl-ft</independentVar>
<tableData>
5 16.93490625
10 18.40375301
15 19.32134464
20 20
25 20.54277915
30 20.99717881
35 21.38920099
40 21.73469725
45 22.04407591
50 22.32455428
55 22.58135087
60 22.81836623
65 23.03859546
70 23.2443904
75 23.43763291
80 23.61985323
85 23.79231315
90 23.9560658
95 24.11199966
100 24.26087142
1000.0 20.9000
2000.0 19.8000
2500.0 18.9000
3000.0 20.0000
3500.0 20.0000
</tableData>
</table>
</function>
</set>
<!--set name="atmosphere/psiw-rad" value="0" /-->
<!--set name="atmosphere/wind-mag-fps" value="0" /-->
<!--set name="atmosphere/wind-down-fps" action="FG_RAMP" value="1" tc="10.0"/-->
</event> |
@kvgkrish did you progress in your study on this topic? |
@agodemar yes, still working on this |
@kvgkrish Any progress on this topic ? Or should we consider this issue closed ? |
Hi all,
This is Gokul doing a Master of Aerospace Engineering at TUM Germany. Currently working on master thesis at Chalmers University of Technology.
I am working on a Bio-Inspired UAV dynamics system. I am new to JSBSIM and I have set up all the files and worked fine with available flights and scripts. If I use a new flight configuration I have simulated the model. It shows trim failure and sometimes flight scripts are not used.
Can you help me to resolve this issue?
The text was updated successfully, but these errors were encountered: