Courses: Introduction to GoldSim:
Unit 4 - Building a Simple Model
Lesson 7 - Proper Model Design: Ensuring All Inputs are Specified Using Input Elements
Recall that in Lesson 4 (when we defined the Inflow_Rate), we noted that there was actually a problem with how we defined that element. Can you spot it?
It probably looks correct to you. And the model as constructed will actually work fine. The problem is really one of style, rather than one of syntax or logic; the style used here is poor, and can lead to confusing and error-prone models. In particular, the problem is that we have “hard-wired” an input directly into the equation. The time that the hose is turned off (2 days) is actually an input parameter. As such, it should be defined as a separate Data element, like this:
The Inflow_Rate should then be edited to look like this:
After doing so, you model should now look something like this:
Why is this important? There are two key reasons:
- It is always good practice to ensure all inputs are specified using Input elements. This allows others to quickly recognize them as model inputs. As we will discuss in a subsequent Unit, often you will group these together in one model location. In this way, all the key input assumptions are more apparent to anyone looking at the model. If an input is buried in an equation, it is very easy for someone to miss it.
- More importantly, if a particular input was actually used in multiple locations in a model, and wherever it was used, it was simply entered directly (as a number), it is quite likely that the model could become inconsistent. For example, suppose the value 2 days was used in 3 places. Suppose further that you decided to change it to 5 days. To make this change, you would need to find the 3 places where you entered this, and make the change. In a complex model, it would be very easy to forget one or more of the places you entered it. On the other hand, if it was originally entered as a Data element (and the three places it was used simply referenced the name of the element), you only need to make the change in one place – the element itself.
The key lesson here is that other than perhaps the default value of 0, in most cases you should not directly enter a number into an element (other than a Data element). Create a Data element representing that number, and enter the name of the Data element into the field, rather than the number.