You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/basics/MTKModel_Connector.md
+7-10
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
##Defining components with `@mtkmodel`
1
+
# Defining components with `@mtkmodel`
2
2
3
3
`@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`.
4
4
5
-
###What can an MTK-Model definition have?
5
+
## What can an MTK-Model definition have?
6
6
7
7
`@mtkmodel` definition contains begin blocks of
8
8
@@ -52,7 +52,7 @@ end
52
52
end
53
53
```
54
54
55
-
####`@parameters` and `@variables` begin block
55
+
### `@parameters` and `@variables` begin block
56
56
57
57
- Parameters and variables are declared with respective begin blocks.
58
58
- Variables must be functions of an independent variable.
@@ -67,12 +67,12 @@ julia > ModelingToolkit.getdefault(model_c.v)
67
67
2.0
68
68
```
69
69
70
-
####`@structural_parameters` begin block
70
+
### `@structural_parameters` begin block
71
71
72
72
- 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.
73
73
- Whenever default values are specified, unlike parameters/variables, they are reflected in the keyword argument list.
And as `k2` isn't listed in the sub-component definition of `ModelC`, its default value can't be modified by users.
104
104
105
-
####`@equations` begin block
105
+
### `@equations` begin block
106
106
107
107
- List all the equations here
108
108
@@ -130,11 +130,8 @@ end
130
130
`@connector`s accepts begin blocks of `@components`, `@equations`, `@extend`, `@parameters`, `@structural_parameters`, `@variables`. These keywords mean the same as described above for `@mtkmodel`.
131
131
132
132
!!! note
133
-
134
133
For more examples of usage, checkout [ModelingToolkitStandardLibrary.jl](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/)
135
134
136
-
* * *
137
-
138
135
### What's a `structure` dictionary?
139
136
140
137
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`.
0 commit comments