Last active
November 25, 2024 16:21
-
-
Save kenwebb/d2c0be6e5ec998149ba8bb288c20a248 to your computer and use it in GitHub Desktop.
Principles of Systems - Section 2.2
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, Mon Nov 25 2024 11:21:04 GMT-0500 (Eastern Standard Time)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Principles of Systems - Section 2.2 | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: d2c0be6e5ec998149ba8bb288c20a248 | |
Keywords: | |
My Notes | |
-------- | |
25 Nov 2024 | |
In this workbook I implement the system described by Forrester in section 2.2. | |
My goal is to create the same results that he reports in Table 2.2 and Figure 2.2c . | |
It works! | |
### References | |
() Jay Forrester, Principles of Systems, 1968 | |
This book was published 7 years after Forrester's book "Industrial Dynamics. | |
It focuses on basic principles, and includes a workbook to help students understand the material. | |
]]></Notes> | |
<_-.XholonClass> | |
<InventoryControlSystem/> | |
<InventoryControl/> | |
<Inventory/> | |
<Cloud superClass="Quantity"> | |
<Supply/> <!-- an infinite supply of the stuff that makes up the inventory --> | |
</Cloud> | |
<PlotValue superClass="Quantity"/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<InventoryControl> | |
<port name="supply" connector="../Supply"/> | |
<port name="inventory" connector="../Inventory/PlotValue"/> | |
</InventoryControl> | |
<Avatar><Color>red</Color></Avatar> | |
<PlotValue xhType="XhtypePurePassiveObject"/> | |
</xholonClassDetails> | |
<InventoryControlSystem> | |
<Supply val="1000000"/> | |
<InventoryControl/> | |
<Inventory> | |
<PlotValue roleName="Inventory balance" val="1000"/> | |
<Plot dataPlotterParams="Inventory,Time (weeks),Inventory (units),./statistics/,stats,1,WRITE_AS_DOUBLE"/> | |
</Inventory> | |
</InventoryControlSystem> | |
<InventoryControlbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
// this works! | |
// constants | |
const AT = 5; // AT Adjustment time (weeks) | |
const DI = 6000; // DI Desired inventory (units) | |
const InitInv = 1000; // initial inventory | |
// functions | |
invErrorF = (di, i) => di - i; // Inventory Error function | |
var me, | |
time, // TIME (weeks) | |
changeInInv, // CI Change in inventory (units) | |
inventory, // I Inventory (units) | |
invError, // IE Inventory error (units) | |
orderRate, // OR Order rate (units/week) | |
beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
me.println(me.supply); | |
me.println(me.inventory); | |
// set initial/starting values | |
time = 0; | |
changeInInv = 0; | |
inventory = InitInv; | |
invError = invErrorF(DI, inventory); | |
orderRate = invError / AT; | |
me.println("TIME\tCI\tI\tIE\tOR"); | |
}, | |
preAct: function() { | |
if (time % 2 == 0) { | |
me.println(time + "\t" + Math.round(changeInInv) + "\t" + Math.round(inventory) + "\t" + Math.round(invError) + "\t" + Math.round(orderRate)); | |
changeInInv = 0; | |
} | |
me.inventory.val(inventory); | |
}, | |
act: function() { | |
time++; | |
changeInInv += orderRate; | |
if (time % 2 == 0) { | |
inventory = inventory + changeInInv; | |
invError = invErrorF(DI, inventory); | |
orderRate = invError / AT; | |
} | |
} | |
} | |
//# sourceURL=InventoryControlbehavior.js | |
]]></InventoryControlbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>InventoryControl</title> | |
<rect id="InventoryControlSystem/InventoryControl" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Inventory</title> | |
<rect id="InventoryControlSystem/Inventory" 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