|
|
|
|
||
|
DEFINITION MODULE SimDatAccess; (******************************************************************* Module SimDatAccess (SD_Version_2.0) Copyright (c) 1997-2006 by Andreas Fischlin, Dimitrios Gyalistras and ETH Zurich. Purpose Read data frames and assign data to ModelWorks objects. Remarks This module is a sister module to SysDatAccess. In contrast to the latter, this module works with any kind of model and model object declarations made by SimBase.routines. This means in particular that models can only be referenced via the opaque type Model from module SimBase, no monitoring levels are supported and that this module is intended for restricted use only (no client interface for general use). A fully functional client interface, however, is available from module SysDatAccess. See also modules SysDatAccess, SimBase, and DataFrames. Programming o Design Andreas Fischlin 17/09/1997 Dimitrios Gyalistras 23/01/1997 o Implementation Andreas Fischlin 17/09/1997 ETH Zurich Systems Ecology CHN E 35.1 Universitaetstrasse 16 8092 Zurich SWITZERLAND URLs: <mailto:RAMSES@env.ethz.ch> <http://www.sysecol.ethz.ch> <http://www.sysecol.ethz.ch/SimSoftware/RAMSES> Last revision of definition: 25/05/1998 AF *******************************************************************) FROM DMLanguage IMPORT userBase; FROM SimBase IMPORT Model; (* Error constants: simDatAccessErrOffset = DMLanguage.userBase + 390 .. 400 *) (************************************************) (*##### Analysis of current model base #####*) (************************************************) PROCEDURE AnalyzeModelWorksModelBasis; (* Call this routine each time you have modified the ModelWorks model basis and before (!) calling any of the following routines from this module. Otherwise no successful data assignment (nor deassignment etc.) will be possible. Note, this routine analyzes all models and model objects by using their identifiers as declared to ModelWorks by calls to the routines DeclM, DeclSV, DeclP, DeclMV or SetDefltM, SetDefltSV, SetDefltP, and/or SetDefltMV. However, note, no access is possible to any models or model objects, in case the strings used for the identifiers do not conform to the syntax of an identifier ( letter { letter | digit } ). *) (**********************************************) (*##### Setting of global parameters #####*) (**********************************************) PROCEDURE AssignGlobalSimulationData; PROCEDURE DeassignGlobalSimulationData; (**************************************************) (*##### Setting the attributes of models #####*) (**************************************************) PROCEDURE AssignModelData( m: Model ); PROCEDURE AssignAllModelData; PROCEDURE DeassignModelData( m: Model ); PROCEDURE DeassignAllModelData; (***************************************************) (*##### Setting the data of model objects #####*) (***************************************************) TYPE ModelObject = REAL; PROCEDURE AssignMObjData ( modObj: ModelObject ); PROCEDURE AssignModelsMObjData ( m: Model ); PROCEDURE AssignAllMObjData; (* Assigns the data stored in all currently available data frames (see also module DataFrames) to the matching model object (AssignMObjData), to all matching model objects of model "m" (AssignModelsMObjData), or of all currently declared model objects (AssignAllMObjData), respectively. A match is given if the same identifier is used for both the value definition in the data frame and the model object. Note, in case of multiple value definitions encountered during reading the data frames, the data finally assigned to the model object are those found last in the reading sequence (overwriting principle). *) PROCEDURE DeassignMObjData ( modObj: ModelObject ); PROCEDURE DeassignModelsMObjData ( m: Model ); PROCEDURE DeassignAllMObjData; (* Reverts the the effect of e.g. AssignMObjData and restores the data of the model object (DeassignMObjData), of all model objects of model "m" (DeassignModelsMObjData), or of all currently declared models (DeassignAllMObjData), respectively, to the values which they had before the last successful call to a data assigning routine, such as AssignMObjData, AssignModelsMObjData, or AssignAllMObjData. Depending on the current mode (see preference 'clearAtDeassignMode' from module SimDatAux) either the values as present before last assignment are restored or missing value data are assigned to all involved models, parameters etc. *) PROCEDURE CheckMObjData ( modObj: ModelObject; VAR allOk: BOOLEAN ); PROCEDURE CheckModelsMObjData ( m: Model; VAR allOk: BOOLEAN ); PROCEDURE CheckAllMObjData ( VAR allOk: BOOLEAN ); (* Checks whether model objects of model "m" or of all currently declared models, respectively, have a valid value, i.e. whether (value<>DMConversions.UndefREAL()) AND (value<>MIN(REAL)). Issues a message of type Errors.Info for each found model object with a non-valid value. Note, you can anytime use SetDebugMode(TRUE) from module Errors or keyboard shortcut "Command^Shift^Capslock^D" to activate the debug mode. In this mode, Errors.Halt messages which allow for calling the debugger, are called instead of Errors.Info. *) (**************************************************) (*##### Setting of monitoring attributes #####*) (**************************************************) CONST noMonitoring = 0; PROCEDURE AssignMObjMonitoring ( modObj: ModelObject; level: CARDINAL ); PROCEDURE AssignModelsMonitoring ( m: Model; level: CARDINAL ); PROCEDURE AssignAllMonitoring ( level: CARDINAL ); (* Sets levels of monitoring for an individual model or for all currently declared models. *) PROCEDURE DeassignMObjMonitoring ( modObj: ModelObject ); PROCEDURE DeassignModelsMonitoring ( m: Model ); PROCEDURE DeassignAllMonitoring; (* Resets monitoring for an individual model or for all currently declared models. *) PROCEDURE CheckMObjMonitoring ( modObj: ModelObject; VAR allOk: BOOLEAN ); PROCEDURE CheckModelsMonitoring ( m: Model; VAR allOk: BOOLEAN ); PROCEDURE CheckAllMonitoring ( VAR allOk: BOOLEAN); (* Checks whether monitoring attributes of all monitored objects of an individual model or of all currently declared models are set to valid values. Issues a message of type Errors.Info for each found non-valid attribute. Note, you can anytime use SetDebugMode(TRUE) from module Errors or keyboard shortcut "Command^Shift^Capslock^D" to activate the debug mode. In this mode, Errors.Halt messages which allow for calling the debugger, are called instead of Errors.Info. *) (*********************************************************) (*##### Setting of multi-run tally computations #####*) (*********************************************************) CONST noTallying = 0; PROCEDURE AssignMObjTallying ( modObj: ModelObject; level: CARDINAL ); PROCEDURE AssignModelsTallying ( m: Model; level: CARDINAL); PROCEDURE AssignAllTallying ( level: CARDINAL); (* Sets levels of statistical analysis of multi-run simulation experiments for an individual model or for all currently declared models. *) PROCEDURE DeassignMObjTallying ( modObj: ModelObject ); PROCEDURE DeassignModelsTallying ( m: Model ); PROCEDURE DeassignAllTallying; (* Resets statistical analyses for an individual model or for all currently declared models. *) PROCEDURE CheckMObjTallying ( modObj: ModelObject; VAR allOk: BOOLEAN ); PROCEDURE CheckModelsTallying ( m: Model; VAR allOk: BOOLEAN ); PROCEDURE CheckAllTallying ( VAR allOk: BOOLEAN ); (* Checks whether attributes of statistical analyses of results of an individual model or of all currently declared models are set to valid values. Issues a message of type Errors.Info for each found non-valid attribute. Note, you can anytime use SetDebugMode(TRUE) from module Errors or keyboard shortcut "Command^Shift^Capslock^D" to activate the debug mode. In this mode, Errors.Halt messages which allow for calling the debugger, are called instead of Errors.Info. *) END SimDatAccess.
|
||
|
|
|