Board index FlightGear Development Aircraft Flight dynamics model

JSBSim - Linear actuator is active in the next repository

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

JSBSim - Linear actuator is active in the next repository

Postby abassign » Tue Jan 08, 2019 10:26 am

The use of the actuator allows obtaining a very realistic result for linear or rotary displacement systems but limited within a certain range of values. While it does not work properly for multi-turn rotary systems. For example this wind speed display is made by simulating an electromechanical component. The effect between 0 and 9 is perfect, but between 9 and 0 or between 0 and 9 (backward rotation) the actuator finds its equilibrium state after a complete rotation. The problem is that Actuator does not provide the ability to manage these particular types of devices. The same problem is present for the lap-compass needle which, when it exceeds 360 °, makes a further rotation to find the equilibrium point.

The reason for this problem is due to the fact that in JSBSim there is no linear actuator, but only an actuator that does not perform the kinematic transformation of a rotation in a linear displacement. The linear actuator is well described in this Wikipedia link:

https://en.wikipedia.org/wiki/Linear_actuator

In this link I have communicated to the copmunity that follows JSBSim that I have made a prototype of this actuator that solves many problems and simplifies the solution of other problems encountered in the development of FGFS code with FDM written for JSBSim:

https://github.com/JSBSim-Team/jsbsim/i ... -452220985

The (temporary) code of the linear actuator can be downloaded at this link:

https://github.com/abassign/JSBSim-Test ... ctions.git

The compilation of the code is not trivial as it is necessary to know JSBSim at the development level. I hope soon to have time to insert a small article on the Wiki that explains how to do it. I think that the FGFS community should participate more actively in the development and maintenance of the JSBSim code as it is a fundamental element for many vehicles present in the FGFS repository.

To make it clear what a linear actuator does and fixes I show this short video:

The video display these feature:
The linear actuator converts a measured rotation with a certain unit of measurement into a linear displacement. The movie shows three possible applications:
1# Mechanical counter with Genoa type gear.
2# Stroke Counters.
3# Analog instruments Indicators (compass) to not jump to 360 ° when it reaches a complete rotation. In the movie you notice that the thin index (arrow), which
is not controlled by the module, instead makes a jump of 360 ° when it reaches the North again (360 to 0 °)

Here instead is the complete syntax of the command with the description of the parameters:

Code: Select all
     /** Models a flight control system summing component.
     *    linear actuators typically operate by conversion of rotary motion into linear motion.
     *    The linear_actuator component is decrobed in the Wikipedia link:
     *    https://en.wikipedia.org/wiki/Linear_actuator
     *    Converts a rotation into a linear movement or a multiturn rotation.
     *    For the conversion it is necessary to declare a module
     *    that is defined by the difference of the maximum and minimum value Input.
     *    List of parameters:
     *
     *    input: Value to be transformed
     *    module: Difference of the maximum and minimum value Input, default is 1.0
     *    versus: Direction of rotation if fixed. The versus allows to obtain a kinematism
     *      similar to the escapement of a clock. The default value is 0.0 If the value
     *      is zero, the verse is automatically obtained according to variation of
     *      the input data.
     *      If set to a value> 0 the verse is increasing, ie the output changes only
     *      if the Input value is greater than the previous one.
     *      If set to a negative value, the output changes only if the next value
     *      is lower than the previous one.
     *      With this parameter allows to easily obtain a "step counter".
     *    rate: To define when the rotation is complete, the differential criterion is used.
     *      For example, if the rotation is clockwise and the module is 360, the revolution
     *      will be complete when the input value changes from 360 to 0.
     *      When this happens a counter increases the output of the value of the module.
     *      As a way the system keeps track of the number of rotations.
     *      Rate defines the sensitivity of the system.
     *      If a difficulty in determining the rotation is observed during the tests,
     *      this parameter must be modified with a positive value not exceeding 1.
     *      The default value is 0.3
     *    set: If the value is greater than zero, the output changes according to the input.
     *      If its value is zero, the output remains constant (the system stores the data).
     *      The use of this parameter allows to simulate the behavior of a servomechanism
     *      that is blocked, for example due to a power failure.
     *    Reset: When high, the output returns to zero.
     *    Lag: Activate a lag filter on exit.
     *    Gain: Apply a multiplication coefficient of the output value.
     *    Clipto: Clips the output. The clipping is applied after the gain and lag.
     *    Output: Output value following the following rule:
     *      Output = gain * (Input + module*countSpin)
     *      CountSpin is the number of complete rotations
     *
     *    The form of the linear_actuator component specification is:
     *
     * @code
     *    <linear_actuator name="{string}">
     *      <input> {property name} </input>
     *      <module> value </module>
     *      <versus> value|property </versus>
     *      <rate> value </rate>
     *      <set> {property name | value} </set>
     *      <reset> {property name | value} </reset>
     *      <lag> number </lag>
     *      <gain> value|property </gain>
     *      <clipto>
     *         <min> {value} </min>
     *         <max> {value} </max>
     *      </clipto>
     *      <output> {property name} </output>
     *    </linear_actuator>
     * @endcode
     *
     * Mechanical counter:
     *
     * It is the typical mechanism used to count the kilometers traveled by a car,
     * for example the value of the digit changes quickly at the beginning of the km.
     * Module 10 indicates that the count goes from 0 to 9 after one complete revolution.
     *
     * @code
     *
     *   <linear_actuator name="systems/gauges/PHI/indicator/digit3AW">
     *      <input>systems/gauges/PHI/indicator/digit3A</input>
     *      <module>10</module>
     *      <rate>0.2</rate>
     *      <lag>8.0</lag>
     *  </linear_actuator>
     *
     * @endcode
     *
     * The gyrocompass from a rotation with a value from 0 to 259 degrees.
     * When it returns to zero, if it is made more realistic by means of an actuator,
     * there is a jump of the disk which performs a complete rotation of 360 °.
     * By activating a linear actuator followed by an actuator
     * it is possible to obtain a very realistic result.
     *
     * @code
     *
     * <linear_actuator name="gyrocompass-magnetic-deg-linear">
     *      <input>gyrocompass-magnetic-deg</input>
     *      <module>360</module>
     *  </linear_actuator>
     *
     *  <actuator name="gyrocompass-magnetic-deg-linear-actuator">
     *      <input>gyrocompass-magnetic-deg-linear</input>
     *      <lag>2.0</lag>
     *      <rate_limit>100</rate_limit>
     *      <bias>0.1</bias>
     *      <deadband_width>1</deadband_width>
     *      <hysteresis_width>0.5</hysteresis_width>
     *  </actuator>
     *
     * @endcode
     *
     * Count steps with memory:
     * If you use a button or switch to advance a mechanism, we can build a step counter.
     * In this case the module is 1 and the rate 1. The verse is positive (increasing).
     *
     * @code
     *
     *  <linear_actuator name="switch-increase-summer">
     *      <input>switch-increase-trigger</input>
     *      <set>switch-increase-operative</set>
     *      <module>1</module>
     *      <rate>1</rate>
     *      <versus>1</versus>
     *      <lag>8.0</lag>
     *      <gain>1.0</gain>
     *  </linear_actuator>
     * 
     * @endcode
     *
     *
     * <pre>
     *    Notes:
     * </pre>
     *
     *    @author Adriano Bassignana
     */


I hope that the FGFS community can actively collaborate on this small project and contribute to the proposal of other features useful to improve the development with JSBSim of their aircraft.
Last edited by abassign on Tue Feb 12, 2019 11:26 am, edited 1 time in total.
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: JSBSim - Proposal for a linear actuator

Postby Alant » Tue Jan 08, 2019 11:22 am

Good,I like it.

Is there any reason that this was not done on the Flightgear side? The actuators you demonstrate are all on instruments, which do not have much effect on the FDM itself.

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: JSBSim - Proposal for a linear actuator

Postby legoboyvdlp » Tue Jan 08, 2019 1:02 pm

If in JSBSIM I suppose it can also be used on systems - e.g. maybe a flight control system.
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: JSBSim - Proposal for a linear actuator

Postby abassign » Tue Jan 08, 2019 1:28 pm

Alant wrote in Tue Jan 08, 2019 11:22 am:Good,I like it.
Is there any reason that this was not done on the Flightgear side?
Alan


Hi, yours is a very good question!
The reason is that the linear actuator is a functional block to handle systems that are an important part of JSBSim.

http://wiki.flightgear.org/Howto:Methods_to_replace_the_NASAL_code_with_JSBSim_code

In this article I wrote in the wiki I explain the reason and some techniques to replace NASAL with JSBSim. It may seem strange, but JSBSim is an excellent data-oriented language (Data Driven) that greatly simplifies the problem of the correct sequencing of events. In the case of the FIAT G91R1B that we are developing (in the movie, display its cockpit) many systems intimately linked to each other. At the beginning of the project I wrote the systems code with NASAL, but by the time the code it was always more complicated and becoming more difficult to manage concurrent processes.

In programming councorrent systems (in automation area) is normal use data-driven languages. I can give you many examples LabView (used in university and research), SIEMENS for its industrial controllers uses LOGO Confort, Modelica and Open Modelica etc ... JSBSim is certainly a small and compact language with low CPU load.

Obviously, those who want to insert a Linear Actuator for XML or NASAL will be welcome, but I will develop more willingly in JSBSim and therefore it seemed natural to propose this solution to the development group. It is currently only a proposal, but I hope that in the future it will become an operational module.

However, in FGFS XML there is a beautiful set of objects that implement Autopilot functions that could have extensions similar to the one I'm designing for JSBSim. The only problem is that XML for FGFS is not for real-time, so it is related to frame-rate and this can cause problems if the value is too low.

http://wiki.flightgear.org/Howto:Design_an_autopilot

If you're curious to read the article on the Wiki for the replacement of part of the NASAL code with JSBSim, you'll see that JSBSim is a very interesting and efficient programming paradigm.
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: JSBSim - Proposal for a linear actuator

Postby abassign » Tue Jan 08, 2019 1:48 pm

legoboyvdlp wrote in Tue Jan 08, 2019 1:02 pm:If in JSBSIM I suppose it can also be used on systems


Exactly it is a system management module. But in JSBSim systems can also be 80-90% of the code written with this language. In our G91R1B we are now 90% and now is constantly increasing.
If you are interested, look into the G91 of the G91R1B (if you are interested you can download or fork it is GPL 3)

https://github.com/abassign/G91-R1B_HD.git

As you can see most of the code is written in the Systems directory and it is only JSBSim.

Another interesting example is that of the Tu144 is practically all of JSBSim (I think it is a very precise choice of the programmer). It is a very remarkable work that I consider really valid and this code served me as a model for the conversion of the NASAL code to JSBSim code.

https://gitlab.com/mdanil/Tu-144
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: JSBSim - Proposal for a linear actuator

Postby Alant » Tue Jan 08, 2019 4:31 pm

Thanks. That make some sense to me now.

It made even more sense when I read the wiki article.

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: JSBSim - Proposal for a linear actuator

Postby Octal450 » Wed Jan 09, 2019 12:21 am

I agree, I have been looking for such a solution for a while, it is very annoying to have the needle spin around like that.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: JSBSim - Proposal for a linear actuator

Postby abassign » Sun Jan 27, 2019 5:40 pm

In these days we have included in the testing version of JSBSim the linear actuator in its complete form:

Code: Select all
/** Models a flight control system summing component.
     *    linear actuators typically operate by conversion of rotary motion into linear motion.
     *    The linear_actuator component is decrobed in the Wikipedia link:
     *    https://en.wikipedia.org/wiki/Linear_actuator
     *    Converts a rotation into a linear movement or a multiturn rotation.
     *    For the conversion it is necessary to declare a module
     *    that is defined by the difference of the maximum and minimum value Input.
     *    List of parameters:
     *
     *    input: Value to be transformed
     *    Output: Output value following the following rule:
     *      Output = gain * (bias + Input + module*countSpin)
     *      CountSpin is the number of complete rotations calculated by this device
     *    gain: Apply a multiplication coefficient of the output value, the default value is 1.0
     *    bias: Value that is added to the input value
     *    module: Difference of the maximum and minimum value Input, default is 1.0
     *    hysteresis: Defines the sensitivity of the actuator according to the input.
     *      For example, if the actuator has a module of 360 and if the hysteresis is 5.0,
     *      the actuator, with gain = 1, will put a value equal to: 5, 10...355, 360, 365, 370 etc.
     *      This parameter allows to simulate stepper motors. The default value is 0.1
     *      It is not advisable to have this parameter too small ( less than 0.1)
     *      as it could make the CPU load heavier.
     *    versus: Direction of rotation if fixed. The versus allows to obtain a kinematism
     *      similar to the escapement of a clock. The default value is 0 If the value
     *      is zero, the verse is automatically obtained according to variation of
     *      the input data.
     *      If set to a value > 0.5 the verse is increasing, ie the output changes only
     *      if the Input value is greater than the previous one.
     *      If set to a value < -0.5 the output changes only if the next value
     *      is lower than the previous one.
     *      With this parameter allows to easily obtain a "step counter".
     *    rate: To define when the rotation is complete, the differential criterion is used.
     *      For example, if the rotation is clockwise and the module is 360, the revolution
     *      will be complete when the input value changes from 360 to 0.
     *      When this happens a counter increases the output of the value of the module.
     *      As a way the system keeps track of the number of rotations.
     *      Rate defines the sensitivity of the system.
     *      If a difficulty in determining the rotation is observed during the tests,
     *      this parameter must be modified with a positive value not exceeding 1.
     *      The default value is 0.3
     *    set: If the absoloute value is greater or equal 0.5, the output changes according to the input.
     *      If its value is lower 0.5, the output remains constant (the system stores the data).
     *      The use of this parameter allows to simulate the behavior of a servomechanism
     *      that is blocked, for example due to a power failure.
     *    Reset: if the absolute value is greater or equal 0.5, the output returns to zero and reset internal data.
     *    lag: Activate a lag filter on exit if the value is greater 0.0 the lag is active.
     *      Be very careful to use the lag filter in case you use two or more "linear_actuator" in cascade;
     *      may happen that the smoothing effect due to the lag in the output value can mislead the rotation
     *      determination system. The effect is similar to that of a loose coupling of a rack and pinion.
     *      Therefore, with these types of coupling, place lag only at the last stage.
     *
     * @code
     *    <linear_actuator name="{string}">
     *      <input> {property name} </input>
     *      <bias> {property name | value} </bias>
     *      <module> {value} </module>
     *      <hysteresis> {value} </hysteresis>
     *      <rate> {value} </rate>
     *      <versus> {property name | value} </versus>
     *      <gain> {value} </gain>
     *      <set> {property name | value} </set>
     *      <reset> {property name | value} </reset>
     *      <lag> {value} </lag>
     *      <output> {property name} </output>
     *    </linear_actuator>
     * @endcode
     *
     * Mechanical counter:
     *
     * It is the typical mechanism used to count the kilometers traveled by a car,
     * for example the value of the digit changes quickly at the beginning of the km.
     * Module 10 indicates that the count goes from 0 to 9 after one complete revolution.
     *
     * @code
     *
     *   <linear_actuator name="systems/gauges/PHI/indicator/digit3AW">
     *      <input>systems/gauges/PHI/indicator/digit3A</input>
     *      <module>10</module>
     *      <rate>0.2</rate>
     *      <lag>8.0</lag>
     *  </linear_actuator>
     *
     * @endcode
     *
     * The gyrocompass from a rotation with a value from 0 to 259 degrees.
     * When it returns to zero, if it is made more realistic by means of an actuator,
     * there is a jump of the disk which performs a complete rotation of 360 °.
     * By activating a linear actuator followed by an actuator
     * it is possible to obtain a very realistic result.
     *
     * @code
     *
     * <linear_actuator name="gyrocompass-magnetic-deg-linear">
     *      <input>gyrocompass-magnetic-deg</input>
     *      <module>360</module>
     *  </linear_actuator>
     *
     *  <actuator name="gyrocompass-magnetic-deg-linear-actuator">
     *      <input>gyrocompass-magnetic-deg-linear</input>
     *      <lag>2.0</lag>
     *      <rate_limit>100</rate_limit>
     *      <bias>0.1</bias>
     *      <deadband_width>1</deadband_width>
     *      <hysteresis_width>0.5</hysteresis_width>
     *  </actuator>
     *
     * @endcode
     *
     * Count steps with memory:
     * If you use a button or switch to advance a mechanism, we can build a step counter.
     * In this case the module is 1 and the rate 1. The verse is positive (increasing).
     * A pulse counter (for example the count of the switched-on states of a switch with values 1 and 0),
     * the module must be 1 in that each step must advance its value by one unit.
     * The verse is "1" because it has to accept only increasing values (as in a clock escapement).
     * The gain is 0.5 because, in similitude to an escapement of a clock,
     * the gear makes two steps for a complete rotation of the pendulum.
     *
     * @code
     *
     *  <linear_actuator name="systems/gauges/PHI/doppler/switch-increase-summer">
     *      <input>systems/gauges/PHI/doppler/switch-increase</input>
     *      <module>1</module>
     *      <rate>1</rate>
     *      <versus>1</versus>
     *      <gain>0.5</gain>
     *      <lag>0.0</lag>
     *      <reset>systems/gauges/PHI/doppler/test_reset_off</reset>
     *  </linear_actuator>
     * 
     * @endcode
     *
     *
     * <pre>
     *    Notes:
     * </pre>
     *
     *    @author Adriano Bassignana
     */


Currently it was compiled in the Linux development version of FGFS, I do not know if it was compiled for the nightly version of Windows (the http://download.flightgear.org/builds/nightly/), I hope this is done as soon as possible.
This type of actuator converts a rotation with an assigned module (for example, 0-1.0-9 ... 0-359 and others) with a corresponding linear value following what is described in the definition of linear actuator on Wikipedia: https://en.wikipedia.org/wiki/Linear_actuator

What the linear actuator can do:

# Build JSBSim Geneva drive counters: https://en.wikipedia.org/wiki/Geneva_drive commonly used for mechanical display as counters and tuning of radio systems 50-80 years.
# Allowing the correct rotation of the dials of the gyros avoiding the ugly jump that typically with such instruments in FGFS.
# Building relay stroke counter in a very simple way.

For the first time in JSBSim the device has a Set and Reset input, this allows to obtain a simple input value storage device. If the Set input results with a value greater or equal than 0.5, the output value is processed according to the input value. If it is less than 0.5, the output value remains constant. The output value is set to zero if the reset input is greater or equal than 0.5

A "hysteresis" parameter has been defined that simulates a step-motor system. Useful for example to simulate clocks.

Having the program the memory of the output value and input, the code execution takes place only if the input value has been modified, this greatly reduces the execution load.

This is a video showing the features of the linear actuator:



The movie shows three possible JSBSim linear actuator applications:
1# Mechanical counter with Genoa type gear.
2# Stroke Counters.
3# Analog instruments Indicators (compass) to not jump to 360 ° when it reaches a complete rotation. In the movie you notice that the thin index (arrow), which is not controlled by the module, instead makes a jump of 360 ° when it reaches the North again (360 to 0 °)
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: JSBSim - Proposal for a linear actuator

Postby legoboyvdlp » Sun Jan 27, 2019 6:16 pm

https://sourceforge.net/p/flightgear/fl ... log/?path=

JSBSim in FlightGear has not yet been updated with the commits from GitHub: it is usually merged every few months by the JSBSim team.
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: JSBSim - Proposal for a linear actuator

Postby abassign » Sun Jan 27, 2019 10:43 pm

legoboyvdlp wrote in Sun Jan 27, 2019 6:16 pm:https://sourceforge.net/p/flightgear/flightgear/ci/f05c0297c078d4184000b1454a0ddc3d1a2ed71c/log/?path=

JSBSim in FlightGear has not yet been updated with the commits from GitHub: it is usually merged every few months by the JSBSim team.


Thanks for the report, I hope soon that the update is done so that we can test in FGFS.
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: JSBSim - Proposal for a linear actuator

Postby abassign » Tue Feb 12, 2019 11:25 am

The linear actuator has been added to the "next" version of FGFS, so it can be used for testing. I therefore invite those who are inept to its characteristics to try it and give their comments. You can modify it and / or add new features to make it closer to your needs

https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/FDM/JSBSim/models/flight_control/

Image
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10


Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 0 guests