Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active December 9, 2024 10:52
Show Gist options
  • Save kenwebb/5397014862fb61054786198a7fa06452 to your computer and use it in GitHub Desktop.
Save kenwebb/5397014862fb61054786198a7fa06452 to your computer and use it in GitHub Desktop.
Rechenmann Modeling Language
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Mon Dec 09 2024 05:51:13 GMT-0500 (Eastern Standard Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Rechenmann Modeling Language
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 5397014862fb61054786198a7fa06452
Keywords:
My Notes
--------
7 Dec 2024
A 1976 paper by F. Rechenmann describes a simple but interesting modeling language that should be compatible with Xholon.
In this workbook I plan to test this possibility.
Some questions:
- Can I export a Xholon subtree to the Rechenmann format?
- Can I import from the Rechenmann format?
The paper was presented at a System Dynamics conference.
Rechenmann uses several names for Nodes.
From the Xholon perspective, there should really only be one name for a generic "Node".
He uses the terms "black box", "level", "sub", "part", "base", "sub-system", "sub-model"
I could just call these "RNode"
He also discusses "inputs", "outputs", "input variables", "output variables"
He mentions a language called LADESH: LAngage de DEscription de Systemes Hierarchises
"such a language has been defined and implemented"
"it has been thoroughly described elsewhere (2, 3)"
"its functional properties are similar to other continuous 'simulation languages'"
### References
(1) https://proceedings.systemdynamics.org/1976/proceed/reche497.pdf
Rechenmann, F., Top-Down Systems Analysis and Modeling, 1976
Ecole Nationale Superieure d'Informatique et de Mathematiques Appliquees (ENS-IMAG)
The REFERENCES section on page 508 includes two previous papers by F. Rechenmann, which I haven't been able to find yet.
I believe this is Francois Rechenmann.
(2) Rechenmann, F., A Continuous Simulation Language for Dynamic Space-distributed Models, 1974
(3) Rechenmann, F., Equations Sorting in Multilevel Structured Models", 1975
(4) Uvietta, P., Migration Dynamics in Urban-Regional Systems: a Multi-level Model, 1976
(5) search: continuous simulation languages
(6) https://en.wikipedia.org/wiki/Continuous_simulation
Continuous Simulation refers to simulation approaches where a system is modeled with the help of variables that change continuously according to a set of differential equations
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<!-- names from Rechenmann paper, Fig. 2 p.501, and from APPENDIX p.509 -->
<Level/>
<Sub/> <!-- a sub-model or sub-system -->
<RNode>
<Level>
<Level1/>
<Level2/>
<Level3/>
</Level>
</RNode>
<Sector/>
</_-.XholonClass>
<xholonClassDetails>
<!--<Block>
<port name="height" connector="Height"/>
</Block>-->
<Level1><DefaultContent><![CDATA[
<_-.lev>
<RNode roleName="left"/>
<RNode roleName="right"/>
<Level2/>
</_-.lev>
]]></DefaultContent></Level1>
<Level2><DefaultContent><![CDATA[
<_-.lev>
<RNode roleName="left"/>
<Level3 roleName="S"/>
</_-.lev>
]]></DefaultContent></Level2>
<Level3><DefaultContent><![CDATA[
<_-.lev>
<RNode roleName="S1"/>
<RNode roleName="S2"/>
<RNode roleName="S3"/>
<Script>
var me, beh = {
postConfigure: function() {
me = this.cnode.parent();
const S = me;
const S1 = me.first();
const S2 = S1.next();
const S3 = S2.next();
S1.Gport = S2
S1.Dport = S3
S2.Aport = S3
S2.Cport = S
S3.Eport = S1
S3.Fport = S
S.Bport = S1
this.cnode.remove();
}
}
</Script>
</_-.lev>
]]></DefaultContent></Level3>
</xholonClassDetails>
<PhysicalSystem>
<!-- see Xml2Xholon - DefaultContent only works if I include RoomModel somewhere before I need to use DefaultContent -->
<RoomModel/>
<Level1/>
<Sector>
<!--<Script>
const scode = this.next().text();
const parseLine = (line) => {return line;}
const scodearr = scode.split("\n").map((item) => parseLine(item.trim()), []);
this.println(scodearr.join("\n"));
</Script>-->
<Script>
this.println("main 1");
const scode = this.next().text();
const parseLine = (line) => {
this.println("parseLine 1");
const linet = line.trim();
if (linet.startsWith("End")) {return parseEnd(linet.substring(4))}
else if (linet.startsWith("Sector")) {return parseSector(linet.substring(7))}
else {return parseSector(linet)}
}
const parseSector = line => {
this.println("parseSector " + line);
const one = line.trim().split("(");
const roleName = one[0];
this.println(roleName);
let inputs, outputs;
if (one[1]) {
const two = one[1].substring(0, one[1].length - 1);
const three = two.split(";");
inputs = three[0].split(",").map(item => item.trim(), []);
outputs = three[1].split(",").map(item => item.trim(), []);
}
return {inputs, outputs};
}
const parseEnd = line => {
this.println("parseEnd " + line);
return {inputs: [""], outputs: [""]};
}
const scodearr = scode.split("\n").map((item) => parseLine(item.trim()), []);
this.println(scodearr.join("\n"));
console.log(scodearr);
//# sourceURL=parseLines.js
</Script>
<!--
the example text from p.509
Each line has this format: RNodeName ( INPUTS ; OUTPUTS )
My script should do things like the following:
node.append(`<RNode roleName="${str}"/>`);
S1.Gport = S2
S1.Dport = S3
S2.Aport = S3
S2.Cport = S ?
S3.Eport = S1
S3.Fport = S ?
S.Bport = S1 ?
Fig. 2 shows arrow G from S1 to S2
- does this mean that S2 contains a value that S1 needs to access ?
- or does it mean that S2 receives a value that S1 sends ?
An intermediate JSO format: to be done by parseLine("S(B; C, F)")
var line = "S(B; C, F)";
var parseLine = (line) => {
var one = line.trim().split("(");
var roleName = one[0];
var two = one[1].substring(0, one[1].length - 1);
var three = two.split(";");
var inputs = three[0].split(",").map(item => item.trim(), []);
var outputs = three[1].split(",").map(item => item.trim(), []);
return {inputs, outputs};
}
parseLine(line);
-->
<Attribute_String>
Sector S(B; C, F);
S1(B, E; D, G);
S2(G; C, A);
S3(A, D; F, E);
End S;
</Attribute_String>
</Sector>
</PhysicalSystem>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Sector</title>
<rect id="PhysicalSystem/Sector" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Sector</title>
<rect id="PhysicalSystem/Sector" 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