Skip to content

Commit dae77a2

Browse files
ven-kAayushSabharwal
authored andcommitted
units of analog
1 parent 2029edb commit dae77a2

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/Electrical/Analog/ideal_components.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ See [OnePort](@ref)
3838
@mtkmodel Resistor begin
3939
@extend v, i = oneport = OnePort()
4040
@parameters begin
41-
R, [description = "Resistance"]
41+
R, [description = "Resistance", unit = u""]
4242
end
4343
@equations begin
4444
v ~ i * R
@@ -66,7 +66,7 @@ See [OnePort](@ref)
6666
@mtkmodel Conductor begin
6767
@extend v, i = oneport = OnePort()
6868
@parameters begin
69-
G, [description = "Conductance"]
69+
G, [description = "Conductance", unit = u"S"]
7070
end
7171
@equations begin
7272
i ~ v * G
@@ -94,7 +94,7 @@ See [OnePort](@ref)
9494
"""
9595
@mtkmodel Capacitor begin
9696
@parameters begin
97-
C, [description = "Capacitance"]
97+
C, [description = "Capacitance",unit = u"F"]
9898
end
9999
@extend v, i = oneport = OnePort(; v)
100100
@equations begin
@@ -123,7 +123,7 @@ See [OnePort](@ref)
123123
"""
124124
@mtkmodel Inductor begin
125125
@parameters begin
126-
L, [description = "Inductance"]
126+
L, [description = "Inductance", unit = u"H"]
127127
end
128128
@extend v, i = oneport = OnePort(; i)
129129
@equations begin

src/Electrical/Analog/sensors.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Creates a circuit component which measures the potential at a pin.
4646
p = Pin()
4747
end
4848
@variables begin
49-
phi(t)
49+
phi(t), [description = "Measured potential", unit = u"V"]
5050
end
5151
@equations begin
5252
p.i ~ 0
@@ -74,7 +74,7 @@ Creates a circuit component that measures the voltage across it. Analogous to an
7474
n = Pin()
7575
end
7676
@variables begin
77-
v(t)
77+
v(t), [description = "Voltage difference from positive to negative pin", unit = u"V"]
7878
end
7979
@equations begin
8080
p.i ~ 0
@@ -112,7 +112,7 @@ consumed by a circuit.
112112
current_sensor = CurrentSensor()
113113
end
114114
@variables begin
115-
power(t)
115+
power(t), [description = "Power being consumed", unit = u"W"]
116116
end
117117
@equations begin
118118
connect(voltage_sensor.p, pv)
@@ -150,8 +150,8 @@ Combines a [`VoltageSensor`](@ref) and a [`CurrentSensor`](@ref).
150150
current_sensor = CurrentSensor()
151151
end
152152
@variables begin
153-
i(t) = 1.0
154-
v(t) = 1.0
153+
i(t) = 1.0, [description = "Current", unit = u"A"]
154+
v(t) = 1.0, [description = "Voltage", unit = u"V"]
155155
end
156156
@equations begin
157157
connect(voltage_sensor.p, pv)

src/Electrical/utils.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Component with two electrical pins `p` and `n` and current `i` flows from `p` to
3333
n = Pin()
3434
end
3535
@variables begin
36-
v(t) = 0.0
37-
i(t) = 0.0
36+
v(t) = 0.0, [description = "Voltage", unit = u"V"]
37+
i(t) = 0.0, [description = "Current", unit = u"A"]
3838
end
3939
@equations begin
4040
v ~ p.v - n.v
@@ -70,10 +70,10 @@ Current `i1` flows from `p1` to `n1` and `i2` from `p2` to `n2`.
7070
n2 = Pin()
7171
end
7272
@variables begin
73-
v1(t) = 0.0
74-
i1(t) = 0.0
75-
v2(t) = 0.0
76-
i2(t) = 0.0
73+
v1(t) = 0.0, [description = "Voltage", unit = u"V"]
74+
i1(t) = 0.0, [description = "Current", unit = u"A"]
75+
v2(t) = 0.0, [description = "Voltage", unit = u"V"]
76+
i2(t) = 0.0, [description = "Current", unit = u"A"]
7777
end
7878
@equations begin
7979
v1 ~ p1.v - n1.v

0 commit comments

Comments
 (0)