SimpleDomains - Electrical

Gallery
Tutorial
Click on the image to view it full size

In this section we've set ourselves the goal of illustrating the concepts shown in Modelica By Example using, as far as possible, the existing elements from the SysPhSLibrary, rather than exactly reproducing the Modelica By Example code and naming.


The Modelica By Example target code is:


connector Electrical
     Modelica.SIunits.Voltage v;
     flow Modelica.SIunits.Current i;
end Electrical;
An equivalent Modelica connector ChargeFlowElement can be generated via SysPhS as part of a minimal electrical system:

model ElectricalContext
  ElectricalContext _ElectricalContext;
  model ElectricalContext
    ElectricalA a;
    ElectricalB b;
  equation
    connect(a.io,b.io);
  end ElectricalContext;
  model ElectricalA
    ChargeFlowElement io;
  end ElectricalA;
  model ElectricalB
    ChargeFlowElement io;
  end ElectricalB;

  connector ChargeFlowElement
    flow Current i;
    Voltage v;
  end ChargeFlowElement;

  type Current=Real(unit="A");
  type Voltage=Real(unit="V");
end ElectricalContext;

There is no sense of positive or negative yet, the Ports have just been named 'io' for in/out.

Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links