-
Notifications
You must be signed in to change notification settings - Fork 31
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
Assignment of external objects not conform with MLS #54
Comments
I don't think that the auto propagation logic is wrong, but I agree that it is contrived. The external object is propagated through causal connectors, so the first block (that which doesn't have an input) needs to construct the external object. The problem is that we need to know the required size of the buffer when constructing it. For this an initial equations system is used which determines the buffer size. I just tested the fix that you proposed Regarding the specification I'm not so dead sure how to interpret it. If one is not allowed to "assign" to external objects, then even the constructor can't assign to it? Isn't assignment used in the MLS in the sense of algorithmic assignment while otherwise we talk from binding equations, e.g., MLS 3.3 Section 3.8: "For an assignment v:=expr or binding equation v=expr, v must be declared to be at least as variable as expr."? Anyway, I don't like the complex propagation stuff myself so much and thought about adding an alternative simpler packaging system but never did it. Are you aware that there is already an option to use a fixed buffer size? You can set parameter |
Quick answer: Please read again: External objects can only be bound in component declarations. Assigments in equation or algorithm sections are not legal. |
Longer answer: I changed the constuction of all external object instances to component declarations (as suggested above). This way SimulationX finally was able to successfully finish the symbolic analysis, i.e. resulted in a runnable simulation model. The problem then was that the buffer size was zero and hence adding the first data to the package failed (with ModelicaError). I did not yet switch the useBackwardPropagatedBufferSize parameter to false. I will try it next week. |
Please test my proposed changes and pull them if you want. |
Merged your branch in a42cb1b I can't test it in the moment in Dymola due to our license being use by somebody else, but it looks good... |
Thanks for merging. Please do test once you have the license. |
Just tested it and it worked fine. |
See https://trac.modelica.org/Modelica/ticket/1669 and https://trac.modelica.org/Modelica/ticket/1705 for related issues on external objects. |
Customer asked for UDP support in SimulationX. Thus I tried to figure out why SerialPackager fails in SimulationX. The reason is that the external objects, i.e. there constructors are used in assignments which is illegal according to the MLS 3.3 (rev 1) section 12.9.7: "Only the constructor may return external objects and external object can only be bound in component declarations and neither modified later nor assigned to."
Thus the current design of the SerialPackager and the Communication package is bad in two ways 😒
when initial()
is not legal at all.Whereas SimulationX is tolerant with the first problem the second problem is a really bad design failure. I changed the construction of the external object from something like
to
which still violates the first problem but could fix the second one. However, this now reveals the bad design of the auto propagation of the buffer size. It is not clear which external object defines the auto buffer size and which external object uses the derived buffer size.
In the need for a quick fix for the second problem I would consider to either use a fixed buffer size or refer to some global parameters like e.g. Modelica.Mechanics.MultiBody.World of the MSL holds.
@bernhard-thiele, @MartinOtter What do you think? Can we find a workaround in order to get the customer project running soon? Do you have other ideas to fix the second problem (or even the first problem to make the library really standard conform)? I am willing to contribute of course.
The text was updated successfully, but these errors were encountered: