FMITest.Utilities

Utility models used by the component models

Information

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
FMITest.Utilities.Icons Icons Additional icons used in package FMITest
FMITest.Utilities.PinToI PinToI Adaptor for a pin with voltage as input and current as output
FMITest.Utilities.PinToV PinToV Adaptor for a pin with current as input and voltage as output
FMITest.Utilities.RotFlangeToPhi RotFlangeToPhi Adaptor for a Rotational flange with angle, speed, and acceleration as outputs
FMITest.Utilities.RotFlangeToTau RotFlangeToTau  
FMITest.Utilities.TransFlangeToS TransFlangeToS Adaptor for a Translational flange with position, speed, and acceleration as outputs
FMITest.Utilities.TransFlangeToF TransFlangeToF  
InquireInitializationEnd Modelica code to inquire when fmiCompletedInitialization has to be called in a Modelica model

FMITest.Utilities.PinToI FMITest.Utilities.PinToI

Adaptor for a pin with voltage as input and current as output

FMITest.Utilities.PinToI

Information

Extends from FMITest.Utilities.Icons.PartialElectricalAdaptorIcon (Basic graphical layout of an adaptor block from a physical to input/output connectors).

Connectors

TypeNameDescription
Pinpin 
input RealInputvPotential at the pin as provided from the outside [V]
output RealOutputiCurrent flowing in to the pin as provided to the outside [A]

Modelica definition

model PinToI "Adaptor for a pin with voltage as input and current as output" extends FMITest.Utilities.Icons.PartialElectricalAdaptorIcon; Modelica.Electrical.Analog.Interfaces.Pin pin; Modelica.Blocks.Interfaces.RealInput v(unit="V") "Potential at the pin as provided from the outside"; Modelica.Blocks.Interfaces.RealOutput i(unit="A") "Current flowing in to the pin as provided to the outside"; equation pin.v = v; i = -pin.i; end PinToI;

FMITest.Utilities.PinToV FMITest.Utilities.PinToV

Adaptor for a pin with current as input and voltage as output

FMITest.Utilities.PinToV

Information

Extends from FMITest.Utilities.Icons.PartialElectricalAdaptorIcon (Basic graphical layout of an adaptor block from a physical to input/output connectors).

Connectors

TypeNameDescription
NegativePinpin 
input RealInputiCurrent flowing in to the pin as provided from the outside [A]
output RealOutputvPotential at the pin as provided to the outside [V]

Modelica definition

model PinToV "Adaptor for a pin with current as input and voltage as output" extends FMITest.Utilities.Icons.PartialElectricalAdaptorIcon; Modelica.Electrical.Analog.Interfaces.NegativePin pin; Modelica.Blocks.Interfaces.RealInput i(unit="A") "Current flowing in to the pin as provided from the outside"; Modelica.Blocks.Interfaces.RealOutput v(unit="V") "Potential at the pin as provided to the outside"; equation pin.i = i; v = pin.v; end PinToV;

FMITest.Utilities.RotFlangeToPhi FMITest.Utilities.RotFlangeToPhi

Adaptor for a Rotational flange with angle, speed, and acceleration as outputs

FMITest.Utilities.RotFlangeToPhi

Information

Extends from FMITest.Utilities.Icons.PartialMechanicalAdaptorIcon.

Parameters

TypeNameDefaultDescription
Booleanenable_atrueEnable the output connector a

Connectors

TypeNameDescription
Flange_aflange 
output RealOutputphiFlange moves with angle phi due to torque tau [rad]
output RealOutputwFlange moves with speed w due to torque tau [rad/s]
output RealOutputaFlange moves with angular acceleration a due to torque tau [rad/s2]
input RealInputtauTorque to drive the flange [N.m]

Modelica definition

model RotFlangeToPhi "Adaptor for a Rotational flange with angle, speed, and acceleration as outputs" extends FMITest.Utilities.Icons.PartialMechanicalAdaptorIcon; parameter Boolean enable_a=true "Enable the output connector a"; Modelica.Mechanics.Rotational.Interfaces.Flange_a flange; Modelica.Blocks.Interfaces.RealOutput phi(unit="rad") "Flange moves with angle phi due to torque tau"; Modelica.Blocks.Interfaces.RealOutput w(unit="rad/s") "Flange moves with speed w due to torque tau"; Modelica.Blocks.Interfaces.RealOutput a(unit="rad/s2") if enable_a "Flange moves with angular acceleration a due to torque tau"; Modelica.Blocks.Interfaces.RealInput tau(unit="N.m") "Torque to drive the flange"; protected Modelica.Blocks.Interfaces.RealInput a_internal "Needed to connect to conditional connector"; equation connect(a, a_internal); if not enable_a then a_internal = 0.0; end if; phi = flange.phi; w = der(phi); if enable_a then a_internal = der(w); end if; flange.tau = tau; end RotFlangeToPhi;

FMITest.Utilities.RotFlangeToTau FMITest.Utilities.RotFlangeToTau


FMITest.Utilities.RotFlangeToTau

Information

Extends from Icons.PartialMechanicalAdaptorIcon.

Parameters

TypeNameDefaultDescription
Booleanenable_atrueEnable the output connector a

Connectors

TypeNameDescription
Flange_bflange 
input RealInputphiAngle to drive the flange [rad]
input RealInputwSpeed to drive the flange [rad/s]
input RealInputaAngular acceleration to drive the flange [rad/s2]
output RealOutputtauTorque needed to drive the flange according to phi, w, a [N.m]

Modelica definition

model RotFlangeToTau extends Icons.PartialMechanicalAdaptorIcon; parameter Boolean enable_a=true "Enable the output connector a"; Modelica.Mechanics.Rotational.Interfaces.Flange_b flange; Modelica.Blocks.Interfaces.RealInput phi(unit="rad") "Angle to drive the flange"; Modelica.Blocks.Interfaces.RealInput w(unit="rad/s") "Speed to drive the flange"; Modelica.Blocks.Interfaces.RealInput a(unit="rad/s2") if enable_a "Angular acceleration to drive the flange"; Modelica.Blocks.Interfaces.RealOutput tau(unit="N.m") "Torque needed to drive the flange according to phi, w, a"; Modelica.Mechanics.Rotational.Sources.Move move; Modelica.Blocks.Routing.Multiplex3 multiplex3; Modelica.Mechanics.Rotational.Sensors.TorqueSensor torqueSensor; Modelica.Blocks.Sources.Constant const(final k=0) if not enable_a; equation connect(multiplex3.y, move.u); connect(phi, multiplex3.u1[1]); connect(w, multiplex3.u2[1]); connect(a, multiplex3.u3[1]); connect(flange, torqueSensor.flange_b); connect(move.flange, torqueSensor.flange_a); connect(torqueSensor.tau, tau); connect(const.y, multiplex3.u3[1]); end RotFlangeToTau;

FMITest.Utilities.TransFlangeToS FMITest.Utilities.TransFlangeToS

Adaptor for a Translational flange with position, speed, and acceleration as outputs

FMITest.Utilities.TransFlangeToS

Information

Extends from FMITest.Utilities.Icons.PartialMechanicalAdaptorIcon.

Parameters

TypeNameDefaultDescription
Booleanenable_atrueEnable the output connector a

Connectors

TypeNameDescription
Flange_aflange 
output RealOutputsFlange moves with position s due to force f [m]
output RealOutputvFlange moves with speed v due to force f [m/s]
output RealOutputaFlange moves with acceleration a due to force f [m/s2]
input RealInputfForce to drive the flange [N]

Modelica definition

model TransFlangeToS "Adaptor for a Translational flange with position, speed, and acceleration as outputs" extends FMITest.Utilities.Icons.PartialMechanicalAdaptorIcon; parameter Boolean enable_a=true "Enable the output connector a"; Modelica.Mechanics.Translational.Interfaces.Flange_a flange; Modelica.Blocks.Interfaces.RealOutput s(unit="m") "Flange moves with position s due to force f"; Modelica.Blocks.Interfaces.RealOutput v(unit="m/s") "Flange moves with speed v due to force f"; Modelica.Blocks.Interfaces.RealOutput a(unit="m/s2") if enable_a "Flange moves with acceleration a due to force f"; Modelica.Blocks.Interfaces.RealInput f(unit="N") "Force to drive the flange"; protected Modelica.Blocks.Interfaces.RealInput a_internal "Needed to connect to conditional connector"; equation connect(a, a_internal); if not enable_a then a_internal = 0.0; end if; s = flange.s; v = der(s); if enable_a then a_internal = der(v); end if; flange.f = f; end TransFlangeToS;

FMITest.Utilities.TransFlangeToF FMITest.Utilities.TransFlangeToF


FMITest.Utilities.TransFlangeToF

Information

Extends from Icons.PartialMechanicalAdaptorIcon.

Parameters

TypeNameDefaultDescription
Booleanenable_atrueEnable the output connector a

Connectors

TypeNameDescription
Flange_bflange 
input RealInputsPosition to drive the flange [m]
input RealInputvSpeed to drive the flange [m/s]
input RealInputaAcceleration to drive the flange [m/s2]
output RealOutputfForce needed to drive the flange according to s, v, a [N]

Modelica definition

model TransFlangeToF extends Icons.PartialMechanicalAdaptorIcon; parameter Boolean enable_a=true "Enable the output connector a"; Modelica.Mechanics.Translational.Interfaces.Flange_b flange; Modelica.Blocks.Interfaces.RealInput s(unit="m") "Position to drive the flange"; Modelica.Blocks.Interfaces.RealInput v(unit="m/s") "Speed to drive the flange"; Modelica.Blocks.Interfaces.RealInput a(unit="m/s2") if enable_a "Acceleration to drive the flange"; Modelica.Blocks.Interfaces.RealOutput f(unit="N") "Force needed to drive the flange according to s, v, a"; Modelica.Mechanics.Translational.Sources.Move move; Modelica.Blocks.Routing.Multiplex3 multiplex3; Modelica.Mechanics.Translational.Sensors.ForceSensor forceSensor; Modelica.Blocks.Sources.Constant const(final k=0) if not enable_a; equation connect(multiplex3.y, move.u); connect(s, multiplex3.u1[1]); connect(v, multiplex3.u2[1]); connect(a, multiplex3.u3[1]); connect(flange, forceSensor.flange_b); connect(move.flange, forceSensor.flange_a); connect(forceSensor.f, f); connect(const.y, multiplex3.u3[1]); end TransFlangeToF;

FMITest.Utilities.InquireInitializationEnd

Modelica code to inquire when fmiCompletedInitialization has to be called in a Modelica model

FMITest.Utilities.InquireInitializationEnd

Modelica definition

model InquireInitializationEnd "Modelica code to inquire when fmiCompletedInitialization has to be called in a Modelica model" Real x(start=1); Boolean first(start=true, fixed=true); Boolean first2; Modelica.Mechanics.Rotational.Examples.Friction friction; initial equation 0.5 = Modelica.Math.sin(x)^2 + sqrt(x); first2 = true; equation der(x) = -x; when not initial() then // Call fmiCompletedInitialization here first = false; first2 = false; end when; LogVariable(first); LogVariable(first2); end InquireInitializationEnd;

Automatically generated Fri Apr 25 16:23:31 2014.