Opened 8 years ago

Closed 8 years ago

#4124 closed defect (fixed)

Does fill() create equations?

Reported by: Volker Waurich Owned by: Volker Waurich
Priority: high Milestone: 1.11.0
Component: Backend Version:
Keywords: external objects, alias Cc: Per Östlund, Bernhard Thiele

Description (last modified by Volker Waurich)

Hi,

In Modelica_DeviceDrivers, there is a Serialpackager class which gets a Modelica_DeviceDrivers.Packaging.SerialPackager model as an input and then, passes this object via a connector to the attached Serialpackager. These packages are meant to be the same object/variable/memory among all connected SerialPackagers. There is no alias equation in the model, only:

if nu == 1 then
    pkgOut.pkg = fill(pkgIn.pkg, nu);

The frontend does not create any alias equation which matters since these are external objects.
What is needed here, is the equation: pkgOut[1].pkg = pkgIn.pkg
This is not the case. Can you reveal this information somehow?
I will care of the backend stuff.

Attachments (1)

test_Ext.mo (1.6 KB ) - added by Volker Waurich 8 years ago.

Download all attachments as: .zip

Change History (17)

by Volker Waurich, 8 years ago

Attachment: test_Ext.mo added

comment:1 by Volker Waurich, 8 years ago

Description: modified (diff)

comment:2 by Volker Waurich, 8 years ago

{fill()} does create alias equations for non-external objects. Only for external objects, its missing.

Version 0, edited 8 years ago by Volker Waurich (next)

comment:3 by Adrian Pop, 8 years ago

I'll look into it.

comment:4 by Adrian Pop, 8 years ago

Status: newaccepted

comment:5 by Adrian Pop, 8 years ago

PR1194 should fix this, running it now.

comment:6 by Adrian Pop, 8 years ago

Owner: changed from Adrian Pop to Volker Waurich
Status: acceptedassigned

Fixed the frontend part in 20336d/OMCompiler. Added test in 8898d5/OpenModelica-testsuite.
@vwaurich: take it away.

comment:7 by Adrian Pop, 8 years ago

Component: FrontendBackend
Milestone: Future1.11.0

comment:8 by Volker Waurich, 8 years ago

Thanks for the very quick fix.

comment:9 by Martin Sjölund, 8 years ago

Except you are not allowed to create aliases or assignments to external objects and this should simply not work in a Modelica compiler...

comment:10 by Bernhard Thiele, 8 years ago

Well, if it can work, I think it should work. It is really useful even if it is not perfect. Maybe we figure out a better way to achieve the same in the future, but for moment I really appreciate that there is a drive to support that feature also in OMC.

comment:11 by Volker Waurich, 8 years ago

@sjoelund Is there a reference about it? I would like to add a notification if external objects are assigned an alias.

comment:12 by Martin Sjölund, 8 years ago

Spec says:

Only the constructor may return external objects and external object can only be bound in component declarations and neither modified later nor assigned to.

I guess inner/outer could possibly be a shared external object, but not connections :(

I would have made it an error that tells the user to enable debug-flags for this behavior to be supported (and only allow it for connections or alias equations, not bindings or assignments).

See also: https://trac.modelica.org/Modelica/ticket/1669

comment:13 by Volker Waurich, 8 years ago

Thanks for the info.
Shall we name the flag "+d=allowExternalAlias" or "+pedantic=false" ;)
Anyway, I am glad that OMC supports this for now.

comment:14 by Adrian Pop, 8 years ago

If we can do more than the specification says, I don't see a reason why we should not do it.
We can give warnings for these things but I think we should support this by default.

comment:15 by Bernhard Thiele, 8 years ago

I completely agree.

comment:16 by Volker Waurich, 8 years ago

Resolution: fixed
Status: assignedclosed

I added a warning and will close the ticket.

Note: See TracTickets for help on using tickets.