ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Use mustBeConnected annotation in Sensors

Open tobolar opened this issue 2 years ago • 2 comments

See also #4204

tobolar avatar Nov 06 '23 14:11 tobolar

I noticed that it still a draft and many of the partial models in Modelica.Mechanics.MultiBody.Interfaces haven't been updated.

However, I noticed an issue with mayOnlyConnectOnce - and I think that should be delayed/changed. Basically the annotation refers to the connection set, not connections - but Modelica.Mechanics.MultiBody.Sensors.CutForceAndTorque has two such connectors in a connection set.

The semantics for that annotation(not mustBeConnected) may have been a mistake, but I more believe that the entire restriction have never been needed - having two connections to a frame_resolve doesn't make it over-determined. If we have connect(a, x.frame_resolve); then it doesn't matter if we do connect(b, x.frame_resolve); or connect(a, b);; both generate the same connection set - and in neither case there's a real issue, right?

My limited understanding would indicate that the logic is based on viewing the position connected to frame_resolve as an absolute position; and in that case the some restriction make sense - but in that case the problem also occurs if we have two of them in the connection set even if we didn't directly connect them, right? I also believe that such connections would be detected in other ways. The restriction could also be a stylistic choice, even if not strictly necessary.

HansOlsson avatar Nov 07 '23 09:11 HansOlsson

I noticed that it still a draft and many of the partial models in Modelica.Mechanics.MultiBody.Interfaces haven't been updated.

Yes, this it just a first try and concerns on purpose Sensors only.

However, I noticed an issue with mayOnlyConnectOnce ...

You mean (?)

  connect(cutForce.frame_resolve, frame_resolve);
  connect(cutTorque.frame_resolve, frame_resolve);

IMO you are right and the connection set shall be fine. So obviously mayOnlyConnectOnce is false here and shall be omited. (The originally used assert(cardinality...) didn't get any problem in Dymola.)


The semantics for that annotation(not mustBeConnected) ...

you rather mean mayOnlyConnectOnce again?


Regarding mustBeConnected annotation for frame_a and frame_b: I do believe this could be detected in other ways. But on the other side indicating something like "The connector ZZ was not connected from the outside, and it must be connected since: Connector frame_a should be connected." (resulting in Dymola from used mustBeConnected annotation) seems to be more clear to the user then "The overdetermined connectors XY are connected, but do not have any root defined."

But anyway, IMO we could get rid of assert(cardinality...) in the Sensor models, and possibly also in the multibody library.

@MartinOtter what do you mean?

tobolar avatar Nov 07 '23 15:11 tobolar