Tags and keywords
SysPhS-1.1: 'Figure 25 shows an example [USAGE OF A] constraint block for a signal flow application, using ports like those defined in Figure 22, Subclause 10.7.3, except in a system containing a spring attached to another object. The block SpringMassSys has a SysML constraint property smsc typed by SMSConstraint. The constraint block has six parameters, each bound to a property reachable from the spring mass system:'
SysPhS-1.1: 'The following Modelica code corresponds to Figure 25. It has three equations from the constraint block. SysML parameter names are replaced in the Modelica equations according to the bindings in Figure 13 [ERROR]: f is replaced by u, pos is replaced by y, x is replaced by position, k is replaced by springcst, v is replaced by velocity, m is replaced by mass.'
There are some errors in the spec's sample Modelica code:
model Spring
input Real u;
output Real y;
Real position;
parameter Real springcst = 1;
Real velocity;
parameter Real mass = 10;
equations
der(velocity)=(u-springcst*position)/m;
der(position)=velocity;
y=position;
end Spring;
rSig
not rsig
:
Also, the model as given in the spec not very useful, if you run it you just get a flat line for the position
, it would be better to at least kick start the spring with something like:
Real position(start=5);
Note also this suggestion (which corresponds with how the MagicDraw SysML Plugin and Magic Cyber-Systems Engineer® (Cameo Systems Modeler®) export it):
Note that the Parametric diagram named 'SpringMassSys' is owned by a context block SpringMassSys
. Export of block SpringMassSys
to Modelica from the MagicDraw SysML Plugin or Magic Cyber-Systems Engineer ® (Cameo Systems Modeler®) gives:
model SpringMassSys
Modelica.Blocks.Interfaces.RealInput u;
Modelica.Blocks.Interfaces.RealOutput y;
Real position;
Real velocity;
parameter Real springcst(start=1.0,fixed=true);
parameter Real mass(start=10.0,fixed=true);
equation
der(velocity)=(u-springcst*position)/mass;
der(position)=velocity;
y=position;
end SpringMassSys;
Note the use of the explicit start
attribute along with the explicit attribute fixed=true
.
And on a minor modelling matter:
In the MagicDraw SysML Plugin and Magic Cyber-Systems Engineer® (Cameo Systems Modeler®) implementation of the SysPhS library the FlowProperty rSig
has AggregationKind 'none':
rSig
as AggregationKind 'composite'.