Connectors

class Connectors "Connectors"
    extends Modelica.Icons.Information;

    annotation (Documentation(info = "<html>\n\n<p>\nThe Modelica standard library defines the most important\n<strong>elementary connectors</strong> in various domains. If any possible,\na user should utilize these connectors in order that components\nfrom the Modelica Standard Library and from other libraries\ncan be combined without problems.\nThe following elementary connectors are defined\n(the meaning of potential, flow, and stream\nvariables is explained in section \"Connector Equations\" below):\n</p>\n\n<table border=1 cellspacing=0 cellpadding=1>\n<tr><td><strong>domain</strong></td>\n   <td><strong>potential<br>variables</strong></td>\n   <td><strong>flow<br>variables</strong></td>\n   <td><strong>stream<br>variables</strong></td>\n   <td><strong>connector definition</strong></td>\n   <td><strong>icons</strong></td></tr>\n\n<tr><td><strong>electrical<br>analog</strong></td>\n   <td>electrical potential</td>\n   <td>electrical current</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Electrical.Analog.Interfaces\">Modelica.Electrical.Analog.Interfaces</a>\n     <br>Pin, PositivePin, NegativePin</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/ElectricalPins.png\"></td></tr>\n\n<tr><td><strong>electrical<br>multi-phase</strong></td>\n   <td colspan=\"3\">vector of electrical pins</td>\n   <td><a href=\"modelica://Modelica.Electrical.MultiPhase.Interfaces\">Modelica.Electrical.MultiPhase.Interfaces</a>\n     <br>Plug, PositivePlug, NegativePlug</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/ElectricalPlugs.png\"></td></tr>\n\n<tr><td><strong>electrical<br>space phasor</strong></td>\n   <td>2 electrical potentials</td>\n   <td>2 electrical currents</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Electrical.Machines.Interfaces\">Modelica.Electrical.Machines.Interfaces</a>\n     <br>SpacePhasor</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/SpacePhasor.png\"></td></tr>\n\n<tr><td><strong>quasi<br>stationary<br>single phase</strong></td>\n   <td>complex electrical potential</td>\n   <td>complex electrical current</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces\">\n                                       Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces</a>\n     <br>Pin, PositivePin, NegativePin</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/QuasiStationarySinglePhasePins.png\"></td></tr>\n\n<tr><td><strong>quasi<br>stationary<br>multi-phase</strong></td>\n   <td colspan=\"3\">vector of quasi stationary single phase pins</td>\n   <td><a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Interfaces\">Modelica.Electrical.QuasiStationary.MultiPhase.Interfaces</a>\n     <br>Plug, PositivePlug, NegativePlug</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/QuasiStationaryMultiPhasePlugs.png\"></td></tr>\n\n<tr><td><strong>electrical<br>digital</strong></td>\n   <td>Integer (1..9)</td>\n   <td></td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Electrical.Digital.Interfaces\">Modelica.Electrical.Digital.Interfaces</a>\n     <br>DigitalSignal, DigitalInput, DigitalOutput</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/Digital.png\"></td></tr>\n\n<tr><td><strong>magnetic<br>flux tubes</strong></td>\n   <td>magnetic potential</td>\n   <td>magnetic flux</td>\n   <td></td>\n   <td>\n<a href=\"modelica://Modelica.Magnetic.FluxTubes.Interfaces\">Modelica.Magnetic.FluxTubes.Interfaces</a>\n     <br>MagneticPort, PositiveMagneticPort,<br>NegativeMagneticPort</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/MagneticPorts.png\"></td></tr>\n\n<tr><td><strong>magnetic<br>fundamental<br>wave</strong></td>\n   <td>complex magnetic potential</td>\n   <td>complex magnetic flux</td>\n   <td></td>\n   <td>\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.Interfaces\">Modelica.Magnetic.FundamentalWave.Interfaces</a>\n     <br>MagneticPort, PositiveMagneticPort,<br>NegativeMagneticPort</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/FundamentalWavePorts.png\"></td></tr>\n\n<tr><td><strong>translational</strong></td>\n   <td>distance</td>\n   <td>cut-force</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces\">Modelica.Mechanics.Translational.Interfaces</a>\n     <br>Flange_a, Flange_b</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/TranslationalFlanges.png\"></td></tr>\n\n<tr><td><strong>rotational</strong></td>\n   <td>angle</td>\n   <td>cut-torque</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces\">Modelica.Mechanics.Rotational.Interfaces</a>\n     <br>Flange_a, Flange_b</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/RotationalFlanges.png\"></td></tr>\n\n<tr><td><strong>3-dim.<br>mechanics</strong></td>\n   <td>position vector<br>\n    orientation object</td>\n   <td>cut-force vector<br>\n    cut-torque vector</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Mechanics.MultiBody.Interfaces\">Modelica.Mechanics.MultiBody.Interfaces</a>\n     <br>Frame, Frame_a, Frame_b, Frame_resolve</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/MultiBodyFrames.png\"></td></tr>\n\n<tr><td><strong>simple<br>fluid flow</strong></td>\n   <td>pressure<br>\n    specific enthalpy</td>\n   <td>mass flow rate<br>\n    enthalpy flow rate</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Thermal.FluidHeatFlow.Interfaces\">Modelica.Thermal.FluidHeatFlow.Interfaces</a>\n     <br>FlowPort, FlowPort_a, FlowPort_b</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/FluidHeatFlowPorts.png\"></td></tr>\n\n<tr><td><strong>thermo<br>fluid flow</strong></td>\n   <td>pressure</td>\n   <td>mass flow rate</td>\n   <td>specific enthalpy<br>mass fractions</td>\n   <td>\n<a href=\"modelica://Modelica.Fluid.Interfaces\">Modelica.Fluid.Interfaces</a>\n     <br>FluidPort, FluidPort_a, FluidPort_b</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/FluidPorts.png\"></td></tr>\n\n<tr><td><strong>heat<br>transfer</strong></td>\n   <td>temperature</td>\n   <td>heat flow rate</td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Thermal.HeatTransfer.Interfaces\">Modelica.Thermal.HeatTransfer.Interfaces</a>\n     <br>HeatPort, HeatPort_a, HeatPort_b</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/ThermalHeatPorts.png\"></td></tr>\n\n<tr><td><strong>blocks</strong></td>\n   <td>\n    Real variable<br>\n    Integer variable<br>\n    Boolean variable</td>\n   <td></td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.Blocks.Interfaces\">Modelica.Blocks.Interfaces</a>\n     <br>\n      RealSignal, RealInput, RealOutput<br>\n      IntegerSignal, IntegerInput, IntegerOutput<br>\n      BooleanSignal, BooleanInput, BooleanOutput</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/Signals.png\"></td></tr>\n\n<tr><td><strong>complex<br>blocks</strong></td>\n   <td>\n    Complex variable</td>\n   <td></td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.ComplexBlocks.Interfaces\">Modelica.ComplexBlocks.Interfaces</a>\n     <br>ComplexSignal, ComplexInput, ComplexOutput</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/ComplexSignals.png\"></td></tr>\n\n<tr><td><strong>state<br>machine</strong></td>\n   <td>Boolean variables<br>\n    (occupied, set,<br>\n     available, reset)</td>\n   <td></td>\n   <td></td>\n   <td><a href=\"modelica://Modelica.StateGraph.Interfaces\">Modelica.StateGraph.Interfaces</a>\n     <br>Step_in, Step_out, Transition_in, Transition_out</td>\n   <td><img src=\"modelica://Modelica/Resources/Images/UsersGuide/StateGraphPorts.png\"></td></tr>\n</table>\n\n<p>\nIn all domains, usually 2 connectors are defined. The variable declarations\nare <strong>identical</strong>, only the icons are different in order that it is easy\nto distinguish connectors of the same domain that are attached at the same\ncomponent.\n</p>\n\n<h4>Hierarchical Connectors </h4>\n<p>\nModelica supports also hierarchical connectors, in a similar way as hierarchical models.\nAs a result, it is, e.g., possible, to collect elementary connectors together.\nFor example, an electrical plug consisting of two electrical pins can be defined as:\n</p>\n\n<blockquote>\n<pre>\n<strong>connector</strong> Plug\n   <strong>import</strong> Modelica.Electrical.Analog.Interfaces;\n   Interfaces.PositivePin phase;\n   Interfaces.NegativePin ground;\n<strong>end</strong> Plug;\n</pre>\n</blockquote>\n\n<p>\nWith one connect(..) equation, either two plugs can be connected\n(and therefore implicitly also the phase and ground pins) or a\nPin connector can be directly connected to the phase or ground of\na Plug connector, such as \"connect(resistor.p, plug.phase)\".\n</p>\n\n<h4 id=\"ConnectorEquations\">Connector Equations</h4>\n\n<p>\nThe connector variables listed above have been basically determined\nwith the following strategy:\n</p>\n\n<ol>\n<li> State the relevant balance equations and boundary\n     conditions of a volume for the particular physical domain.</li>\n<li> Simplify the balance equations and boundary conditions\n     of (1) by taking the\n     limit of an infinitesimal small volume\n     (e.g., thermal domain:\n      temperatures are identical and heat flow rates\n      sum up to zero).\n</li>\n<li> Use the variables needed for the balance equations\n     and boundary conditions of (2)\n     in the connector and select appropriate Modelica\n     <strong>prefixes</strong>, so that these equations\n     are generated by the Modelica connection semantics.\n</li>\n</ol>\n\n<p>\nThe Modelica connection semantics is sketched at hand\nof an example: Three connectors c1, c2, c3 with the definition\n</p>\n\n<pre>\n<strong>connector</strong> Demo\n  Real        p;  // potential variable\n  <strong>flow</strong>   Real f;  // flow variable\n  <strong>stream</strong> Real s;  // stream variable\n<strong>end</strong> Demo;\n</pre>\n\n<p>\nare connected together with\n</p>\n\n<pre>\n   <strong>connect</strong>(c1,c2);\n   <strong>connect</strong>(c1,c3);\n</pre>\n\n<p>\nthen this leads to the following equations:\n</p>\n\n<pre>\n  // Potential variables are identical\n  c1.p = c2.p;\n  c1.p = c3.p;\n\n  // The sum of the flow variables is zero\n  0 = c1.f + c2.f + c3.f;\n\n  /* The sum of the product of flow variables and upstream stream variables is zero\n     (this implicit set of equations is explicitly solved when generating code;\n     the \"&lt;undefined&gt;\" parts are defined in such a way that\n     inStream(..) is continuous).\n  */\n  0 = c1.f*(<strong>if</strong> c1.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> c1.s) +\n      c2.f*(<strong>if</strong> c2.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> c2.s) +\n      c3.f*(<strong>if</strong> c3.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> c3.s);\n\n  <strong>inStream</strong>(c1.s) = <strong>if</strong> c1.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> &lt;undefined&gt;;\n  <strong>inStream</strong>(c2.s) = <strong>if</strong> c2.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> &lt;undefined&gt;;\n  <strong>inStream</strong>(c3.s) = <strong>if</strong> c3.f &gt; 0 <strong>then</strong> s_mix <strong>else</strong> &lt;undefined&gt;;\n</pre>\n\n</html>"));
end Connectors;