ModelingToolkitDesigner.jl icon indicating copy to clipboard operation
ModelingToolkitDesigner.jl copied to clipboard

Electrical example does not produce image correctly

Open overskud opened this issue 6 months ago • 7 comments

Followed example using Julia Version 1.11.5 CairoMakie v0.12.18 ModelingToolkit v9.80.5 ModelingToolkitDesigner v1.4.0 ModelingToolkitStandardLibrary v2.21.1

Produced this result Image

overskud avatar Jun 22 '25 10:06 overskud

Mechanical has the same issue

Image

overskud avatar Jun 22 '25 20:06 overskud

I'm checking currently with the latest version of all packages. Can you confirm that you have the "examples/design/Main" folder downloaded with files Circuit.toml and MassSpringDamper.toml?

bradcarman avatar Jun 22 '25 23:06 bradcarman

In examples/design/Main have Circuit.jl Circuit.toml MassSpringDamper.jl MassSpringDamper.toml System.jl System.toml

Added via package manager. Is there a correct method for testing electrical.jl?

overskud avatar Jun 23 '25 06:06 overskud

When you run "examples/electrical.jl", what do you have for design.file? Does it match the path to "examples/design/Main/Circuit.toml"? For example, on my machine, I have the following details....

julia> design.file
"c:\\Work\\Packages\\ModelingToolkitDesigner.jl\\examples\\design\\Main\\Circuit.toml"

julia> pwd()
"C:\\Work\\Packages\\ModelingToolkitDesigner.jl"

(ModelingToolkitDesigner) pkg> st
Project ModelingToolkitDesigner v1.4.0
Status `C:\Work\Packages\ModelingToolkitDesigner.jl\Project.toml`
⌅ [13f3f980] CairoMakie v0.12.18
  [5789e2e9] FileIO v1.17.0
  [d8f44d74] FilterHelpers v0.2.0
⌅ [e9467ef8] GLMakie v0.10.18
⌅ [961ee093] ModelingToolkit v9.80.2
⌃ [16a59e39] ModelingToolkitStandardLibrary v2.21.1
  [fa267f1f] TOML v1.0.3
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`

If you can post the same info, I'll be able to sort out the issue hopefully.

bradcarman avatar Jun 23 '25 16:06 bradcarman

mkdir mechanical cd mechanical cp https://github.com/bradcarman/ModelingToolkitDesigner.jl/blob/master/examples/mechanical.jl to here.

With julia include("mechanical.jl")

creates: mechanical.svg shown above Directories: design/Main design/ModelingToolkitStandardLibrary/Mechanical/Translational

These directories are empty

(@v1.11) pkg> st Status ~/.julia/environments/v1.11/Project.toml ⌅ [13f3f980] CairoMakie v0.12.18 [5789e2e9] FileIO v1.17.0 ⌅ [e9467ef8] GLMakie v0.10.18 ⌅ [961ee093] ModelingToolkit v9.80.6 [23d639d0] ModelingToolkitDesigner v1.4.0 ⌃ [16a59e39] ModelingToolkitStandardLibrary v2.21.1

overskud avatar Jun 25 '25 13:06 overskud

Right, so I see what is happening. If you are going to run mechanical.jl in a directory outside of the ModelingToolkitDesigner.jl directory, then you also need to copy the "design" folder as well. The information about the placement of the components in order to generate the correct layout is located in the "design/Main/Circuit.toml" file. Since that file is missing in your case, the rendered layout is placing the components in a random location.

bradcarman avatar Jun 26 '25 06:06 bradcarman

cp MassSpringDamper.toml design/Main/ rm -rf ModelingToolkitStandardLibrary

With julia include("mechanical.jl")

This produced the expected result.

Image

Also created the empty directory ModelingToolkitStandardLibrary/Mechanical/Translational

Thanks for the help.

overskud avatar Jun 30 '25 19:06 overskud