sarahtattersall / pipecore Goto Github PK
View Code? Open in Web Editor NEWCore libraries for building and editing Petri nets
Core libraries for building and editing Petri nets
Provide some sort of way to layout a Petri net
Now that PIPECore is pretty stable design some good interfaces :)
Given place P0, transition T0 and one inbound arc "P0 TO T0", if P0 is empty and arc "P0 TO T0" has an arc weight expression "#(P0)" (i.e., "the weight of this arc is the number of tokens in P0"), then the transition T0 is enabled. It shouldn't be.
When multiple transitions can be fired (I tested for choice, conflict: one place goes out to two transitions), always one transition is ignored and never fired (no matter how often you repeat).
Problem is: in PetriNetAnimator.java (in pipe.animation) in getRandomEnabledTransition the correct index is produced - but this is in [0, number_possible_fired_transitions - 1], but the for loop used for getting to the transition at that specific index starts at 1 - therefore it can never reach the last element of the Collection of fire-able transitions (line 80, should be corrected to for (int i = 0; i < index; i++) )
Stacktrace:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at uk.ac.imperial.pipe.models.PetriNetHolder.getNet(PetriNetHolder.java:41)
at uk.ac.imperial.pipe.io.PetriNetIOImpl.read(PetriNetIOImpl.java:78)
at uk.ac.imperial.pipe.models.manager.PetriNetManagerImpl.createFromFile(PetriNetManagerImpl.java:95)
at pipe.controllers.application.PipeApplicationController.createNewTabFromFile(PipeApplicationController.java:169)
The real problem is that there are no messages given when errors are found while reading the pnml. If an error prevents the Petri net from being built, we next attempt to read the first (non-existent) PN, causing this exception.
Is there some API (.jar library) in order to use PIPE utilities in java?
Infinite server semantics are not supported.
Use the example gspn1.xml from PIPE it loads 0 arcs!
For my use case, I'd like to add data to the petrinets so as to make integration with a client application easier. Ideally, it would be possible to make annotations in the GUI and use them programatically after loading the petri net using the java api. Thus the client application can query the petri net about enabled transitions and marked places and use the annotations on those items to interpret them and decide which transitions to fire.
Is there any way to embed data that can be accessed via the java api? So far, the only solution I see is to use the id
field (the 'name' is not shown/accessible in the GUI), which is ok as long as there are no duplicates in the data I want to annotate, and as long as a simple ID is all I need (but I am thinking about a solution that would require more data to be embedded).
A rate parameter can be created whose value is "#(P0)", i.e., referencing the number of tokens in place P0. If the Petri net is saved and then re-opened from the xml file, I get:
InvalidRateException: Rate of #(P0) is invalid (this message is only visible after the fix for issue 22)
Processing stops and the Petri net is not built.
The error is as follows:
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.029 sec <<< FAILURE! - in PipeTest
verifyExampleNetLoadsAndAnimates(PipeTest) Time elapsed: 0.025 sec <<< ERROR!
java.lang.reflect.InvocationTargetException: null
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1288)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1263)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1347)
at Pipe.runPipeForTesting(Pipe.java:37)
at PipeTest.setUp(PipeTest.java:31)
Caused by: java.lang.NullPointerException: null
at javax.swing.ImageIcon.(ImageIcon.java:205)
at pipe.views.PipeApplicationView.(PipeApplicationView.java:129)
at pipe.views.PipeApplicationBuilder.build(PipeApplicationBuilder.java:54)
at Pipe.(Pipe.java:17)
at Pipe.(Pipe.java:9)
at Pipe$1.run(Pipe.java:31)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
verifyMenusAddedToGui(PipeTest) Time elapsed: 0.004 sec <<< ERROR!
java.lang.reflect.InvocationTargetException: null
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1288)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1263)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1347)
at Pipe.runPipeForTesting(Pipe.java:37)
at PipeTest.setUp(PipeTest.java:31)
Caused by: java.lang.NullPointerException: null
at javax.swing.ImageIcon.(ImageIcon.java:205)
at pipe.views.PipeApplicationView.(PipeApplicationView.java:129)
at pipe.views.PipeApplicationBuilder.build(PipeApplicationBuilder.java:54)
at Pipe.(Pipe.java:17)
at Pipe.(Pipe.java:9)
at Pipe$1.run(Pipe.java:31)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Results :
Tests in error:
PipeTest.setUp:31 ? InvocationTarget
PipeTest.setUp:31 ? InvocationTarget
Tests run: 207, Failures: 0, Errors: 2, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PIPE Parent Project ................................ SUCCESS [ 0.262 s]
[INFO] pipe-module-gui .................................... SUCCESS [01:34 min]
[INFO] PIPE-gui ........................................... FAILURE [ 4.700 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:39 min
[INFO] Finished at: 2016-01-18T13:07:03+08:00
[INFO] Final Memory: 35M/372M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project PIPE-gui: There are test failures.
[ERROR]
[ERROR] Please refer to F:\github\PIPE\pipe-gui\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :PIPE-gui
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.