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 theElectrical Referenceblock 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, seeConnections 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 thebranchessection, 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.

的declaration section of the component contains:

  • One electrical node,V

  • A Through variable, currenti, 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.

Thebranchessection establishes the relationship between the component Through variable, currenti, and the component nodes (and therefore the domain Through variable). Thei : V.i -> *statement indicates that the current flows from nodeVto 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