Howto talk:Methods to replace the NASAL code with JSBSim code: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
(Response.)
Line 16: Line 16:
@AndersG Meanwhile, I do not understand why the article is not useful ... certainly converting the NASAL code in JSBSim may seem strange, but JSBSim is a very good and fast language that allows a direct control of parts of the aircraft and often can completely replace NASAL avoiding having to use two different programming languages. The example (certainly can be improved) describes the method of starting a rocket engine of an aircraft (G91R1B) for the assisted take-off (see this example: https://youtu.be/wdr9CuAsBL0 ). The ignition of rockets requires to manage a series of procedures and checks on the status of the power supply bus (entirely realized in JSBSim) and some switches (also managed via JSBSim) that in the old writing with NASAL code produced an overlap of the code . The rewriting in JSBSim has simplified everything and avoided having to write two procedures (with concurrent logic) different motion between them.
@AndersG Meanwhile, I do not understand why the article is not useful ... certainly converting the NASAL code in JSBSim may seem strange, but JSBSim is a very good and fast language that allows a direct control of parts of the aircraft and often can completely replace NASAL avoiding having to use two different programming languages. The example (certainly can be improved) describes the method of starting a rocket engine of an aircraft (G91R1B) for the assisted take-off (see this example: https://youtu.be/wdr9CuAsBL0 ). The ignition of rockets requires to manage a series of procedures and checks on the status of the power supply bus (entirely realized in JSBSim) and some switches (also managed via JSBSim) that in the old writing with NASAL code produced an overlap of the code . The rewriting in JSBSim has simplified everything and avoided having to write two procedures (with concurrent logic) different motion between them.
I must point out to you that the solution you have found (I obviously tried) does not work and the reasons are descripted in the article discussed here, as there is a continuous rewrite of the variable: ''fcs/throttle-pos-norm[1]'' by FGFS that cancels any modification realized by JSBSim. --[[User:Abassign|Abassign]] ([[User talk:Abassign|talk]]) 17:11, 11 August 2018 (EDT)
I must point out to you that the solution you have found (I obviously tried) does not work and the reasons are descripted in the article discussed here, as there is a continuous rewrite of the variable: ''fcs/throttle-pos-norm[1]'' by FGFS that cancels any modification realized by JSBSim. --[[User:Abassign|Abassign]] ([[User talk:Abassign|talk]]) 17:11, 11 August 2018 (EDT)
@Abassing JSBSim itself continuously rewrites ''fcs/throttle-pos-norm[1]'' from ''fcs/throttle-cmd-norm[1]''. However, when you put a FCS component that does so too it'll win over JSBSim's default write. Unless you use ''execrate'' on the channel, I suppose (and I suppose that that is an unforeseen bug with ''execrate'', which is a fairly new and untried feature of JSBSim). I've looked inside FGRocket.cpp in JSBSim and it seems to use ''fcs/throttle-pos-norm[x]'' just like FGPiston.cpp so I don't expect that rocket engines behave differently in this regard than piston engines where this method is well tried. [[User:AndersG|AndersG]] ([[User talk:AndersG|talk]]) 17:46, 11 August 2018 (EDT)

Revision as of 21:47, 11 August 2018

To me this HowTo seems confused and in its present state not very helpful to anyone. Can you try this single component instead of what you propose in this HowTo?

   <channel name="JATO">
       <switch name="systems/jato/throttle-norm">
           <default value="0"/>
           <test logic = "AND" value = "1">
               systems/jato/ignition-on == 1
               systems/jato/rocket_number_1 == 1
           </test>
           <output>fcs/throttle-pos-norm[1]</output>
       </switch>
   </channel>

This would be a pure JSBSim-side way to control the JATO ignition. Also note that the name of a component should (preferably) be the name of a property tree node that doesn't exist beforehand. AndersG (talk) 15:52, 11 August 2018 (EDT)

@AndersG Meanwhile, I do not understand why the article is not useful ... certainly converting the NASAL code in JSBSim may seem strange, but JSBSim is a very good and fast language that allows a direct control of parts of the aircraft and often can completely replace NASAL avoiding having to use two different programming languages. The example (certainly can be improved) describes the method of starting a rocket engine of an aircraft (G91R1B) for the assisted take-off (see this example: https://youtu.be/wdr9CuAsBL0 ). The ignition of rockets requires to manage a series of procedures and checks on the status of the power supply bus (entirely realized in JSBSim) and some switches (also managed via JSBSim) that in the old writing with NASAL code produced an overlap of the code . The rewriting in JSBSim has simplified everything and avoided having to write two procedures (with concurrent logic) different motion between them. I must point out to you that the solution you have found (I obviously tried) does not work and the reasons are descripted in the article discussed here, as there is a continuous rewrite of the variable: fcs/throttle-pos-norm[1] by FGFS that cancels any modification realized by JSBSim. --Abassign (talk) 17:11, 11 August 2018 (EDT)

@Abassing JSBSim itself continuously rewrites fcs/throttle-pos-norm[1] from fcs/throttle-cmd-norm[1]. However, when you put a FCS component that does so too it'll win over JSBSim's default write. Unless you use execrate on the channel, I suppose (and I suppose that that is an unforeseen bug with execrate, which is a fairly new and untried feature of JSBSim). I've looked inside FGRocket.cpp in JSBSim and it seems to use fcs/throttle-pos-norm[x] just like FGPiston.cpp so I don't expect that rocket engines behave differently in this regard than piston engines where this method is well tried. AndersG (talk) 17:46, 11 August 2018 (EDT)