From 052b95d0d04d533357130635d6ab54a99087c926 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:55:53 +0530 Subject: [PATCH 1/2] docs: rename the `@mtkmodel` docs --- docs/src/basics/MTKModel_Connector.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/basics/MTKModel_Connector.md b/docs/src/basics/MTKModel_Connector.md index 7b92e19ceb..78e135d71c 100644 --- a/docs/src/basics/MTKModel_Connector.md +++ b/docs/src/basics/MTKModel_Connector.md @@ -1,4 +1,4 @@ -# [Components and Connectors](@id mtkmodel_connector) +# [ModelingToolkit Language: Modeling with `@mtkmodel` and `@connectors`](@id mtkmodel_connector) ## MTK Model From de31b29dd71e270a769ca42b5b1292782b00bc55 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:14:39 +0530 Subject: [PATCH 2/2] docs: add a section describing `@mtkbuild` --- docs/pages.jl | 2 +- .../{MTKModel_Connector.md => MTKLanguage.md} | 30 ++++++++++++++++++- docs/src/tutorials/ode_modeling.md | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) rename docs/src/basics/{MTKModel_Connector.md => MTKLanguage.md} (96%) diff --git a/docs/pages.jl b/docs/pages.jl index ff499177bf..a58d1dcf1a 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -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", diff --git a/docs/src/basics/MTKModel_Connector.md b/docs/src/basics/MTKLanguage.md similarity index 96% rename from docs/src/basics/MTKModel_Connector.md rename to docs/src/basics/MTKLanguage.md index 78e135d71c..a2fb7d0870 100644 --- a/docs/src/basics/MTKModel_Connector.md +++ b/docs/src/basics/MTKLanguage.md @@ -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 @@ -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) +``` diff --git a/docs/src/tutorials/ode_modeling.md b/docs/src/tutorials/ode_modeling.md index 2448f88ac6..86ac9b0850 100644 --- a/docs/src/tutorials/ode_modeling.md +++ b/docs/src/tutorials/ode_modeling.md @@ -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