Tags and keywords
SysPhS-1.1: 'In a SysML block with constraint properties, the constraints correspond to the same equations in Modelica ... except the SysML parameters in those equations correspond in Modelica to the properties they are bound to in SysML (and flow properties in SysML property paths leading to PhSVariables on conserved quantity kinds are omitted in Modelica, see Subclause 10.7.8).'
SysPhS-1.1: 'The following Modelica code corresponds to Figure 26. It has five equations from the SysML constraint block. SysML parameter names are replaced in the Modelica equations according the bindings in Figure 14 [ERROR]: f1 is replaced by p1.f, v1 is replaced by p1.lV, x is replaced by lengthchg, k is replaced by springcst, v is replaced by velocitydiff, f is replaced by forcethru, v2 is replaced by p2.v, and f2 is replaced by p2.f.'
model Spring
Flange p1;
Flange p2;
Real lengthchg;
parameter Real springcst = “10”;
Real velocitydiff
Real forcethru
equation
p1.f+p2.f=0
forcethru=p1.f;
velocitydiff=p1.lV-p2.lV;
velocitydiff=der(lengthchg);
forcediff=springcst*lengthchg;
end Spring;
The spec code contains a typo:
Export of blockSpring
to Modelica from the MagicDraw SysML Plugin or Magic Cyber-Systems Engineer ® (Cameo Systems Modeler®) gives:
model Spring
Spring _Spring;
model Spring
Flange p1;
Flange p2;
Length lengthchg;
parameter Stiffness springcst(start=10.0,fixed=true);
Velocity velocitydiff;
Force forcethru;
equation
p1.f+p2.f=0;
forcethru=p1.f;
velocitydiff=p2.lV-p1.lV;
velocitydiff=der(lengthchg);
forcethru=springcst*lengthchg;
end Spring;
connector Flange
flow Force f;
Velocity lV;
end Flange;
type Length=Real(unit="m");
type Stiffness=Real(unit="N/m");
type Velocity=Real(unit="m/s");
type Force=Real(unit="N");
end Spring;
Note the use of the explicit start
attribute along with the explicit attribute fixed=true
.
Unfortunately, the
Note how in the trail model version the custom ValueTypes Spring
model as shown is not quite well formed. Wolfram SystemModeler reports:
Validation of model WebelSysMLvsSysPhS.Spring
Warning: Parameter _Spring.springcst has no value, and is fixed during initialization (fixed = true), using available start value (start = 10.0) as default value.
Error: The following equations are redundant:
0.0 = 0.0
Corresponding variables with arbitrary value: _Spring.p1.lV
Validation of model Spring completed with 1 error.
Stiffness
and Length
explicitly extend Real
:
And on a very minor modelling matter: