Serialization Configuration File Format
Configurations are saved in an XML format. The advantages of this format are the following:
|
- Parser robustness – This makes it less likely that an application will crash due to a bug in the configuration file parser.
- Transformations – A configuration file that was generated with an older version of the MPX must be transformed to be compatible with newer versions of the MPX. There are several well-established methods for transforming XML.
- Availability of 3rd party editors – There are a variety of 3rd party editors available for XML. Some are simple text editors enhanced with syntax highlighting and line folding. Others will display XML in a tree and not allow the user to construct an invalid document. Ideally, Danher Motion will provide a specialized XML editor for configuration files. Until such an editor can be developed, a 3rd party editor can be used.
- Validation – XML can be checked for validity based on a schema file. A schema file for MPX configuration can be generated automatically.
|
XML Terminology
The table below illustrates some basic XML terms:
|
XML |
Description |
<Foo attr="0"> |
Start-tag for an element named Foo. A single attribute attr is defined with the value of 0. |
<SubFoo/> |
Empty-element-tag for an element named SubFoo. The slash at the end of the tag indicates that this element is completely defined within this tag. There is no end-tag. |
</Foo> |
End-tag for the element named Foo. |
|
Element – An element is delimited by a start-tag and an end-tag, or in the case of an empty element, an empty-element-tag. Sub-elements can be defined between start and end tags. In the example above, SubFoo is a sub-element of the Foo element.
Attribute – Attributes are contained in the element tag. In the example above, attr is an attribute of the Foo element.
MPX Configuration Elements
An MPX configuration file consists of four types of element:
Top-level Element
An MPX configuration file has a single top-level element named MPXConfig. The MPXConfig element contains a single Object Element, which defines the configuration for an MPX object.
Below is an example of a file that contains the configuration for an SqNode object:
|
<MPXConfig>
<SqNode>
… SqNode Properties …
</SqNode>
</MPXConfig>
|
Object Element
An Object Element defines the configuration for an MPX object, such as an Axis, Motion or Controller. Object elements contain Property Elements. An object element can also contain lists of sub-objects.
Below is an example of a Controller object element that contains a list of Axis sub-elements and the AxisCount Property Element.
|
<Controller children="true">
<Axis>
<_listElem_ index="0">
… Properties of Axis 0 …
</_listElem_>
<_listElem_ index="1">
… Properties of Axis 1 …
</_listElem_>
</Axis>
<AxisCount value="0" />
</Controller>
|
Note the use of a _listElem_ element above. Each _listElem_ element contains the configuration for a single sub-object in a list of sub-objects. More will be mentioned on this type of element below.
Also note that the top-level object element (Controller, in this example) has a children attribute. This attribute will be set to true if the file contains sub-objects.
List Element
A List element is denoted by the name _listElem_. It has an index attribute that defines the position of the element in the list. The index may be an unsigned integer or an enumeration value. Below is an example of both types of index:
|
<SqNode>
<AlarmMask>
<_listElem_ index="0" value="false" />
<_listElem_ index="1" value="true" />
…
</AlarmMask>
<EventEnable>
<_listElem_ index=" SqNodeIoAbort " value="true" />
<_listElem_ index=" SqNodeDisable " value="false" />
…
</EventEnable>
</SqNode>
|
In the example above, the AlarmMask element has index values that are unsigned integers and the EventEnable element has index values of type EventType, which is an enumeration defined in the MPX.
A list element may also have a value attribute, which defines the value of a property in a list. If the list element represents a sub-object, then there will be no value attribute.
Property Element
A property element defines the value of an object property. The value is saved in the value attribute. Below are examples of properties of an axis object:
|
<Axis>
<MotorType value="Stepper" />
<GeneralIoConfig>
<_listElem_ index="0" value="Input" />
<_listElem_ index="1" value="Output" />
</GeneralIoConfig>
</Axis>
|
Note that the GeneralIoConfig element contains a list of property elements.
Below is an example of a partial configuration file:
|
<?xml version="1.0" ?>
<MPXConfig xmlns="mpxConfig">
<Controller children="true">
<Axis>
<_listElem_ index="0">
<AmpDisableAction value="CmdEqAct" />
<DemandOffset>
<_listElem_ index="Primary" value="2.2" />
</DemandOffset>
<FilterCoeff>
<_listElem_ index="PidKi" value="2.7" />
</FilterCoeff>
<UserLimit>
<_listElem_ index="0">
<Action value="Abort" />
<ConditionActiveHigh>
<_listElem_ index="0" value="false" />
</ConditionActiveHigh>
</_listElem_>
</UserLimit>
</_listElem_>
</Axis>
<AxisCount value="0" />
<CaptureCount value="0" />
<FilterCount value="0" />
<Motion>
<_listElem_ index="0">
<Axes>
<_listElem_ index="0" value="0" />
</Axes>
<DefaultAccel value="0.05" />
</_listElem_>
</Motion>
<MotionCount value="0" />
<MotorCount value="0" />
<SampleRate value="2.9" />
<SynqNet>
<_listElem_ index="0">
<EventEnable>
<_listElem_ index="AmpFault" value="false" />
</EventEnable>
<RecoveryMode value="SingleShot" />
<Node>
<_listElem_ index="0">
<AlarmIoAbort value="false" />
<AlarmMask>
<_listElem_ index="0" value="false" />
</AlarmMask>
<Segment>
<_listElem_ index="0">
<DigitalOutWait value="false" />
</_listElem_>
</Segment>
</_listElem_>
</Node>
</_listElem_>
</SynqNet>
</Controller>
</MPXConfig>
|
|