Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

problem importing PetriNet

problem importing PetriNet

I was trying to model the example JobShopSystem in Chapter 13 Discrete event, hybrid, and concurrency modelling. the 2nd line of the code says import NormalPetriNet, I copied the entire code correctly but when I tried to run the simulation, nothing happened, there wasn't any graphs like those in the book. can someone tell me what is wrong? Did I import PetriNet wrongly. By the way, the ModelicaAdditions.PetriNets is not shown under the library section when I start OMEdit, but it is in the ModelicaAdditions folder.

Re: problem importing PetriNet

You need to load the ModelicaAdditions library. In OMEdit you can do it like this,

Tools->Options->Libraries then click on Add. Write ModelicaAdditions in the Name field and default in the Value field, click OK and then restart OMEdit.

Adeel.

Re: problem importing PetriNet

Hey adeel, thanks for helping!

I tried that however it didn't work, the ModelicaAddition is still not in the library section and simulation gives nothing. It is because of the location of the file or something? Are there other ways to import?

Re: problem importing PetriNet

Thanks for helping!

I tried that however it didn't work, the ModelicaAddition is still not in the library section and simulation gives nothing. It is because of the location of the file or something? Are there other ways to import?

Re: problem importing PetriNet

Note that the library is called ModelicaAdditions, not ModelicaAddition.

Re: problem importing PetriNet

OpenModelica r14546 can't load this library. I got this,

Code:


loadModel(ModelicaAdditions)
false
[C:/OpenModelica/trunk/build/lib/omlibrary/ModelicaAdditions/Blocks/package.mo:1:1-55:11:writable] Error: Expected the package to have within ModelicaAdditions; but got within ;
Error: Failed to load package ModelicaAdditions (default) using MODELICAPATH C:/OpenModelica/trunk/build/lib/omlibrary.

Adeel.

Re: problem importing PetriNet

ModelicaAdditions is an rather old library and is as far as I know based on Modelica 2.x annotations which OMEdit does not support.
Most of this library is part of the Modelica Standard Library (MSL) now.
I guess Peter F. will update this example in his new book that should come out soon.
See if you cannot find a newer version of the PetriNet library that uses MSL 3.x.

You might be able to load the library with a few minor changes (fixing within, etc) and then
simulate the example but I think you will not be able to see the models in the library.

Cheers,
Adrian Pop/

Re: problem importing PetriNet

The following works to load it, but OMEdit requires MSL 3.1+:

Code:

loadModel(Modelica,{"2.2"});getErrorString();

loadModel(ModelicaAdditions);getErrorString();

Re: problem importing PetriNet

when i added ModelicaAdditions into the library under tools, i restarted OMEditor and it gave me the below messages:

Scripting    15:37:15        0:0-0:0    Failed to load package ModelicaAdditions (default) using MODELICAPATH E:/Tools/Modelica1.9.0/lib/omlibrary.
Grammar    15:37:15    E:/Tools/Modelica1.9.0/lib/omlibrary/ModelicaAdditions/Blocks/package.mo    1:1-55:11    Expected the package to have within ModelicaAdditions; but got within ;

Re: problem importing PetriNet

Even if you managed to load it, OMEdit still wouldn't handle the Modelica 1.x annotations in there. Use ModelicaAdditions from the scripting enviornment (command-line or OMShell). Note that most parts of the library (like MultiBody) are part of MSL 3.x already. And that the PetriNet library has been improved since the ModelicaAdditions release.

See: https://modelica.org/events/modelica201 … elibs.html for PNLib

Re: problem importing PetriNet

Ohh thanks! is the library code available somewhere so that i can test it out?

Re: problem importing PetriNet

OK I think I found it!

Thank you so much for helping me!

Re: problem importing PetriNet

I downloaded that library but I am not sure how to use that. When I try to open it using OpenModelica, no files are loaded. And I can't seem to load this library either.

Re: problem importing PetriNet

Open the file and re-save it to UTF-8 encoding. Or use loadFile("PNlib.mo",encoding="Windows-1252")

Re: problem importing PetriNet

I copied the PetriNets package and imported it to the job shop system model, instead importing it from the modelica library, when i tried to simulate, it gave me error message:
[<interactive>:44:3-44:67:writable] Error: Variable arrival.condition: In modifier (start = true), class or component start not found in <PetriNets.ConditionPort>
Error: Error occurred while flattening model JobShopSystem

There are 0 guests and 0 other users also viewing this topic
You are here: