Last active
November 26, 2024 19:25
-
-
Save kenwebb/97d783e43f4f1ed242e1adf56421b6da to your computer and use it in GitHub Desktop.
DYNAMO XMILE
This file contains hidden or 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/gwt/ MIT License, Copyright (C) Ken Webb, Tue Nov 26 2024 14:24:39 GMT-0500 (Eastern Standard Time)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: DYNAMO XMILE | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 97d783e43f4f1ed242e1adf56421b6da | |
Keywords: | |
My Notes | |
-------- | |
25 Nov 2024 | |
Experiment with the XMILE format. | |
TODO: | |
- DONE create ports using connector "from" and "to" XMILE nodes | |
- DONE make use of start, stop, dt | |
26 Nov 2024 | |
I decided to manually change 20 instances of "name=" to "roleName=" because of the conflict between XMILE name and Xholon name(). | |
I considered using PI Processing Instruction to do this, but my existing PI apps don't seem to be working. ??? | |
### References | |
(1) Jay Forrester, Industrial Dynamics, 1961 | |
System Dynamics, DYNAMO | |
(2) Jay Forrester, Principles of Systems, 1968 | |
System Dynamics, DYNAMO | |
(3) https://github.com/SDXchange/SDXlate | |
4) https://github.com/SDXchange/SDXlate/wiki | |
(5) https://github.com/SDXchange/SDXlate/tree/gh-pages/models | |
a few XMILE models | |
(6) file://~/Downloads/pugh_p211.xmile | |
and a few other XMILE files I downloaded from ref 5 | |
(7) https://sdxchange.github.io/SDXlate/downloads/index.html | |
Translators | |
Java-Based | |
These stand-alone java stand-alone applications (packaged as .jar files) will translate from various modeling representations to XMILE and from XMILE to other modeling representations. | |
Each translator link will take you to a separate page with download and installation instructions. | |
Currently we offer these translations: | |
Dynamo to Xmile. | |
Xmile to Stella. | |
Xmile to InsightMaker. | |
Python-Based | |
These translators are available as part of the PySD project. | |
Smile to python. | |
Xmile to python. | |
Vensim to python. | |
(8) https://sdxchange.github.io/SDXlate/downloads/dyn2xmile.html | |
(9) https://sdxchange.github.io/SDXlate/downloads/dyn2xmile.jar | |
I used this link to download the .jar file to ~/Downloads | |
The following does NOT work: | |
ken@rip:~/Downloads$ java -jar dyn2xmile.jar pugh_p211.xmile | |
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/v4/runtime/tree/ParseTreeListener | |
(10) https://github.com/SDXorg | |
SDXorg | |
Open source tools for system dynamics | |
6+ projects; some are very recent | |
Python, Java, Jupyter Notebook | |
(11) https://github.com/SDXorg/pysd | |
388 stars | |
This project is a library for running System Dynamics (SD) models in Python, with the purpose of improving integration of Big Data and Machine Learning into the SD workflow. | |
The current version needs to run at least Python 3.9. | |
(12) http://pysd.readthedocs.org/ | |
This project is a simple library for running System Dynamics models in Python, with the purpose of improving integration of Big Data and Machine Learning into the SD workflow. | |
PySD translates Vensim or XMILE model files into Python modules, and provides methods to modify, simulate, and observe those translated models. | |
The translation is done through an intermediate Abstract Syntax Tree representation, which makes it possible to add builders in other languages in a simpler way | |
(13) https://pysd-cookbook.readthedocs.io/en/latest/ | |
The PySD Cookbook | |
(14) https://github.com/SDXorg/test-models | |
Models for testing system dynamics translation, simulation, and display software | |
This repository is a resource for testing system dynamics software and translation tools. | |
It provides a standard set of simple test cases in various formats, with a proposed canonical output for that test. | |
Python | |
() https://github.com/SDXorg/SD-Tools | |
various useful looking tools | |
() https://insightmaker.com/ | |
Unlock the Power of Browser-Based Model Creation | |
Use Insight Maker to create rich pictures and causal loop diagrams. | |
Then make shareable simulation models. All right in your browser, for free. | |
Just sign up for a free account and start modeling now. | |
System Dynamics Models | |
Agent Based Models | |
() https://github.com/scottfr/simulation | |
insightmaker source code | |
Node and browser JavaScript library to run simulations. | |
Supports System Dynamics modeling, Differential Equation mathematical modeling, and Agent Based Modeling | |
100% JavaScript | |
() https://simlin.com/ | |
Simlin is built around the system dynamics methodology, as introduced by the Thinking in Systems book (among others). | |
() https://github.com/bpowers/simlin | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<aux/> | |
<flow/> | |
<stock/> | |
<eqn superClass="Attribute_String"/> | |
<doc superClass="Attribute_String"/> | |
<inflow superClass="Attribute_String"/> | |
<name superClass="Attribute_String"/> | |
<connector/> | |
<from superClass="Attribute_String"/> | |
<to superClass="Attribute_String"/> | |
<sim_specs/> | |
<stop/> | |
<start/> | |
<dt/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<!--<Block> | |
<port name="height" connector="Height"/> | |
</Block>--> | |
<Avatar><Color>orange</Color></Avatar> | |
<aux><Color>indigo</Color></aux> | |
<flow><Color>red</Color></flow> | |
<stock><Color>green</Color></stock> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<!-- this is correctly read by the Xholon runtime --> | |
<xmile version="1.0" xmlns="http://docs.oasis-open.org/xmile/ns/XMILE/v1.0"> | |
<header> | |
<vendor>SDXchange</vendor> | |
<name>Teacup cooling</name> | |
<options> | |
<has_model_view/> | |
<uses_outputs/> | |
</options> | |
<product version="1.0">SDXchange Dynamo to XMILE</product> | |
</header> | |
<sim_specs> | |
<stop>50.0</stop> | |
<start>0.0</start> | |
<dt>0.25</dt> | |
</sim_specs> | |
<model> | |
<variables> | |
<aux roleName="MAXLEN"> | |
<eqn>50</eqn> | |
</aux> | |
<flow roleName="TDIFF"> | |
<doc>Heat Loss</doc> | |
<eqn>KFAC*(RMTMP-CUPTEMP)</eqn> | |
</flow> | |
<aux roleName="RMTMP"> | |
<doc>AMBIENT ROOM TEMPERATURE</doc> | |
<eqn>68</eqn> | |
</aux> | |
<stock roleName="CUPTEMP"> | |
<doc>CURRENT TEMPERATURE</doc> | |
<inflow>TDIFF</inflow> | |
<eqn>170</eqn> | |
</stock> | |
<aux roleName="KFAC"> | |
<eqn>.17</eqn> | |
</aux> | |
</variables> | |
<views> | |
<view> | |
<aux roleName="MAXLEN" x="50.0" y="50.0"/> | |
<flow roleName="TDIFF" x="150.0" y="50.0"> | |
<pts> | |
<pt x="125.0" y="50.0"/> | |
<pt x="175.0" y="50.0"/> | |
</pts> | |
</flow> | |
<aux roleName="RMTMP" x="50.0" y="100.0"/> | |
<stock roleName="CUPTEMP" x="200.0" y="50.0"/> | |
<aux roleName="KFAC" x="50.0" y="150.0"/> | |
<connector uid="1"> | |
<from>RMTMP</from> | |
<to>TDIFF</to> | |
</connector> | |
<connector uid="2"> | |
<from>KFAC</from> | |
<to>TDIFF</to> | |
</connector> | |
<connector uid="3"> | |
<from>CUPTEMP</from> | |
<to>TDIFF</to> | |
</connector> | |
<stacked_container x="100.0" y="100.0" uid="4" width="350.0" height="280.0"> | |
<graph show_grid="true" left_axis_multi_scale="false" plot_numbers="true" background="yellow"> | |
<plot index="0" show_y_axis="true"> | |
<entity roleName="CUPTEMP"/> | |
</plot> | |
</graph> | |
</stacked_container> | |
</view> | |
</views> | |
</model> | |
</xmile> | |
</PhysicalSystem> | |
<auxbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
/*var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.role(me.name); | |
this.cnode.remove(); | |
} | |
}*/ | |
]]></auxbehavior> | |
<stockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
/*var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.role(me.name); | |
this.cnode.remove(); | |
} | |
}*/ | |
]]></stockbehavior> | |
<flowbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
/*var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.role(me.name); | |
this.cnode.remove(); | |
} | |
}*/ | |
]]></flowbehavior> | |
<connectorbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
this.cnode.remove(); | |
// TODO use the child "from" and "to" nodes to establish ports | |
const fromm = me.first(); | |
const too = fromm.next(); | |
me.println(fromm.name() + " " + fromm.text()); | |
me.println(too.name() + " " + too.text()); | |
const fromnode = me.xpath("ancestor::model/variables/*[@roleName='" + fromm.text() + "']"); | |
me.println(fromnode); // YES | |
me.fromnode = fromnode; | |
const tonode = me.xpath("ancestor::model/variables/*[@roleName='" + too.text() + "']"); | |
me.println(tonode); // YES | |
me.tonode = tonode; | |
fromnode.tonode = tonode; | |
} | |
} | |
]]></connectorbehavior> | |
<sim_specsbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
const startt = me.xpath("./start"); | |
const stopp = me.xpath("./stop"); | |
const dtt = me.xpath("./dt"); | |
me.println("start:" + startt + " stop:" + stopp + " dt:" + dtt); | |
$wnd.xh.param("MaxProcessLoops", Number(stopp.text())); // works | |
this.cnode.remove(); | |
} | |
} | |
]]></sim_specsbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Block</title> | |
<rect id="PhysicalSystem/xmile" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Height</title> | |
<rect id="PhysicalSystem/xmile/model" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</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