-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start PlanarMechanics
module
#220
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
===========================================
- Coverage 54.12% 12.98% -41.15%
===========================================
Files 48 52 +4
Lines 1648 1987 +339
===========================================
- Hits 892 258 -634
- Misses 756 1729 +973 ☔ View full report in Codecov by Sentry. |
I think this idea is great! Down the line we may move this out to a separate SciML/PlanarMechanics to reduce the loading time of the standard library, but we can do any reformatting like that down the line so I wouldn't worry about that right now. For now, just getting more modules is good and we'd be happy to help maintain them. |
test/Mechanical/planar_mechanics.jl
Outdated
e = r / sqrt(r' * r) | ||
@named prismatic = Prismatic(rx = r[1], ry = r[2], ex = e[1], ey = e[2]) | ||
# just testing instantiation | ||
@test true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is @test_nowarn
for testing instantiation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know it 😅 pretty neat!
I will replace it with a proper test case like the Pendulum
and Free body
, it's only temporary for now.
ea52779
to
e885e99
Compare
Is there a way I can do this in MTK, i.e., asserting the number of connections? assert(cardinality(frame_a) > 0, "Connector frame_a must be connected at least once"); |
Not at the moment, but it would be a nice feature to have |
Could you hint where I can start to add this in MTK? |
I'm not sure TBH, but this feature is a debugging feature, the PR here should be good to go without it. Do you feel that the PR has reached a state where it's ready for review? |
Sorrowfully no, but I will resume working on it and get it ready as soon as possible. |
- There is something wrong with the `Revoulte` model and I can't figure it
…doing so" This reverts commit f454f1b.
It's broken but just saving it unit I figure out what is going on with the `FixedTranslation` component
@baggepinnen, @YingboMa, could you take a look at the pendulum model below? ModelingToolkitStandardLibrary.jl/test/Mechanical/planar_mechanics.jl Lines 35 to 61 in 7051dbe
I have been stuck with it for quite long time so far. Why would such a system have 7 states after simplification? it's unlikely to be a problem with |
What are these 7 variables? These equations in phi ~ ifelse(constant_phi === nothing, phi, constant_phi) You are adding the equation The |
Removing it didn't make a difference.
You're right, I needed
|
It looks like MTK has chosen rod variables as state
these are equivalent to the revolute joint angle and angular velocity and should be sufficient as state variables.
Something like this component? i.e., a constant-speed source |
The problem here might be the same problem that we have with the multibody library. Multibody requires JuliaSimCompiler to simpify properly. I tried the pendulum example with JuliaSimCompiler but ran into a bug, so I cannot verify that this is indeed the case julia> sys = structural_simplify(JuliaSimCompiler.IRSystem(model))
ERROR: BoundsError: attempt to access 61-element Vector{Vector{Int64}} at index [62]
Stacktrace:
[1] getindex
@ ./essentials.jl:13 [inlined]
[2] 𝑑neighbors
|
Yes, this is better, I'll add it. |
I merged the main branch into this branch, just in case this bug was fixed in the latest version. |
originally implemented in SciML/ModelingToolkitStandardLibrary.jl#220
Inspired by https://github.com/dzimmer/PlanarMechanics
I'll add all the basic components from the PlanarMechanics Modelica library. Are you OK with adding it to the standard library?