Skip to content

Commit 2b0bc6e

Browse files
ven-kAayushSabharwal
authored andcommitted
metadata(components): adds units to Magnetic/FluxTubes components
1 parent dae77a2 commit 2b0bc6e

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

src/Magnetic/FluxTubes/basic.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Idle running branch.
2020
@mtkmodel Idle begin
2121
@extend (Phi,) = two_port = TwoPort()
2222
@equations begin
23-
Phi ~ 0
23+
Phi ~ 0.0
2424
end
2525
end
2626

@@ -68,7 +68,7 @@ Constant permeance.
6868
@mtkmodel ConstantPermeance begin
6969
@extend V_m, Phi = two_port = TwoPort()
7070
@parameters begin
71-
G_m = 1.0, [description = "Magnetic permeance"]
71+
G_m = 1.0, [description = "Magnetic permeance", unit = u"H"]
7272
end
7373
@equations begin
7474
Phi ~ G_m * V_m
@@ -87,7 +87,7 @@ Constant reluctance.
8787
@mtkmodel ConstantReluctance begin
8888
@extend V_m, Phi = two_port = TwoPort(; Phi = 0.0)
8989
@parameters begin
90-
R_m = 1.0, [description = "Magnetic reluctance"]
90+
R_m = 1.0, [description = "Magnetic reluctance", unit = u"H^-1"]
9191
end
9292
@equations begin
9393
V_m ~ Phi * R_m
@@ -114,8 +114,9 @@ Initial magnetic flux flowing into the port_p can be set with `Phi` ([Wb])
114114
N, [description = "Number of turns"]
115115
end
116116
@variables begin
117-
v(t)
118-
i(t)
117+
v(t),
118+
[description = "Voltage difference from positive to negative pin", unit = u"V"]
119+
i(t), [description = "Current", unit = u"A"]
119120
end
120121
@extend V_m, Phi = two_port = TwoPort(; Phi)
121122
@components begin
@@ -146,10 +147,11 @@ Initial magnetic flux flowing into the port_p can be set with `Phi` ([`Wb`])
146147
"""
147148
@mtkmodel EddyCurrent begin
148149
@parameters begin
149-
rho = 0.098e-6, [description = "Resistivity of flux tube material"]
150-
l = 1, [description = "Average length of eddy current path"]
151-
A = 1, [description = "Cross sectional area of eddy current path"]
152-
R = rho * l / A # Electrical resistance of eddy current path
150+
rho = 0.098e-6, [description = "Resistivity of flux tube material", unit = u"Ω*m"]
151+
l = 1, [description = "Average length of eddy current path", unit = u"m"]
152+
A = 1, [description = "Cross sectional area of eddy current path", unit = u"m^2"]
153+
R = rho * l / A,
154+
[description = "Electrical resistance of eddy current path", unit = u""]
153155
end
154156
@extend (V_m, Phi) = two_port = TwoPort(; Phi)
155157
@equations begin

src/Magnetic/FluxTubes/sources.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Parameters:
1313
port_n = NegativeMagneticPort()
1414
end
1515
@parameters begin
16-
V_m = 0.0, [description = "Magnetic potential difference"]
16+
V_m = 0.0, [description = "Magnetic potential difference", unit = u"A"]
1717
end
1818
@variables begin
19-
Phi(t)
19+
Phi(t), [description = "Magnetic flux", unit = u"Wb"]
2020
end
2121
@equations begin
2222
V_m ~ port_p.V_m - port_n.V_m
@@ -40,10 +40,10 @@ Parameters:
4040
port_n = NegativeMagneticPort()
4141
end
4242
@parameters begin
43-
Phi = 0.0, [description = "Magnetic flux"]
43+
Phi = 0.0, [description = "Magnetic flux", unit = u"Wb"]
4444
end
4545
@variables begin
46-
V_m(t)
46+
V_m(t), [description = "Magnetic potential difference", unit = u"A"]
4747
end
4848
@equations begin
4949
V_m ~ port_p.V_m - port_n.V_m

src/Magnetic/FluxTubes/utils.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@connector MagneticPort begin
2-
V_m(t), [description = "Magnetic potential at the port"]
3-
Phi(t), [connect = Flow, description = "Magnetic flux flowing into the port"]
2+
V_m(t), [description = "Magnetic potential at the port", unit = u"A"]
3+
Phi(t),
4+
[connect = Flow, description = "Magnetic flux flowing into the port", unit = u"Wb"]
45
end
56
Base.@doc "Port for a Magnetic system." MagneticPort
67

@@ -30,8 +31,15 @@ Partial component with magnetic potential difference between two magnetic ports
3031
port_n = NegativeMagneticPort()
3132
end
3233
@variables begin
33-
V_m(t) = 0.0
34-
Phi(t) = 0.0
34+
V_m(t) = 0.0, [description = "Magnetic potential at the port", unit = u"A"]
35+
function Phi(t)
36+
0.0,
37+
[
38+
connect = Flow,
39+
description = "Magnetic flux flowing into the port",
40+
unit = u"Wb",
41+
]
42+
end
3543
end
3644
@equations begin
3745
V_m ~ port_p.V_m - port_n.V_m

0 commit comments

Comments
 (0)