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: README.md
+48-3Lines changed: 48 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,52 @@ If a component has a double lined box then it is possible to "look under the hoo
91
91
92
92
Edits made to sub-components can be saved and loaded directly or indirectly.
93
93
94
+
# Pass Thrus
95
+
To generate more esthetic diagrams, one can use as special kind of component called a `PassThru`, which simply defines 2 or more connected `connectors` to serve as a corner, tee, or any other junction. Simply define a component function starting with `PassThru` and ModelingToolkitDesigner.jl will recognize it as a special component type. For example for a corner with 2 connection points:
96
+
97
+
98
+
```julia
99
+
@componentfunctionPassThru2(;name)
100
+
@variables t
101
+
102
+
systems =@namedbegin
103
+
p1 =Pin()
104
+
p2 =Pin()
105
+
end
106
+
107
+
eqs = [
108
+
connect(p1, p2)
109
+
]
110
+
111
+
returnODESystem(eqs, t, [], []; name, systems)
112
+
end
113
+
```
114
+
115
+
And for a tee with 3 connection points
116
+
117
+
```julia
118
+
@componentfunctionPassThru3(;name)
119
+
@variables t
120
+
121
+
systems =@namedbegin
122
+
p1 =Pin()
123
+
p2 =Pin()
124
+
p3 =Pin()
125
+
end
126
+
127
+
eqs = [
128
+
connect(p1, p2, p3)
129
+
]
130
+
131
+
returnODESystem(eqs, t, [], []; name, systems)
132
+
end
133
+
```
134
+
135
+
Adding these components to your system will then allow for corners, tees, etc. to be created. When editing is complete, use the toggle switch to hide the `PassThru` details, showing a more esthetic connection diagram.
ModelingToolkitDesigner.jl comes with icons for the ModelingToolkitStandardLibrary.jl pre-loaded. For custom components, icons are loaded from the `path` variable supplied to `ODESystemDesign()`. To find the path ModelingToolkitDesign.jl is searching, pass the system of interest to `ODESystemDesign()` and replace the `.toml` with `.png`. For example if we want to make an icon for the `sys.vol` component, we can find the path by running...
96
142
@@ -105,10 +151,9 @@ Placing a "FixedVolume.png" file in this location will load that icon.
105
151
ModelingToolkitDesigner.jl colors the connections based on `ModelingToolkitDesigner.design_colors`. Colors for the ModelingToolkitStandardLibrary.jl are already loaded. To add a custom connector color, simply use `add_color(system::ODESystem, color::Symbol)` where `system` is a reference to the connector (e.g. `sys.vol.port`) and `color` is a named color from [Colors.jl](https://juliagraphics.github.io/Colors.jl/stable/namedcolors/).
106
152
107
153
# TODO
108
-
109
154
- Finish adding icons for the ModelingToolkitStandardLibrary.jl
110
155
- Add documentation
111
-
- Support more complex connection paths with bends etc.
112
156
113
157
# [compat]
114
-
ModelingToolkit = "8.50" > needed for Domain feature
158
+
- ModelingToolkit = "8.50" > needed for Domain feature
159
+
- ModelingToolkitStandardLibrary = "1.12" > needed for Hydraulic components
0 commit comments