Skip to content

Commit 1541500

Browse files
spelling and minor changes
1 parent 48bc6e5 commit 1541500

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/src/tutorials/custom_component.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Custom Component
2-
In this tutorial the creation of a custom component is demonstrated via the [Chua's circuit](https://en.wikipedia.org/wiki/Chua%27s_circuit).
2+
In this tutorial, the creation of a custom component is demonstrated via the [Chua's circuit](https://en.wikipedia.org/wiki/Chua%27s_circuit).
33
The circuit is a simple circuit that shows chaotic behaviour.
44
Except for a non-linear resistor every other component already is part of `ModelingToolkitStandardLibrary.Electrical`.
55

6-
First we need to make some imports.
6+
First, we need to make some imports.
77
```@example components
88
using ModelingToolkit
99
using ModelingToolkitStandardLibrary.Electrical
@@ -26,7 +26,7 @@ equation
2626
i = if (v < -Ve) then Gb*(v + Ve) - Ga*Ve else if (v > Ve) then Gb*(v - Ve) + Ga*Ve else Ga*v;
2727
end NonlinearResistor;
2828
```
29-
this can almost be directly translate it to the syntax of `ModelingToolkit`.
29+
this can almost be directly translated to the syntax of `ModelingToolkit`.
3030
```@example components
3131
@parameters t
3232
@@ -49,26 +49,26 @@ nothing # hide
4949
```
5050

5151
### Explanation
52-
All components in `ModelingToolkit` are created via a function that serves as the constructor and returns some form of system, in this case a `ODESystem`.
52+
All components in `ModelingToolkit` are created via a function that serves as the constructor and returns some form of system, in this case, an `ODESystem`.
5353
Since the non-linear resistor is essentially a standard electrical component with two ports, we can extend from the `OnePort` component of the library.
5454
```julia
5555
@named oneport = OnePort()
5656
```
5757
This creates a `OnePort` with the `name = :oneport`.
58-
For easier notation we can unpack the states of the component
58+
For easier notation, we can unpack the states of the component
5959
```julia
6060
@unpack v, i = oneport
6161
```
6262
It might be a good idea to create parameters for the constants of the `NonlinearResistor`.
6363
```julia
6464
pars = @parameters Ga=Ga Gb=Gb Ve=Ve
6565
```
66-
The syntax looks funny but it simply creates symbolic parameters with the name `Ga` where it's default value is set from the function's argument `Ga`.
67-
While this is not strictly necessary it allows the user to `remake` the problem easily with different parameters or allow for auto-tuning or parameter optimization without having to do all costly steps that may be involved with building and simplifying a model.
66+
The syntax looks funny but it simply creates symbolic parameters with the name `Ga` where its default value is set from the function's argument `Ga`.
67+
While this is not strictly necessary it allows the user to `remake` the problem easily with different parameters or allow for auto-tuning or parameter optimization without having to do all the costly steps that may be involved with building and simplifying a model.
6868
The non-linear (in this case piece-wise constant) equation for the current can be implemented using `IfElse.ifelse`.
6969
Finally, the created `oneport` component is extended with the created equations and parameters.
70-
In this case no extra state variables are added, hence an empty vector is supplied.
71-
The independent variable `t` needs to be supplied as second argument.
70+
In this case, no extra state variables are added, hence an empty vector is supplied.
71+
The independent variable `t` needs to be supplied as the second argument.
7272
```julia
7373
extend(ODESystem(eqs, t, [], pars; name=name), oneport)
7474
```
@@ -105,7 +105,7 @@ nothing # hide
105105

106106
## Simulating the Model
107107
Now the model can be simulated.
108-
First `structural_simplify` is called on the model and a `ODEProblem` is build from the result.
108+
First, `structural_simplify` is called on the model and an `ODEProblem` is built from the result.
109109
Since the initial voltage of the first capacitor was already specified via `v_start`, no initial condition is given and an empty pair is supplied.
110110
```@example components
111111
sys = structural_simplify(model)

docs/src/tutorials/rc_circuit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RC Circuit Model
22

33
This tutorial is a simplified version of the [RC circuit tutorial in the
4-
ModelingToolkit.jl documentation](https://mtk.sciml.ai/dev/tutorials/acausal_components/).
4+
`ModelingToolkit.jl` documentation](https://mtk.sciml.ai/dev/tutorials/acausal_components/).
55
In that tutorial, the full RC circuit is built from scratch. Here, we will use the
66
components of the `Electrical` model in the ModelingToolkit Standard Library to simply
77
connect pre-made components and simulate the model.

0 commit comments

Comments
 (0)