The Limits to Growth

Started by K-Dog, Apr 30, 2024, 08:18 PM

Previous topic - Next topic

K-Dog

Why should we be interested in half-century-old simulations carried out on clunky, ancient mainframe computers that were Fred Flinstone technology compared to the modern day?

Because we're living out the simulations now.

This year an updated version of The Limits to Growth model showed industrial production peaking, with food production peaking soon.

As the authors caution ....

Yada Yada Yada, so what.  It is academic and obscure like the first model.  A compartmentalized academic exercise, and if it is not reproduced so the public can understand and play with the model perhaps humanity deserves to expire.  A snarky comment you think?  No, because we are not talking about that much code.  Less code than some of the JavaScript modules I have written here I think.  I have the background to understand all of it. 

My last professional job was restoring an IBM CRT display like the one which shows at 9:11 in the video.  The one I was tasked to restore was found in an Australian junkyard.  Half of it was missing but i was able to get to tube to work again.  The point is I understand old technology, and the desert air preserved the tube.

New code will be able be run using JavaScript in a browser.  The master open source model model will be written in Python with modules broken down with chapters written on each to show where data comes from and how it is used.  A forum like this can be on the documentation website to answer questions, and share info.

A dedicated website where people can go to understand the model.  I am willing to do my part to make this happen.  Start by watching this if you can help:


The first thing to do is get a copy of the code and break it down so it can be rebuilt as an open source project.  People with the connections and abilities to make this happen, please get in touch with me.

The first production milestones will be to reproduce the standard run.

Brian Hayes is not a relation.  Here are two of the books mentioned in the video.  I'll be busy.

Industrial Dynamics (Jay W Forrester)

World Dynamics (Jay W Forrester)

RE

It would be a blast to have the model as an App you could run on your phone, especially if you could add and change parameters as new information and statistics come in.  For instance, back in 72 I doubt anyone projected how far the global fertility rate would have fallen by 2024, and how fast that drop is accelerating. Also current data on CO2 content in the atmosphere or aquifer & soil depletion rates.  Nor I think was there a way to factor in substitution of new technologies such as the growth of Solar PV and Wind power.

Unfortunately, my own skills don't fall in this area, so besides suggesting ideas for what it would be cool if it could do, I am of no use to this project.  I can see where you would get completely obsessed by it though. lol.

What about incorporating AI into the model?  Maybe there would be a way to set it up so that an AI subroutine was constantly searching the net for data that would improve the accuracy of the projections?  You could turn it on every day and check to see how the latest Collapse Weather report is!  "Today will be cloudy with a chance of extinction by 2100 improved by 2%.  Occasional dry periods as your taps run dry from noon to 4PM."  lol.

RE

K-Dog

#2
Urban Dynamics

This one was harder to find.  I am well in to digesting 'World Dynamics'.  Finding the user guide to to the DYNAMO compiler has not been successful so far.

The concepts behind the system dynamic models are readily accessible.  Reading the notation is a challenge.  My idea for the project is evolving.  Still waiting for others to dig into the model details.

An Idea:

A website can use the results of a model 'run' to show 'fake news' to a viewer.  This visitor knows the model generates the news.  The news selected to show the view will represent the model state.  If agricultural production is crashing.  This might show as news.


K-Dog

Urban Dynamics is worth talking about all by itself.  But not today.  Today I found the Dynamo Users Manual using a Russian search engine.

It looks like I may be working on this project by myself for a while.  I'll publish a link to the manual when somebody else shows up to participate.


K-Dog

#4
Running The Limits to Growth model involves processing the model equations to generate initial values.

Once the initial values are know the model runs and generates data.

From the data, plots are generated.

The hard part is processing the model equations to generate initial values.  After that part is done turning the digital crank is easy enough.

I am making progress.  About 1000 lines of JavaScript into the project.

K-Dog

#5
Now over 1200 lines and I loaded initial values from the Dynamo example card deck. I ran my first time 'DT' cycle to step Dynamo model equations forward one time increment.

Dynamo is the simulator that ran the original Limits to Growth model.  A new page will be added to this website when the Limits to Growth model simulator is ready for prime time.  Users will be able to run the card deck and see the original graphs.  They will also be able to run their own versions.

The input card deck.

*    M478-248,DYN,TEST,1,1,0,0
RUN  2698JP
NOTE  MODEL OF RETAIL STORE
NOTE 
1L    IAR.K=IAR.J+(DT)(SRR.JK-SSR.JK)          INVENTORY ACTUAL
1L    UOR.K=UOR.J+(DT)(RRR.JK-SSR.JK)          UNFILLED ORDERS
20A  NIR.K=IAR.K/DT                          NEGATIVE INVENTORY
20A  STR.K=UOR.K/DFR                          SHIPMENTS TRIED
54R  SSR.KL=MIN(STR.K,NIR.K)                  SHIPMENTS SENT
40R  PSR.KL=RRR.JK+(1/DIR)(IDR.K-IAR.K)      PURCHASE ORDERS SENT
12A  IDR.K=(AIR)(RSR.K)                      INVENTORY DESIRED
3L    RSR.K=RSR.J+(DT)(1/DRR)(RRR              REQUISITIONS SMOOTHED
X1    .JK-RSR.J)
39R  SRR.KL=DELAY3(PSR.JK,DTR)                SHIPMENTS RECEIVED
NOTE 
NOTE  INITIAL CONDITIONS
NOTE 
12N  UOR=(DFR)(RRR)                         
6N    RSR=RRR                                 
6N    IAR=IDR                                 
NOTE 
NOTE  INPUT
NOTE 
7R    RRR.KL=RRI+RCR.K                        REQUISITIONS RECEIVED
45A  RCR.K=STEP(STH,5)                        REQUISITION CHANGE
NOTE 
NOTE  CONSTANTS
NOTE 
C    AIR = 8 WKS                              CONSTANT FOR INVENTORY
C    DFR = 1 WK                              DELAY IN FILLING ORDERS
C    DIR = 4 WKS                              DLY REFILLING INVENTORY
C    DRR = 8 WKS                              REQUISITION SMTHNG T C
C    DTR = 2 WKS                              DELAY IN TRANSIT
C    RRI = 1000 ITEMS/WK                      REQ. RECEIVED INITIALLY
C    STH = 100 ITEMS/WK                      STEP HEIGHT
NOTE 
PRINT 1)IAR,IDR/2)UOR/3)RRR,SSR/4)PSR,SRR
PLOT  IAR=I,UOR=U/RRR=R,SSR=S,PSR=P,SSR=Q
SPEC  DT=0.1/LENGTH=10/PRTPER=5/PLTPER=0

Results from reading and processing the input card deck.  The variables *001, *002, *003 are internally generated by expanding a delay card.  Getting this far took quite a bit of processing.  The hard work is done.  Now the devil will be in the details.

RSRJ1000K1000
UORJ1000K1000
IARJ8000K8000
RCRJ0K100
STRJ1000K1000
IDRJ8000K8000
NIRJ80000K80000
RRRJK1000KL1100
SSRJK1000KL1000
PSRJK1000KL1000
SRRJK1000KL1000
*001JK1000KL1000
*002JK1000KL1000

   
DT0.1
AIR8
DFR1
DIR4
DRR8
DTR2
RRI100
STH100
*0036.666666666666666

This output shows Dynamo sample model array variables.  The variables on the bottom are constants that do not change.  The variables above them have J and JK values.  J values are initial values.  The K and KL variables are the result of calculating to the next time increment.  The next step will be to  transfer K values to J values and KL values to JK values to step time again.

The Limits to Growth model has about ten time as many equation lines.  When it works and is ready for prime time, the equation simulator won't care about more lines.  First I have errors to fix.  The output is not correct*.

This is what defines what I am doing.  The users manual.

Dynamo

Q: How will the JavaScript implementation compare in speed to the original IBM mainframe implementation?  A: The modern Javascript implementation will run rings around the original IBM implementation.

* The errors were fixed.  But the output above is not corrected.  Output should have no values changing before a step input generates an order in the system at time five.

K-Dog

#6
Progress on the Dynamo Equation Compiler.  The variables from the demo card deck are computed correctly as you can see. 

The scales on the graph are unfinished.  The plots are not scaled to the vertical axis relative to each other as dictated by the plot card yet.

That is the next thing to get working.  More fully parse the PLOT card.  So far I have just grabbed the variable names and charged on to get this far.  I also need to get the PRINT card printing.  So far I only grabbed variable names from the PRINT card and collected the data for them as the model ran.

The icons on top are buttons that run tasks.  The meanings change as I change my code.  The rotating arrow button currently shows the results you see.  I clicked it before taking the screenshot.  In final form these buttons will be the user interface.  Appearance and code will then match, but not now.  Before I reconstruct the original Limits to Growth card deck.

The Dynamo Compiler will need refinement.

So far I have about 90 functions in 1500 lines of JavaScript.  Each of the buttons jumps to a function a generates a chain of activity that gets a task done when pressed.

The Dog button fetches a Dynamo Card Deck file.  Each line represents a card.  Clicking the buttons in sequence runs tasks that are done sequentially to process the deck so it can produce and show output.

K-Dog

#7
Here the variables are scaled correctly.

Processing the details of the plot card was a challenge.  And the example plot in the users manual has two scales but the demo plot card did not specify the plot limits.

Example: 
PLOT  IAR=I,UOR=U/RRR=R,SSR=S,PSR=P,SRR=Q

Corrected:
PLOT  IAR=I,UOR=U(0,12000)/RRR=R,SSR=S,PSR=P,SRR=Q(1000,1200) 

UOR and SSR were cleverly picked to plot because they are on top of each other if both plot to a default scale.  UOR is hidden in my first version which had only internally generated limits.

Scale limits are added to the two plot groups, each plot group has it's variables plotted to the same scale.  The notation to specify the vertical scale limits follows the user manual notation.  Defaults are generated if scale limits are omitted.

Leaving the scale limits off the original card made sense so as to not confuse the reader.  Reading the plot card specification clears things up right away.  Scale groups are separated by '/' on the plot card.  Scale group numbers next to the variable swatch map tell what scale to use to read the variable.