Opened 6 years ago

Last modified 3 years ago

#5175 new defect

OMEdit cannot create models as separate .mo files

Reported by: Francesco Casella Owned by: Adeel Asghar
Priority: critical Milestone:
Component: OMEdit Version:
Keywords: Cc: albertoleva

Description

Steps to replicate the issue:

  • open the attached package
  • right-click on TestPackage, select New Modelica class
  • create a Model

Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.

Ditto for other types of classes like function, connector, etc.

Of course you can create a package as a separate file, then edit its code and change the package keyword into model or other types of classes, but that's more like a hack.

Attachments (1)

TestPackage.zip (525 bytes ) - added by Francesco Casella 6 years ago.
Zip file of the package

Download all attachments as: .zip

Change History (10)

comment:1 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:2 by Adeel Asghar, 6 years ago

There is not attachment.

How the things are stored is driven by the package.

  1. If the package is created with option Save contents in one file then all the nested classes are stored inside it and you can't choose to save as separate .mo file since the directory structure doesn't make sense then.
  2. If the package is created without option Save contents in one file then the nested classes are saved as separate.mo but you can have a nested package with option Save contents in one file and then for its all nested classes rule 1 will apply.

Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.

In this case how the model is saved depends on how the package was created. If it was created with option Save contents in one file then its the model is saved in the same .mo file otherwise its saved in a separate .mo file.

in reply to:  2 comment:3 by Francesco Casella, 6 years ago

Replying to adeas31:

There is not attachment.

Sorry about that, please find it attached.

How the things are stored is driven by the package.

  1. If the package is created with option Save contents in one file then all the nested classes are stored inside it and you can't choose to save as separate .mo file since the directory structure doesn't make sense then.

Sure, but that's not the case here. An empty package was created without that option, resulting in a directory with the package name, containing a package.mo file with the package declaration and nothing else.

  1. If the package is created without option Save contents in one file then the nested classes are saved as separate.mo but you can have a nested package with option Save contents in one file and then for its all nested classes rule 1 will apply.

Exactly.

Unfortunately there is no way to select whether you want the model to be saved as a separate .mo file or within the existing (package.mo) file. This is only possible with Packages.

That's precisely the point of this ticket. I don't see any reason for this restriction, and I actually found myself in a use case where I had to do this manually, which is kind of awkward. I then propose to make this possible with the GUI. Is there any technical reason why this should be hard or impossible to implement?

by Francesco Casella, 6 years ago

Attachment: TestPackage.zip added

Zip file of the package

comment:4 by Francesco Casella, 6 years ago

In fact, my original description of the issue was inaccurate and misleading, sorry about that. I try once more.

When you create a new package P in TestPackage, you can indeed decide to put it in a single file P.mo inside the TestPackage directory, or to put it in a directory TestPackage/P containing a package.mo file. What you can't do with both with a new package and with a new model, is to put them inside package.mo. I understand this maybe considere as a somewhat odd practice, but it is nevertheless allowed by the specification, which reads

13.2.2.1 Mapping a Package/Class Hierarchy into a Directory Hierarchy (Structured Entity)

A directory shall contain a node, the file package.mo . The node shall contain a stored-definition that defines a class [A] with a name matching the name of the structured entity. [The node typically contains documentation and graphical information for a package, but may also contain additional elements of the class A.]

Maybe this is not a feature required by many users, but it would be nevertheless nice if one had the option of storing new classes (of any kind, including package, class, function, type, etc.) in the package.mo file, when the package in which you want to create the new class is stored in a directory.

comment:5 by Adeel Asghar, 6 years ago

Aha, at least its now clear for me what you want :)
I will see how this can be achieved.

Last edited 6 years ago by Adeel Asghar (previous) (diff)

comment:6 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:7 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:8 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:9 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.