Engee documentation

setports

Sets the ports for the circuit object of the electrical circuit.

Library

EngeeRF

Syntax

Function call

  • setports(cktobj, nodepairs) — defines pairs of nodes in a multiport cktobj using the argument nodepairs. Port names are assigned by default. The function also defines the terminals cktobj using terminal names from port names. If any of the pairs of nodes does not exist, then setports creates it.

Arguments

Input arguments

# cktobj — schema object

+ scalar descriptor object

Details

The schema object for which ports are defined, specified as a scalar descriptor object.

# nodepairs — pairs of schema nodes

+ vector of integers

Details

Pairs of nodes of a schema object specified as a vector of integers. The function uses this input argument to define ports.

# portnames — port names

+ character vector

Details

Names for ports defined for the schema object, specified as a character vector.

Examples

Creating a single-port chain by default names

Details

Let’s create a single-port circuit and use setports.

using EngeeRF

hckt1 = circuit("new_circuit1")
add(hckt1,[1 2],resistor(50))
setports(hckt1,[1 2])
println(hckt1)
circuit(ElementNames = ("R",), Terminals = ("p1+", "p1-"), Name = "new_circuit1", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Ports = ("p1",), Nodes = [1, 2], TerminalNodes = [1, 2])

Creating a two-port chain with specified port names

Details

Let’s create a chain and define two ports with the names In and Out.

using EngeeRF

hckt2 = circuit("new_circuit2")
add(hckt2,[2 3],resistor(50))
add(hckt2,[3 1],capacitor(1e-9))
setports(hckt2,[2 1],[3 1],("in", "out"))
println(hckt2)
circuit(ElementNames = ("R", "C"), Terminals = ("in+", "out+", "in-", "out-"), Name = "new_circuit2", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Ports = ("in", "out"), Nodes = [1, 2, 3], TerminalNodes = [2, 3, 1, 1])8