Advice for controlling a flow

Use this forum to post Vensim related questions.
Post Reply
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Advice for controlling a flow

Post by Phill »

Hello, I would appreciate some 'best practice' advice on how to control a flow to a stock. I have a flow of visitors into a park, with a rate that depletes the stock of 'Available visitors' and transfers them to the stock of 'Visitors in park'. The model runs hourly for 24 hours and the flow is controlled by an auxiliary variable with a Lookup curve. The default operation is simple and works well.

My problem is that I want to introduce controls that allow the flow to vary depending on the weather. I can use delays for bad weather, but I am unsure how best to deal with an increase in flow. For example, the default flow of arrivals is 1000 per hour. The weather is very sunny and I want more people to arrive earlier, so I want the first three hours to be 1500, 1000, 500, then continue at 1000 per hour.

I have used different Lookup curves for different weather patterns and I've tried using external data (Excel) but these seem cumbersome and inflexible. Can anyone suggest a better way? What i would really like is a variable to represent the weather pattern each hour throughout the day and for that to influence the visitor flow pattern.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I should have added that I need the model to respond to different weather patterns, so the key would be to easily change the weather distribution without having to change any other variables
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Advice for controlling a flow

Post by tomfid »

Lookups were the first thing that came to my mind, if you want a very general set of patterns. However, they are more troublesome than something with just a couple of parameters.

I think the question then is, what should those parameters be? A really simple option would be the mean and standard deviation of arrivals, but that's not very dynamic. OTOH if you have some data, it might be easy to characterize the historic response to weather.

To do better, I guess you'd have to get into the head of the visitor - what's their normal planned arrival time, what fraction of them drop out in bad weather, and what signal are they watching - current weather, or the forecast? If early current weather is bad, do they delay and hope for better, or abandon the trip?
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

Thank you Tom, a simple lookup, or external data table is sufficient to start with. I added those to my model, just three lookup tables for 'normal', 'good' and 'bad' weather. On each run I can simply manually alter which lookup table is called, but is there any way to randomly select a lookup table or a tab on an Excel worksheet, so that if my students are going through successive runs of the model they are presented with a random choice of pattern each time?
I want to host the model on a web server, running the Vensim DLL, then a class of students can access the model at the same time. I want them to submit a staffing plan beforehand, then run the model and understand how that plan might be disrupted by changing events such as weather patterns. To facilitate discussion, I would like the selected weather pattern each student sees on each run to be randomly selected. If I cannot set this in Vensim I can probably program the choice in the javascript interface.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Advice for controlling a flow

Post by tomfid »

One option - assuming you're in DSS or Pro - would be to have an array of lookups - as many as you need to have a low probability of the same student hitting the same realization. Then you could point to the desired value via VECTOR SELECT or VECTOR ELM MAP.

DSS can now publish models to a javascript/html/webassembly app that runs in the browser, which is generally much easier to set up than server-side .dll. You probably want that.

One thing we probably haven't tested is whether randomization to the clock (or whatever) works in a browser, so that might be something to test early.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I am using DSS, version 9.3.0. Is there documentation about the javascript/html/webassembly options? If I use the option under the 'File' menu to 'Publish web files', I get a 'Stop' error, 'Emscripten SDK not set up'.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

That will teach me to check the Help files before I ask a question. I installed the Emscripten SDK and 'Publish web files' now seems to work well, but can I ask if it is possible to compile a model that uses external data sources? My model links to Excel files and I get an error for 'unsupported file types' when I try to publish the web files. If I remove the 'GET XLS DATA' variables the web files are compiled without any problem. In this case I can simply change the data sources to lookups within the model, but I have other models currently running on a web server with the Vensim DLL that do quite extensively use Excel files, so I would be grateful to now if it is possible using this compiler.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Advice for controlling a flow

Post by tomfid »

Not yet unfortunately, but we're working on it.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

Thank you Tom, do you know yet when that might be available, it is a very interesting option for us?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Advice for controlling a flow

Post by tomfid »

We'll have a better idea when the dust settles after the SD conference.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I hope the SD conference went well. Do you have any more information on the web-ready publishing feature and connections to external data?
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I tried converting my XLS data to VDF, via a DAT file, but now when I try to 'Publish web files' I still get an error, 'ERROR: Data variables are not yet supported for web publishing:', so I assume no external data sources are yet possible in this publishing mode. I understand what you said before, that you would be working on this after the SD conference, but I would like to begin trying to create some interfaces for models published to web files, so I'd be grateful to know what the best way to incorporate data constants is. If I use LOOKUP variables, will that work?
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Advice for controlling a flow

Post by Administrator »

Lookups will work.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Advice for controlling a flow

Post by tomfid »

If there are still data variables in the model, you'll get the warning. If they're not used, I think you can probably ignore it without consequence.

Data doesn't yet work, and it doesn't matter if the source is GET XLS or file import. This is a high priority development item, just not quite as high as finishing some graphics items.
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

That's all clear, thanks
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I have changed the data variables in my model to lookups, but now when I run the 'Publish web files' command, I get the following errors, then the routine fails:

error: undefined symbol: GET_TIME_VALUE (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _GET_TIME_VALUE may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: 'C:/Users/Public/Vensim/COMP/wasm/emsdk/node/14.18.2_64bit/bin/node.exe C:\Users\Public\Vensim\COMP\wasm\emsdk\upstream\emscripten\src\compiler.js C:\Users\pmars\AppData\Local\Temp\tmp2_5c0_7y.txt' failed (1)
"Batch file complete!"

I'd be very grateful for some pointers towards what might be going wrong.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Advice for controlling a flow

Post by Administrator »

That function is missing from our implementation. I'll see if I can get it to compile and get back to you.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Advice for controlling a flow

Post by Administrator »

ok, there isn't a quick fix for this.

How are you using the GET TIME VALUE function? Only asking in case there is a straightforward workaround.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I'm using it in a NOISE SEED variable,

NOISE SEED= INITIAL(
GET TIME VALUE(2,0,10))
~ Dmnl
Phill
Senior Member
Posts: 156
Joined: Wed Jun 04, 2014 2:18 pm
Vensim version: DSS

Re: Advice for controlling a flow

Post by Phill »

I've removed that NOISE SEED variable and the web files compile correctly now.
Post Reply