Main Content

Grounding Component — Electrical Reference

The easiest way to implement a grounding component is to use a connection to an implicit reference node. For an example of a component that provides an electrical ground to a circuit, see the source for the Electrical Reference block in the Foundation library:

component reference
% Electrical Reference :0.5
% Electrical reference port. A model must contain at least one
% electrical reference port (electrical ground).

% Copyright 2005-2016 The MathWorks, Inc.
  
nodes
    V = foundation.electrical.electrical; % :top
end

connections
    connect(V, *);
end

end

For more information on component connections and the implicit reference node syntax, see Connections to Implicit Reference Node.

The following file, elec_reference.ssc, shows how to implement a behavioral model of an electrical reference. This component has one node, where the voltage equals zero. It also declares a current variable, makes it incident to the component node using the branches section, and does not specify any value for it in the equation section. Therefore, it can take on any value and handle the current flowing into or out of the reference node.

The declaration section of the component contains:

  • One electrical node, V.

  • A Through variable, current i, to be connected to the electrical domain later in the file. Note that there is no need to declare an Across variable (voltage) because this is a grounding component.

The branches section establishes the relationship between the component Through variable, current i, and the component nodes (and therefore the domain Through variable). The i : V.i -> * statement indicates that the current flows from node V to the reference node, indicated as *.

The equation section of the component contains the equation that defines the grounding action:

  • V.v == 0, that is, voltage at the node equals zero

component elec_reference
% Electrical Reference
% Electrical reference port. A model must contain at least one
% electrical reference port (electrical ground).
  
  nodes
    V = foundation.electrical.electrical; % :top
  end

  variables
    i = { 0, 'A' };
  end

  branches
    i : V.i -> *;
  end

  equations
    V.v == 0;
  end

end

Related Topics