Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5924 closed defect (duplicate)

annotation(DynamicSelect)

Reported by: Anton Haumer Owned by: adeas31
Priority: critical Milestone: 1.16.0
Component: OMEdit Version: v1.16.0-dev
Keywords: Cc: ahaumer@…, christian@…

Description

OM ignores the
annotation(Icon(Text(textString=DynamicSelect(...)...)...)...);
I would like to use that to provide an experiment to students.
They shall vary a parameter and take notes of the readings (measurements). This is a virtual replacement for a lab experiment - necessary due to the Corona pandemic.
Is there any help available within short?

Attachments (1)

PMP_V16.mo (30.3 KB) - added by ahaumer@… 4 years ago.
Example for annotation(DynamicSelect)

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by ahaumer@…

Example for annotation(DynamicSelect)

comment:1 Changed 4 years ago by casella

  • Component changed from *unknown* to OMEdit
  • Milestone changed from Future to 1.16.0
  • Owner changed from somebody to adeas31
  • Priority changed from high to critical
  • Status changed from new to assigned

@ahaumer, let's see what we can do. I think this would be a very useful feature given the current times. Promoting OMC for virtual labs during the corona crisis would be a good strategy, if we can deliver performance.

@adeas31, how long would it take to add this feature?

comment:2 Changed 4 years ago by adeas31

  • Resolution set to duplicate
  • Status changed from assigned to closed

See #3675 and #5631.

We do have some basic support for DynamicSelect but new frontend is required to evaluate expressions etc. Also right now it is not working if you have Enable new frontend use in the OMC API (faster GUI response) enabled in Tools->Options->Simulation. Disable that option and restart OMEdit.

comment:3 Changed 4 years ago by mwetter

This would be a very desired feature as the IBPSA and Buildings library uses DynamicSelect() in a lot of models. As most users (me included for many weeks) are not likely to know that the setting in Tools->Options->Simulation affects the display in the model editor, it would be nice if in the meantime, until this is fixed, OMEdit could simply render the icon with the first argument of the DynamicSelect() statement. This way, the system model would still be legible.

Below is a small test problem.

within ;
package DynamicSelectTest

  model SystemModel "System model that uses the block"

    TestBlock testBlock
      annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
  end SystemModel;

  block TestBlock "Block that uses dynamic select"
    extends Modelica.Blocks.Icons.Block;
    Real t = time;
    annotation (
    Icon(graphics={
    Text(   extent={{226,60},{106,10}},
            lineColor={0,0,0},
            textString=DynamicSelect("", String(t, leftjustified=false, significantDigits=3))),
         Rectangle(
            extent={{-60,80},{-20,-22}},
            lineColor={28,108,200},
            fillColor=DynamicSelect({0,0,255}, if t > 0.5 then {255,0,0} else {0,0,255}),
            fillPattern=FillPattern.Solid), Text(
            extent={{-44,-32},{20,-62}},
            lineColor={28,108,200},
            fillColor={28,108,200},
            fillPattern=FillPattern.None,
            textString="Test")}));

  end TestBlock;
end DynamicSelectTest;

comment:4 Changed 4 years ago by casella

@mwetter, please follow #5631

Note: See TracTickets for help on using tickets.