Including Atmospheric Winds in JSBSim Simulation via Python #1088
Replies: 4 comments 3 replies
-
Hmm, I wondered whether the # Atmosphere conditions
fdm['atmosphere/psiw-rad'] = math.pi/2
fdm['atmosphere/wind-mag-fps'] = 10
print(f"BIC psiw-rad: {fdm['atmosphere/psiw-rad']:.3f} \n",
f"wind-mag-fps: {fdm['atmosphere/wind-mag-fps']:.3f} \n\n")
# Initial Conditions
fdm['ic/h-sl-ft'] = 15000
fdm['ic/vc-kts'] = 300
fdm['ic/gamma-deg'] = 0
# Initialize the aircraft with initial conditions
fdm.run_ic()
print(f"AIC psiw-rad: {fdm['atmosphere/psiw-rad']:.3f} \n",
f"wind-mag-fps: {fdm['atmosphere/wind-mag-fps']:.3f} \n\n")
# Atmosphere conditions
fdm['atmosphere/psiw-rad'] = math.pi/2
fdm['atmosphere/wind-mag-fps'] = 10
# Trim
try:
print(f"BT: psiw-rad: {fdm['atmosphere/psiw-rad']:.3f} \n",
f"wind-mag-fps: {fdm['atmosphere/wind-mag-fps']:.3f} \n\n")
fdm['simulation/do_simple_trim'] = 1
print(f"AT: psiw-rad: {fdm['atmosphere/psiw-rad']:.3f} \n",
f"wind-mag-fps: {fdm['atmosphere/wind-mag-fps']:.3f} \n\n") BIC psiw-rad: 0.000
wind-mag-fps: 10.000
AIC psiw-rad: 0.000
wind-mag-fps: 0.000
BT: psiw-rad: 0.000
wind-mag-fps: 10.000
AT: psiw-rad: 3.142
wind-mag-fps: 0.000 Now there are some initial condition properties for wind, however it looks like a setter for the magnitude is missing? jsbsim/src/initialization/FGInitialCondition.cpp Lines 1521 to 1525 in 56c6662 |
Beta Was this translation helpful? Give feedback.
-
Should be fairly easy, busy testing it out - seanmcleod@190c060 If my further testing is successful then I'll submit a pull request. |
Beta Was this translation helpful? Give feedback.
-
So for my testing I took the script <event name="Set wind">
<condition> simulation/sim-time-sec le 0.1 </condition>
<set name="ic/vw-mag-fps" value="10"/>
<set name="ic/vw-dir-deg" value="30"/>
<notify/>
</event> And then compared the trim results with wind present and noted that the trim results are slightly different, as well as most of the properties being reported every 5 seconds. I also had the <event name="Repeating Notify" persistent="true">
<description>Output message at 5 second intervals</description>
<notify>
....
....
<property>atmosphere/psiw-rad</property>
<property>atmosphere/wind-mag-fps</property>
</notify> So I'll submit a pull request now. |
Beta Was this translation helpful? Give feedback.
-
There is an order dependence here. In order to set the wind direction you need to have wind that has a magnitude > 0. jsbsim/src/initialization/FGInitialCondition.cpp Lines 619 to 638 in e26d03b |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I'm trying to include synthetic winds in a JSBSim simulation using Python, but I'm facing some difficulties.
I'd like to know the correct way to include synthetic winds in the simulation via Python, especially when I'm trying to trim the aircraft in the presence of these winds.
Here's the code I'm using:
However, I noticed that both atmosphere/psiw-rad and atmosphere/wind-mag-fps were not changed.
Here's the answer I got:
Does anyone have any suggestions on how to correctly set up initialization to include atmospheric winds in the simulation?
Thank you in advance for any help!
Beta Was this translation helpful? Give feedback.
All reactions