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

Parameter order in parameter dialog is sometimes not correct #10167

Closed
niklwors opened this issue Feb 6, 2023 · 4 comments
Closed

Parameter order in parameter dialog is sometimes not correct #10167

niklwors opened this issue Feb 6, 2023 · 4 comments
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

@niklwors
Copy link
Contributor

niklwors commented Feb 6, 2023

Description

For models derived from multiple classes, the order of parameters in the parameter dialog is not correct. The parameters of the base classes are not listed in the correct order. Often it is important that the parameters appear in the order in which they are declared in the model and base models.

Steps to Reproduce

Here is an example for this issue from our BRSL library:

Load the package Rexroth_Generic\package.mo
Drag and drop the component Rexroth_Generic.Hydraulics.Cylinders.DoubleRodCylinder onto a new sheet.
Open the parameter dialog of the cylinder

The order in the paramter dialog is:

dRodA
dPiston
dRodB
stroke
mPiston
g
contactDampingFactor

Expected Behavior

According to the inheritance hierarchy it should be:

dPiston
dRodB
stroke
mPiston
g
contactDampingFactor
dRodA

Screenshots

Version and OS

  • OpenModelica Version: v1.21.0-dev-215-gfbc4a47daf
  • OS: e.g. Windows 10, 64 bit
  • MSL 4.0.0
  • BRSL 2.2.1

Additional Context

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

casella commented Feb 7, 2023

@niklwors, what do you mean by "correct parameter order"? In principle, the semantics of Modelica model is totally independent from the declaration order. Even more so when you have inheritance. What do you expect to get? First the base class defined parameters and then the child class defined parameters?

@niklwors
Copy link
Contributor Author

niklwors commented Feb 7, 2023

Yes, we would expect them to appear in the same order as in the flattened model. The other Modelica tools using also this order.

@perost
Copy link
Member

perost commented Feb 7, 2023

@niklwors, what do you mean by "correct parameter order"? In principle, the semantics of Modelica model is totally independent from the declaration order. Even more so when you have inheritance. What do you expect to get? First the base class defined parameters and then the child class defined parameters?

The parameters from extends should be inserted where the extends are. This is currently not the case with the instance API, it dumps extends and components separately. I don't remember why we designed it like that, but I guess we might have to rethink it.

The question is how to add that information to the JSON. I guess the most straightforward way is to just merge the components and extends into one array, but there are other ways if we want to avoid that. We could for example add "pointers" to the extends in the component array, or just have the information as a completely separate structure. It depends on what @adeas31 thinks is best for OMEdit.

@adeas31
Copy link
Member

adeas31 commented Feb 8, 2023

Why we have them in separate lists is because it makes sense when drawing. First we draw extends and then components.

For parameters I see that we need to maintain order as in the actual Modelica code. I always thought that we are suppose to list components first and then the extends.

@perost I think it doesn't matter what solution you pick since we anyway need to adapt OMEdit to it. So pick the solution that is best for JSON structure.

@adeas31 adeas31 added this to To do in Improvements for BR Feb 10, 2023
@adeas31 adeas31 moved this from To do to In progress in Improvements for BR Feb 24, 2023
adeas31 added a commit to adeas31/OpenModelica that referenced this issue Feb 24, 2023
Improvements for BR automation moved this from In progress to Done Feb 24, 2023
@casella casella added this to the 1.21.0 milestone Feb 24, 2023
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
Development

No branches or pull requests

4 participants