Monday, September 26, 2011

Simulation Modeling Exercises 3.1

Finally got Stella installed! $129 for a perpetual student license. A good deal, but no upgrades, and they're set to upgrade in a few months. Did a quick tutorial from Voinov's online course, now on to the first exercises that actually involve playing with models. Yippie!

1. A model of a car dealership. The number of customers is random and sales occur with a certain probability. New stock is delivered with a delay. At given model parameters the stock goes to zero at certain times. How to avoid this if:
a) the delivery time is no less than 10 days?
b) or the size of the warehouse is limited by 100 units?
c) or both of the above? Can you change the dealership operation in such a way, that the average number of units sold daily will be above 10, while the stock size will be maintained below 50?



Stock (blue) and # deals/day (red) using either
a moving average or 10, whichever is greater.
This took a long time (and dinged my modeling confidence, but hey, I'm a beginner, right?), but I found something that works. I made two changes to the number of deliveries: to smooth things out, I use a moving average of the past 10 days (which is 10 to 20 days ago when the cars get delivered). In addition to using the moving average, I also set a minimum number of deliveries for each day of 10. That way, if the dealership had a bad day 10 days ago, we still get 10 cars 10 days later, so the inventory never collapses.

2. A simple population growth model, that has a certain growth rate and mortality rate. At this time it shows exponential growth with the population increasing to infinity. Modify the model in such a way that the population would grow to 400 and stabilize at about that size. Can this be achieved by changing parameter values only or the functions that describe flows need be modified? 
Booyah! #2 came much easier and more elegantly, if I may say so myself. All I did was modify the birthrate to be a function of the ratio of the population to the target population relative to the death rate. So my birthrate equation became
(Target_Population/Population)*Death_Rate
and the model and output ended up looking like this. Notice that now we can stabilize the population at whatever target we want.
3. The system describes a human population, which growth also depends upon the level of "development". The larger the population, the higher level of development it can reach. The development in turn stimulates population growth. As development grows, more babies are born, therefore the higher the population. Is there anything wrong with this conceptual model? What modifications could make the system "sustainable"? (That is, keep both variables within certain limits, avoiding extinction and runaway growth to infinity)

One way this model differs from the real world is that natality is linearly influenced by development, while in the real world, natality is inversely influenced by development; that is, as development increases, family size goes down. Making just that one change to the model, stabilizes the population at 30 and development at 1.5.

4. A model of CO2 and biomass on this planet. CO2 is released into the atmosphere. It is consumed by the forests. The forests are cut at a certain rate. They also decompose adding to the pool of CO2. Currently the model displays infinite growth of forests. How to modify the system to stabilize it?
Deforestation = Biomass / 100
I suspect there are many ways to stabilize this system, and I'd rather have done this by adjusting photosynthesis rate so that it's not linearly affected by CO2 (it's not, and in the climate change debate, that matters. If we assume, as Dr. Voinov seems to here, that as we pump more CO2 into the atmosphere, forests will be proportionally stimulated, then we'd have much less to be concerned with than we do). Nevertheless, one easy solution is to make the deforestation rate proportional to the amount of forest. Since the deforestation was originally set to 1 and biomass to 100, I used deforestation = biomass/100 to keep the initial deforestation rate the same, and the simulation stabilizes nicely.

5. Model of body weight. You gain weight because you eat. You loose weight due to exercising. However the more you exercise, the higher your appetite. Also the more you weigh the higher the appetite. So the weight grows and grows. Can this pattern be changed? 

Well, I suppose it's as good a time as any to show how ridiculous an exercise modeling can be if you're not careful. I solved this one analytical and managed to stabilize the weight right at 120 ... with -48.5 hours of exercise a day! Hmm... back to the drawing board.

There's another solution, which I also hit on analytically, which stabilizes weight with a positive value for exercise. All I did was set the equations for food intake and weight loss equal, decided that calorie content and exercise efficiency should be static parameters (so I substituted the values from the original model), and then solved for exercise in terms of body weight, which ends up being body weight * .07/2.3, and the model ends up looking like that to the left.

6. A river is represented by 5 identical reaches. The water collected from the catchment area drains into the river reach N5 and then travels down the river. The precipitation pattern is random and results in sharp oscillations in the river stage in the reaches. What changes to parameters and/or functions are necessary to stabilize the system so that
1) there is no accumulation of water in the river;
2) the oscillations in the water depth are smoothed out.
Modify the model to describe the travel of one pulse of water through the river system. 

I don't completely understand this model. I don't get what the parameter M is. However, by unclogging the plug at the bottom of the model, I accomplished the two goals. I increased the outflow rate from 0.1 to 1, which drains the system so that water no longer accumulates, but doesn't drain it so fast that the each precipitation event flashes through all five reaches.

Fun with modeling! I really love this stuff and am glad to have moved from the theoretical part of the course to the hands on part. Can't wait until we're building our own models. First, "Essential Math."

No comments:

Post a Comment