Introduction
When you set up a Function or a Modelled Variablefunction or modelled variable, you get to can choose which simulation phase (s) you want to evaluate at. In order for the correct information to be it in. It is essential that the correct time of evaluation(s) is chosen to ensure that:
- Correct information is used in the function
...
- ; and
- It is evaluated on time, so it can be used in the
...
- selected location.
Types of Time of Evaluations
A total of seven Time of Evaluation
...
phases are available in Source:
- Start of TimeStep
...
- Resource Assessment
...
- Ordering
...
- phase
- Flow
...
- phsae
...
- Post flow phsae
- End of TimeStep
...
- Post Function Evaluation
...
- - Only available for
...
- modelled variables.
Resource Assessment
...
If you choose Resource Assessment as , the Function or Modelled Variable will be evaluated before each Resource Assessment System is processed. This could obviously result in If there are multiple Resource Assessment systems, there will be multiple evaluations.
Ordering/Flow Phase Time of Evaluation
Each function can be used in one or more model inputs. Each model input
...
As the ordering phase moves up the network, or as the flow phase moves down the network, the Function or Modelled Variable will be evaluated before each element it is used at. For example, if a function is used at two inflows, and the Order Phase has been selected as the time of evaluation, then the function will be evaluated twice in the order phase - once before each inflow where it is used. If the Function or Modelled Variable is used at an input which is not a network element, then it will be evaluated once before the phase begins.
Choosing the Time of Evaluation(s)
...
A lot of the power , (and confusion, ) when setting up a function is based around when to choose to evaluate a function or modelled variable. One One important note here is that there will most likely be multiple solutions which will work. To To understand where each of the choices fits in within the larger scheme of the model phases please review ......
Suggestion: Each element in Source is evaluated at a different time-step, depending on its .... (what word can be used here?).
-----------------------------------------------
Introduction to function ToE
A few words talking about the two types available - ie. functions & modelled variables.
, refer to 3.5.0 Simulation phases.
Functions Time of Evaluation
Anu: The key to choosing the time of evaluation for a function is to consider its usage. For example, if a function is used in a Resource Assessment system, then it is ideally evaluated in the Resource Assessment phase. ((Next sentence: Leave as is))The way to decide which time of evaluation to choose, is to look at where the function is being used. As an example, Likewise, if you are using the function in a Resource Assessment System, then ideally the function will be evaluated in the Resource Assessment phase. Likewise, if you are using the function to drive the demand on a time series demand model, then you would want to choose the ordering phase to evaluate the function. UNCLEAR: In In cases where you are using the function in at multiple placesinputs, you will have to decide whether its appropriate to may want to evaluate the function in at multiple phasespoints.
Modelled Variable Time of Evaluation
Modelled variables are designed to read data from the model, to be used as part of an equation in a function. Which Which Time of Evaluation you choose will depend on when the data you need will be available. For For example, if your modelled variable is pointing to the downstream flow of a node, then that data will only be available after the flow phase, so using the Post Flow Phase Time of Evaluation would most likely to be correct choice. End of Time Step Additionally, End of TimeStep would also work in this case.
Initial value
Its It is important to understand when the initial value of a modelled variable is used. At At the start of a run, all the modelled variable values are set to their initial value. If If a modelled variable is set to use a date range which results in an array - eg. (such as "Previous 30 Days" - then ), the array is populated with this initial value. If If a modelled variable is used by a function before it has been evaluated for the first time, or before it has been evaluated enough to fill in the associated date range array, then it will return the initial value (or an array of initial values). If we do a couple of examples: The following examples illustrate this principle.
Example 1
...
$Function1 = $ModelledVariable1
Time of Evaluations:
$Function1 = Start of Time StepTimeStep
$ModelledVariable1 = End of TimeStep
In this case, when $Function1 evaluates is evaluated it will use the initial value of $ModelledVariable1 for the first time-step. After this, after this it will use whatever the value that $ModelledVariable1 evaluates evaluated to at the end of the previous timesteptime-step.
Example 2
...
$Function1 = $ModelledVariable1
Time of Evaluations:
$Function1 = Start of Time StepTimeStep
$ModelledVariable1 = Start of Time StepTimeStep
$ModelledVariable1 points to the Downstream Flow of a node.
In this case, $ModelledVariable1 will never use its initial value because its it has already been evaluated before the function is evaluated. For For its first time-step, it most likely will be 0 though, as the downstream flow of a node is 0 at the start of the first time-step. After After this, $ModelledVariable1 will be yesterdays previous time-step value of the downstream flow of the node.