Skip to content

ElectricPort

Jonathan edited this page Aug 7, 2020 · 4 revisions

Electric Port

The ElectricPort class is used by the components of the NPSS Power System Library communicate with each other. Nearly every component in the Power System Library will have at least one or more ports that is uses to transfer the physical attributes that have been defined or calculated (voltage, current, etc.) within it. This works in nearly the same fashion as the fluid and other type ports in the original NPSS framework.

The ElectricPort component is never used directly. Instead, components in the library will define only its child classes, ElectricInputPort and ElectricOutputPort. This is done for simplicity and to accord to standard NPSS conventions of separating input and output port components (although they are all functionally identical).

An additional consideration when connecting electrical components is ElectricPowerType. Each electric port declares its own ElectricPowerType NPSS Option variable that must either be set by the user when defining or automatically set by the findSourcesAndPropagate() function. Many components will have some or all of their port power types already set in their source files.

Usage

Electric ports are defined into all NPSS Power System Library electrical components. Thus, it is typically not required for a user to define their own electric ports.

The naming convention used in the Power System Library follows that of the standard NPSS framework. ElectricInputPorts are named EP_I and ElectricOutputPorts are named EP_O. Components with more than one input or output port such as Enode will simply append a number like: EP_I1, EP_I2, EP_O1, EP_O2, etc. to the port names.

Linking Ports

As shown in the Home page, once model components have been defined, a user may connect them to each other using the linkPortsI() (see InterpretedPort). This works almost identically to the linkPorts() method used for ports in the standard NPSS framework. All Power System Library electrical components will contain at least one electric port (input or output) to connect to.

Simple DC Powertrain Example

Consider a DC Source (Battery) component S1 with ElectricPort EP_O and Cable component C1 with ElectricInputPort EP_I and ElectricOutputPort EP_O. If we wish to connect the Sources output port with the Cables input port to form a connection, we use linkPortsI() like so:

linkPortsI(S1.EP_O, C1.EP_I);

Following this, consider an Inverter component Inv with ElectricInputPort EP_I and ElectricOutputPort EP_O. If we'd like to now connect the cable C1 to the inverter's input port, we add another line:

linkPortsI(C1.EP_O, Inv.EP_I);

Finally, if we'd like to add a Motor component

Creating Ports

TODO

Implementation (How It Works)

Although similar to the NPSS port types, the present implementation of the NPSS ElectricPort class is not compiled either statically or dynamically (as a DLM). Instead it functions as an interpreted component whose source code may be found in ElectricPort.int. TODO

Clone this wiki locally