Basic Rotational Components - TwoFlange

Gallery
Tutorial
Click on the image to view it full size

The Modelica By Example target code is:


within ModelicaByExample.Components.Rotational.Interfaces;
partial model TwoFlange
  "Definition of a partial rotational component with two flanges"

  Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
    annotation ...
  Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b
    annotation ...
protected
  Modelica.SIunits.Angle phi_rel;
equation
  phi_rel = flange_a.phi-flange_b.phi;
end TwoFlange;

Note we're targeting the DRY versions.

We could use the SysPhS «modelicaBlock» facility to target the Modelica library definitions of Flange_a and Flange_b, but then we couldn't use custom stereotype icons within the SysML model, and it's also harder to manage references to the variables within the SysML tool, so custom versions have been created for this trail version.

The complete exported Modelica code for block TwoFlange is:


model TwoFlange
  TwoFlange _TwoFlange;
  model TwoFlange
    Flange_a fa;
    Flange_b fb;
  protected
    Angle phi_rel;
  equation
    phi_rel=fa.phi-fb.phi;
  end TwoFlange;
  connector Flange_a
    extends Flange;
  end Flange_a;
  connector Flange_b
    extends Flange;
  end Flange_b;
  type Angle=Real(unit="rad");
  connector Flange
    flow Torque tau;
    Angle phi;
  end Flange;
  type Torque=Real(unit="N·m");
end TwoFlange;
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)