resistor
Creates a resistor object.
| Library |
|
Arguments
Input arguments
# rvalue — Resistance, ohms
+
real scalar
Details
The resistance value in ohms, given as a real scalar.
# rname is the name of the resistor
+
"R" (by default) | character vector
Details
The name of the resistor, specified as a vector of characters.
Output arguments
# robj — resistor object
+
scalar descriptor object
Details
The object of the resistor. The resistor object contains the following properties:
-
Resistance— the resistance of the resistor in ohms in the form of a real scalar, for example50. -
Name— the name of the resistor in the form of a character vector, for example"K2uf". -
Terminals— resistor terminals in the form of a vector of cells, for example("p", "n"). -
ParentPath— the full path to the circuit to which the resistor object belongs, in the form of a character vector. This path appears only after adding a resistor to the circuit. For example"example". -
ParentNodes— nodes of the parent circuit to which the resistor terminals are connected, in the form of a vector of integers. This property appears only after adding a resistor to the circuit. For example[1, 2].
Examples
Creating a resistor
Details
Create a resistor and display its properties.
using EngeeRF
hR1 = resistor(50)
println(hR1)
resistor(Terminals = ("p", "n"), Name = "R", Resistance = 50.0)
Adding a resistor to the circuit
Details
Add a resistor to the circuit and display its properties.
using EngeeRF
hR2 = resistor(3e-6,"R2uf")
hckt2 = circuit("example")
add(hckt2,[1 2],hR2)
setports(hckt2, [1 0],[2 0])
println(hR2)
resistor(ParentPath = "example", Terminals = ("p", "n"), Name = "R2uf", ParentPath = "example", ParentNodes = [1, 2], Resistance = 3.0e-6)