Skip to content

Commit

Permalink
docs(mtkmodel): update headings sizes and remove stray bullet points
Browse files Browse the repository at this point in the history
* Update heading sizes
* Remove stray bullet points
  • Loading branch information
thazhemadam committed Sep 27, 2023
1 parent ff66232 commit c28326c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions docs/src/basics/MTKModel_Connector.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Defining components with `@mtkmodel`
# Defining components with `@mtkmodel`

`@mtkmodel` is a convenience macro to define ModelingToolkit components. It returns `ModelingToolkit.Model`, which includes a constructor that returns an ODESystem, a `structure` dictionary with metadata and flag `isconnector` which is set to `false`.

### What can an MTK-Model definition have?
## What can an MTK-Model definition have?

`@mtkmodel` definition contains begin blocks of

Expand Down Expand Up @@ -52,7 +52,7 @@ end
end
```

#### `@parameters` and `@variables` begin block
### `@parameters` and `@variables` begin block

- Parameters and variables are declared with respective begin blocks.
- Variables must be functions of an independent variable.
Expand All @@ -67,12 +67,12 @@ julia > ModelingToolkit.getdefault(model_c.v)
2.0
```

#### `@structural_parameters` begin block
### `@structural_parameters` begin block

- This block is for non symbolic input arguements. These are for inputs that usually are not meant to be part of components; but influence how they are defined. One can list inputs like boolean flags, functions etc... here.
- Whenever default values are specified, unlike parameters/variables, they are reflected in the keyword argument list.

#### `@extend` block
### `@extend` block

To extend a partial system,

Expand All @@ -88,7 +88,7 @@ julia> @named model_c = ModelC(; p1 = 2.0)

However, as `p2` isn't listed in the model definition, its default can't be modified by users.

#### `@components` begin block
### `@components` begin block

- Declare the subcomponents within `@components` begin block.
- The arguments in these subcomponents are promoted as keyword arguments as `subcomponent_name__argname` with `nothing` as default value.
Expand All @@ -102,7 +102,7 @@ julia> @named model_c1 = ModelC(; model_a.k1 = 1);

And as `k2` isn't listed in the sub-component definition of `ModelC`, its default value can't be modified by users.

#### `@equations` begin block
### `@equations` begin block

- List all the equations here

Expand Down Expand Up @@ -130,11 +130,8 @@ end
`@connector`s accepts begin blocks of `@components`, `@equations`, `@extend`, `@parameters`, `@structural_parameters`, `@variables`. These keywords mean the same as described above for `@mtkmodel`.

!!! note

For more examples of usage, checkout [ModelingToolkitStandardLibrary.jl](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/)

* * *

### What's a `structure` dictionary?

For components defined with `@mtkmodel` or `@connector`, a dictionary with metadata is created. It lists `:components` (sub-component list), `:extend` (the extended states and base system), `:parameters`, `:variables`, ``:kwargs`` (list of keyword arguments), `:independent_variable`, `:equations`.
Expand Down

0 comments on commit c28326c

Please sign in to comment.