Skip to content

Commit 24a3fd2

Browse files
authored
Merge pull request #1546 from AnasAbdelR/patch-1
📝 update docs for acausal circuit example
2 parents 5f250f6 + c997c71 commit 24a3fd2

File tree

1 file changed

+42
-43
lines changed

1 file changed

+42
-43
lines changed

docs/src/tutorials/acausal_components.md

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -283,57 +283,57 @@ of differential-algebraic equations (DAEs) which define the evolution of each
283283
state of the system. The equations are:
284284

285285
```julia
286-
equations(rc_model)
286+
equations(expand_connections(rc_model))
287287

288288
20-element Vector{Equation}:
289-
0 ~ resistor₊p₊i(t) + source₊p₊i(t)
290-
source₊p₊v(t) ~ resistor₊p₊v(t)
291-
0 ~ capacitor₊p₊i(t) + resistor₊n₊i(t)
292-
resistor₊n₊v(t) ~ capacitor₊p₊v(t)
293-
0 ~ capacitor₊n₊i(t) + ground₊g₊i(t) + source₊n₊i(t)
294-
capacitor₊n₊v(t) ~ source₊n₊v(t)
295-
source₊n₊v(t) ~ ground₊g₊v(t)
296289
resistor₊v(t) ~ resistor₊p₊v(t) - resistor₊n₊v(t)
297290
0 ~ resistor₊n₊i(t) + resistor₊p₊i(t)
298291
resistor₊i(t) ~ resistor₊p₊i(t)
299292
resistor₊v(t) ~ resistor₊R*resistor₊i(t)
300293
capacitor₊v(t) ~ capacitor₊p₊v(t) - capacitor₊n₊v(t)
301294
0 ~ capacitor₊n₊i(t) + capacitor₊p₊i(t)
302295
capacitor₊i(t) ~ capacitor₊p₊i(t)
303-
Differential(t)(capacitor₊v(t)) ~ capacitor₊i(t)*(capacitor₊C^-1)
296+
Differential(t)(capacitor₊v(t)) ~ capacitor₊i(t) / capacitor₊C
304297
source₊v(t) ~ source₊p₊v(t) - source₊n₊v(t)
305298
0 ~ source₊n₊i(t) + source₊p₊i(t)
306299
source₊i(t) ~ source₊p₊i(t)
307300
source₊V ~ source₊v(t)
308301
ground₊g₊v(t) ~ 0
302+
source₊p₊v(t) ~ resistor₊p₊v(t)
303+
0 ~ resistor₊p₊i(t) + source₊p₊i(t)
304+
resistor₊n₊v(t) ~ capacitor₊p₊v(t)
305+
0 ~ capacitor₊p₊i(t) + resistor₊n₊i(t)
306+
ground₊g₊v(t) ~ source₊n₊v(t)
307+
ground₊g₊v(t) ~ capacitor₊n₊v(t)
308+
0 ~ capacitor₊n₊i(t) + ground₊g₊i(t) + source₊n₊i(t)
309309
```
310310

311311
the states are:
312312

313313
```julia
314314
states(rc_model)
315315

316-
20-element Vector{Term{Real, Base.ImmutableDict{DataType, Any}}}:
317-
source₊p₊i(t)
318-
resistor₊p₊i(t)
319-
source₊p₊v(t)
320-
resistor₊p₊v(t)
321-
capacitor₊p₊i(t)
322-
resistor₊n₊i(t)
323-
resistor₊n₊v(t)
324-
capacitor₊p₊v(t)
325-
source₊n₊i(t)
326-
capacitor₊n₊i(t)
327-
ground₊g₊i(t)
328-
capacitor₊n₊v(t)
329-
source₊n₊v(t)
330-
ground₊g₊v(t)
316+
20-element Vector{Any}:
331317
resistor₊v(t)
332318
resistor₊i(t)
319+
resistor₊p₊v(t)
320+
resistor₊p₊i(t)
321+
resistor₊n₊v(t)
322+
resistor₊n₊i(t)
333323
capacitor₊v(t)
334324
capacitor₊i(t)
325+
capacitor₊p₊v(t)
326+
capacitor₊p₊i(t)
327+
capacitor₊n₊v(t)
328+
capacitor₊n₊i(t)
335329
source₊v(t)
336330
source₊i(t)
331+
source₊p₊v(t)
332+
source₊p₊i(t)
333+
source₊n₊v(t)
334+
source₊n₊i(t)
335+
ground₊g₊v(t)
336+
ground₊g₊i(t)
337337
```
338338

339339
and the parameters are:
@@ -361,17 +361,15 @@ representation of the system. Let's see what it does here:
361361
sys = structural_simplify(rc_model)
362362
equations(sys)
363363

364-
2-element Vector{Equation}:
365-
0 ~ capacitor₊v(t) + resistor₊R*resistor₊i(t) - source₊V
366-
Differential(t)(capacitor₊v(t)) ~ resistor₊i(t)*(capacitor₊C^-1)
364+
1-element Vector{Equation}:
365+
Differential(t)(capacitor₊v(t)) ~ capacitor₊i(t) / capacitor₊C
367366
```
368367

369368
```julia
370369
states(sys)
371370

372-
2-element Vector{Any}:
371+
1-element Vector{Term{Real, Base.ImmutableDict{DataType, Any}}}:
373372
capacitor₊v(t)
374-
capacitor₊p₊i(t)
375373
```
376374

377375
After structural simplification we are left with a system of only two equations
@@ -419,25 +417,26 @@ variables. Let's see what our observed variables are:
419417
```julia
420418
observed(sys)
421419

422-
18-element Vector{Equation}:
423-
capacitor₊i(t) ~ resistor₊i(t)
424-
ground₊g₊i(t) ~ 0.0
425-
source₊n₊i(t) ~ resistor₊i(t)
426-
source₊i(t) ~ -resistor₊i(t)
427-
source₊p₊i(t) ~ -resistor₊i(t)
428-
capacitor₊n₊i(t) ~ -resistor₊i(t)
420+
19-element Vector{Equation}:
421+
ground₊g₊i(t) ~ 0
429422
resistor₊n₊v(t) ~ capacitor₊v(t)
430-
resistor₊n₊i(t) ~ -resistor₊i(t)
431-
resistor₊p₊i(t) ~ resistor₊i(t)
432-
capacitor₊p₊i(t) ~ resistor₊i(t)
433423
capacitor₊p₊v(t) ~ capacitor₊v(t)
434-
capacitor₊n₊v(t) ~ 0.0
435-
source₊n₊v(t) ~ 0.0
436-
ground₊g₊v(t) ~ 0.0
424+
capacitor₊n₊v(t) ~ 0
425+
source₊n₊v(t) ~ 0
426+
ground₊g₊v(t) ~ 0
437427
source₊v(t) ~ source₊V
438-
source₊p₊v(t) ~ source₊v(t)
439428
resistor₊p₊v(t) ~ source₊v(t)
429+
source₊p₊v(t) ~ source₊v(t)
440430
resistor₊v(t) ~ source₊v(t) - capacitor₊v(t)
431+
capacitor₊i(t) ~ resistor₊v(t) / resistor₊R
432+
resistor₊i(t) ~ capacitor₊i(t)
433+
source₊i(t) ~ -capacitor₊i(t)
434+
resistor₊n₊i(t) ~ -capacitor₊i(t)
435+
resistor₊p₊i(t) ~ capacitor₊i(t)
436+
source₊p₊i(t) ~ -capacitor₊i(t)
437+
source₊n₊i(t) ~ capacitor₊i(t)
438+
capacitor₊p₊i(t) ~ capacitor₊i(t)
439+
capacitor₊n₊i(t) ~ -capacitor₊i(t)
441440
```
442441

443442
These are explicit algebraic equations which can then be used to reconstruct

0 commit comments

Comments
 (0)