[MUSIC] Hello my name is Ligia Paina and this is a tutorial on how to develop stack and flow diagrams using Vensim. And I'd first like to acknowledge the contributions of my co facilitator Dr. David Bishai. I'd also like to mention that the model that we be using today is courtesy of Professor from the engineering school. He developed this model as part of the future health system’s workshop on complexity in June 2014. So our objectives today are to introduce you to Vensim and then to demonstrate the development of a stock and flow diagram in Vensim using a public health example. First of all, I would like to mention that you can all access Vensim for free. This software is available on the Vensim website and the PLE version can be used to build a variety of diagrams, including causal loop diagrams, stock-and-flow diagrams. And it can also be used to conduct basic modeling analysis. If that software version does not meet your needs, there are more advanced versions available for purchase within disconfer and academic use. And if you are interested in comparing the various features, the Vensim website has a table available that can help you figure out which version would be best suited for your needs. Although today we will be working in Vensim, there are other softwares available to draw stock and flow diagrams, and these include STELLA and AnyLogic. To get us started, we will be going over a simple scenario today. In this scenario, we will have just a few variables, and we will talk about technical quality. And these four bulleted statements illustrate the relationships that we will be interested in. So in this case, we will have a situation in which improvements in technical quality will lead to greater volume of services. And that make sense. The better the quality of services, the more patients will want to attend a facility and, therefore, the volume of services grows. After some time, the increases in the volume of services could potentially erode the technical quality. If, for example, this high volume of services exceeds the capacity of the service facility. An intervention, a reward, can be introduced to improve the technical quality. And also the higher the technical quality, the greater the reward. These relationships are illustrated in this Causal Loop Diagram. Especially if they are related to the technical quality and volume of services and that is really what we'll be focused on today. And you see that the Casual Loop Diagram is a diagram that proposes which variables are related and illustrates in core feedback and this can also be illustrated in Vensim and there is a separate tutorial for that. However, our interest today is in Stock-and-Flow diagram. In the Stock-and-Flow diagram we learned how these variables are related. Here we will distinguish between the various variables. For example, some will accumulate. Some will actually be inflows and outflows. And some will be used as descriptors or auxiliar variables. A review from lecture of the main elements of a Stock-and-Flow diagram, we have four main components. The first one is the box or level variable. And these symbolize quantities that can accumulate. Rates are components that illustrate changes in quantity over time. Auxiliary variables are constants or other parameters that help to describe the various rates or box variables. And finally, we have connectors and these are arrows which illustrate the dependency between variables. After you download Vensim, we can get started with recreating the diagram. And just a quick reminder this is just a very minor part of a larger system dynamics model. On your desktop your will find the Vensim PLE button, and you double click it to open it. To get started, we'll double click the Vensim icon on the desktop, and this opens the workspace. You will see that there are two toolbars. One on the left-hand side and one on the top. To start with a new model, we click this button. And here we will see that we get a model settings sub menu. And there are four elements that we need to consider here, the initial time which is set at 0, the final time which is set here at 100, the time stamp, which is one, but can be less depending on what you need. And the units of time which now is set at a month but can be set at smaller units if needed or larger as well. For now, if we leave it with these initial settings, we will have a model that can run for 100 months and that is fine for this initial model as we're not going to be doing too much modeling analysis. So we can just press OK. There are several steps that we have to go through to rebuilt the diagram that we started in the slides. First of all, we have to build the box variables or the levels. In order to do that, we will click on the box variable button on the top toolbar. And then we go to the workspace and click to add technical quality [NOISE] and volume of services. [NOISE] We click enter. If we need to move these variables or any other variables, the cursor turns into a hand and that allows us to move things around the work space. If we need to delete any of the elements, there is a delete button on the top toolbar, and you're able to delete variables that you no longer need. Control Z undoes the steps that you no longer want. After you create the box variables, you will create the rates. In order to do that, you click on the rate button at the top toolbar. We know that in this case, we remember that quality was lost. So we click on the quality variable and then we click next to it to add the quality loss rate. We remember from the scenario that volume is gain. So we click on the work space and click on the Volume of Services box variable to get the volume gain rate. So we have added the two box variables that were of interest and the two rates, both are flowing out and flowing in. The next step is to add the arrows to define the relationships between what we have so far. So we go to the top tool bar and we click on the Arrow button. And we'll remember that technical quality influence volume gain. So we click on Technical quality. Click on Volume Gain, and use the knob to curve the arrow, both to make it legible and also to follow convention. We then remember that the Volume of Services led to equality loss, so we click on the Volume of Services, we click on the rate, and we have our arrow there. The next step is to add our descriptive variables or our auxiliary variables. In order to do that, we go to the top toolbar, click on the variable button, and we'll have three auxiliary variables to add. These are an initial quality and then a couple of constants. Quality constant, and a volume constant. And we will draw arrows from a couple of these from the quality constant to quality rate, and from the volume constant to the volume rate. At this point we don't need to draw an error from the Initial quality. The next major step in completing this diagram is adding equations. In order to do that you click on the Equations button on the top toolbar. And this will highlight all the variables that either do not have a equation added or have not passed the error test that Vensim does internally. So today we will only be adding equations to two of the variables, but if you want to see all of the equations you can use Professor full model and explore it that way. We will be adding equations to the technical quality and also to the quality loss. So let's first work with the technical quality. Once you use the equations button and click on a variable, you get a sub menu that comes up. And in here you have some variable information. You have your equation. You have functions that you can add if you are so interested. You can also add various numbers and such. You have the variables that are available to you to use in an equation. And you have a comment box that you can use to document your assumptions, your data sources, any work that's left to do, and anything else that is useful to document. In this case, the technical quality is influenced by quality loss, and that is denoted by a negative sign. And the initial value is the constant we created that was initial quality. So we'll type that in, and once we're done, we'll just press OK. And as you can see, technical quality is no longer highlighted, which means that now it has an equation there. Next, we'll look at the adding an equation for the rate. And that is quality loss. So here, in the pop-up menu, we see the same variable information, equation, available variables, and such. And here, the variables that are of interest are the volume of services, and the quality constant. And they're related by a negative relationship. And then we click OK. Now if we were to go through the full model there would be much more work to do. Before we conclude on this particular point and I point you to the larger model that Professor developed,I would also like to point you to the Document All button. If you click on it, you're able to see all of the equations that are at play in this model. You will see that a lot of them are undefined, and that just means that, indeed, the highlighted ones need to have an equation filled in. So that is one good way to double check your equations and make sure that you have inputted things that you expect. Now I wanted to show you a brief glimpse at how to run the model and to do so we'll use professor model that you have available. So if we open it, we'll see the same diagram that we tried to recreate, but this one actually has all the equations put in. So the final step in building a system dynamic model is to actually run the simulations and do analysis. And in order to do so, you go to the top tool bar and you click on the simulate button. And here you will see both the trajectory, the point of equilibrium, and how quality and volume change over time. And you have this file in your resources in order to be able to play with it, change the quality constant, change the volume constant, and see how that shifts the equilibrium point and how that changes quality and volume over time. So while we won't go in depth over it, this is just to encourage you to try it out, and to change the various parameters and try to identify the dynamics that are at play, even in this very simple model. If you're interested to see all the equations that are here, you can click the Document All button. And you can see here which ones are available. Moving out of Vensim, this is an important reminder that the comment box in Vensim, or another separate document that can be used to document your assumptions, is very important. It's important both to document the iterations through the research question and objectives, especially as the dynamics emerge. And it's also important to document the rationale for including various variables and what data sources you are using. Often times, especially in low income health systems, you will not have very much data available and you'll have to make assumptions. So having these documented will be important, both for rigor and also to enhance the value of your model. What we will not cover in this tutorial is how to export the data and analyze it and how to run sensitivity analyses. But if you would like more information on that there are further tutorials available online. And John Sterman's Business Dynamics book is a good resources. This concludes our tutorial on how to develop Stock-and-Flow diagrams with Vensim. In this tutorial, we learned both how to draw the various components of the Stock-and-Flow diagram, and also how to run equations. And you'll have an example to play with and try it out on running your own simulations. [MUSIC]