Contents
Icon | Description |
<element> | A XML element of name 'element' |
attrName | A XML attribute of name 'attrName' |
namespace | A XML namespace of name 'namespace' |
type | A XML element or attribute type of name 'type' |
Elements which must be referable must have a name. Mostly this name is given by the attribute name. A valid name starts with a letter or a underscore. The following characters can be letters, underscores or digits. The content between '{
' and '}
' can be any Expression Evaluator and is substituted by the result of the evaluator (which must be a valid name; normal a integer number).
The following table shows examples for valid element names (on the left) and the substituted names (on the right), if there exist a scalar (integer) parameter of name n
with the value 2
:
Element Name | Substituted Element Name |
Object1 | Object1 |
myname_3 | myname_3 |
body{n+6} | body8 |
Obj_{n+4}_{if n==2; ret=3; else ret=6; end} | Obj_6_3 |
A scalar type can be of any unit defined in measurements. The unit is given by a optional
attribute of name unit.
The type name of a scalar of measure length is pv:lengthScalar and so on.
Where pv
is mapped to the namespace-uri http://www.mbsim-env.de/MBXMLUtils.
The content of a scalar type must be a Expression Evaluator. The following examples are valid, if there exist a scalar paremter a
and b
in the parameter file:
<myScalarElement unit="mm">4*sin(a)+b</myScalarElement>
<myScalarElement>[a,2]*[3;b]</myScalarElement>
There is also a special unit of name unknown
defined. This unit dose not take the optional unit
attribute, it takes an optional attribute of name convertUnit. The value of this attribute can be a
Expression Evaluator
which must contain a parameter of name value
. The given value is then converted by this expression.
A vector type can be of any unit defined in measurements. The unit is given by a optional
attribute of name unit.
The type name of a vector of measure length is pv:lengthVector and so on.
Where pv
is mapped to the namespace-uri http://www.mbsim-env.de/MBXMLUtils.
The content of a vector type can be one of the following:
- A Expression Evaluator. The following examples are valid, if there exist a scalar paremter
a
and b
in the parameter file:
<myVectorElement unit="mm">[1;b;a;7]</myVectorElement>
<myVectorElement>[a,2;5.6,7]*[3;b]</myVectorElement>
Using the corresponding evaluator command it is also possible to load the data from a external file (for octave):
<myMatrixElement>ret=load('mydata.dat')</myMatrixElement>
- A XML representation of a vector: The following shows a example of such a XML representation.
<myVectorElement>
<pv:ele>6.5</pv:ele>
<pv:ele>1.5</pv:ele>
<pv:ele>7.3</pv:ele>
</myVectorElement>
For the special unit of name unknown
see Scalar Type
A matrix type can be of any unit defined in measurements. The unit is given by a optional
attribute of name unit.
The type name of a matrix of measure length is pv:lengthMatrix and so on.
Where pv
is mapped to the namespace-uri http://www.mbsim-env.de/MBXMLUtils.
The content of a matrix type can be one of the following:
- A Expression Evaluator. The following examples are valid, if there exist a scalar paremter
a
and b
in the parameter file:
<myMatrixElement unit="mm">[1,b;a,7]</myMatrixElement>
<myMatrixElement>[a,2;5.6,7]*rand(2,2)</myMatrixElement>
Using the corresponding evaluator command it is also possible to load the data from a external file (for octave):
<myMatrixElement>ret=load('mydata.dat')</myMatrixElement>
- A XML representation of a matrix: The following shows a example of such a XML representation.
<myMatrixElement>
<pv:row>
<pv:ele>6.5</pv:ele>
<pv:ele>1.5</pv:ele>
</pv:row>
<pv:row>
<pv:ele>6.5</pv:ele>
<pv:ele>1.5</pv:ele>
</pv:row>
</myMatrixElement>
For the special unit of name unknown
see Scalar Type
A example for a parameter file is given below:
<Parameter xmlns="http://www.mbsim-env.de/MBXMLUtils">
<scalarParameter name="N">9</scalarParameter>
<vectorParameter name="a">[1;2;3]*N</scalarParameter>
<scalarParameter name="lO">0.2*N</scalarParameter>
<matrixParameter name="A">[1,2;3,4]</scalarParameter>
</Parameter>
The parameter names must be unique. The parameters are added from top to bottom. Parameters may depend on parameters already added. The parameter values can be given as Expression Evaluator. Hence a parameter below another parameter may reference this value.
Different expression evaluators can be used. Currently implemented is only octave as evaluator. Hence this section covers only the octave expression evaluator.
A octave expression/program can be arbitary octave code. So it can be a single statement or a statement list.
If it is a single statement, then the value for the XML element is just the value of the evaluated octave statement. The type of this value must match the type of the XML element (scalar, vector or matrix). The following examples shows valid examples for a single octave statement (one per line), if a scalar parameter of name a
and b
exist:
4
b
3+a*8
[4;a]*[6,b]
If the text is a statement list, then the value for the XML element is the value of the variable 'ret' which must be set by the statement list. The type of the variable 'ret' must match the type of the XML element (scalar, vector or matrix). The following examples shows valid examples for a octave statement list (one per line), if a scalar parameter of name a
and b
exist:
if 1==a; ret=4; else ret=8; end
myvar=[1;a];myvar2=myvar*2;ret=myvar2*b;dummy=3
A octave expression can also expand over more then one line like below. Note that the characters '&', '<' and '>' are not allowed in XML. So you have to quote them with '&', '<' and '>', or you must enclose the octave code in a CDATA section:
<![CDATA[
function r=myfunc(a)
r=2*a;
end
if 1 & 2, x=9; else x=8; end
ret=myfunc(m1/2);
]]>
The following m-functions extent the octave functionality being useful for several applications:
-
T=rotateAboutX(φ)
- Returns the transformation matrix by angle φ around the x-axis:
| 1 | 0 | 0 | |
| 0 | cos(φ) | -sin(φ) | |
| 0 | sin(φ) | cos(φ) | |
-
T=rotateAboutY(φ)
- Returns the transformation matrix by angle φ around the y-axis:
| cos(φ) | 0 | sin(φ) | |
| 0 | 1 | 0 | |
| -sin(φ) | 0 | cos(φ) | |
-
T=rotateAboutZ(φ)
- Returns the transformation matrix by angle φ around the z-axis:
| cos(φ) | -sin(φ) | 0 | |
| sin(φ) | cos(φ) | 0 | |
| 0 | 0 | 1 | |
-
T=cardan(α,β,γ)
- Returns the cardan transformation matrix:
| cos(β)cos(γ) | -cos(β)sin(γ) | sin(β) | |
| cos(α)sin(γ)+sin(α)sin(β)cos(γ) | cos(α)cos(γ)-sin(α)sin(β)sin(γ) | -sin(α)cos(β) | |
| sin(α)sin(γ)-cos(α)sin(β)cos(γ) | cos(α)sin(β)sin(γ)+sin(α)cos(γ) | cos(α)cos(β) | |
-
T=euler(Φ,θ,φ)
- Returns the Euler transformation matrix:
| cos(φ)cos(Φ)-sin(φ)cos(θ)sin(Φ) | -cos(φ)cos(θ)sin(Φ)-sin(φ)cos(Φ) | sin(θ)sin(Φ) | |
| cos(φ)sin(Φ)+sin(φ)cos(θ)cos(Φ) | cos(φ)cos(θ)cos(Φ)-sin(φ)sin(Φ) | -sin(θ)cos(Φ) | |
| sin(φ)sin(θ) | cos(φ)sin(θ) | cos(θ) | |
-
r=rad2deg(a)
- Returns r=a*180/pi
-
r=deg2rad(a)
- Returns r=a*pi/180
Using the <pv:Embed> element, where the prefix pv
is mapped to the namespace-uri http://www.mbsim-env.de/MBXMLUtils it is possible to embed a XML element multiple times. The full valid example syntax for this element is:
<pv:Embed href="file.xml" count="2+a" counterName="n" onlyif="n!=2"/>
or
<pv:Embed count="2+a" counterName="n" onlyif="n!=2">
<any_element_with_childs/>
</pv:Embed>
This will substitute the <pv:Embed> element in the current context 2+a
times with the element defined in the file file.xml
or with <any_element_with_childs>. The insert elements have access to the global parameters and to a parameter named n
which counts from 1
to 2+a
for each insert element. The new element is only insert if the octave expression defined by the attribute onlyif evaluates to 1
(true
). If the attribute onlyif is not given it is allways 1
(true
).
The attributes count and counterName must be given both or none of them. If none are given, then count
is 1
and counterName is not used.
The first child element of <pv:Embed> can be the element <pv:localParameter> which has one child element <p:parameter> OR a attribute named href. In this case the global parameters are expanded by the parameters given by the element <p:parameter> or in the file given by href
. If a parameter already exist then the parameter is overwritten.
<pv:Embed count="2+a" counterName="n" onlyif="n!=2">
<p:Parameter>
<p:scalarParameter name="h1">0.5</p:scalarParameter>
<p:scalarParameter name="h2">h1</p:scalarParameter>
</p:Parameter>
<any_element_with_childs/>
</pv:Embed>
The following subsections show all defined measurements.
The column "Unit Name" in the tables is the name of the unit and the column
"Conversion to SI Unit" is a expression which converts a value of this unit to the SI unit.
The highlighted row shows the SI unit of this measurement which always has a conversion of "value".
Unit Name | Conversion to SI Unit |
m/s^2 | value |
Unit Name | Conversion to SI Unit |
mol | value |
Unit Name | Conversion to SI Unit |
rad | value |
degree | value/360*2*3.141592653589793238462643383279502884 |
Unit Name | Conversion to SI Unit |
mum^2 | value*1e-6**2 |
mm^2 | value*1e-3**2 |
cm^2 | value*1e-2**2 |
dm^2 | value*1e-1**2 |
m^2 | value |
ar^2 | value*1e1**2 |
ha | value*1e2**2 |
km^2 | value*1e3**2 |
Unit Name | Conversion to SI Unit |
N/m^2 | value |
N/mm^2 | value*1/1e-3**2 |
Unit Name | Conversion to SI Unit |
A | value |
Unit Name | Conversion to SI Unit |
N*s/m | value |
Unit Name | Conversion to SI Unit |
kg/m^3 | value |
g/cm^3 | value*1e-3/1e-2**3 |
t/m^3 | value*1e3/1**3 |
Unit Name | Conversion to SI Unit |
mPa*s | value*1e-3*1 |
Pa*s | value |
Unit Name | Conversion to SI Unit |
mm^3/s | value*1e-3**3/1 |
m^3/s | value |
l/s | value*1e-1**3/1 |
l/min | value*1e-1**3/60 |
Unit Name | Conversion to SI Unit |
mN | value*1e-3 |
N | value |
kN | value*1e3 |
Unit Name | Conversion to SI Unit |
cd | value |
Unit Name | Conversion to SI Unit |
kg*m^2 | value |
kg*mm^2 | value*1*1e-3**2 |
g*mm^2 | value*1e-3*1e-3**2 |
Unit Name | Conversion to SI Unit |
m^2/s | value |
mm^2/s | value*1e-3**2/1 |
Unit Name | Conversion to SI Unit |
mum | value*1e-6 |
mm | value*1e-3 |
cm | value*1e-2 |
dm | value*1e-1 |
m | value |
km | value*1e3 |
Unit Name | Conversion to SI Unit |
mg | value*1e-6 |
g | value*1e-3 |
kg | value |
t | value*1e3 |
Unit Name | Conversion to SI Unit |
| value |
- | value |
% | value/100 |
Unit Name | Conversion to SI Unit |
mPa | value*1e-3 |
Pa | value |
mbar | value*1e2 |
bar | value*1e5 |
Unit Name | Conversion to SI Unit |
N/m | value |
N/mm | value*1/1e-3 |
Unit Name | Conversion to SI Unit |
K | value |
degC | value+273.16 |
degF | (value+459.67)*5/9 |
Unit Name | Conversion to SI Unit |
mus | value*1e-6 |
ms | value*1e-3 |
s | value |
sec | value |
min | value*60 |
h | value*3600 |
d | value*86400 |
Unit Name | Conversion to SI Unit |
N*cm | value*1e-2 |
N*m | value |
Unit Name | Conversion to SI Unit |
m/s | value |
km/h | value*1e3/3600 |
Unit Name | Conversion to SI Unit |
mum^3 | value*1e-6**3 |
mm^3 | value*1e-3**3 |
cm^3 | value*1e-2**3 |
dm^3 | value*1e-1**3 |
l | value*1e-1**3 |
m^3 | value |
km^3 | value*1e3**3 |
Impressum /
Disclaimer /
Datenschutz
Generated on Tue Jun 21 2016 04:47:42 for MBXMLUtils by MBXMLUtils