icpsr - complex systems computing - session 9 - 2012

188
Introduction to Computing for Complex Systems Daniel Martin Katz Eric Provins

Upload: daniel-martin-katz

Post on 29-Nov-2014

480 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: ICPSR - Complex Systems Computing - Session 9 - 2012

Introduction to Computing for Complex Systems!

Daniel Martin Katz! Eric Provins!

Page 2: ICPSR - Complex Systems Computing - Session 9 - 2012

Goals For Today!

Quick Overview of System Dynamics!

Quick Overview of NOVA Programming Concepts!

Simple Population Growth Model!

Page 3: ICPSR - Complex Systems Computing - Session 9 - 2012

System Dynamics Modeling!

!

Page 4: ICPSR - Complex Systems Computing - Session 9 - 2012

System Dynamics Modeling !

Professor Forester also responsible for inventing random-access magnetic-core memory (RAM)!

In 1950‘s Jay Forester of MIT Business School applied ideas in engineering to study business dynamics

Page 5: ICPSR - Complex Systems Computing - Session 9 - 2012

Feedback Effects!

System Dynamics is interested in !systems that feature feedback effects!

Feedback = the return to the input of a part of the output (can be +, - or 0 )!

Page 6: ICPSR - Complex Systems Computing - Session 9 - 2012

negative feedback !

negative feedback --> negative if the resulting action opposes the condition that triggers it!

This class of feedback is often described as auto-regulating in so much as deviations from the equilbriua are dragged back !

Page 7: ICPSR - Complex Systems Computing - Session 9 - 2012

System Dynamics!

positive --> if the resulting action builds upon the condition that triggers it!

These are the more interesting class !

Perturbations to the system can generate a novel set of outcomes!

Page 8: ICPSR - Complex Systems Computing - Session 9 - 2012

An Example of Feedback !

A positive connection: !!“The positive connection for a cooling coffee cup implies that the hotter the coffee is the faster it cools. The variables Tc and Tr are coffee and room temperature respectively.”!

For Full Example: http://serc.carleton.edu/introgeo/models/loops.html

Page 9: ICPSR - Complex Systems Computing - Session 9 - 2012

a negative connection:!!“the negative connection in the figure below for a cooling coffee cup implies a positive cooling rate makes the coffee temperature drop.” !

For Full Example: http://serc.carleton.edu/introgeo/models/loops.html

An Example of Feedback !

Page 10: ICPSR - Complex Systems Computing - Session 9 - 2012

An Example of Feedback !the two connections are combined yield a !

negative !feedback !

loop !!

coffee temperature approaches the stable equilibrium of the room temperature.!

!

going around the loop the positive connection times the negative connection gives a negative loop feedback effect. !

Page 11: ICPSR - Complex Systems Computing - Session 9 - 2012

System Dynamics!System Dynamics Models are typically represented by stocks and flows!

http://www.systemdynamics.org!

Page 12: ICPSR - Complex Systems Computing - Session 9 - 2012

Basic Ideas, !Basic Ingredients!

Page 13: ICPSR - Complex Systems Computing - Session 9 - 2012

Basic ideas, Basic Ingredients!

• Like agent based modeling, system dynamics modeling is another method used to study the behavior of complex systems. !

Page 14: ICPSR - Complex Systems Computing - Session 9 - 2012

Basic ideas, !Basic Ingredients!

!

• The dynamics of these systems are generated by the interdependent nature of their parts, especially concerning the role of feedback loops between entities that change over time, and the various relationships that affect the rate of change over time. !

Page 15: ICPSR - Complex Systems Computing - Session 9 - 2012

• The relationships described by system dynamics models offer us a better picture into how these systems often exhibit nonlinear behavior and produce emergent phenomena.!

Basic ideas, !Basic Ingredients!

Page 16: ICPSR - Complex Systems Computing - Session 9 - 2012

Basic ideas, Basic Ingredients !

!

!

• System dynamics models are distinguished by the use of stocks, flows, feedback loops. !

Page 17: ICPSR - Complex Systems Computing - Session 9 - 2012

Basic ideas, Basic Ingredients!

• Stocks are things that either accumulate or deplete over time, but which at any given point in time can be measured.!

!

• Flows are measured over a period of time; they represent the rate of change in a stock.!

Page 18: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

• Let’s take a quick look at what a system dynamics model would look like before we build some for ourselves.!

• Let’s model a population that grows, but has no outlet for depletion. !

Page 19: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

!

• First, we will need an accumulator, a stock. Let’s call our stock “Population,” since a population is something that can be measured at a given time, but which can also grow or decrease over time.!

Page 20: ICPSR - Complex Systems Computing - Session 9 - 2012

Stock: Population!

Page 21: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

!

• Now we will want to manipulate our stock over time. Let’s add a flow coming into our stock so that we can put new things into it over time. Since we are not going to remove things from our stock, there is no reason to place a flow leaving the stock.!

Page 22: ICPSR - Complex Systems Computing - Session 9 - 2012

Adding an In Flow!

Page 23: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

!

• You may have noticed the hour glass shaped object on the inflow. Stock and flow diagrams often use this symbol to represent a valve controlling the rate of flow into or out of stocks.!

!

Page 24: ICPSR - Complex Systems Computing - Session 9 - 2012

Flows represent the rate of change!

Page 25: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

!

!

• Let’s call our flow “Growth.” This will represent the amount of new population members flowing in to the population during each time step.!

Page 26: ICPSR - Complex Systems Computing - Session 9 - 2012

Growth Added!

Page 27: ICPSR - Complex Systems Computing - Session 9 - 2012

Example: Simple Population Growth!

• To finalize our model, we will want to inform the growth flow of the prior population size as well as the current rate of growth. !

!

• After adding those last elements we will have finished our qualitative description of a simple population growth model!!

Page 28: ICPSR - Complex Systems Computing - Session 9 - 2012

Simple Population Growth!

Page 29: ICPSR - Complex Systems Computing - Session 9 - 2012

!

• System dynamics modeling programs allow us to mathematical define the relationships between our stocks and flows, allowing us to simulate model runs and see what occurs in the system when we tweak parameter and variable values.!

Basic ideas, Basic Ingredients !

Page 30: ICPSR - Complex Systems Computing - Session 9 - 2012

!

• The program we will be using to create system dynamics models is called NOVA.!

Introduction to NOVA!

Page 31: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 32: ICPSR - Complex Systems Computing - Session 9 - 2012

Introduction to NOVA!

•  “Nova is a dynamic modeling platform (currently under development) that supports and encourages hierarchical design. Through hierarchical design, Nova combines the dynamic systems (DS), spacial and agent-based modeling paradigms.” !

• http://nova.oberlin.edu/!

Page 33: ICPSR - Complex Systems Computing - Session 9 - 2012

Introduction to NOVA!

• NOVA is being developed by Professor Richard Salter of Oberlin College!

• NOVA takes an interesting approach to system dynamics modeling by enabling modelers to easily create sub-procedures that are also system dynamics models.!

Page 34: ICPSR - Complex Systems Computing - Session 9 - 2012

Introduction to NOVA!!

• This features gives modelers flexibility and scalability in modeling dynamic relationships between different interacting systems as well as the ability to quickly duplicate dynamic systems of interest, either in a higher level of the same model, or in other models.!

Page 35: ICPSR - Complex Systems Computing - Session 9 - 2012

Introduction to NOVA!

• Like writing good modular code in Netlogo or other programming languages, the sub-models of NOVA provide an excellent way to organize models and allow users to utilize relevant sub-procedures of other models within their own programs.!

Page 36: ICPSR - Complex Systems Computing - Session 9 - 2012

Quick Overview of Nova Concepts!

• Helpful Sites:!

• The following website features explanations of NOVA modeling components, as well as tutorials.!

• https://sites.google.com/a/oberlin.edu/nova-help/ !

Page 37: ICPSR - Complex Systems Computing - Session 9 - 2012

Quick Overview of Nova Concepts!

• Helpful Sites:!

• The following website features several NOVA models that can run through Java Web Start.!

• https://sites.google.com/a/oberlin.edu/nova/00-nova-concepts!

Page 38: ICPSR - Complex Systems Computing - Session 9 - 2012

Quick Overview of Nova Concepts!

• Let’s go through a quick run down of some of NOVA’s components before we build a model of our own.!

• First, open the Nova.exe application file in your Nova_Windows folder.!

Page 39: ICPSR - Complex Systems Computing - Session 9 - 2012

Open Nova Application!

Page 40: ICPSR - Complex Systems Computing - Session 9 - 2012

Quick Overview of Nova Concepts!

• You should now have an open window; the large empty area on the left is known as the canvas, which is where models are built!

• As we will see later, the boxes to the left are where the main model and sub-models are located!

Page 41: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 42: ICPSR - Complex Systems Computing - Session 9 - 2012

Quick Overview of Nova Concepts!

• Let’s look at where we will locate the many of the things needed to build system dynamics models. !

• There are three buttons on the top right that we should look at: Components, Plugins, and the Simulator!

Page 43: ICPSR - Complex Systems Computing - Session 9 - 2012

First Click on Components!

Page 44: ICPSR - Complex Systems Computing - Session 9 - 2012

Components!

• The components contain the building blocks of the models, such as the stocks and flows!

• It also contains items unique to NOVA, such as the cell grid, which creates a homogeneous multidimensional array of submodels that can interact with each other.!

Page 45: ICPSR - Complex Systems Computing - Session 9 - 2012

Components Menu!

Page 46: ICPSR - Complex Systems Computing - Session 9 - 2012

Plugins!

• The next button to look at is the Plugins.!

• This contains the different types of GUI’s that we will use to visualize our models with.!

• Plugins can also be developed and specialized for a user’s model and added to NOVA’s Plugin directory.!

Page 47: ICPSR - Complex Systems Computing - Session 9 - 2012

Plugins!

• Plugins can also be developed and specialized for a user’s model, as well as added to NOVA’s Plugin directory.!

• Not all Plugins deal with visualizations, for example, one creates histograms.!

Page 48: ICPSR - Complex Systems Computing - Session 9 - 2012

Plugins Menu!

Page 49: ICPSR - Complex Systems Computing - Session 9 - 2012

Simulator!

!

• Finally, let’s investigate the Simulator!

• The simulator offers several different means of operating model runs.!

Page 50: ICPSR - Complex Systems Computing - Session 9 - 2012

Clock!

• The first way to run a model is to use clock.!

• It allows users to start a model run, pause it, stop it, reset it, speed it up or slow it down, and also turn looping on and off.!

Page 51: ICPSR - Complex Systems Computing - Session 9 - 2012

Auto!

• The second way to run a simulation is through Auto mode, which reruns the simulation any time there is a change of input using a slider or spinner.!

• This is highly useful when you want to visually see what changing a given parameter can do.!

Page 52: ICPSR - Complex Systems Computing - Session 9 - 2012

Repeater!

• Finally, the Repeater is used primarily for sensitivity analysis, to create multiple runs with varying parameter values.!

Page 53: ICPSR - Complex Systems Computing - Session 9 - 2012

The Simulator!

Page 54: ICPSR - Complex Systems Computing - Session 9 - 2012

Model Library!

• You can find other NOVA models in the NOVA model library, which is under File > Browse Model Library!

Page 55: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 56: ICPSR - Complex Systems Computing - Session 9 - 2012

NOVA Help!

• If you forget what a component or plug-in does, just left click it and then press ‘F1.’ !

• This will bring up the NOVA help website which will explain what that component does.!

Page 57: ICPSR - Complex Systems Computing - Session 9 - 2012

Applying Model Building Principles Across Different

Platforms !!

Page 58: ICPSR - Complex Systems Computing - Session 9 - 2012

This ought to look familiar…!

• Although system dynamics provide a different way of approaching complex systems, many of the lessons you have learned so far about programming agent based models in Netlogo should readily apply, especially in the NOVA environment.!

Page 59: ICPSR - Complex Systems Computing - Session 9 - 2012

This ought to look familiar…!

• For example, let’s look at the flocking model, found in the NOVA Model Library under the Agent-based model section.!

• Since it is a new environment, it is not surprising that the model may at first look strange and intimidating…!

Page 60: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 61: ICPSR - Complex Systems Computing - Session 9 - 2012

Applying Model Building Principles Across

Different Platforms !

• However, I think if you take a closer look, you’ll start to see some similarities…!

Page 62: ICPSR - Complex Systems Computing - Session 9 - 2012

NOVA!

Page 63: ICPSR - Complex Systems Computing - Session 9 - 2012

Netlogo!

Page 64: ICPSR - Complex Systems Computing - Session 9 - 2012

NOVA!

Page 65: ICPSR - Complex Systems Computing - Session 9 - 2012

Net!Logo!

Page 66: ICPSR - Complex Systems Computing - Session 9 - 2012

Applying Model Building Principles Across

Different Platforms !

• You’ve mapped the dependencies in the code of the flocking model of Netlogo before, so I think you can see that while there are differences, some basic principles can be applied across different modeling platforms!!

Page 67: ICPSR - Complex Systems Computing - Session 9 - 2012

Similarities Across Programs!

• In Netlogo, there are sub-procedures to handle a bird’s aligning, cohering, or separating, !

• As you saw, there are similar dependencies in the NOVA system dynamics model version.!

Page 68: ICPSR - Complex Systems Computing - Session 9 - 2012

Similarities Across Programs!

!

• Although the flocking model is an advanced model, your prior experience with it in Netlogo should make what once looked strange and unfamiliar seem much more manageable.!

Page 69: ICPSR - Complex Systems Computing - Session 9 - 2012

Modular Coding and Hierarchical Systems!

• Another thing to note is that NOVA’s hierarchical design works just like modular coding in Netlogo.!

• Even better, as we will see when we construct our own NOVA model, NOVA allows you to literally drag and drop sub-models into other models.!

Page 70: ICPSR - Complex Systems Computing - Session 9 - 2012

Modular Coding and Hierarchical Systems!

• The drag-and-drop feature is just like adapting already existing code in Netlogo to your own modeling needs. !

•  If you needed the “Mover” sub-model in the NOVA flocking model, which converts polar coordinates to rectilinear coordinates, you can copy it to your own model.!

Page 71: ICPSR - Complex Systems Computing - Session 9 - 2012

Modular Coding and Hierarchical Systems!

• You do not need to reinvent the wheel.!

Page 72: ICPSR - Complex Systems Computing - Session 9 - 2012

Building Our Own Model!

• Now we are ready to build our own system dynamics model in NOVA. !

• Since we have already conceptually mapped what a simple population growth model would look like, why don’t we expand upon that and see what implementing a system dynamics model looks like!!

Page 73: ICPSR - Complex Systems Computing - Session 9 - 2012

!Building the Simple Population Growth

Model!!

Page 74: ICPSR - Complex Systems Computing - Session 9 - 2012

Building Our Own Model!

• If you haven’t done so already, let’s get a clear NOVA canvas to work with. !

• Go to File > New Project to bring up a blank page to work with.!

Page 75: ICPSR - Complex Systems Computing - Session 9 - 2012

File > New Project!

Page 76: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 77: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• As you remember from before when we conceptually built the simple population growth model, we know that we will need a stock for population, a flow for growth, and parameters that will tell the model what the growth rate is at any given time.!

Page 78: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Let’s get components for our model.!

• Please click on the Components button on the top right of the screen to access the Components Menu.!

Page 79: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• We are going to want to get a stock.!

• Stocks are represented by the green square in the first top left button in the Components menu. !

Page 80: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now that you have pressed stock, click on any clear section of the NOVA canvas.!

• The program will ask you to name the stock. Please name it “Population” !

Page 81: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• If you do not give a Stock a name, NOVA will assign it the name “Stock 0.” This is true for other component types as well.!

• If you need to rename a component, just double click on the name (not the component, just the name tag).!

Page 82: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• You should now have a stock called “Population.” !

Page 83: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The next thing we need is a flow. Click on the flow button, which is the button on the very top far right that looks like a yellow hour glass. !

!

• As we mentioned before, it represents a valve controlling the rate of the flow.!

Page 84: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now click somewhere to the left of the population stock.!

• Next, NOVA will ask you to assign the flow a name. Give the flow the name, Growth.!

Page 85: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• You should now have something that looks like this:!

Page 86: ICPSR - Complex Systems Computing - Session 9 - 2012

The Select, Resize, & Move Arrow!

• Before we move on, it would be a good thing to learn about an arrow you can use to select and move components with. This arrow is on the top right, next to the blue question mark and green ‘i’ button.!

Page 87: ICPSR - Complex Systems Computing - Session 9 - 2012

The Select, Resize, & Move Arrow!

• By forming a rectangle completely around any component you wish to move, this arrow will allow you to move any object or objects you wish.!

Page 88: ICPSR - Complex Systems Computing - Session 9 - 2012

The Select, Resize, & Move Arrow!

• The objects will become black when they are selected. While they are this color, you may move them.!

!

Page 89: ICPSR - Complex Systems Computing - Session 9 - 2012

Another Way to Move Objects!

• Even without the move arrow, you can simply click on a component once to move it. Like with the move arrow, after a single click, the object will turn black.!

Page 90: ICPSR - Complex Systems Computing - Session 9 - 2012

The Select, Resize, & Move Arrow!

• Sometimes, when you are selecting components, you might forget that you still have a component button turned on, and this will cause you to accidently put down components.!

• The Select & Move arrow is a good ‘neutral’ position to be in to stop that from occurring.!

Page 91: ICPSR - Complex Systems Computing - Session 9 - 2012

• Back to our model…!

Page 92: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Again, you should now have something that looks like this:!

Page 93: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The next step is to connect the Growth Flow rate to our population stock.!

• However, first we should look inside the flow rate, to see how flow rates work, and to make the flow rate uniflow (since it will only be moving in one direction, into the stock.)!

Page 94: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Right-click on the valve of the Growth Flow rate, you should get the following interface:!

Page 95: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 96: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• This is where you will be able to define the mathematical relationships between stocks and flows. !

• You can see that on the bottom left, there is a list of programming code that is native to NOVA, just like the ‘primatives’ of Netlogo.!

Page 97: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 98: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The box on the top right will be where other variables and parameters that affect the rate of the flow will show up. !

• This will you will know what needs to be accounted for when you write out the equation detailing how the flow will influence your stock. !

Page 99: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 100: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The large box in the top middle is where the code will be written.!

• Just to give a hint of what is to come, in order to model population growth we will have to come up with an equation using the following terms: current population and the current growth rate.!

Page 101: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 102: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Finally, the bottom middle box is for comments. !

• Just like commenting in Netlogo was not used by the program, anything written here is for users to see only, and will not alter the operation of the model in any way.!

Page 103: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 104: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Under the comments box you will see two options, Uniflow and Biflow.!

• Select Uniflow and then press OK.!

Page 105: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now we will connect our Growth Flow to our Population Stock.!

• First double-click on the right-hand cloud. You should see a blue dotted line that follows your mouse wherever it goes.!

Page 106: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 107: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The blue dotted line is ‘sticky,’ it will not let go of your mouse until it is stuck onto a stock. Right now, that is exactly what we want. However, sometimes, especially if you double click a cloud by mistake, this can be a nuisance.!

Page 108: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• As mentioned earlier, selecting the Select and Move arrow is a good way to get out of such jams.!

• Another way is to click the bottom right edge of the components or plugins box. This will get rid of the sticky blue dotted line, as well as other component buttons.!

Page 109: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 110: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now we will connect the flow to the stock.!

• Double-click the right-hand cloud again and drag the blue dotted line to the population box. Once there click the population stock.!

Page 111: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 112: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Your model show look like the following:!

Page 113: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 114: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now our flow is connected to our stock!!

• We now have a stock, and something to change the stock.!

Page 115: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

!

• Since we are building an exponential growth model, we need to inform the flow of the existence of the current population, since the current growth rate is dependent upon the current population size.!

Page 116: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

!

!

• This is done by ‘adding arrows,’ which connect an information source to another component that needs the information.!

Page 117: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Go back to the components menu and select the red arrow button!

• It is on the left hand column of the 2nd to the top row.!

Page 118: ICPSR - Complex Systems Computing - Session 9 - 2012

Sticky Lines!!

• WARNING!!

• Red arrows are sticky too. If you need to get out of red arrow mode, just select the select and move arrow, or click the bottom right edge of the components menu.!

Page 119: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Once you clicked the red arrow, click on the Population Stock. There should now be a red dotted line following your mouse coming out of the stock.!

Page 120: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Drag your mouse, and the red dotted line, to the yellow valve on the Growth Flow and click it. There will not be a red arrow pointing from the Population Stock to the flow.!

Page 121: ICPSR - Complex Systems Computing - Session 9 - 2012

How do I get Rid of !Red Arrows?!

•  If you have a red arrow you don’t like, just click off the red arrow (by clicking the bottom right edge of the components menu) and then click the circle on the end of the red arrow.!

•  It will turn the arrow black, and you can either move the arrow or delete it.!

Page 122: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

Page 123: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now we need a rate of growth. !

• We will allow the user to select what the rate of growth will be, so we want to use a component that allows for user input.!

Page 124: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Go back to the components menu and select the button in the middle column of the second to the top row. This button looks like a red arrow pointing away from the left.!

Page 125: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• This is a data input button.!

• We are actually creating the sub-model of our main model right now. The rate of growth slider will be in the main model’s interface, and this input button brings in the information into the sub-model.!

Page 126: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Call the Data Input button ‘rate.’ !

• Now we want to connect the rate to the Growth Flow.!

• Go back to the components menu and get a red arrow and connect it to ‘rate.’ !

Page 127: ICPSR - Complex Systems Computing - Session 9 - 2012

It Should Look Like This!

Page 128: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Now connect the red arrow to the yellow growth valve. Now we have information about the current population size and the rate of growth going into the flow.!

Page 129: ICPSR - Complex Systems Computing - Session 9 - 2012

!NOW Time to!

ADD THE MATH …!!

J !!

Page 130: ICPSR - Complex Systems Computing - Session 9 - 2012

It’s Getting Serious Now!

• Right-click once on the yellow valve on the Growth Flow.!

• This will take you back to the Flow Interface.!

• We are going to add an equation in the large box in the middle.!

Page 131: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 132: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

!

• Notice how the stock and data input are now in the box on the top left.!

• That is because the red arrows are pointing to the flow.!

!

Page 133: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• You can now either write “rate * population” !

• OR!

• You can click rate in the top left box, type *, and then click population. Clicking them ensures you won’t misspell anything.!

Page 134: ICPSR - Complex Systems Computing - Session 9 - 2012

It Will Look Like This:!

Page 135: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• If you misspell a word, the flow’s name becomes red.!

Page 136: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• We would also like to add an initial population, especially one that the user could select.!

• In order to do that we return back to the components menu, and select the Data Input button again.!

Page 137: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• This time, click on a clear spot on the canvas and name the Data Input, “Initial Population” !

• Go back to the components menu and select the red arrow, click it on the Data Input, “Initial Population,” and then connect that arrow to the Population Stock.!

Page 138: ICPSR - Complex Systems Computing - Session 9 - 2012

Here’s What It Should Look Like!

Page 139: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Once you have clicked out of red arrow mode, go back and left click the Population Stock.!

• This will bring up the Stock Interface. Click on Initial Population in the top left hand box, so that Initial Population then appears in the top middle box.!

Page 140: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Click on Initial Population in the top left hand box, so that Initial Population then appears in the top middle box. Then click OK to get out of the interface.!

Page 141: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• The next step is to bring the current population information into the main model interface.!

• Just as Data Input buttons are used to bring information from the main model to the sub-model, we will bring the information to the main model from the sub-model with a Data Output button.!

Page 142: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Go back to the components menu, and select the button in the right hand column of the 2nd to the top row.!

Page 143: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• Click somewhere to the right of the population stock and name the Data Output, “pop”.!

• Then get a red arrow, connect it to the Population Stock, and connect the arrow to the Data Output, “pop.” !

Page 144: ICPSR - Complex Systems Computing - Session 9 - 2012

Our Sub-Model Is Almost Done!

Page 145: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• There is only one more step before our sub-modal is finished.!

• Right-Click on the data output “pop”, and write “Population” in the Data Output Interface Coding box (the one in the middle on the top). This sets “pop” to “Population,” our stock.!

Page 146: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 147: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Model!

• That’s it! Now the stock’s value will be outputted to the main level of the model.!

• Now we will create the main level so that we can create the sliders and the GUI.!

Page 148: ICPSR - Complex Systems Computing - Session 9 - 2012

Finished Sub-Model!

Page 149: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• To create the main level of the model, we need to click the yellow paper button on the top left.!

Page 150: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• It will ask you to name the sub-model. Call it “Simple Population Growth” !

Page 151: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Now there is probably a blank screen. This is the higher level of the model. It has not yet been made.!

Page 152: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• You’ll see the sub-model in the bottom left box. Click on the name and you’ll get our sub-model.!

Page 153: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• We can give our main model a title. Just right click on “Untitled” and give it the name “Population Model”.!

Page 154: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 155: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Now click on “Population Model,” the main model.!

• We are about the drag-and-drop our sub-model into the main model.!

Page 156: ICPSR - Complex Systems Computing - Session 9 - 2012

• Click, AND HOLD, the sub-model’s name in the bottom left box (Simple Population Growth), and drag your mouse, while holding down, until you get into the empty canvas. Now drop.!

• You now have the sub-model embedded as a chip inside the main model.!

Building the Main Model!

Page 157: ICPSR - Complex Systems Computing - Session 9 - 2012

Drag-and-Dropping the Sub-model!

Page 158: ICPSR - Complex Systems Computing - Session 9 - 2012

Seeing the Sub-Model from the Main Model Level!

•  To see the sub-model, just press Shift + right click and press on the chip.!

Page 159: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Did you see the little red things sticking out of the chip? Those are the two data inputs and the one data output!!

• They are called pins, and they communicate with the sub-model.!

Page 160: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Which means we need sliders for the data inputs.!

• Go to components and select the slider (its on the left hand side, 4th row down).!

Page 161: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Once you selected slider, click somewhere clear on the canvas and name the slider, “rate”.!

Page 162: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 163: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• The slider goes between 0 and 100.!

• Those are bad values for a growth rate.!

• Right click the bottom right edge to get the slider interface, and change the high value to 2.0.!

Page 164: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 165: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Create another slider and call it “Initial Population.” !

• You can leave the range between 0 and 100.!

!

Page 166: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• However, we cannot have fractions of people in the initial population.!

• Right click on the bottom right edge of the slider to change the decimal place to 0.!

Page 167: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 168: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• We can now assign the sliders to the input pins in out sub-model chip in the main model.!

• Go ahead and right click on the sub-model chip and an interface will appear.!

Page 169: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 170: ICPSR - Complex Systems Computing - Session 9 - 2012

Building the Main Model!

• Go ahead and assign the input “rate” to “rate” in the draw down menu, and the input “Initial_Population” to Initial Population in the draw down menu.!

• These connect the inputs in the sub-model to the main model’s sliders. No red sticky arrows needed.!

Page 171: ICPSR - Complex Systems Computing - Session 9 - 2012

Our Main Model, so far!

Page 172: ICPSR - Complex Systems Computing - Session 9 - 2012

Our Model, so far!

• Our sub-model calculates the new population is each time step, and with the new sliders, we are able to input an initial population, and a current population growth rate.!

• All we need now is a graph!!

Page 173: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

• Go to the components menu and select the ‘add graph’ button, located on the left-hand side on the 2nd to the bottom row.!

Page 174: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

• Now add the graph somewhere to the right of the sub-model chip.!

• Name the graph, “Population.” !

Page 175: ICPSR - Complex Systems Computing - Session 9 - 2012

The Graph, Population!

Page 176: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

!

• We need to configure the graph.!

• Right click on the right bottom edge of the graph to pull up the graph interface.!

Page 177: ICPSR - Complex Systems Computing - Session 9 - 2012
Page 178: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

• As you can see, the interface wants us to now select what we want to graph.!

• In the left-hand “Select Contents,” there is an option labeled, Simple Population Growth_0.pop!

• Clearly, that is what we want to select, but why?!

Page 179: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

• Simple Population Growth is the name of the sub-model.!

!

• The “.pop” refers to the output pin, which you will remember we named, “pop.” !

Page 180: ICPSR - Complex Systems Computing - Session 9 - 2012

Sub-Models Can Be Used by Multiple Chips, Multiple Models!

•  It is assigned the number zero because that is the name of the chip in our interface. We could create another chip, and then we would have two models, each using the same sub-model, but we could supply different sliders in order to provide different values.!

Page 181: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

• We can give an alias what we are graphing by selecting Simple Population Growth_0.pop, and then writing an alias in the Alias box, and pressing Set.!

• Name the alias, “Population Model” !

Page 182: ICPSR - Complex Systems Computing - Session 9 - 2012

Getting the Graph!

Page 183: ICPSR - Complex Systems Computing - Session 9 - 2012

Our Model Output! !A Success!!

Page 184: ICPSR - Complex Systems Computing - Session 9 - 2012

The Finished Product!

• Our model now is fully linked up to the graph, and therefore has a complete two-tiered hierarchical system dynamics model of exponential growth!!

Page 185: ICPSR - Complex Systems Computing - Session 9 - 2012

The Finished Product!

Page 186: ICPSR - Complex Systems Computing - Session 9 - 2012

Running the Simulation!

• Now go to the Simulator and select Clock!

• As we said earlier, Clock runs for a period of time given certain parameters.!

• Go ahead and run the model with different parameters!

Page 187: ICPSR - Complex Systems Computing - Session 9 - 2012

Running the Simulation!

• You can also select Auto in the Simulator.!

• Auto will automatically update when you change parameters!

• Go ahead an run a few different parameters using Auto!

Page 188: ICPSR - Complex Systems Computing - Session 9 - 2012

A Word of Advice!

• While not so important with graphs, be careful about fussing too much with the GUIs while they run.!

• It can cause problems.!