Tables are top level objects in that they are represented by icons in the simulator window. They are free-form objects in that they have no defined slot composition; indeed, they have no slots at all when first created. The user adds slots to a table to accomplish certain logistical and policy tasks. There are three broad tasks that the slots in a table may accomplish:
- Holding input time series data. A table's slots may be loaded with
time series data.
- If any of these slots is linked to inflow slots in a water object, it
represents unregulated inflow.
- If a table time series slot is linked to the storage slot on a water
object, it represents desired end of period storage.
- Finally, if such a slot is linked to the outflow slot, it represents
a demand.
Note that if a series is to be linked only to a single water object slot,
it is more efficient to load that series directly into that slot. Table input
series make the most sense for such things as evaporation coefficients which
might be the same over several reservoirs.
- Collecting output data. Any of the slots in a water object may be linked
to slots in a table. In that case, the table slot will collect an output series.
This feature is most useful in the case where summed output is desired. For
example, linking the evaporation from all the reservoirs to a single table slot
will yield the total system evaporation for each time step. As above, this
feature may be used to get individual output values, but that is more easily
done simply by checking the output box for the slot in question.
- Defining intermediate variables. The slots in a table may be used to
define new variables which may then be used to control the course of the
simulation. For example, if the release from one reservoir is dependent on
the average inflow to another reservoir over the past year, that average
would be held by a running average slot on a table.
All tables in a model are guaranteed to calculate their values before any water
object begins. Within a table, slot values will be calculated from the top slot
in the display moving downward in turn. There is no way to determine the precedence
of calculation between two tables. Hence, if order of evaluation is important, place
all such slots in the same table in the order required to get the desired result.
If it is necessary to link tables into the model using
graphical links through the GUI, it is important to remember that a table may be
either input or output, but not both. This designation is at the table level and
does not effect intermediate variable calculations which may be on input, output
or unlinked tables.
Table Slot Types
The possibilities for using table objects to perform complex calculations are quite
rich. To add a slot to a table, simply choose "Add Slot" from the menu at the top
of the workspace when a table is open. The menu will drop a list of the possible
types of slot. Upon choosing the type for the new slot, a dialog will pop up asking
for more information. The only thing you must choose is the physical type
of the slot (flow, volume, area, etc.). This value cannot be changed once the slot
is created. There are several types of slot that may be attached to a table (they
may freely be intermixed in any proportion):
- Accumulator slots: These slots accumulate a running average or a running
summation over some number of time steps. Their value may be set by writing a
rule.
- Calculator slots: These are normal time series slots. Such slots may be
linked to or from corresponding type water object slots. Time series slots also may
have rules attached which makes them ideal
for holding intermediate calculated values. These values are calculated at the
beginning of the time step and may be accessed by any other rule in the system.
- Forecast slots. As the name suggests, these slots are used to generate
a forecast. They do so by watching some other slot in the system which has a
user series attached to it. This slot looks at that
series some number of time steps ahead of the simulation timer. This forecast can
be used as the basis for decisions in a rule.
- Gradient slots: As with the forecast slot, this slot watches the
user series of some other slot in the system. It
calculates the time rate of change of that series over some number of time steps.
This gradient can be used as the basis for decision in a
rule. For example, one might want to
increase the release from a reservoir if the inflow was increasing above a certain
rate. The gradient slot allows such rules.
- Time Hack slots: It is often useful to be able to make a decision
that depends on the time within a simulation. The time hack slot keeps track of
the simulation timer and reports its value in whatever terms are desired. The
following time hacks are available:
- Hour of Day: This is a number between 1 and 24.
- Day of Cycle: This is a number between 1 and the number of days
in the control cycle.
- Julian Date: This is a number between 1 and either 365 or 366.
- Month of Year: This is a number between 1 and 12.
The figure below shows a table with the various types of slots added:
This table has two calculator slots in addition to one
each of the other types. The slot labeled "GenPrice" is used simply to hold a
time series. In this case the series contains a list of power prices by hour of
the day. The second slot has nothing but a rule. In the model from which this
example was taken, the rule looks at the GenPrice and decides whether it is
worthwhile to turn on the generators.