Skip to content

Commit 2d2643b

Browse files
Merge pull request #311 from sathvikbhagavan/sb/docs
docs: clean up docs and fix custom component tutorial
2 parents 3d5997b + 211e37d commit 2d2643b

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

docs/src/API/blocks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Pages = ["blocks.md"]
1919
```@docs
2020
RealInput
2121
RealOutput
22+
RealInputArray
23+
RealOutputArray
2224
SISO
25+
MIMO
2326
```
2427

2528
## Math Blocks

docs/src/tutorials/custom_component.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ The final model can now be created with the components from the library and the
9191

9292
```@example components
9393
systems = @named begin
94-
L = Inductor(L = 18)
94+
L = Inductor(L = 18, i = 0)
9595
Ro = Resistor(R = 12.5e-3)
9696
G = Conductor(G = 0.565)
9797
C1 = Capacitor(C = 10, v = 4)
98-
C2 = Capacitor(C = 100)
98+
C2 = Capacitor(C = 100, v = 0)
9999
Nr = NonlinearResistor(Ga = -0.757576,
100100
Gb = -0.409091,
101101
Ve = 1)
@@ -124,20 +124,14 @@ Since the initial voltage of the first capacitor was already specified via `v`,
124124

125125
```@example components
126126
sys = structural_simplify(model)
127-
prob = ODEProblem(sys, Pair[], (0, 5e4), saveat = 0.01)
128-
sol = solve(prob, Rodas4())
127+
prob = ODEProblem(sys, Pair[], (0, 5e4))
128+
sol = solve(prob, Rodas4(); saveat = 1.0)
129129
130-
Plots.plot(sol[C1.v], sol[C2.v], title = "Chaotic Attractor", label = "",
130+
plot(sol[C1.v], sol[C2.v], title = "Chaotic Attractor", label = "",
131131
ylabel = "C1 Voltage in V", xlabel = "C2 Voltage in V")
132-
Plots.savefig("chua_phase_plane.png")
133-
nothing # hide
132+
```
134133

135-
Plots.plot(sol; idxs = [C1.v, C2.v, L.i],
134+
```@example components
135+
plot(sol; idxs = [C1.v, C2.v, L.i],
136136
labels = ["C1 Voltage in V" "C2 Voltage in V" "Inductor Current in A"])
137-
Plots.savefig("chua.png")
138-
nothing # hide
139137
```
140-
141-
![Time series plot of C1.v, C2.v and L.i](chua_phase_plane.png)
142-
143-
![Phase plane plot of C1.v and C2.v](chua.png)

docs/src/tutorials/dc_motor_pi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ sys = structural_simplify(model)
7777
prob = ODEProblem(sys, unknowns(sys) .=> 0.0, (0, 6.0))
7878
sol = solve(prob, Rodas4())
7979
80-
p1 = Plots.plot(sol.t, sol[inertia.w], ylabel = "Angular Vel. in rad/s",
80+
p1 = plot(sol.t, sol[inertia.w], ylabel = "Angular Vel. in rad/s",
8181
label = "Measurement", title = "DC Motor with Speed Controller")
82-
Plots.plot!(sol.t, sol[ref.output.u], label = "Reference")
83-
p2 = Plots.plot(sol.t, sol[load.tau.u], ylabel = "Disturbance in Nm", label = "")
84-
Plots.plot(p1, p2, layout = (2, 1))
82+
plot!(sol.t, sol[ref.output.u], label = "Reference")
83+
p2 = plot(sol.t, sol[load.tau.u], ylabel = "Disturbance in Nm", label = "")
84+
plot(p1, p2, layout = (2, 1))
8585
```
8686

8787
## Closed-loop analysis

docs/src/tutorials/rc_circuit.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,4 @@ sol = solve(prob, Tsit5())
3535
plot(sol, idxs = [capacitor.v, resistor.i],
3636
title = "RC Circuit Demonstration",
3737
labels = ["Capacitor Voltage" "Resistor Current"])
38-
savefig("plot.png");
39-
nothing; # hide
4038
```
41-
42-
![](plot.png)

docs/src/tutorials/thermal_model.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,4 @@ T_final_K = sol[(mass1.T * C1 + mass2.T * C2) / (C1 + C2)]
3737
plot(title = "Thermal Conduction Demonstration")
3838
plot!(sol, idxs = [mass1.T, mass2.T], labels = ["Mass 1 Temperature" "Mass 2 Temperature"])
3939
plot!(sol.t, T_final_K, label = "Steady-State Temperature")
40-
savefig("thermal_plot.png");
41-
nothing; # hide
4240
```
43-
44-
![Plot of Temperatures](thermal_plot.png)

0 commit comments

Comments
 (0)