Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#4062 closed defect (fixed)

External Object Alias

Reported by: Volker Waurich Owned by: Volker Waurich
Priority: high Milestone: 1.11.0
Component: Frontend Version:
Keywords: Cc: Adrian Pop, Per Östlund, Mahder Alemseged Gebremedhin, Bernhard Thiele

Description

Hi,
In the attached Model, 2 objects are connected with the following connectors whereas pkg extends ExternalObject:

connector PackageOut "Packager output connector"
  output Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
  output Boolean trigger;
  output Real dummy;
  input Boolean backwardTrigger;
  input Integer userPkgBitSize;
  input Integer autoPkgBitSize;

and

connector PackageIn "Packager input connector"
  input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
  input Boolean trigger;
  input Real dummy;
  output Boolean backwardTrigger;
  output Integer userPkgBitSize;
  output Integer autoPkgBitSize;

With dumpdaelow, I see the following alias equations:

8/8 serialReceive.pkgOut.autoPkgBitSize = unpackInt.pkgIn.autoPkgBitSize
9/9 serialReceive.pkgOut.backwardTrigger = unpackInt.pkgIn.backwardTrigger
10/10 serialReceive.pkgOut.dummy = unpackInt.pkgIn.dummy
11/11 serialReceive.pkgOut.trigger = unpackInt.pkgIn.trigger
12/12 serialReceive.pkgOut.userPkgBitSize = unpackInt.pkgIn.userPkgBitSize 

The alias assignment for the external object is missing:

serialReceive.pkgOut.pkg= unpackInt.pkgIn.pkg

Can you retrieve the information that connected external objects are equal like in this input-output connection?
I can take care of the backend handling, but I would ask you to deal with the frontend.

Thanks.

Attachments (2)

MDD_test.mo (1.4 KB ) - added by Volker Waurich 8 years ago.
test model
simulate.mos (180 bytes ) - added by Volker Waurich 8 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 by Volker Waurich, 8 years ago

Sorry, cannot attache files due to "IndexError: pop from empty list"

comment:2 by Volker Waurich, 8 years ago

model MDD_test

  Modelica_DeviceDrivers.Blocks.Communication.SerialPortReceive serialReceive(
    Serial_Port="COM3",
    baud=Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate.B9600,
    parity=0,
    startTime=0.1,
    userBufferSize=2,
    sampleTime=2,
    enableExternalTrigger=false)
    annotation (Placement(transformation(extent={{-82,16},{-62,36}})));
  Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.UnpackUnsignedInteger unpackInt(bitOffset=
       0, width=16)
    annotation (Placement(transformation(extent={{-62,-14},{-42,6}})));
  Modelica.Blocks.Math.IntegerToReal integerToReal
    annotation (Placement(transformation(extent={{-30,-14},{-10,6}})));
equation 

  connect(serialReceive.pkgOut,unpackInt. pkgIn) annotation (Line(
      points={{-61.2,26},{-52,26},{-52,6.8}}));
  connect(unpackInt.y,integerToReal. u) annotation (Line(
      points={{-41,-4},{-32,-4}},
      color={255,127,0},
      smooth=Smooth.None));
  annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200,
            -100},{100,100}}), graphics),
    experiment(
      StopTime=15,
      Tolerance=0.001,
      __Dymola_fixedstepsize=0.001,
      __Dymola_Algorithm="Euler"),
    __Dymola_experimentSetupOutput,
    Icon(coordinateSystem(extent={{-200,-100},{100,100}})));
end MDD_test;
Last edited 8 years ago by Adrian Pop (previous) (diff)

comment:3 by Volker Waurich, 8 years ago

The mos file:

loadModel(Modelica);getErrorString();
loadModel(Modelica_DeviceDrivers); getErrorString();
loadFile("MDD_test.mo"); getErrorString();
simulate(MDD_test); getErrorString();

comment:4 by Adrian Pop, 8 years ago

@vwaurich: you go to Preferences and select language to English. Then you should be able to upload files. The DE locale has issues with Trac.

by Volker Waurich, 8 years ago

Attachment: MDD_test.mo added

test model

by Volker Waurich, 8 years ago

Attachment: simulate.mos added

comment:5 by Adrian Pop, 8 years ago

Fixed in: bb8669/OMCompiler. We now generate also the connect for the ExternalObject present in connectors:

serialReceive.pkgOut.pkg = unpackInt.pkgIn.pkg;

@vwaurich: can you check if it works fine for you and close the ticket if so?
I will add a test also.

comment:6 by Adrian Pop, 8 years ago

Last edited 8 years ago by Adrian Pop (previous) (diff)

comment:7 by Adrian Pop, 8 years ago

Owner: changed from somebody to Volker Waurich
Status: newassigned

@vwaurich: the front-end part of this is done, you can play with the back-end part.

comment:8 by Volker Waurich, 8 years ago

Thanks a lot for the quick fix.
I have added functionality to assign alias variables, replace expressions etc. to BackendDAECreate.mo. Its now in master and works for my model.

comment:9 by Volker Waurich, 8 years ago

Resolution: fixed
Status: assignedclosed

comment:10 by Adrian Pop, 8 years ago

Maybe you can add a test with simulation too as the test I added just tests flattening.

comment:11 by Martin Sjölund, 7 years ago

Milestone: Future1.11.0
Note: See TracTickets for help on using tickets.