Install
openclaw skills install @container32/yasim-xmlProvide a detailed specification for writing YASim XML files.
openclaw skills install @container32/yasim-xmlYASim is one of two flight dynamics models commonly used in FlightGear, alongside JSBSim. It uses the geometry of the aircraft to generate the base flight characteristics. While this suggests a 'realistic' or out-of-the-box approach, it is a only rough approximation that will require much tweaking before you get a result that approaches realism. If you have solid flight data for your aircraft such as wind-tunnel data or you are looking to eventually generate a hyper-realistic simulation, JSBSim is probably a better approach. If you lack such data but know the geometry of the aircraft and have access to the same flight characteristics and limits as a real pilot would, then YASim can provide a solution that is more than sufficient for most simulation needs.
All positions specified are in metres (which is weird, since all other units in the file are English). The X axis points forward, Y is left, and Z is up. Take your right hand, and hold it like a gun. Your first and second fingers are the X and Y axes, and your upwards-pointing thumb is the Z. This is slightly different from the coordinate system used by JSBSim. Sorry. The origin can be placed anywhere, so long as you are consistent. I use the nose of the aircraft.
(In the JSBSim coordinate system, X and Z are the same as in YASim, but Y points to the right instead of left.)
The top-level element for the file. It contains the following attributes:
Available versions are:
YASIM_VERSION_ORIGINAL explicitly use the old buggy calculations (same as no version attribute at all)YASIM_VERSION_32 enable bugfixes up to version 3.22017.2 enable bugfixes up to version 2017.22018.1 use this version if your aircraft makes use of new features in YASim 2018.1.YASIM_VERSION_CURRENT use latest version compiled into the users FlightGear. (recommended)The approach parameters for the aircraft. The solver will generate an aircraft that matches these settings (by adjusting the parameters of the surface like drag and lift). It is extremely important to give parameters which could be really achieved by defined aircraft geometry, otherwise, it gives an unstable or not flyable result. The element can (and should) contain <control> elements indicating pilot input settings, such as flaps and throttle, for the approach.
The cruise speed and altitude for the solver to match. As above, this should contain <control> elements indicating aircraft configuration. Especially, make sure the engines are generating enough thrust at cruise!
The location of the cockpit (pilot eyepoint).
This defines a tubelike structure. It will be given an even mass and aerodynamic force distribution by the solver. You can have as many as you like, in any orientation you please.
This defines the main wing of the aircraft. You can have only one (but see below about using vstab objects for extra lifting surfaces). The wing should have a <stall> subelement to indicate stall behavior, control surface subelements (flap0, flap1, spoiler, slat) to indicate what and where the control surfaces are, and <control> subelements to map user input properties to the control surfaces.
Wing section support:
Wing section support to define variable geometry (geometry parameters per section)
<wing>-element is allowed now.<wing> in the XML file. They will be overridden for subsequent <wing>-elements.These define the horizontal stabilizer of the aircraft. Internally, it is just a wing object and therefore works the same in XML. You are allowed only one hstab object; the solver needs to know which wing's incidence to play with to get the aircraft trimmed correctly.
A "vertical" stabilizer. Like hstab, this is just another wing, with a few special properties. The surface is not "mirrored" as are wing and hstab objects. If you define a left wing only, you'll only get a left wing. The default dihedral, if unspecified, is 90 degrees instead of zero. But all parameters are equally settable, so there's no requirement that this object be "vertical" at all. You can use it for anything you like, such as extra wings for biplanes. Most importantly, these surfaces are not involved with the solver computation, so you can have none, or as many as you like.
A mirrored horizontal stabilizer. Exactly the same as wing, but not involved with the solver computation, so you can have none, or as many as you like.
A subelement of a wing (or hstab/vstab/mstab) that specifies the stall behavior.
These are subelements of wing/hstab/vstab objects, and specify the location and effectiveness of the control surfaces.
YASim has also possibility to simulate rotorcraft blades.
A rotor. Used for simulating helicopters. You can have one, two or even more.
If you specify a rotor, you do not need to specify a wing or hstab, the settings for approach and cruise will be ignored then. You have to specify the solver results manually. See below.
The rotor generates downwash acting on all stabs, surfaces and fuselages. For all fuselages in the rotor downwash you should specify idrag="0" to get realistic results.
name: The name of the rotor.
(some data is stored at /rotors/name/)
The rpm, cone angle, yaw angle and roll angle are stored for the complete rotor. For every blade the position angle, the flap angle and the incidence angle are stored. All angles are in degree, positive values always mean "up". This is not completely tested, but seem to work at least for rotors rotating counterclockwise.
A value stall gives the fraction of the rotor in stall (weighted by the fraction they have on lift and drag without stall). Use this for modifying the rotor-sound.
x,y,z: The position of the rotor center
nx,ny,nz: The normal of the rotor (pointing upwards, will be normalized by the computer)
fx,fy,fz: A Vector pointing forward, if not perpendicular to the normal it will be corrected by the computer
diameter: The diameter in meter [D]
numblades: The number of blades
weightperblade: The weight per blade in pounds
relbladecenter: The relative center of gravity of the blade. Maybe not 100% correct interpreted; use 0.5 for the start and change in small steps [b/R]
chord: The chord of the blade at its base, along the X axis (not normal to the leading edge, as it is sometimes defined). [c]
twist: The difference between the incidence angle at the blade root and the incidence angle at the wing tip. Typically, this is a negative number so that the rotor tips have a lower angle of attack.
taper: The taper fraction, expressed as the tip chord divided by the root chord. A taper of one is a bar blade, and zero would be a blade ending at a point. Defaults to one. [d/c]
rel-len-where-incidence-is-measured: If the blade is twisted, you need a point where to measure the incidence angle. Zero means at the base, 1 means at the tip. Typically it should be something near 0.7
rel-len-blade-start: Typically the blade is not mounted in the center of the rotor [a/R]
rpm: rounds per minute.
phi0: initial position of this rotor
ccw: determines if the rotor rotates clockwise (="0") or counterclockwise (="1"), (if you look on the top of the normal, so the bo105 has counterclockwise rotor). "true" and "false" are not any longer supported to increase my lifespan. ;
maxcollective: The maximum of the collective incidence in degree
mincollective: The minimum of the collective incidence in degree
maxcyclicele: The maximum of the cyclic incidence in degree for the elevator like function
mincyclicele: The minimum of the cyclic incidence in degree for the elevator like function
maxcyclicail: The maximum of the cyclic incidence in degree for the aileron like function
mincyclicail: The minimum of the cyclic incidence in degree for the aileron like function
airfoil-incidence-no-lift: non symmetric airfoils produces lift with no incidence. This is the incidence, where the airfoil is producing no lift. Zero for symmetrical airfoils (default)
incidence-stall-zero-speed:
incidence-stall-half-sonic-speed: the stall incidence is a function of the speed. I found some measured data, where this is linear over a wide range of speed. Of course the linear region ends at higher speeds than zero, but just extrapolate the linear behavior to zero.
lift-factor-stall: In stall airfoils produce less lift.
Without stall the c-lift of the profile is assumed to be sin(incidence-"airfoil-incidence-no-lift")*liftcoef;
And in stall:
sin(2*(incidence-"airfoil-incidence-no-lift"))*liftcoef*"lift-factor-stall";
Therefore this factor is not the quotient between lift with and without stall.
Use 0.28 if you have no idea.
drag-factor-stall: The drag of an airfoil in stall is larger than without stall.
Without stall c-drag is assumed to be abs(sin(incidence-"airfoil-incidence-no-lift"))*dragcoef1+dragcoef0);
With stall this is multiplied by drag-factor
stall-change-over: For incidence < "incidence-stall" there is no stall.
For incidence > ("incidence-stall" + "stall-change-over") there is stall.
In the range between these incidences it is interpolated linear.
pitch-a:
pitch-b: collective incidence angles,
If you start flightgear with --log-level=info, flightgear reports lift and needed power for these incidence angles
forceatpitch-a:
poweratpitch-b:
poweratpitch-0: old tokens, not supported any longer, the result are not exactly the expected lift and power values. Will be removed in one of the next updates directly. Use "real" coefficients instead (see below) and adjust the lift with rotor-correction-factor.
The airfoil of the rotor is described as follows: The way is to define the lift and drag coefficients directly. Without stall the c-lift of the profile is assumed to be sin(incidence-"airfoil-incidence-no-lift")*liftcoef; And in stall: sin(2*(incidence-"airfoil-incidence-no-lift"))*liftcoef*"lift-factor-stall";
Without stall c-drag is assumed to be abs(sin(incidence-"airfoil-incidence-no-lift"))*dragcoef1+dragcoef0); See above, how the coefficients are defined with stall.
The parameters:
To find the right values, see file <path to fgdata>/README.yasim.rotor.xls.
With this file you can generate graphs of the airfoil coefficients and adjust the parameters to match real airfoils.
factor = 1 + diameter/altitude * "ground-effect-constant"All rotors can have <control> subelements for the cyclic (CYCLICELE, CYCLICAIL) and collective (COLLECTIVE) input, and can have <control> subelements for tilting the whole rotor head around the y-axis (TILTPITCH), the x-axis (TILTROLL) and the z-axis (TILTYAW). ROTORBALANCE is a factor for the balance.
If you are using one or more rotors you have to define a rotorgear. It connects all the rotors and adds a simple engine. In the future it will be possible to add a YASim-engine.
The rotorgear needs a <control> subelement for the engine (ROTORGEARENGINEON) and can have further <control> subelements:
ROTORBRAKE: rotor brakeROTORRELTARGET: the target rpm of the engine relative to the "normal" value for the governor. Default is 1.ROTORENGINEMAXRELTORQUE: the maximum torque of the engine relative to the torque defined by the enginepower. Default is 1. By setting the rel-target to a large number you get control over the engine by this control. Alternatively you can use these two values for individual start-up sequences (see the s58)Here's the main rotor definition of the bo105:
<rotor name="main" x="-2.75" y="0.0" z="1.55" nx="0.05" ny="0" nz="1." fx="1" fy="0" fz="0" ccw="1"
maxcollective="15.8" mincollective="0.2"
mincyclicele="-4.7" maxcyclicele="10.5"
mincyclicail="-4.23" maxcyclicail="5.65"
diameter="9.98" numblades="4" weightperblade="75" relbladecenter="0.5"
dynamic="1" rpm="442" rellenflaphinge="0.18" delta3="0"
delta=".125"
pitch-a="10"
pitch-b="15"
flapmin="-15"
flapmax="15"
flap0="-5"
flap0factor="0"
notorque="0"
dragfactor="0.30"
translift-ve="20"
translift-maxfactor="1.5"
ground-effect-constant="0.1"
twist="-8.5"
taper="1"
chord="0.27"
number-of-segments="8"
number-of-parts="8"
rel-len-where-incidence-is-measured="0.7"
rel-len-blade-start="0.076"
airfoil-lift-coefficient="3.46"
airfoil-drag-coefficient0="0.0064"
airfoil-drag-coefficient1="0.20"
incidence-stall-zero-speed="15"
incidence-stall-half-sonic-speed="14.5"
lift-factor-stall="0.18"
stall-change-over="5.5"
drag-factor-stall="2.0"
cyclic-factor="0.8"
rotor-correction-factor="0.95"
downwashfactor="1.0"
>
<control-input axis="/controls/flight/aileron-trim" control="CYCLICAIL"/>
<control-input axis="/controls/flight/aileron" control="CYCLICAIL"
src0="-1.0" src1="1.0"
dst0="-1.0" dst1="1.0"/>
<control-input axis="/controls/flight/elevator-trim" control="CYCLICELE"/>
<control-input axis="/controls/flight/elevator" control="CYCLICELE"
src0="-1.0" src1="1.0"
dst0="-1.0" dst1="1.0"/>
<control-input axis="/controls/engines/engine[0]/throttle" control="COLLECTIVE"
src0="0.0" src1="1.0"
dst0="1.0" dst1="-1.0"/>
</rotor>
A very simple "thrust only" engine object. Useful for things like thrust vectoring nozzles. All it does is map its THROTTLE input axis to its output thrust rating. Does not consume fuel, etc...
Example:
<thruster x="0" y="0" z="0.03" vx="1" vy="0" vz="0" thrust="6.61">
<control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
</thruster>
A turbojet/fan engine. It accepts a <control> subelement to map a property to its throttle setting, and an <actionpt> subelement to place the action point of the thrust at a different position than the mass of the engine.
actionpt is specified, this will also be the point of application of thrust.A propeller. This element requires an engine subtag. Currently <piston-engine>, <turbine-engine>, and <electric-engine> are supported.
<actionpt> subelement.contra="1"), this indicates that the propeller is a contra-rotating pair. It will not contribute to the aircraft's net gyroscopic moment, nor will it produce asymmetric torque on the aircraft body. Asymmetric slipstream effects, when implemented, will also be zero when this is set.YASim assumes a fixed-pitch propeller by default. If your engine is using a constant-speed propeller, you'll also need to provide these attributes:
coarse-stop attribute limits how far the governor can go into trying to reach this RPM.fine-stop attribute limits how far the governor can go in trying to reach this RPM.A piston engine definition. This must be a subelement of an enclosing <propeller> tag.
eng-power is developed.<piston-engine eng-power="2" eng-rpm="3800" displacement="20">
<control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
<control-input axis="/controls/engines/engine[0]/starter" control="STARTER"/>
<control-input axis="/controls/engines/engine[0]/magnetos" control="MAGNETOS"/>
<control-input axis="/controls/engines/engine[0]/mixture" control="MIXTURE"/>
</piston-engine>
A simplified electric DC engine model. This definition must be a subelement of an enclosing <propeller> tag.
Example:
<propeller x="0.02" y="0" z="0.03"
mass="0.05"
moment="0.0006"
radius="0.203"
cruise-speed="26"
cruise-rpm="7000"
cruise-power="0.5"
cruise-alt="2000"
takeoff-power="0.70"
takeoff-rpm="9200"
contra="1">
<actionpt x="0" y="0" z="0.03"/>
<electric-engine Kv="750" voltage="15" Rm="0.02">
<control-input axis="/controls/engines/engine[0]/throttle" control="THROTTLE"/>
</electric-engine>
</propeller>
Defines a landing gear. Accepts <control> subelements to map properties to steering and braking. Can also be used to simulate floats. Although the coefficients are still called ..fric, it is calculated in fluids as a drag (proportional to the square of the speed). In fluids, gears are not considered to detect crashes (as on ground).
compression.stiction="1" ensures the gear isn't sliding unintentionally.spring-factor-not-planing. Above speed-planing, this factor is equal to 1. The idea is to use this for floats simulating the transition from swimming to planing. speed-planing defaults to 0, spring-factor-not-planing defaults to 1.on-water/on-solid tags, you can have more than one set of gears on an aircraft. If the solver (which automatically generates the spring constants) takes all gears into account, the result will be wrong. Set this tag to "1" for all gears that are not active on runways. Defaults to "0". You cannot exclude all gears in the solving process.Will define two properties associated with compression of landing gear:
<!-- front gear -->
<gear x="0.0" y="0.0" z="-0.205"
spring="0.9"
damp="0.8"
dfric="0.9"
sfric="1.1"
compression="0.051">
<control-input axis="/controls/flight/rudder" control="STEER" square="true" src0="-1.0" src1="1.0" dst0="-0.3" dst1="0.3"/>
<control-input axis="/controls/gear/brake-right" control="BRAKE" split="true"/>
<control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
</gear>
<!-- two rear gears -->
<gear x="-0.4" y="0.25" z="-0.205"
spring="0.9"
damp="0.8"
dfric="0.9"
sfric="1.1"
compression="0.051">
<control-input axis="/controls/gear/brake-right" control="BRAKE" split="true"/>
<control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
</gear>
<gear x="-0.4" y="-0.25" z="-0.205"
spring="0.9"
damp="0.8"
dfric="0.9"
sfric="1.1"
compression="0.051">
<control-input axis="/controls/gear/brake-left" control="BRAKE" split="true"/>
<control-input axis="/controls/gear/brake-parking" control="BRAKE" split="true"/>
</gear>
One can specify a torus-shaped tyre contact surface using these parameters:
The contact point will be the lowest point on a torus with radius tyre-radius wrapped around a wheel with radius wheel-radius centred on point (wheel-x, wheel-y, wheel-z) with orientation defined by wheel-axle. This contact point will depend on the aircraft's orientation relative to the ground.
If not specified, wheel-axle defaults to (0, 1, 0), giving a conventional vertical wheel in line with the aircraft. Other values may allow modelling of, for example, a Bf109's non-vertical undercarriage.
Default values of zero for wheel-radius and tyre-radius give a fixed contact point at (wheel-x, wheel-y, wheel-z).
If an aircraft also specifies an old-style contact point with (x, y, z), it will also work with older FlightGear versions.
Defines a catapult launchbar or strop.
up-angle and down-angle are the same as those defined for the launchbar and are not specified in the configuration.A fuel tank. Tanks in the aircraft are identified numerically (starting from zero), in the order they are defined in the file. If the left tank is first, tank[0] will be the left tank.
This is a mechanism for modifying the mass distribution of the aircraft. A ballast setting specifies that a particular amount of the empty weight of the aircraft must be placed at a given location. The remaining non-ballast weight will be distributed "intelligently" across the fuselage and wing objects. Note again: this does NOT change the empty weight of the aircraft.
<ballast x="-0.24" y="0.0" z="0.33" mass-kg="0.5"/>
This is an added weight, something not part of the empty weight of the aircraft, like passengers, cargo, or external stores. The actual value of the mass is not specified here; instead, a mapping to a property is used. This allows external code, such as the panel, to control the weight (loading a given cargo configuration from preference files, dropping bombs at runtime, etc.).
<weight> tag during solution. The default is to assume all weights are zero at the given performance numbers.<weight x="-0.06471" y="0.225" z="-0.2" mass-prop="/sim/weight[0]/weight-kg"/>
This element manages a mapping from fgfs properties (user input) to settable values on the aircraft's objects. Note: the value to be set MUST (!) be valid on the given object type (wings don't have throttle controls, etc.). This is not checked for by the parser, and will cause a runtime crash if misconfigured. Note that multiple axes may be set on the same value; they are summed before setting.
axis: The name of the double-valued fgfs property "axis" to use as input, such as /controls/flight/aileron.
control: Which control axis to set on the objects. Available values include:
THROTTLE — The throttle on a jet or propeller.
MIXTURE — The mixture on a propeller.
REHEAT — The afterburner on a jet.
PROP — The propeller advance.
BRAKE — The brake on a gear.
STEER — The steering angle on a gear.
INCIDENCE — The incidence angle of a wing.
FLAP0 / FLAP1 — Flap deflections of a wing.
SLAT — Slat extension of a wing.
SPOILER — Spoiler extension for a wing.
CYCLICAIL / CYCLICELE — Cyclic inputs (aileron/elevator) of a rotor.
COLLECTIVE — Collective input of a rotor.
ROTORENGINEON — If non-zero, the rotor is rotating.
WINCHRELSPEED — Relative winch speed.
...
invert: Negate the value of the property before setting on the object.
split: Applicable to wing control surfaces. Sets the normal value on the left wing, and a negated value on the right wing.
square: Squares the value before setting. Useful for controls like steering that need a wide range yet high sensitivity around the center.
src0/src1/dst0/dst1: Defines a linear mapping from source to output value. Input values in the range src0-src1 map linearly to dst0-dst1, with clamping for values outside the range.
Used to pass the value of a YASim control axis (after all mapping and summing is applied) back to the property tree.
"right" or "left").Defines maximum slew rates for controls (such as flaps or hydraulics) that cannot respond instantly to pilot input.
Used to define a specific setting for a control axis inside <cruise> or <approach> tags where property input is unavailable (e.g., informing the solver that approach performance assumes full flaps).
A hitch used for winch launches (gliders), aerotow (gliders and motorized aircraft), or external cargo (helicopters). Aerotowing over multiplayer is supported.
aerotow for multiplayer aerotow functionality. Properties are created under /sim/hitches/name."1" in the tow aircraft for multiplayer aerotowing. Leave at "0" in gliders.The tow cable used for aerotow or winch. Must be a subelement of an enclosing <hitch> tag.
The winch mechanism parameters. Must be a subelement of an enclosing <hitch> tag.
<hitch name="winch" x="0.0" y="0.0" z="0.0">
<tow length="50" weight-per-meter="0.0035" elastic-constant="40000" break-force="10000"/>
<!-- 3mm paracord -->
<winch max-tow-length="1000" min-tow-length="1" initial-tow-length="1000" max-winch-speed="20" power="2" max-force="80"/>
<control-input axis="/controls/winch/place" control="PLACEWINCH"/>
</hitch>
<hitch name="aerotow" x="0.0" y="0.0" z="0.0" force-is-calculated-by-other="0">
<tow length="60" weight-per-meter="0.0035" elastic-constant="9000" break-force="100" mp-auto-connect-period="0.0"/>
<winch max-tow-length="1000" min-tow-length="60" initial-tow-length="60"/>
<control-input axis="/controls/aerotow/find-aircraft" control="FINDAITOW"/>
</hitch>