Open kvgkrish opened 3 months ago
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>
I have attached the engine power and new script for your review. Even after this modification, model has failed du to trim error.
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? I faced this issue while editing the aircraft file and getting this error.
Take a look at this example of using the <running>
element.
The -1 means all engines that the aircraft has.
Now I am getting Very high thrust and again trim failure.
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.
I have reduced the command, but it is still getting very high value.
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?
It is a very small motor. I have attached the details of it.
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. How to resolve this issue.
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
I am getting this error.
Take a look at - https://www.technewstoday.com/fix-command-prompt-access-denied/
Did you download JSBSim.exe from the web, or did you clone the repo and build it yourself? If downloaded from the web take a look at the Properties and check the Unblock checkbox if it's there, it is by default for any files downloaded from the internet.
I have downloaded from the web
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. Can you help me write control logic for dynamic soaring?
@seanmcleod Hi, I want to input the altitude setpoint as input to the S function. But the S function won't take it when its fed through input. I have modified the input output XML file. It only considers when I fed through script files. Can you please help me resolve this issue.
Do you see any error message when the input properties are processed?
Hi, I haven´t get any errors but I cant use that as a input.
So in what way can't you use it?
The figure below is for the desired altitude and headings function.
I want to feed the autopilot to follow the desired trajectory. I have created a function for the desired altitude and desired heading angle with respect to time. I want to feed as an input to the autopilot. If sending this comment through input, the model doesnt't follow the desired altitude. If I write this desired altitude and heading in the script file as a piecewise input, the model won't take it as an input. The figure below is a script with a piecewise function. If I go with the below script, it crashes the model.
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 Desired Flight Path
event to be executed more than once. Also the same comment applies to the script case, make sure the autopilot is enabled.
<use aircraft="GBSv02" initialize="ini03"/>
<run start="0.0" end="1000" dt="0.008333333333333333333">
<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>
<event name="Desired Flight Path">
<!-->condition> position/h-agl-ft ge 600 </condition-->
<condition> simulation/sim-time-sec ge 0.1 </condition>
<set name="ap/altitude_hold" value="1.0" />
<set name="ap/heading_hold" value="1.0" />
</event>
</run>
</runscript>
I have enabled the autopilot for altitude hold and heading hold.
<s_function_config>
<input>
<property> fcs/throttle-cmd-norm[0] </property>
<property> fcs/aileron-cmd-norm </property>
<property> fcs/elevator-cmd-norm </property>
<property> fcs/rudder-cmd-norm </property>
<property>ap/altitude_setpoint</property>
<property>ap/heading_setpoint</property>
</input>
I have included the autopilot setpoint as an input for the S-Function. The model works well for altitude hold, but if I enable the heading, it oscillates around the x-axis.
The model works well for altitude hold, but if I enable the heading, it oscillates around the x-axis.
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. To address this, I am looking to incorporate a windshear model into the simulation. I have already introduced values representing wind velocity with respect to altitude. However, the current model generates same responses for all directions. I am seeking guidance on how to effectively implement the windshear phenomenon into the atmospheric conditions of the simulation.
<?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? Updates to the community are welcomed
@agodemar yes, still working on this
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?