-
James Goppert authoredJames Goppert authored
JSBSimScript.xsd 18.24 KiB
<?xml version="1.0"?>
<!--<?xml-stylesheet type="text/xsl" href="XMLToDoc.xsl"?>-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation><xs:documentation>
This schema specifies the format that a JSBSim (www.jsbsim.org) script must take to be
valid. The JSBSim scripting language provides for specification of which aircraft
and initialization file will be used for a "batch" run, as well as how long it will run,
and at what time-step size it will be integrated at. Also, "Events" may be defined
that can direct the simulation to set parameter values when specific conditions
have been reached. The script author may also specify that some notifications
should take place when an event is reached.
</xs:documentation>
</xs:annotation>
<xs:element name="runscript">
<xs:annotation><xs:documentation>
The "runscript" element is the top-level containing XML element. It may have
a name attribute, that describes briefly what the script does.
</xs:documentation></xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="description" minOccurs="0" maxOccurs="1"/>
<xs:element ref="use"/>
<xs:element ref="run" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="run">
<xs:annotation><xs:documentation>
The "run" element has as its parent the "runscript" element. The run element contains
any and all "event" elements. Within the run element, the start and end time must be
specified, and the integration timestep size (the inverse of the integration frequency).
Note that the start time will almost always be 0.0, and so the end time merely specifies
the duration of the run.
</xs:documentation></xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="property" minOccurs="0" maxOccurs="unbounded">
<xs:annotation><xs:documentation>
A property element placed within the run element (in a sort of "global"
script space) allows variables to be created for scripting. The property can
be given an initial value, as well.
</xs:documentation></xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="value" type="xs:decimal" default="0.0" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element ref="event" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="start" type="xs:decimal" use="optional">
<xs:annotation><xs:documentation>
This attribute is not currently used. A script will always begin execution at
time 0.0.
</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute name="end" type="xs:decimal" use="required">
<xs:annotation><xs:documentation>
Since script execution always begins at time 0.0, the "end" attribute is essentially
the same thing as the duration of the script.
</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attribute name="dt" type="xs:decimal" use="required">
<xs:annotation><xs:documentation>
The dt attribute is simply the frame time, or the times step size.
</xs:documentation></xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="event">
<xs:annotation><xs:documentation>
The "event" element (if any) has as its parent the "run" element. There may be any
number of event elements defined - even none at all. An event element may feature a
name attribute, and/or a persistent attribute.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element ref="condition" minOccurs="0" maxOccurs="1"/>
<xs:element ref="set" maxOccurs="unbounded" minOccurs="0"/>
<xs:element ref="notify" minOccurs="1" maxOccurs="1"/>
<xs:element ref="delay" minOccurs="0" maxOccurs="1"/>
<xs:element name="description" type="xs:string"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="persistent" use="optional" default="false">
<xs:annotation><xs:documentation>
If an event is marked persistent, the event will be executed anytime the condition[s]
first evaluate to true after toggling from false. Otherwise, the event only executes
the first time the condition evaluates toggles to true.
</xs:documentation></xs:annotation>
<xs:simpleType><xs:restriction base="xs:string"><xs:pattern value="true|false"/></xs:restriction></xs:simpleType>
</xs:attribute>
<xs:attribute name="continuous" use="optional" default="false">
<xs:annotation><xs:documentation>
If an event is marked as "continuous", the "set" action will be executed at all times
while the conditions evaluate to true. This is not only relevant when a property is set
via the exponential approach method. If a function is used within the "set" element to
define the value that the event will assign, the use of the continuous attribute (set
to true) causes the function to be evaluated continuously while the condition evaluates
to true.
</xs:documentation></xs:annotation>
<xs:simpleType><xs:restriction base="xs:string"><xs:pattern value="true|false"/></xs:restriction></xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="condition">
<xs:annotation><xs:documentation>
The condition element has as its parent the "event" element. The condition element
specifies the test or tests that must evaluate to true if the event is to have its "set"
actions carried out. Conditions are specified in the form:
</xs:documentation>
<xs:documentation>
{property} {operation} {property|number}
</xs:documentation>
<xs:documentation>
where {property} is simply a property name, and {operation} is one of the comparison
operators (gt, ge, lt, le, eq, ne) in lower or upper case. For example:
</xs:documentation>
<xs:documentation>
sim-time-sec ge 5.0
</xs:documentation>
<xs:documentation>
Any number of conditional tests such as the one above may be listed.
</xs:documentation>
<xs:documentation>
Additionally, further groupings of conditional tests may be collected within a
test element.
</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="test" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="logic" default="AND">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="AND|OR"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="notify">
<xs:annotation><xs:documentation>
The "notify" element may appear by itself, or it may group together properties. The
notify element specifies that the program should print out a notification message when
the event is executed (when its conditions evaluate to true). If the notify element contains
properties, the values of those properties will also be printed when the event is triggered.
</xs:documentation></xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="property" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="delay" type="xs:double">
<xs:annotation><xs:documentation>
The delay element represents the number of seconds to delay in executing the set
actions for an event once the conditions have been met.
</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="property">
<xs:annotation><xs:documentation>
A "property" is a JSBSim simulation parameter that represents any of a number of
things, from engine throttle settings, to aircraft rotation rates, to the simulation time.
To see a list of properties that are available for an individual aircraft, one can provide
the "--catalog" option to the JSBSim standalone program.
</xs:documentation></xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="set">
<xs:annotation>
<xs:documentation>
The "set" element is the mechanism by which the JSBSim Scripting function carries
out actions, setting the value of a property or properties to the specified value, or
change in value, when the event conditions have been met. Once a condition has been
met, a value may be assigned to a property directory via a step change, via an
exponential approach, or via a ramp (when supplied with the time constant for the
latter two).
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all minOccurs="0">
<xs:element minOccurs="0" ref="function"/>
</xs:all>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="action" use="optional" default="FG_STEP">
<xs:annotation>
<xs:documentation>
The action specifies how the new value should be reached from the old value. The
choices are: step, ramp, exponential approach.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="FG_RAMP|FG_STEP|FG_EXP"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="value" type="xs:double" use="optional"/>
<xs:attribute name="tc" type="xs:double" use="optional"/>
<xs:attribute name="type" use="optional" default="FG_VALUE">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="FG_VALUE|FG_DELTA"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="test">
<xs:complexType mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="test"/>
</xs:sequence>
<xs:attribute name="logic" default="AND">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="AND|OR"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="description" type="xs:string">
<xs:annotation id="test">
<xs:documentation>Documents the runscript purpose.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="use">
<xs:complexType>
<xs:attribute name="aircraft" type="xs:string" use="required"/>
<xs:attribute name="initialize" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<!-- Functions -->
<xs:group name="func_group">
<xs:choice>
<xs:element ref="table" />
<xs:element ref="product" />
<xs:element ref="difference" />
<xs:element ref="sum" />
<xs:element ref="quotient" />
<xs:element ref="pow" />
<xs:element ref="abs" />
<xs:element ref="sin" />
<xs:element ref="cos" />
<xs:element ref="tan" />
<xs:element ref="asin" />
<xs:element ref="acos" />
<xs:element ref="atan" />
<xs:element ref="atan2" />
<xs:element ref="min" />
<xs:element ref="max" />
<xs:element ref="avg" />
<xs:element ref="fraction" />
<xs:element ref="integer" />
<xs:element ref="mod"/>
<xs:element name="random"/>
</xs:choice>
</xs:group>
<xs:element name="function">
<xs:complexType>
<xs:sequence>
<xs:element name="description" minOccurs="0">
<xs:annotation><xs:documentation>
A descriptiopn of the element.
</xs:documentation></xs:annotation>
</xs:element>
<xs:group ref="func_group" />
</xs:sequence>
<xs:attribute name="name" use="optional" />
</xs:complexType>
</xs:element>
<xs:element name="product">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="difference">
<xs:complexType>
<xs:choice maxOccurs="2">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="sum">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="quotient">
<xs:complexType>
<xs:choice maxOccurs="2">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="abs">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="pow">
<xs:complexType>
<xs:choice maxOccurs="2" minOccurs="2">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="sin">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="cos">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="tan">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="asin">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="acos">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="atan">
<xs:complexType>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="atan2">
<xs:complexType>
<xs:choice maxOccurs="2" minOccurs="2">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="min">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="max">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="avg">
<xs:complexType>
<xs:choice minOccurs="2" maxOccurs="unbounded">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="fraction">
<xs:complexType>
<xs:choice>
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="integer">
<xs:complexType>
<xs:choice>
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="value" type="xs:double" />
<xs:element name="mod">
<xs:complexType>
<xs:choice maxOccurs="2" minOccurs="2">
<xs:group ref="func_group" />
<xs:element ref="value" />
<xs:element ref="property" />
</xs:choice>
</xs:complexType>
</xs:element>
<xs:simpleType name="PositiveNumber">
<xs:restriction base="xs:double">
<xs:minInclusive value="0" />
</xs:restriction>
</xs:simpleType>
<xs:element name="table">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="independentVar" />
<xs:element ref="tableData" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" use="optional" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="independentVar">
<xs:complexType mixed="true">
<xs:attribute name="lookup" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="tableData">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="breakPoint" type="xs:double" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>