circuit
Creates a circuit diagram object.
| Library |
|
Syntax
Function call
-
cktobj = circuit(elem1,…,elemN)— creates a schema objectcktobjby cascading the specified two-port elements.
-
cktobj = circuit(elem1,…,elemN, cktname)— creates a cascade scheme objectcktobjwith a namecktname.
Arguments
Input arguments
# cktname — schema name
+
"unnamed" (by default) | character vector
Details
The name of the schema, specified as a vector of symbols.
Output arguments
# cktobj — schema object
+
scalar descriptor object
Details
The schema object. The circuit may contain elements such as a resistor, a capacitor, and an inductor.
The schema object contains the following properties:
-
Name— the name of the scheme in the form of a symbolic vector, for example"new_circuit1". -
Elements— an array of circuit elements present in the circuit. The elements of the scheme can be:amplifier,resistor,capacitor,inductorandnport. -
ElementNames— names of the circuit elements in the form of a vector of cells. The circuit elements can be a resistor, a capacitor, an inductor and a circuit, for example("C", "L"). -
Terminals— the names of the terminals in the circuit in the form of a vector of cells. To determine the terminals, use the functionsetportsorsetterminals. The terminals of the circuit are displayed only after they are identified. For example("t1", "t2"). -
Ports— the names of the ports in the scheme in the form of a character vector. To determine the ports, use the functionsetports. The schema ports are displayed only after they are defined. For example"p1". -
Nodes— a list of nodes in the diagram in the form of a vector of integers. These nodes are created when a new element is added to the schema. For example[1, 2]. -
ParentPath— the full path to the parent schema to which the schema object belongs, in the form of a character vector. This path is displayed only after adding the child schema to the parent schema. For example"example". -
ParentNodes— nodes of the parent schema in the form of a vector of integers. This vector of integers has the same length as the propertyTerminals. This property is read-only and is displayed only after adding the child schema to the parent schema.
Examples
Creating a circuit with elements and terminals
Details
Create a schema with the name "new_circuit1". Add a resistor and a capacitor to the circuit, adjust the terminals. Let’s derive the properties of the scheme.
using EngeeRF
hckt = circuit("new_circuit1")
hC1= add(hckt,[1 2],capacitor(3e-9))
hR1 = add(hckt,[2 3],resistor(100))
setterminals(hckt,[1 3])
println(hckt)
circuit(ElementNames = ("C", "R"), Terminals = ("t1", "t2"), Name = "new_circuit1", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Nodes = [1, 2, 3], TerminalNodes = [1, 3])
Creating a circuit with parallel elements
Details
Create a schema with the name "new_circuit". We will add a capacitor and an inductor in parallel to it.
using EngeeRF
hckt = circuit("new_circuit")
hC = add(hckt,[1 2],capacitor(1e-12))
hL = add(hckt,[1 2],inductor(1e-9))
println(hckt)
circuit(ElementNames = ("C", "L"), Name = "new_circuit", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Nodes = [1, 2])