|
<?xml version="1.0" encoding="UTF-8"?> |
|
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Fri Aug 17 2012 14:33:34 GMT-0400 (EDT)--> |
|
<XholonWorkbook> |
|
|
|
<Notes><![CDATA[ |
|
Xholon |
|
------ |
|
Title: Petri net - Climate model |
|
Description: |
|
Url: http://www.primordion.com/Xholon/wb/ |
|
InternalName: |
|
YoutubeId: |
|
Keywords: |
|
|
|
My Notes |
|
-------- |
|
This is a simple climate model, implemented as a Petri net. |
|
|
|
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. |
|
|
|
(5) Expand the View node, and click the xYChart node to display a line chart. |
|
The simulation reaches equilibrium after about 3000 time steps. |
|
|
|
Although the model is not quantitatively accurate, it is correct in a qualitative sense. |
|
It demonstrates conservation of mass and energy. |
|
Initially there are 1000 charged particles in the Sun. |
|
In the end there are 1000 shortwave and longwave photons in Space. |
|
|
|
Charged particles in the Sun move through Space to the Earth as shortwave (sw) photons. |
|
Some photons are reflected by the Atmosphere, and some are reflected by the Surface. |
|
These shortwave photons end up back in Space. |
|
Some photons heat up the Atmosphere, increasing its Temperature. |
|
Other photons heat up the Surface and increase its Temperature. |
|
Heat gradually becomes longwave (lw) radiation that ends up in Space. |
|
The simulation stabilizes once all the shortwave and longwave radiation photons are in Space. |
|
|
|
How to use the three Analysis nodes:: |
|
Right-click the AnalysisPetriNet node and select one of the "Special" menu items. |
|
Nodes are interpreted in a Petri net way, as Places and Trnsitions. |
|
|
|
Right-click the AnalysisCRN node and select one of the "Special" menu items. |
|
Nodes are interpreted in a Chemical Reaction Network way, as Species and Reactions. |
|
|
|
Right-click the AnalysisCat node and select one of the "Special" menu items. |
|
Nodes are interpreted in a mathematical Category way, as Objects and Morphisms. |
|
]]></Notes> |
|
|
|
<script implName="lang:python:inline:"><![CDATA[ |
|
|
|
]]></script> |
|
|
|
<script implName="lang:javascript:inline:"><![CDATA[ |
|
|
|
]]></script> |
|
|
|
<_-.XholonClass> |
|
<ClimateSystem/> |
|
|
|
<!-- large container objects --> |
|
<Sun/> |
|
<Space/> |
|
<Earth/> |
|
<Atmosphere/> |
|
<Surface/> |
|
</_-.XholonClass> |
|
|
|
<xholonClassDetails> |
|
|
|
</xholonClassDetails> |
|
|
|
<ClimateSystem xmlns:xi="http://www.w3.org/2001/XInclude"> |
|
|
|
<SolarSystem> |
|
|
|
<Sun> |
|
<!-- |
|
The Sun is made of plasma, "an electrically neutral medium of positive and negative particles" (Wikipedia: Sun, Plasma). |
|
I'll guess there are about 1e40 charged particles in the Sun (1 with 40 zeros after it). |
|
Wikipedia says Sun has mass of about 2e30 kg. |
|
I'll make it 1 billion (1e9 1000000000) for now. |
|
For now, it's set to 1000, which makes testing easier. |
|
--> |
|
<PlacePN roleName="ChargedParticles" token="1000"/> |
|
<TransitionPN roleName="Sunbehavior_SW"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Sun/PlacePN[@roleName='ChargedParticles']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::SolarSystem/Space/PlacePN[@roleName='SunSpc_sw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
</Sun> |
|
|
|
<Space> |
|
<PlacePN roleName="SunSpc_sw" token="0"/> |
|
<!-- counters --> |
|
<PlacePN roleName="AtmSpc_sw" token="0"/> <!-- ReflectedSwPhotonsFromAtmosphere --> |
|
<PlacePN roleName="SrfSpc_sw" token="0"/> <!-- ReflectedSwPhotonsFromSurface --> |
|
<PlacePN roleName="AtmSpc_lw" token="0"/> <!-- LwPhotonsFromAtmosphere --> |
|
<TransitionPN roleName="Spacebehavior_SW"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Space/PlacePN[@roleName='SunSpc_sw']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::SolarSystem/Earth/Atmosphere/PlacePN[@roleName='SpcAtm_sw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
</Space> |
|
|
|
<Earth> |
|
|
|
<Atmosphere> |
|
<PlacePN roleName="SpcAtm_sw" token="0"/> |
|
<PlacePN roleName="Temperature" token="0.0" units="°X"/> |
|
<TransitionPN roleName="Atmospherebehavior_SW" p="0.9"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Atmosphere/PlacePN[@roleName='SpcAtm_sw']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::Earth/Surface/PlacePN[@roleName='AtmSrf_sw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
<TransitionPN roleName="Atmospherebehavior_SW_REFLECTED" p="0.1"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Atmosphere/PlacePN[@roleName='SpcAtm_sw']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::SolarSystem/Space/PlacePN[@roleName='AtmSpc_sw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
<TransitionPN roleName="Atmospherebehavior_LW1" p="0.25"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Atmosphere/PlacePN[@roleName='Temperature']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::SolarSystem/Space/PlacePN[@roleName='AtmSpc_lw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
<TransitionPN roleName="Atmospherebehavior_LW2" p="0.25"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Atmosphere/PlacePN[@roleName='Temperature']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::Earth/Surface/PlacePN[@roleName='Temperature']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
</Atmosphere> |
|
|
|
<Surface> |
|
<PlacePN roleName="AtmSrf_sw" token="0"/> |
|
<PlacePN roleName="Temperature" token="0.0" units="°X"/> |
|
<TransitionPN roleName="Surfacebehavior_SW" p="0.8"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Surface/PlacePN[@roleName='AtmSrf_sw']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::Surface/PlacePN[@roleName='Temperature']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
<TransitionPN roleName="Surfacebehavior_SW_REFLECTED" p="0.2"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Surface/PlacePN[@roleName='AtmSrf_sw']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::SolarSystem/Space/PlacePN[@roleName='SrfSpc_sw']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
<TransitionPN roleName="Surfacebehavior_LW" p="1.0"> |
|
<InputArcs> |
|
<InputArc weight="1" connector="ancestor::Surface/PlacePN[@roleName='Temperature']"/> |
|
</InputArcs> |
|
<OutputArcs> |
|
<OutputArc weight="1" connector="ancestor::Earth/Atmosphere/PlacePN[@roleName='Temperature']"/> |
|
</OutputArcs> |
|
</TransitionPN> |
|
</Surface> |
|
|
|
</Earth> |
|
|
|
<Plot mode="new"/> |
|
</SolarSystem> |
|
|
|
<!-- kineticsType |
|
1 = Basic place/transition net kinetics (default) |
|
2 = Mass action kinetics |
|
--> |
|
<PetriNet roleName="climate01" kineticsType="1"> |
|
<QueueTransitions connector="ancestor::ClimateSystem/SolarSystem"/> |
|
<AnalysisPetriNet/> |
|
<AnalysisCRN/> |
|
<AnalysisCat/> |
|
</PetriNet> |
|
|
|
</ClimateSystem> |
|
|
|
<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 net Climate model</title> |
|
<rect id="PhysicalSystem/Block" 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> |