RiverWare 6.1: Unit Schemes / 8-10-2011
Unit Configurtion Data Inventory

  1. Sources, Repositories and Uses of Unit Configuration Data in RiverWare
    1. RiverWare Unit Types Definition
    2. Standard RiverWare Units Definition
    3. "User" or "Display" Units
    4. Slot-Configured ("Local") Scale and Units
    5. "riverwareDB" file.
    6. Old-Style DMI control files and data files
    7. Database DMI "Dataset" Units
    8. Mapped Unit Schemes (new development)

[ See also Unit Schemes: Initial Release Options ].

(1) Sources, Repositories and Uses of Unit Configuration Data in RiverWare

(1.1) RiverWare Unit Types Definition

RiverWare defines a fixed set of unit types (currently 52 general purpose unit types), e.g. Flow or Volume. Those are hard-coded within the RiverWare implementation ...

Unit types are associated with the following entities. The assignment of unit types to these entities is fixed, except in the case of entities which occur on Data Objects. (On Data Objects, the user assigns unit types to these entities using Slot Configuration editors) ...

Except for these entities on Data Objects, the associated unit types are defined in the Engineering Object, Account, Supply and Exchange class definitions of those slot-containing objects -- in Slot or SlotProxy C++ field initializers ... (Engineering Object Example ... Account Example).

A RiverWare unit type may also be dynamically associated with a numeric RPL value. (This doesn't really involve "configuration" data, except for the content of users' RPL code). RPL has its own unit system which is more general and dynamic than the RiverWare unit system; not all numeric values computed within RPL have a unit type represented within the RiverWare unit system.

(1.2) Standard RiverWare Units Definition

Hard coded into RiverWare (primarily in Units/StdUnits.cpp) is information about a "Standard Unit" associated with each RiverWare Unit Type. The primary unit-related information is a Standard RiverWare Unit name (e.g. "m3" for the standard "Volume" unit). There is also information:

(1.3) "User" or "Display" Units

The various units which can be chosen by the user for each of the RiverWare Unit Types are defined in the user-editable "units" file.

Primary fields for each Unit in the "units" file are:

There is also support for summation (integration with respect to time) of units having a "per-time" factor into the integrated unit. The application of this information is very limited. This data provides a basis for implementing conversions between Flow and Volume (and Power and Energy) in time series without requiring the per-Slot "alt" unit configurations used in Account SeriesSlots AND without resorting to "magic" unit type knowledge in RiverWare.

(1.4) Slot-Configured ("Local") Scale and Units

The Slot-related entities having a Unit Type association (see section 1.1) can also be assigned a particular Display Scale and Display Unit. Those Slot-related entities are:

Display scales are currently generally unrestriced floating point numbers, but are intended to be limited to non-negative powers of 10. (Currently, only the Periodic Slot configuration dialog and the Unit Scheme editor implements this restriction).

These assignments of Display Scale and Units to the entities above have been referred to as "Slot-Configured Units" or "Local Units" in recent Unit Scheme development documentation.

The Slot-Configured (or "Local") Scale and Units (and also Display Format and Precision) can receive values from the following SOURCES:

The following uses of these configuration values could potentially use instead a particular mapped Unit Scheme instance -- possibly the currently "active" mapped Unit Scheme.

(1.5) "riverwareDB" file.

The user-editable "riverwareDB" file (see example) is a source of Slot-name, Slot column label, and Unit-Type indexed attributes, including Display Scale and Units. It has the following uses:

  1. Initialization of slots' "local scheme" scale and units on new Simulation Objects, via the Prototype Objects (initialized only once at RiverWare startup).
  2. Initialization of Data Objects' "local scheme" scale and unit configuration widgets when switching a Data Object slot entity to a new Unit Type.
  3. Units and Scale for presentation of RPL numeric values outside of a "Slot context" (See option in RPL Parameters dialog).

(1.6) Old-Style DMI control files and data files

(1.7) Database DMI "Dataset" Units

A Database DMI "Dataset" in a RiverWare model can be used by multiple Database DMIs in that model. It allows the user to specify a Scale and Unit for each RiverWare Unit Type -- see image.

Within the Database DMI Dataset, the user can selected one of these three settings -- but not all three are applicable to the particular types of supported Database DMIs (e.g. Excel DMI Datasets don't support a "Database Units" source):

The unavailability of units for a particular slot may either generate an error OR may default to the slot's "local" (slot-configured) unit -- (sometimes? resulting in a warning) -- (I haven't yet looked at the specifics for the three different types of Database DMIs).

(1.8) Mapped Unit Schemes (new development)

A mapped unit scheme maps Unit Types -- optionally with respect to a Slot Name OR a Slot name on an Simulation Object or Account type -- TO numeric display attributes (Display Scale & Unit, Format and Precision).

We are envisioning the following types of mapped unit schemes:

A mapped Unit Scheme may be "complete" or "incomplete" with respect to Unit Types. As currently implemented, an "incomplete" Unit Scheme defaults to Standard RiverWare Units if no matching rule is found within the scheme for a given slot instance or unit type. (This can be changed to default to a well-known complete unit scheme).

One particular Unit Scheme will be the "Active" Unit Scheme at any given time. Uses of the "Active" scheme include:

One or distinct stable unit schemes (possibly the "Initialization" scheme -- or something else) should probably be used for the following applications. Such Unit Schemes could be a "well known" and complete unit scheme (e.g. THE "Initialization" scheme), or unconstrained identification of a unit scheme selected by the user.

Note that IF the "Local Scheme" goes away as a selectable globally-applicable unit scheme (i.e. legacy slot configurations) ...

  1. The "Initialization" Scheme should be renamed, e.g. to the "Default" Scheme, because the thing that it had been "initializing" has gone away.
  2. The SEVEN related Slot Configuration Dialogs and Tabs virtually disappear or are greatly simplified (i.e. the non-display attribute configurations and unit type settings on Data Object Slots will still need to be supported).
  3. We can canabalize the Slot class hierarchy display attribute fields which had implemented the "Local Scheme" -- FOR AN OVERRIDE MODE (i.e. to represent the override state). When initiating an override on a Slot, those fields would be initialized from the currently active scheme (for that Slot), and the user would modify only the display attributes needing to be overridden -- typically Display Precision -- but it could also be Scale, Unit or Display Format.

... See also: Unit Schemes: Initial Release Options.

--- (end) ---