Skip to content
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

Unexpected changes in connector declarations when moving the connector in the icon view #11116

Closed
mpradovelasco opened this issue Sep 4, 2023 · 8 comments · Fixed by #11211
Closed
Assignees
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature COMP/GUI/OMEdit Issue and pull request related to OMEdit
Milestone

Comments

@mpradovelasco
Copy link

mpradovelasco commented Sep 4, 2023

Hi,

I think that the following behaviour is incorrect. If I modify the position of the connector bFreeze in the icon view of AUC block component, defined as:

encapsulated package Metrics
 import Modelica.Blocks.Interfaces.{BooleanOutput,BooleanInput,RealOutput,RealInput};
 ...
 block AUC
  BooleanInput bFreeze "Freeze boolean input signal" 
    annotation(Placement(visible = hold, transformation(origin = {-80, 110}, extent = {{-10, -10}, {10, 10}}, rotation = -90),      
    iconTransformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
   ...
 end AUC;
 ...
end Metrics;

OMEdit updates the connector definition to this one:

Modelica.Blocks.Interfaces.BooleanInput bFreeze "Freeze boolean input signal" 
    annotation(Placement(visible = true, transformation(origin = {-80, 110}, extent = {{-10, -10}, {10, 10}}, rotation = -90),   
     iconTransformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));

This code has two fails:
First, since the package is encapsulated the full prefix definition is not understood.
Second, the boolean "hold" is removed from visible assignation.

This occurs with OMEdit 1.22-dev (26 august) with Enable Instance API = TRUE on Windows 11.

Thanks in advance for your support!

@casella casella added COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature COMP/GUI/OMEdit Issue and pull request related to OMEdit labels Sep 6, 2023
@casella
Copy link
Contributor

casella commented Sep 6, 2023

Yet another corner case failure for the instance-based API. @perost, @adeas31 can you please check?

I guess this should be fixed with high priority in 1.22.0

@casella casella added this to the 1.22.0 milestone Sep 6, 2023
@adeas31
Copy link
Member

adeas31 commented Sep 14, 2023

@mpradovelasco please share the complete model.

@mpradovelasco
Copy link
Author

OK @adeas31 , I review and upload the complete model in a while.

@adeas31
Copy link
Member

adeas31 commented Sep 14, 2023

Don't bother. It doesn't matter now. I have a model for testing.

@mpradovelasco
Copy link
Author

This is a simplified version of the model that replicates the issue:

encapsulated package ConnectorDeclarationGUI
  import Modelica.Blocks.Interfaces.{BooleanOutput,BooleanInput,RealOutput,RealInput};
  import Modelica.Units.SI;
  block AUC "Configurable Area Under the Curve computation block for MCIMCO"
    BooleanInput bFreeze "Freeze boolean input signal" 
      annotation(
      Placement(visible = not hold, transformation(origin = {-80, 110}, extent = {{-10, -10}, {10, 10}}, rotation = -90), 
      iconTransformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
    parameter Boolean hold = false "true if inputs are held constant";
        annotation(
      defaultComponentName = "auc",
      Icon(graphics = {Text(origin = {32, -48}, extent = {{-150, 150}, {150, 110}}, textString = "%name"), 
        Rectangle(lineColor = {0, 0, 255}, fillColor = {251, 255, 230}, fillPattern = FillPattern.Solid, extent = {{-70, 50}, {70, -50}}), 
        Text(origin = {-68, -78}, extent = {{32, 62}, {100, 100}}, textString = "AUC")}),
      Diagram(graphics = {Line(origin = {0, 0.35}, points = {{-80, -88}, {-80, 86}}, color = {100, 100, 100}), 
        Polygon(lineColor = {100, 100, 100}, fillColor = {100, 100, 100}, fillPattern = FillPattern.Solid, points = {{-80, 96}, {-86, 80}, {-74, 80}, {-80, 96}}), 
        Line(origin = {0.35, -60.3}, points = {{-100, 0}, {84, 0}}, color = {100, 100, 100}), 
        Polygon(origin = {0, -60}, lineColor = {100, 100, 100}, fillColor = {100, 100, 100}, fillPattern = FillPattern.Solid, points = {{100, 0}, {84, 6}, {84, -6}, {100, 0}}), 
        Line(origin = {19.8807, -40.2007}, points = {{-100, 0}, {70, 0}}, color = {255, 0, 0}, pattern = LinePattern.Dash), 
        Text(origin = {2, -88}, extent = {{67, 22}, {96, 6}}, textString = "time"), 
        Text(origin = {-154, 58}, extent = {{67, 22}, {96, 6}}, textString = "x"), 
        Line(origin = {0.36588, 0.890442}, points = {{-80, -24}, {-76.7, 0.200001}, {-71.5, 19.1}, {-65.1, 42.4}, {-55.4, 62.6}, {-49.8, 71.1}, {-42.2, 77.8}, {-32.6, 76.6}, {-26.9, 69.7}, {-21.3, 59.4}, {-14.9, 44.1}, {-6.83, 21.2}, {8.1, -26.8}, {15.3, -50.2}, {23.7, -64.2}, {29.3, -73.1}, {35, -78.4}, {40.6, -80}, {46.2, -77.6}, {51.9, -71.5}, {61.5, -51.9}, {67.9, -39.2}, {74, -28.8}, {80, -20}}, color = {0, 0, 255}, smooth = Smooth.Bezier), Text(origin = {-118, -50}, extent = {{49, 30}, {96, 6}}, textString = "xThreshold"), 
        Line(origin = {160.309, 27.5625}, points = {{-80, -88}, {-80, 32}}, color = {100, 100, 100}), 
        Line(origin = {71.6645, 27.3956}, points = {{-80, -88}, {-80, 32}}, color = {100, 100, 100}), 
        Line(origin = {37.8126, -34.0411}, points = {{-46, 83}, {42, 83}}, color = {95, 95, 95}), 
        Polygon(origin = {2, -34}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, points = {{-10, 83}, {-1, 85}, {-1, 81}, {-10, 83}}), 
        Polygon(origin = {30, -34}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, points = {{50, 83}, {42, 85}, {42, 81}, {50, 83}}), 
        Text(origin = {-22, 32}, extent = {{49, 30}, {74, 18}}, textString = "tau"), 
        Polygon(origin = {2, -16}, fillColor = {214, 214, 214}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-10, 2}, {-10, -24}, {10, -24}, {-10, 40}, {-10, 2}}), 
        Polygon(origin = {60, -16}, fillColor = {214, 214, 214}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{20, -4}, {20, -24}, {8, -24}, {14, -14}, {20, -4}})}));
  end AUC;
end ConnectorDeclarationGUI;

Initial icon:

image

After minor modification with mouse dragging:

image

And modified code due to this change (the code not presented below is the same than the initial code):

block AUC "Configurable Area Under the Curve computation block for MCIMCO"
    Modelica.Blocks.Interfaces.BooleanInput bFreeze "Freeze boolean input signal" 
      annotation(
      Placement(visible = true, transformation(origin = {-80, 110}, extent = {{-10, -10}, {10, 10}}, rotation = -90), 
      iconTransformation(origin = {-80, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
    ...
end AUC

I hope this model may help you.
Thanks!

@casella
Copy link
Contributor

casella commented Sep 18, 2023

Almost fixed.

@casella
Copy link
Contributor

casella commented Sep 18, 2023

@mpradovelasco please try the latest nightly build and check that everything's fine for you.

@mpradovelasco
Copy link
Author

Hi @casella,

I have just tested successfully. It goes fine!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/InstBased Interface Issues with new instantiation-based OMEdit feature COMP/GUI/OMEdit Issue and pull request related to OMEdit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants