Last active
October 8, 2015 19:28
-
-
Save kenwebb/3378212 to your computer and use it in GitHub Desktop.
Petri nets - various
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNet roleName="Azimuth Chem"> | |
<!-- Azimuth Project - Chemical compounds and reactions | |
http://johncarlosbaez.wordpress.com/2011/01/18/petri-nets/ | |
expected result (markings): | |
11101000 | |
00111000 | |
00001100 | |
00010011 | |
--> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="C" token="1"/> | |
<PlacePN roleName="O2" token="1"/> | |
<PlacePN roleName="NaOH" token="1"/> | |
<PlacePN roleName="CO2" token="0"/> | |
<PlacePN roleName="HCl" token="1"/> | |
<PlacePN roleName="NaHCO3" token="0"/> | |
<PlacePN roleName="H2O" token="0"/> | |
<PlacePN roleName="NaCl" token="0"/> | |
</Places> | |
<Transitions> | |
<TransitionPN roleName="Rone"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='C']"/> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='O2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='CO2']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<TransitionPN roleName="Rtwo"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='NaOH']"/> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='CO2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='NaHCO3']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<TransitionPN roleName="Rthree"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='HCl']"/> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='NaHCO3']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='H2O']"/> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='NaCl']"/> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='CO2']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNetSystem> | |
<!-- | |
An app with two PetriNet (PN) nodes. | |
The two PN share a Place. | |
They can run with different parameters. | |
--> | |
<PetriNet roleName="multiA"> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="p1" token="10"/> | |
<PlacePN roleName="p2" token="30"/> | |
<PlacePN roleName="p3"/> | |
</Places> | |
<Transitions> | |
<TransitionPN roleName="t1"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
<InputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="3" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p3']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> | |
<PetriNetSystem> | |
<PetriNet roleName="multiB" kineticsType="2" p="0.9" timeStepMultiplier="1"> | |
<QueueTransitions shouldAct="false"/> | |
<AnalysisCRN/> | |
<Places> | |
<PlacePN roleName="p1" token="10"/> | |
<PlacePN roleName="p2" token="30"/> | |
<PlacePN roleName="p3"/> | |
</Places> | |
<Transitions> | |
<TransitionPN roleName="t1" count="10"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
<InputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="3" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p3']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<TransitionPN roleName="t2" count="1"> | |
<InputArcs> | |
<!-- the input Place is in the other multi Petri net --> | |
<InputArc weight="1" connector="ancestor::PetriNet/../../PetriNet[@roleName='multiA']/Places/PlacePN[@roleName='p3']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> | |
<!-- grid owner - doesn't work --> | |
<GridOwner rows="50" cols="50" gridCellColor="000020" shouldPlacesMove="true"/> | |
</PetriNetSystem> | |
</PetriNetSystem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNet roleName="one"> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="p1" token="10"/> | |
<PlacePN roleName="p2" token="30"/> | |
<PlacePN roleName="p3"/> | |
</Places> | |
<Transitions> | |
<TransitionPN roleName="t1"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
<InputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="3" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p3']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNet roleName="two"> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="p0" token="1000000"/> | |
<PlacePN roleName="p1" token="1"/> | |
<PlacePN roleName="p2" token="60"/> | |
<PlacePN roleName="p3"/> | |
<PlacePN roleName="p4"/> | |
<PlacePN roleName="p5"/> | |
</Places> | |
<Transitions> | |
<!-- t0 --> | |
<TransitionPN roleName="t0"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p0']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<!-- t1 --> | |
<TransitionPN roleName="t1"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="5" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p3']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<!-- t2 --> | |
<TransitionPN roleName="t2"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p4']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<!-- t3 --> | |
<TransitionPN roleName="t3"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p5']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNet roleName="wikipedia1"> | |
<!-- http://en.wikipedia.org/wiki/File:Animated_Petri_net_commons.gif --> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="p1" token="0"/> | |
<PlacePN roleName="p2" token="0"/> | |
</Places> | |
<Transitions> | |
<!-- incoming Transition --> | |
<TransitionPN roleName="t1"> | |
<!--<InputArcs/>--> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<!-- middle Transition --> | |
<TransitionPN roleName="t2" p="0.5"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</OutputArcs> | |
</TransitionPN> | |
<!-- outgoing Transition --> | |
<TransitionPN roleName="t3" p="0.0"> | |
<InputArcs> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</InputArcs> | |
<!--<OutputArcs/>--> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PetriNet roleName="wikipedia2"> | |
<!-- | |
http://en.wikipedia.org/wiki/File:Petri_Net_A.jpg | |
http://en.wikipedia.org/wiki/File:Petri_Net_B.jpg | |
marking before the transition fires: 2 0 2 | |
marking after the transition fires: 0 2 1 | |
--> | |
<QueueTransitions/> | |
<Places> | |
<PlacePN roleName="p1" token="2"/> <!-- in --> | |
<PlacePN roleName="p2" token="0"/> <!-- out --> | |
<PlacePN roleName="p3" token="2"/> <!-- in --> | |
</Places> | |
<Transitions> | |
<TransitionPN roleName="t"> | |
<InputArcs> | |
<InputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p1']"/> | |
<InputArc weight="1" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p3']"/> | |
</InputArcs> | |
<OutputArcs> | |
<OutputArc weight="2" connector="ancestor::PetriNet/Places/PlacePN[@roleName='p2']"/> | |
</OutputArcs> | |
</TransitionPN> | |
</Transitions> | |
</PetriNet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Fri Aug 17 2012 07:39:29 GMT-0400 (EDT)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Petri nets - various | |
Description: | |
Url: http://www.primordion.com/Xholon/wb/ | |
InternalName: | |
YoutubeId: | |
Keywords: | |
My Notes | |
-------- | |
Various Petri nets. Each is stored as a separate file. | |
How to run the Java app that's included on this Xholon Workbook page:: | |
(1) Click the "Save locally" button at the top of this page. | |
This will assemble the contents of the workbook into a separate web browser page. | |
Position the cursor in the new page and do "Select All" (Ctrl-A). | |
(2) Click the second "Launch" button further down on this page (http://www.primordion.com/Xholon/jnlp/Chameleon_0.jnlp). | |
This will start the Chameleon Java application. It's called Chameleon because if can be changed into anything else. | |
Select "File --> Open". | |
(3) Drag the contents of the workbook into the Chameleon app. | |
Just click on the selected text in the new browser window, and drag it anywhere within the Chameleon window. | |
An SVG image should appear in its own window. | |
(4) Click the "Refresh" button in the Chameleon window. | |
Explore the model to confirm that it has the same structure that's specified on this page. | |
Click the "Start" button to start the simulation. | |
Use the "Pause" and "Step" buttons to pause, unpause, and single-step the simulation. | |
]]></Notes> | |
<script implName="lang:python:inline:"><![CDATA[ | |
]]></script> | |
<script implName="lang:javascript:inline:"><![CDATA[ | |
]]></script> | |
<_-.XholonClass> | |
<PetriNetSystem/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<GridOwner> | |
<port name="petriNet" connector="#xpointer(../PetriNet)"/> | |
</GridOwner> | |
</xholonClassDetails> | |
<PetriNetSystem xmlns:xi="http://www.w3.org/2001/XInclude"> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnOne_csh.xml"/> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnTwo_csh.xml"/> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnWikipedia1_csh.xml"/> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnWikipedia2_csh.xml"/> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnAzimuthChem_csh.xml"/> | |
<xi:include href="https://gist.github.com/kenwebb/3378212/raw/pnMulti_csh.xml"/> | |
</PetriNetSystem> | |
<Blockbehavior implName="lang:python:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<Blockbehavior implName="lang:webEditionjs:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[ | |
]]></Blockbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Petri nets - various</title> | |
<rect id="PetriNetSystem" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment