Board index FlightGear Support Interfacing

JSBsim SFunction problems

Connecting two computers, using generic protocol, connecting with Matlab?

JSBsim SFunction problems

Postby Hassan Ali » Sat Apr 12, 2014 10:19 am

Hi everybody ... i've been working for a while on interfacing matlab with FG, and i could eventually achieve this connection, but i have some problems regarding the flight dynamics itself.

I use the JSBsim SFunction that can be used directly in a simulink model, and i would like to ask how can i make sure that i've specified the right aircraft model, because when i run the GUI of the JSBsim SFunction project, the AC model list says "AC model selection (Not working yet)" so i have the feeling that the AC model may not be well specified.

Image

The motivation behind this question is that when i used the version 1.9.1 with matlab, using the f16 aircraft model, the aircraft keeps climbing till it reaches an altitude of 45000 ft and then descends till it hits the ground, but when i used the version 3.0, the aircraft started to fall from its initial altitude and velocity till it hit the ground, baring in mind that the JSBsim folder that contains the data of planes and engines (that found in the JSBsim project folder) is the same, and i don't have an explanation for this.

Moreover, i made a quick search on the center of gravity of the f16 aircraft, and found that it is designed to have negative stability, meaning the center of gravity is behind the neutral point of the aircraft, in other words, the aircraft should tend to pitch upwards rather than downwards in normal aircrafts. However, it tends to make a pitch down and fall direct to the ground when i start the matlab simulation and i interpreted this as an error in reading aircraft data by JSBsim.

Another question ... is there a way that i can get the stability derivatives and the dimensions of an aircraft out of the FG?? i need them so i can use them to build a simple FDM model using matlab aerospace block instead of the JSBsim project.

Thank you in advance.
Hassan Ali
 
Posts: 19
Joined: Thu Apr 03, 2014 3:47 pm

Re: JSBsim SFunction problems

Postby Johan G » Tue Apr 15, 2014 7:21 pm

When using an older version of FlightGear it is worth keeping in mind that the implementation of JSBsim have changed over the years just as FlightGear has done. ;)

In essence, and apart from the usual problem with varying quality of the aircraft models, you can not expect a current version of an aircraft to work with an older version of FlightGear. If you run a much older FlightGear try find and use an aircraft that was released about at that time. Unfortunately I am not really sure where you can find aircraft for 1.9.1 though. :(
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: JSBsim SFunction problems

Postby Hooray » Tue Apr 15, 2014 7:40 pm

we don't really provide support for 1.9.1 or even any versions much older than 1-2 release cycles (6-12 months), simply because most of the people who actually do provide support here, will typically be running the latest release and/or "next", i.e. the code that is going to be the upcoming release.

to be honest, it isn't helping that 3rd party packages do not update their stuff - we have so many people that are running significantly outdated versions of FG due to inertia, which is certainly contributing to quite some frustration around here, not only on the user side, but also on our side.

We should probably work out some arrangement to send out notices to entities like Matlab, so that they can update their stuff for each release cycle, it shouldn't be much of a problem actually, and it would mean less frustration for their users, and less work for us.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: JSBsim SFunction problems

Postby Hassan Ali » Tue Apr 15, 2014 10:57 pm

thank you for your reply :) I think that this is not the issue, because the matlab itself (the JSBsim SFunction) takes the aircraft model as an input and then simulink performs the calculations and give the results to FG at the end to draw the aircraft, so the solver of the FG itself has nothing to do here with what is drawn on the screen because the matlab performs the calculations. What do you think?
Hassan Ali
 
Posts: 19
Joined: Thu Apr 03, 2014 3:47 pm

Re: JSBsim SFunction problems

Postby Alant » Tue Apr 15, 2014 11:37 pm

I would suggest that you post this query on one of the JSBsim mail lists, http://sourceforge.net/p/jsbsim/mailman/ and possibly on the Matlab forums.

Flightgear is just one of the users of JSBsim.

I think that neither the JSBsim-matlab nor the Flightgear-Matlab interfaces have been updated in recent years, and you may need to spend some time on this. That is the problem with free software - you cannot expect full support as the orignal author may have gone on to other things.
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: JSBsim SFunction problems

Postby Thorsten » Wed Apr 16, 2014 6:07 am

I think that this is not the issue, because the matlab itself (the JSBsim SFunction) takes the aircraft model as an input and then simulink performs the calculations and give the results to FG at the end to draw the aircraft, so the solver of the FG itself has nothing to do here with what is drawn on the screen because the matlab performs the calculations.


But a FG 3.0 aircraft expects the FG 3.0 JSBSim solver to work properly, and an FG 1.9.1 aircraft expects the FG 1.9.1 solver to work properly, so if your solver corresponds to what FG had in 1.9.1 and you use aircraft data from 3.0, the result may not necessarily be reasonable.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: JSBsim SFunction problems

Postby Hassan Ali » Thu Apr 17, 2014 12:42 pm

@Thorsten: based on what you have said, i made a small test: i generated the run script from matlab, and i specified that the aircraft type to be a 777-200, while the JSBsim was reset to have the f16 dynamics, and when i ran the simulation, i got a response which is almost the same as that of the f16 (regarding main states like pitch angle response, speed and so on), so i understood that the FG here is just a display method that has nothing to do with calculating the states of the aircraft, so its version won't make a difference, am i wrong??

i attached a picture of the simulink model i'm working on, to show the JSBsim block i'm using (i made some modifications over the original model)
Image
Hassan Ali
 
Posts: 19
Joined: Thu Apr 03, 2014 3:47 pm

Re: JSBsim SFunction problems

Postby pranav » Thu Oct 12, 2017 11:51 am

Can anyone please tell why i am getting this error while running JSBSIM in simulink 'Error getting arg counts for S-function 'JSBSim_SFunction' in 'jsbsimgui_test/JSBSim S-Function'.
Caused by:
JSBSim_SFunction is a script.'

Thanks
pranav
 
Posts: 1
Joined: Thu Oct 12, 2017 11:48 am


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 3 guests