Skip to content

Commit

Permalink
docs: add a section describing @mtkbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ven-k committed Jul 24, 2024
1 parent 052b95d commit de31b29
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pages = [
"basics/Composition.md",
"basics/Events.md",
"basics/Linearization.md",
"basics/MTKModel_Connector.md",
"basics/MTKLanguage.md",
"basics/Validation.md",
"basics/DependencyGraphs.md",
"basics/Precompilation.md",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [ModelingToolkit Language: Modeling with `@mtkmodel` and `@connectors`](@id mtkmodel_connector)
# [ModelingToolkit Language: Modeling with `@mtkmodel`, `@connectors` and `@mtkbuild`](@id mtk_language)

## MTK Model

Expand Down Expand Up @@ -441,3 +441,31 @@ Using ternary operator or if-elseif-else statement, conditional initial guesses
end
end
```

## Build structurally simplified models:

`@mtkbuild` builds an instance of a component and returns a structurally simplied `ODESystem`.

```julia
@mtkbuild sys = CustomModel()
```

This is equivalent to:

```julia
@named model = CustomModel()
sys = structural_simplify(model)
```

Pass keyword arguments to `structural_simplify` using the following syntax:

```julia
@mtkbuild sys=CustomModel() fully_determined=false
```

This is equivalent to:

```julia
@named model = CustomModel()
sys = structural_simplify(model; fully_determined = false)
```
2 changes: 1 addition & 1 deletion docs/src/tutorials/ode_modeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ Where to go next?
- Not sure how MTK relates to similar tools and packages? Read
[Comparison of ModelingToolkit vs Equation-Based and Block Modeling Languages](@ref).
- For a more detailed explanation of `@mtkmodel` checkout
[Defining components with `@mtkmodel` and connectors with `@connectors`](@ref mtkmodel_connector)
[Defining components with `@mtkmodel` and connectors with `@connectors`](@ref mtk_language)
- Depending on what you want to do with MTK, have a look at some of the other
**Symbolic Modeling Tutorials**.
- If you want to automatically convert an existing function to a symbolic
Expand Down

0 comments on commit de31b29

Please sign in to comment.