Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ModelingToolkitDesigner Release Notes

## v1.4
- supports ModelingToolkit v8 and v9

## v1.3
- updating to ModelingToolkit v9

## v1.1.0
- easier component selection (one only needs to click inside the boarder box)

## v1.0.0
- added icon rotation feature

![rotation](https://github.com/bradcarman/ModelingToolkitDesigner.jl/assets/40798837/8c904030-5d4c-4ba8-a105-f0b098ae842a)

- added keyboard commands
- m: after selecting a component, use the `m` key to turn dragging on. This can be easier then clicking and dragging.
- c: connect
- r: rotate


## v0.3.0
- Connector nodes are now correctly positioned around the component with natural ordering

![moving](https://user-images.githubusercontent.com/40798837/242108325-0736b264-5374-4b63-8823-589c0e447de7.gif)


## v0.2.0
- Settings Files (*.toml) Updates/Breaking Changes
- icon rotation now saved with key `r`, previously was `wall` which was not the best name
- connectors nodes now saved with an underscore: `_name`, this helps prevent a collision with nodes named `x`, `y`, or `r`
52 changes: 10 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,9 @@
# ModelingToolkitDesigner.jl

The ModelingToolkitDesigner.jl package is a helper tool for visualizing and editing ModelingToolkit.jl system connections.

# Updates
## v1.4
- supports ModelingToolkit v8 and v9

## v1.3
- updating to ModelingToolkit v9

## v1.1.0
- easier component selection (one only needs to click inside the boarder box)

## v1.0.0
- added icon rotation feature

![rotation](https://github.com/bradcarman/ModelingToolkitDesigner.jl/assets/40798837/8c904030-5d4c-4ba8-a105-f0b098ae842a)

- added keyboard commands
- m: after selecting a component, use the `m` key to turn dragging on. This can be easier then clicking and dragging.
- c: connect
- r: rotate


## v0.3.0
- Connector nodes are now correctly positioned around the component with natural ordering

![moving](https://user-images.githubusercontent.com/40798837/242108325-0736b264-5374-4b63-8823-589c0e447de7.gif)


## v0.2.0
- Settings Files (*.toml) Updates/Breaking Changes
- icon rotation now saved with key `r`, previously was `wall` which was not the best name
- connectors nodes now saved with an underscore: `_name`, this helps prevent a collision with nodes named `x`, `y`, or `r`
The ModelingToolkitDesigner.jl package is a helper tool for visualizing and editing [ModelingToolkit.jl](https://github.com/SciML/ModelingToolkit.jl) system connections.

## Examples
Examples can be found in the "examples" folder.
Examples can be found in the `examples` folder.

### Hydraulic Example

Expand All @@ -49,7 +17,7 @@ Examples can be found in the "examples" folder.

![example3](examples/mechanical.svg)

# Tutorial
## Tutorial

Let's start with a simple hydraulic system with no connections defined yet...

Expand Down Expand Up @@ -119,14 +87,14 @@ connect(vol.port, res.port_b)

After the original `system()` component function is updated with the connection equations, the connections will be re-drawn automatically when using `ModelingToolkitDesigner.view()`. *Note: CairoMakie vector based images can also be generated by passing `false` to the 2nd argument of `view()` (i.e. the `interactive` variable).*

# Hierarchy
## Hierarchy
If a component has a double lined box then it is possible to "look under the hood". Simply select the component and click __open__.

![step8-9](https://user-images.githubusercontent.com/40798837/228666972-14ea5032-52c6-4447-a97b-383356fbcbcf.png)

Edits made to sub-components can be saved and loaded directly or indirectly.

# Pass Thrus
## Pass Thrus
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:


Expand Down Expand Up @@ -172,7 +140,7 @@ Adding these components to your system will then allow for corners, tees, etc. t
![step10-11](https://user-images.githubusercontent.com/40798837/229201536-4444a037-18b3-4efd-bc93-d2c182abf533.png)


# Icons
## Icons
ModelingToolkitDesigner.jl comes with icons for the ModelingToolkitStandardLibrary.jl pre-loaded. For custom components, icons are loaded from either the `path` variable supplied to `ODESystemDesign()` or from an `icons` folder of the package namespace. To find the paths ModelingToolkitDesign.jl is searching, run the following on the component of interest (for example `sys.vol`)

```julia
Expand All @@ -184,7 +152,7 @@ julia> println.(ModelingToolkitDesigner.get_icons(sys.vol, path));

The first file location comes from the `path` variable. The second is looking for a folder `icons` in the component parent package, in this case `ModelingToolkitStandardLibrary`, and the third path is from the `icons` folder of this `ModelingToolkitDesigner` package. The first real file is the chosen icon load path. Feel free to contribute icons here for any other public component libraries.

## Icon Rotation
### Icon Rotation
Rotate an icon using the button or key `r`. The icon rotation is controlled by the `r` atribute in the saved `.toml` design file. The default direction is "E" for east. The image direciton can change to any "N","S","E","W". For example, to rotate the capacitor icon by -90 degrees (i.e. from "E" to "N") simply edit the design file as

```
Expand All @@ -195,12 +163,12 @@ y = 0.29
r = "N"
```

# Colors
## Colors
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/).

# TODO
## TODO
- Finish adding icons for the ModelingToolkitStandardLibrary.jl
- Improve text positioning and fontsize
- How to include connection equations automatically, maybe implement the `input` macro
- Provide `PassThru`'s without requiring user to add `PassThru` components to ODESystem
- Add documentation
- Add documentation
Loading