Engee documentation

add

Adds a schema element or schema object to the schema.

Library

EngeeRF

Syntax

Function call

  • add(cktobj, cktnodes, elem) — adds a schema element elem to the schema object cktobj. Element terminals elem they join the nodes specified in cktnodes. If elem — this is an object of S-parameters, then an object is created from the input data nport and is added to cktobj.

  • elem_out = add(_) — returns the inserted schema element. elem_out as an output value. Specify any of the combinations of input arguments from the previous syntaxes.

Arguments

Input arguments

# cktobj — schema object

+ scalar descriptor object

Details

The schema object into which the schema element is inserted, specified as a scalar descriptor object. This schema object can be a new schema, an object nport or an existing scheme.

# cktnodes — schema nodes

+ a vector of integers

Details

The nodes of the schema object, specified as a vector of integers. The function uses this input argument to attach a new element to the schema.

# elem — elements of the scheme

+ scalar descriptor object

Details

Schema elements inserted into a schema object specified as scalar descriptor objects. The element can be a resistor, a capacitor, an inductor, an S-parameter object, or an entire circuit.

# termorder — element terminals

+ vector of cells

Details

Element terminals specified as cell vectors specified in the property Terminals The argument elem. These input arguments are specified as scalar descriptor objects.

Output arguments

# elem_out — schema elements

+ scalar descriptor object

Details

Schema elements returned as scalar descriptor objects after using the function add. The function uses any or all of the input arguments to create these schema elements.

Examples

Adding an element to the chain

Details

Create a resistor and add it to the circuit.

using EngeeRF

hR1 = resistor(50)
hckt1 = circuit("new_circuit1")
add(hckt1,[1 2],hR1)
print(hR1)
resistor(ParentPath = "new_circuit1", Terminals = ("p", "n"), Name = "R", ParentPath = "new_circuit1", ParentNodes = [1, 2], Resistance = 50.0)
print(hckt1)
circuit(ElementNames = ("R",), Name = "new_circuit1", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Nodes = [1, 2])

Adding an element to certain nodes of the schema

Details

Let’s create a capacitor.

using EngeeRF

hC2 = capacitor(1e-10)
print(hC2)
capacitor(Terminals = ("p", "n"), Name = "C", Capacitance = 1.0e-10)

Connect the terminal n connect the capacitor to the node 3, and the terminal p capacitor — to the node 4.

hckt2 = circuit("new_circuit2")
add(hckt2,[3 4],hC2,("n","p"))
print(hckt2)
circuit(ElementNames = ("C",), Name = "new_circuit2", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Nodes = [3, 4])

Creating a chain and adding an element to it

Details

Let’s create a chain.

using EngeeRF

hckt3 = circuit("new_circuit3")
circuit(Name = "new_circuit3")

Add an inductor to the circuit using the function add, and display the schema element.

hL3 = add(hckt3,[100 200],inductor(1e-9))
print(hckt3)
circuit(ElementNames = ("L", "L"), Name = "new_circuit3", Elements = Vector{EngeeRF.DomainRF.DomainObjectRF}, Nodes = [100, 200])

Let’s display the added schema element.

print(hL3)
inductor(ParentPath = "new_circuit3", Terminals = ("p", "n"), Name = "L", ParentPath = "new_circuit3", ParentNodes = [100, 200], Inductance = 1.0e-9)