Skip to content

Commit 397b20d

Browse files
committed
Fix typos in the tutorial
1 parent d3ecbf1 commit 397b20d

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/src/tutorials/acausal_components.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ equalities before solving. Let's see this in action.
1212
## Copy-Paste Example
1313

1414
```julia
15-
using ModelingToolkit, Plots
15+
using ModelingToolkit, Plots, OrdinaryDiffEq
1616

1717
@parameters t
1818

@@ -23,15 +23,15 @@ function Pin(;name)
2323
end
2424

2525
function Ground(;name)
26-
g = Pin(:g)
26+
@named g = Pin()
2727
eqs = [g.v ~ 0]
2828
ODESystem(eqs, t, [], [], systems=[g], name=name)
2929
end
3030

3131
function Resistor(;name, R = 1.0)
3232
val = R
33-
p = Pin(:p)
34-
n = Pin(:n)
33+
@named p = Pin()
34+
@named n = Pin()
3535
@variables v(t)
3636
@parameters R
3737
eqs = [
@@ -44,8 +44,8 @@ end
4444

4545
function Capacitor(; name, C = 1.0)
4646
val = C
47-
p = Pin(:p)
48-
n = Pin(:n)
47+
@named p = Pin()
48+
@named n = Pin()
4949
@variables v(t)
5050
@parameters C
5151
D = Differential(t)
@@ -59,8 +59,8 @@ end
5959

6060
function ConstantVoltage(;name, V = 1.0)
6161
val = V
62-
p = Pin(:p)
63-
n = Pin(:n)
62+
@named p = Pin()
63+
@named n = Pin()
6464
@parameters V
6565
eqs = [
6666
V ~ p.v - n.v
@@ -135,7 +135,7 @@ names to correspond to duplicates of this topology with unique variables.
135135
One can then construct a `Pin` like:
136136

137137
```julia
138-
Pin(:mypin1)
138+
Pin(name=:mypin1)
139139
```
140140

141141
or equivalently using the `@named` helper macro:
@@ -151,7 +151,7 @@ that the voltage in such a `Pin` is equal to zero. This gives:
151151

152152
```julia
153153
function Ground(;name)
154-
g = Pin(:g)
154+
@named g = Pin()
155155
eqs = [g.v ~ 0]
156156
ODESystem(eqs, t, [], [], systems=[g], name=name)
157157
end
@@ -167,8 +167,8 @@ zero. This leads to our resistor equations:
167167
```julia
168168
function Resistor(;name, R = 1.0)
169169
val = R
170-
p = Pin(:p)
171-
n = Pin(:n)
170+
@named p = Pin()
171+
@named n = Pin()
172172
@variables v(t)
173173
@parameters R
174174
eqs = [
@@ -190,8 +190,8 @@ Using our knowledge of circuits we similarly construct the Capacitor:
190190
```julia
191191
function Capacitor(; name, C = 1.0)
192192
val = C
193-
p = Pin(:p)
194-
n = Pin(:n)
193+
@named p = Pin()
194+
@named n = Pin()
195195
@variables v(t)
196196
@parameters C
197197
D = Differential(t)
@@ -212,8 +212,8 @@ model this as:
212212
```julia
213213
function ConstantVoltage(;name, V = 1.0)
214214
val = V
215-
p = Pin(:p)
216-
n = Pin(:n)
215+
@named p = Pin()
216+
@named n = Pin()
217217
@parameters V
218218
eqs = [
219219
V ~ p.v - n.v

0 commit comments

Comments
 (0)