Can I design its control law in matlab to directly input it for control? #600
Replies: 12 comments 1 reply
-
Hello friend!!! Now that i'm discovering about JSBsim and embedding it into Matlab. I've already run jsbsim in matlab and there somethings are stucked like:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for noticing my problems.I have the same confusion as you. Now I find that some input commands of the s-function, such as thrust, don't seem to have any effect on the airplane model when not run as a script.
|
Beta Was this translation helpful? Give feedback.
-
First off it all depends on what JSBSim aircraft model you're using. Neither of you have specified what you're using. In general you can specify the FCS commands and actuators in JSBSim if you want, or you can put all that logic and actuator modelling in Matlab/Simulink. For example take a look at say the A-4 JSBSim model. There is no actuator specified and the FCS is a trivial mapping of Lines 198 to 219 in 6461c86 |
Beta Was this translation helpful? Give feedback.
-
I dont seem like you, i'vs just test with aircraft A4, If i set DeCmd = 0.5, the control output DePos = 0.15. I dont know why, if you know how please show me where difference? |
Beta Was this translation helpful? Give feedback.
-
How are you reading 0.15 is exactly 0.5 of the max elevator position in radians as shown in the snippet I shared. |
Beta Was this translation helpful? Give feedback.
-
Yes, thank you for your support, I saw that, it has a scale |
Beta Was this translation helpful? Give feedback.
-
Correct, the A-4 FCS is simply mapping a control input in the range The elevator position Lines 424 to 432 in 6461c86 If you want your Matlab/Simulink model to perform the FCS logic and actuator modelling and effectively just output a control surface position then you could modify the FCS in the A-4 FCS as shown above to not perform a scaling from |
Beta Was this translation helpful? Give feedback.
-
Sorry I still have some problems:
1. Why when I run the script, I can do a simple trim to make the plane fly at a constant height and constant speed, but when I run in standalone mode with the same throttle and elevator inputs the plane keeps dropping high?
2. How to trim the aircraft when running in standalone model? I want to build a PID controller in Simulink so that the plane can fly at a fixed altitude
|
Beta Was this translation helpful? Give feedback.
-
Which script are you running?
If you're using the control position results from an earlier trim solution are you sure you're duplicating the other state that the trim solution is using and it created. For example is the airspeed identical, is altitude identical, is AoA identical? Matlab also has built-in tools to calculate trim solutions. |
Beta Was this translation helpful? Give feedback.
-
It is 737_cruise. And I don't know what other states need to be set and how other than the throttle and elevator and initial state setting files.
|
Beta Was this translation helpful? Give feedback.
-
I think you should read file JSBSimInterface.h/cpp if you run it on matlab! So you can get more variables or change something you want. |
Beta Was this translation helpful? Give feedback.
-
This topic has been moved to JSBSim Discussions as per the issue template statement: Support for this topic will therefore continue within this discussion. Thanks for your understanding. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions