From 1d227774a9db4e3cd1ee8ed04bcb0e1fb035b2ea Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Thu, 28 Sep 2023 09:38:34 +0200 Subject: [PATCH] MTKstdlib 2 and JSComp --- docs/src/examples/free_motion.md | 2 +- docs/src/examples/gearbox.md | 2 +- docs/src/examples/pendulum.md | 7 +++---- docs/src/examples/sensors.md | 1 - docs/src/examples/spherical_pendulum.md | 2 +- docs/src/examples/three_springs.md | 2 +- src/Multibody.jl | 2 +- test/runtests.jl | 8 ++++---- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/src/examples/free_motion.md b/docs/src/examples/free_motion.md index 5b65bec2..fb1d90c2 100644 --- a/docs/src/examples/free_motion.md +++ b/docs/src/examples/free_motion.md @@ -5,7 +5,7 @@ This example demonstrates how a free-floating [`Body`](@ref) can be simulated. T using Multibody using ModelingToolkit using Plots -using SymbolicIR +using JuliaSimCompiler using OrdinaryDiffEq t = Multibody.t diff --git a/docs/src/examples/gearbox.md b/docs/src/examples/gearbox.md index fbcddb60..37db9c46 100644 --- a/docs/src/examples/gearbox.md +++ b/docs/src/examples/gearbox.md @@ -10,7 +10,7 @@ The [`GearConstraint`](@ref) has two rotational axes which do not have to be par using Multibody using ModelingToolkit using Plots -using SymbolicIR +using JuliaSimCompiler using OrdinaryDiffEq t = Multibody.t diff --git a/docs/src/examples/pendulum.md b/docs/src/examples/pendulum.md index 8c024296..e850383f 100644 --- a/docs/src/examples/pendulum.md +++ b/docs/src/examples/pendulum.md @@ -6,7 +6,7 @@ This beginners tutorial will model a pendulum pivoted around the origin in the w To start, we load the required packages ```@example pendulum using ModelingToolkit -using Multibody, SymbolicIR +using Multibody, JuliaSimCompiler using OrdinaryDiffEq # Contains the ODE solver we will use using Plots ``` @@ -94,8 +94,8 @@ A mass suspended in a spring can be though of as a linear pendulum (often referr ![Spring with mass](https://doc.modelica.org/Modelica%203.2.3/Resources/Images/Mechanics/MultiBody/Examples/Elementary/SpringWithMass.png) ```@example pendulum -@named damper = Translational.Damper(0.5) -@named spring = Translational.Spring(1) +@named damper = Translational.Damper(d=0.5) +@named spring = Translational.Spring(c=1) @named joint = Prismatic(n = [0, 1, 0], isroot = true, useAxisFlange = true) connections = [connect(world.frame_b, joint.frame_a) @@ -117,7 +117,6 @@ As is hopefully evident from the little code snippet above, this linear pendulum ### Why do we need a joint? In the example above, we introduced a prismatic joint to model the oscillating motion of the mass-spring system. In reality, we can suspend a mass in a spring without any joint, so why do we need one here? The answer is that we do not, in fact, need the joint, but if we connect the spring directly to the world, we need to make the body (mass) the root object of the kinematic tree instead: ```@example pendulum -using SymbolicIR @named root_body = Body(; m = 1, isroot = true, r_cm = [0, 1, 0], phi0 = [0, 1, 0]) @named multibody_spring = Multibody.Spring(c=1) diff --git a/docs/src/examples/sensors.md b/docs/src/examples/sensors.md index 20e85a0f..09d5bc27 100644 --- a/docs/src/examples/sensors.md +++ b/docs/src/examples/sensors.md @@ -7,7 +7,6 @@ The example below adds a force and a torque sensor to the pivot point of a pendu using Multibody using ModelingToolkit using Plots -using SymbolicIR using OrdinaryDiffEq using LinearAlgebra diff --git a/docs/src/examples/spherical_pendulum.md b/docs/src/examples/spherical_pendulum.md index c70fbe41..03bf6271 100644 --- a/docs/src/examples/spherical_pendulum.md +++ b/docs/src/examples/spherical_pendulum.md @@ -5,7 +5,7 @@ This example models a spherical pendulum. The pivot point is modeled using a [`S using Multibody using ModelingToolkit using Plots -using SymbolicIR +using JuliaSimCompiler using OrdinaryDiffEq t = Multibody.t diff --git a/docs/src/examples/three_springs.md b/docs/src/examples/three_springs.md index 7a14d150..95950cf7 100644 --- a/docs/src/examples/three_springs.md +++ b/docs/src/examples/three_springs.md @@ -9,7 +9,7 @@ The example connects three springs together in a single point. The springs are a using Multibody using ModelingToolkit using Plots -using SymbolicIR +using JuliaSimCompiler using OrdinaryDiffEq t = Multibody.t diff --git a/src/Multibody.jl b/src/Multibody.jl index 52cce046..5ae4688c 100644 --- a/src/Multibody.jl +++ b/src/Multibody.jl @@ -2,7 +2,7 @@ module Multibody using LinearAlgebra using ModelingToolkit -using SymbolicIR +using JuliaSimCompiler import ModelingToolkitStandardLibrary.Mechanical.Rotational import ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica as Translational diff --git a/test/runtests.jl b/test/runtests.jl index 95992cfb..d8a599ea 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -269,7 +269,7 @@ connections = [connect(damper1.flange_b, rev1.axis) damper2, ]) modele = ModelingToolkit.expand_connections(model) -ssys = structural_simplify(model, allow_parameter = false) +# ssys = structural_simplify(model, allow_parameter = false) irsys = IRSystem(modele) ssys = structural_simplify(irsys, alias_eliminate = false) @@ -294,8 +294,8 @@ isinteractive() && ## Linear mass-spring-damper =================================================== # ============================================================================== -@named damper = Translational.Damper(0.5) -@named spring = Translational.Spring(1) +@named damper = Translational.Damper(d=0.5) +@named spring = Translational.Spring(c=1) @named joint = Prismatic(n = [0, 1, 0], isroot = true, useAxisFlange = true) connections = [connect(world.frame_b, joint.frame_a) @@ -433,7 +433,7 @@ equation connect(spring2.frame_a, spring1.frame_b); end ThreeSprings; =# - +## using Multibody using ModelingToolkit using JuliaSimCompiler