Skip to content

Commit 48bc6e5

Browse files
adds missing deps
1 parent 66961d8 commit 48bc6e5

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](http://mtkstdlib.sciml.ai/stable/)
55
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](http://mtkstdlib.sciml.ai/dev/)
66

7-
The ModelingToolkit Standard Library is standard library of components to model the world and beyond.
7+
The ModelingToolkit Standard Library is a standard library of components to model the world and beyond.
88

99
![](https://user-images.githubusercontent.com/1814174/172000112-3579f5cf-c370-48c2-8047-558fbc46aeb6.png)
1010

@@ -41,27 +41,30 @@ The following is the [RC Circuit Demonstration](http://mtkstdlib.sciml.ai/dev/tu
4141
```julia
4242
using ModelingToolkit, OrdinaryDiffEq, Plots
4343
using ModelingToolkitStandardLibrary.Electrical
44+
using ModelingToolkitStandardLibrary.Blocks: Constant
4445

4546
R = 1.0
4647
C = 1.0
4748
V = 1.0
4849
@variables t
4950
@named resistor = Resistor(R=R)
5051
@named capacitor = Capacitor(C=C)
51-
@named source = ConstantVoltage(V=V)
52+
@named source = Voltage()
53+
@named constant = Constant(k=V)
5254
@named ground = Ground()
5355

5456
rc_eqs = [
57+
connect(constant.output, source.V)
5558
connect(source.p, resistor.p)
5659
connect(resistor.n, capacitor.p)
5760
connect(capacitor.n, source.n, ground.g)
5861
]
5962

60-
@named rc_model = ODESystem(rc_eqs, t, systems=[resistor, capacitor, source, ground])
63+
@named rc_model = ODESystem(rc_eqs, t, systems=[resistor, capacitor, constant, source, ground])
6164
sys = structural_simplify(rc_model)
6265
prob = ODAEProblem(sys, Pair[], (0, 10.0))
6366
sol = solve(prob, Tsit5())
64-
plot(sol, vars = [capacitor.v,resistor.i],
67+
plot(sol, vars = [capacitor.v, resistor.i],
6568
title = "RC Circuit Demonstration",
6669
labels = ["Capacitor Voltage" "Resistor Current"])
6770
savefig("plot.png")

docs/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
4+
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
5+
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
6+
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
7+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
38

49
[compat]
510
Documenter = "0.26, 0.27"

docs/src/tutorials/rc_circuit.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,30 @@ connect pre-made components and simulate the model.
99
```@example
1010
using ModelingToolkit, OrdinaryDiffEq, Plots
1111
using ModelingToolkitStandardLibrary.Electrical
12+
using ModelingToolkitStandardLibrary.Blocks: Constant
1213
1314
R = 1.0
1415
C = 1.0
1516
V = 1.0
1617
@variables t
1718
@named resistor = Resistor(R=R)
1819
@named capacitor = Capacitor(C=C)
19-
@named source = ConstantVoltage(V=V)
20+
@named source = Voltage()
21+
@named constant = Constant(k=V)
2022
@named ground = Ground()
2123
2224
rc_eqs = [
25+
connect(constant.output, source.V)
2326
connect(source.p, resistor.p)
2427
connect(resistor.n, capacitor.p)
2528
connect(capacitor.n, source.n, ground.g)
2629
]
2730
28-
@named rc_model = ODESystem(rc_eqs, t, systems=[resistor, capacitor, source, ground])
31+
@named rc_model = ODESystem(rc_eqs, t, systems=[resistor, capacitor, constant, source, ground])
2932
sys = structural_simplify(rc_model)
3033
prob = ODAEProblem(sys, Pair[], (0, 10.0))
3134
sol = solve(prob, Tsit5())
32-
plot(sol, vars = [capacitor.v,resistor.i],
35+
plot(sol, vars = [capacitor.v, resistor.i],
3336
title = "RC Circuit Demonstration",
3437
labels = ["Capacitor Voltage" "Resistor Current"])
3538
savefig("plot.png"); nothing # hide

0 commit comments

Comments
 (0)