-
Notifications
You must be signed in to change notification settings - Fork 176
Improve inheritance of classes in MultiBody #4091
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
Draft
tobolar
wants to merge
19
commits into
modelica:master
Choose a base branch
from
tobolar:issue3739_inheritanceMBS
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f0e1859
Extend from PartialTwoFrames
tobolar 9a00453
Extend from PartialTwoFrames
tobolar 5a5913e
Extend from PartialOneFrame_a
tobolar c8fe7dd
Extend from PartialElementaryJoint
tobolar 8e39823
Extend from PartialTwoFrames
tobolar 47cc893
Simplify selection of constraint equations to be used (less error-pro…
tobolar cb8c316
Add base class for constraints
tobolar 0a47813
Inherit from PartialConstraint
tobolar a915324
Omit unnecessary import
tobolar 75549ab
Use frame transformation function for constraint
tobolar ef47ecf
Comment code
tobolar cbf738e
Minor typo
tobolar bf00851
Inherit from PartialConstraint
tobolar 81153b6
Inherite from PartialOneFrame_a
tobolar 8516e70
Revert "Extend from PartialTwoFrames"
tobolar 86d2182
Add and use OneFrame_a and TwoFrames interfaces
tobolar 0b5414c
PartialXxxBaseSensors depend on corresponding interface definitions
tobolar 9227dc1
Inherite from PartialAbsoluteSensor
tobolar 6c93616
Inherite from PartialOneFrame_a
tobolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 2 additions & 3 deletions
5
Modelica/Mechanics/MultiBody/Forces/Internal/ZeroForceAndTorque.mo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| within Modelica.Mechanics.MultiBody.Interfaces; | ||
| partial model OneFrame_a | ||
| "Base model for components providing one frame_a connector and outer world" | ||
|
|
||
| Interfaces.Frame_a frame_a | ||
| "Coordinate system fixed to the component with one cut-force and cut-torque" | ||
| annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); | ||
| protected | ||
| outer Modelica.Mechanics.MultiBody.World world; | ||
|
|
||
| annotation (Documentation(info="<html> | ||
| <p> | ||
| This partial model provides one frame_a connector and access to | ||
| the world object. | ||
| Therefore, inherit from this partial model if both is needed. | ||
| </p> | ||
| </html>")); | ||
| end OneFrame_a; |
73 changes: 73 additions & 0 deletions
73
Modelica/Mechanics/MultiBody/Interfaces/PartialConstraint.mo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| within Modelica.Mechanics.MultiBody.Interfaces; | ||
| partial model PartialConstraint | ||
| "Base model for elementary constraints" | ||
| extends PartialTwoFrames; | ||
|
|
||
| parameter Boolean x_locked=true | ||
| "= true, if constraint force in x-direction, resolved in frame_a" | ||
| annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); | ||
| parameter Boolean y_locked=true | ||
| "= true, if constraint force in y-direction, resolved in frame_a" | ||
| annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); | ||
| parameter Boolean z_locked=true | ||
| "= true, if constraint force in z-direction, resolved in frame_a" | ||
| annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); | ||
|
|
||
| protected | ||
| SI.Position r_rel_a[3] | ||
| "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"; | ||
| Frames.Orientation R_rel | ||
| "Relative orientation object from frame_a to frame_b"; | ||
| SI.InstantaneousPower P "Instantaneous power"; | ||
|
|
||
| equation | ||
| // Determine relative position and orientation | ||
| r_rel_a = Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0); | ||
| R_rel = Frames.relativeRotation(frame_a.R, frame_b.R); | ||
|
|
||
| // Constraint equations concerning translations | ||
| if x_locked then | ||
| r_rel_a[1]=0; | ||
| else | ||
| frame_a.f[1]=0; | ||
| end if; | ||
|
|
||
| if y_locked then | ||
| r_rel_a[2]=0; | ||
| else | ||
| frame_a.f[2]=0; | ||
| end if; | ||
|
|
||
| if z_locked then | ||
| r_rel_a[3]=0; | ||
| else | ||
| frame_a.f[3]=0; | ||
| end if; | ||
|
|
||
| // Force and torque balance | ||
| zeros(3) = frame_a.f + Frames.resolve1(R_rel, frame_b.f); | ||
| zeros(3) = frame_a.t + Frames.resolve1(R_rel, frame_b.t) - cross(r_rel_a, frame_a.f); | ||
| // - cross(r_rel_a, frame_a.f) gives the same result like cross(r_rel_a, Frames.resolve1(R_rel, frame_b.f)) | ||
|
|
||
| // Instantaneous power | ||
| P = frame_a.t * Frames.angularVelocity2(frame_a.R) + | ||
| frame_b.t * Frames.angularVelocity2(frame_b.R) + | ||
| frame_a.f * Frames.resolve2(frame_a.R, der(frame_a.r_0)) + | ||
| frame_b.f * Frames.resolve2(frame_b.R, der(frame_b.r_0)); | ||
|
|
||
| annotation (Documentation(info="<html> | ||
| <p> | ||
| All <strong>elementary joints defined by constraints</strong> should inherit | ||
| from this base model, i.e., joints that are directly defined by constraint | ||
| equations between the two frames. | ||
| </p> | ||
| <p> | ||
| This partial model provides relative kinematic quantities <code>r_rel_a</code> | ||
| and <code>R_rel</code> between the two frame connectors <code>frame_a</code> | ||
| and <code>frame_b</code>, and basic equations constraining translational movement. | ||
| The inheriting class shall additionally provide corresponding equations | ||
| constraining rotational movement. | ||
| </p> | ||
| </html> | ||
| ")); | ||
| end PartialConstraint; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| within Modelica.Mechanics.MultiBody.Interfaces; | ||
| partial model TwoFrames | ||
| "Base model for components providing two frame connectors and outer world" | ||
|
|
||
| Interfaces.Frame_a frame_a | ||
| "Coordinate system a fixed to the component with one cut-force and cut-torque" | ||
| annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); | ||
| Interfaces.Frame_b frame_b | ||
| "Coordinate system b fixed to the component with one cut-force and cut-torque" | ||
| annotation (Placement(transformation(extent={{84,-16},{116,16}}))); | ||
| protected | ||
| outer Modelica.Mechanics.MultiBody.World world; | ||
|
|
||
| annotation ( | ||
| Icon( | ||
| coordinateSystem( | ||
| preserveAspectRatio=true, | ||
| extent={{-100,-100},{100,100}}), | ||
| graphics={ | ||
| Text( | ||
| extent={{-136,-25},{-100,-50}}, | ||
| textColor={128,128,128}, | ||
| textString="a"), | ||
| Text( | ||
| extent={{100,-25},{136,-50}}, | ||
| textColor={128,128,128}, | ||
| textString="b")}), | ||
| Documentation(info="<html> | ||
| <p> | ||
| This partial model provides two frame connectors and access to | ||
| the world object. | ||
| Therefore, inherit from this partial model if the two frame | ||
| connectors are needed. | ||
| </p> | ||
| </html>")); | ||
| end TwoFrames; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.