关于OpenModelica中ExtendedPetriNets库报错的技术咨询
Hey there! Let's tackle your ExtendedPetriNets and OpenModelica compatibility questions head-on.
1. Is this definitely a version compatibility issue?
Absolutely—this is almost certainly a mismatch between the older ExtendedPetriNets V1.0 library and your OmEdit v1.13.2 setup.
OpenModelica has evolved over time, especially in how it handles Modelica's icon-rendering components like Ellipse and Line properties. Here's why the errors happen:
- The missing
Ellipseerror: Older library versions might referenceEllipsewithout a fully qualified namespace (likeModelica.Icons.Ellipse), which OmEdit v1.13.2 now requires for icon components. - The duplicate
Line.pointsmodification: Later OpenModelica releases enforce stricter rules about modifying a component's property multiple times in the same scope—something the V1.0 library's code doesn't account for.
2. How to fix this problem?
Here are practical solutions, ordered by how reliable they are:
Option 1: Upgrade OpenModelica to a newer version
This is the easiest and most robust fix. OpenModelica v1.20 and later have improved compatibility with third-party libraries like ExtendedPetriNets, and many icon-related bugs from older versions (like v1.13.2) are resolved. Just grab the latest stable release, install it, reimport the library, and your errors should vanish.
Option 2: Manually patch the library code
If upgrading isn't an option right now, you can tweak the library's icon code to match OmEdit v1.13.2's requirements:
- For the missing
Ellipseerror: In every<Icon>section whereEllipseis used, replace the bareEllipsewith the fully qualified pathModelica.Icons.Ellipse. - For the duplicate
Line.pointserror: Go to line 569 of the ExtendedPetriNets code (as noted in your error). You'll find two separate lines modifyingLine.points—merge these into one single assignment that defines all the points at once (e.g., combine two partial point lists into a complete set).
Option 3: Check for an updated ExtendedPetriNets release
The library might have a newer version that's already patched to work with modern OpenModelica. Look for updates in the library's repository—if a newer build exists, download it and replace your current V1.0 copy.
Option 4: Temporarily ignore icon errors (last resort)
If you only care about the functional Petri net logic and don't mind missing icons, you can configure OmEdit to suppress icon-related errors. Head to OmEdit's settings, find the error-checking preferences, and disable checks for icon component issues. Note this is a temporary workaround and won't fix the root compatibility problem.
内容的提问来源于stack exchange,提问作者mnx

