Integrate Custom 3D Wind Field and Temperature Data into JSBSim #1130
Replies: 4 comments 2 replies
-
I also encountered the same problem. In addition, I want to know how to write a proper script file to control the flight path of the aircraft |
Beta Was this translation helpful? Give feedback.
-
Couple of initial comments and thoughts. So, in terms of integrating a 3D grid of wind vectors Take a look at #74 for more details and a link to the research paper. In summary there was an external process which received the aircraft's position for each simulation time step, which then interpolated the wind vectors from the 3D grid and then updated the current wind components in JSBSim via the properties Do you want to/need to run this in real-time, i.e. typically if you're going to have a human pilot in the loop? Or are you only interested in using this in batch mode? In addition to @agodemar's approach another option is something along these lines: fdm = jsbsim.FGFDMExec()
fdm.load_model('737')
fdm.run_ic()
while fdm.get_sim_time() < period:
# Source and interpolate wind vectors
(wN, wE, wD) = get_wind(fdm['position/long-gc-deg'], fdm['position/lat-gc-deg'], fdm['position/h-agl-ft'])
fdm['atmosphere/wind-north-fps'] = wN
fdm['atmosphere/wind-east-fps'] = wE
fdm['atmosphere/wind-down-fps'] = wD
fdm.run() Another option I guess is for JSBSim to supply a mechanism for a user to supply a wind callback function like JSBSim does for determining the ground elevation via an optional ground callback function. In which case then you would simply implement the wind callback function which would get called on each timestep, do your lookup and interpolation and return the wind components. Linking in your implementation with JSBSim. In general the same options apply to setting the temperature, i.e. instead of implementing a whole new atmosphere model make use of one the options I've mentioned. |
Beta Was this translation helpful? Give feedback.
-
Have you decided which sort of approach you're going to try? If you go with the Python approach you can make use of numpy/scipy interpolation methods. |
Beta Was this translation helpful? Give feedback.
-
Python may be the optimal choice. Thanks for your help. I will try this.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm attempting to integrate a complex 3D wind field and temperature dataset into JSBSim. My dataset consists of:
Three 3D data files representing u, v, w wind speed components.
One 3D data file containing temperature data.
Each file is formatted as follows:
First 5 lines contain metadata (title, grid dimensions, starting coordinates, grid spacing)
Followed by data values arranged in x, y, z order
My objectives are:
Create a custom atmosphere model class in JSBSim that can read and utilize this data.
During simulation, use trilinear interpolation to calculate wind speed and temperature based on the aircraft's current position.
Ensure this custom model integrates seamlessly with JSBSim's existing architecture.
I've attempted to create a CustomAtmosphere class, derived from FGAtmosphere, which includes methods for loading the data and performing interpolation. However, I'm unsure about the best way to integrate this into JSBSim.
Specifically, I have the following questions:
Where in JSBSim should this custom atmosphere model be initialized and used?
Do I need to modify FGFDMExec or other core classes to support this new model?
How can I specify the use of this custom model in JSBSim's XML configuration files?
Are there recommended approaches for handling large 3D datasets to ensure simulation performance isn't impacted?
I would appreciate any guidance on best practices and integration methods. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions