Skip to content

Commit 9869b2b

Browse files
authored
Merge pull request #2200 from SciML/myb/renaming
`@model` -> `@mtkmodel`
2 parents 67175ab + 786d42e commit 9869b2b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/ModelingToolkit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export JumpProblem, DiscreteProblem
188188
export NonlinearSystem, OptimizationSystem, ConstraintsSystem
189189
export alias_elimination, flatten
190190
export connect, @connector, Connection, Flow, Stream, instream
191-
export @component, @model
191+
export @component, @mtkmodel
192192
export isinput, isoutput, getbounds, hasbounds, isdisturbance, istunable, getdist, hasdist,
193193
tunable_parameters, isirreducible, getdescription, hasdescription, isbinaryvar,
194194
isintegervar

src/systems/model_parsing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct Model{F, S}
44
end
55
(m::Model)(args...; kw...) = m.f(args...; kw...)
66

7-
for f in (:connector, :model)
7+
for f in (:connector, :mtkmodel)
88
@eval begin
99
macro $f(name::Symbol, body)
1010
esc($(Symbol(f, :_macro))(__module__, name, body))
@@ -173,7 +173,7 @@ function get_var(mod::Module, b)
173173
b isa Symbol ? getproperty(mod, b) : b
174174
end
175175

176-
function model_macro(mod, name, expr; arglist = Set([]), kwargs = Set([]))
176+
function mtkmodel_macro(mod, name, expr; arglist = Set([]), kwargs = Set([]))
177177
exprs = Expr(:block)
178178
dict = Dict{Symbol, Any}()
179179
dict[:kwargs] = Dict{Symbol, Any}()

test/model_parsing.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010
@connector RealOutput begin
1111
u(t), [output = true]
1212
end
13-
@model Constant begin
13+
@mtkmodel Constant begin
1414
@components begin
1515
output = RealOutput()
1616
end
@@ -34,7 +34,7 @@ end
3434
@named p = Pin(; v = π)
3535
@test getdefault(p.v) == π
3636

37-
@model OnePort begin
37+
@mtkmodel OnePort begin
3838
@components begin
3939
p = Pin()
4040
n = Pin()
@@ -51,7 +51,7 @@ end
5151
end
5252
end
5353

54-
@model Ground begin
54+
@mtkmodel Ground begin
5555
@components begin
5656
g = Pin()
5757
end
@@ -64,7 +64,7 @@ end
6464
end
6565

6666
resistor_log = "$(@__DIR__)/logo/resistor.svg"
67-
@model Resistor begin
67+
@mtkmodel Resistor begin
6868
@extend v, i = oneport = OnePort()
6969
@parameters begin
7070
R
@@ -90,7 +90,7 @@ l15 0" stroke="black" stroke-width="1" stroke-linejoin="bevel" fill="none"></pat
9090
end
9191
end
9292

93-
@model Capacitor begin
93+
@mtkmodel Capacitor begin
9494
@extend v, i = oneport = OnePort()
9595
@parameters begin
9696
C
@@ -101,7 +101,7 @@ end
101101
end
102102
end
103103

104-
@model Voltage begin
104+
@mtkmodel Voltage begin
105105
@extend v, i = oneport = OnePort()
106106
@components begin
107107
V = RealInput()
@@ -111,7 +111,7 @@ end
111111
end
112112
end
113113

114-
@model RC begin
114+
@mtkmodel RC begin
115115
@components begin
116116
resistor = Resistor(; R)
117117
capacitor = Capacitor(; C = 10)
@@ -145,7 +145,7 @@ end
145145

146146
@test length(equations(structural_simplify(rc))) == 1
147147

148-
@model MockModel begin
148+
@mtkmodel MockModel begin
149149
@parameters begin
150150
a
151151
b(t)

0 commit comments

Comments
 (0)