Skip to content

2 Simulation Pipeline

shengxie edited this page Dec 21, 2024 · 2 revisions

Pipeline

anse-pipeline 001

Command Line Interface (CLI)

📌 Reminder: For ./anse-importer and ./anse-simulator, model= must use underscore _ (e.g., model=hello_world), hyphen -, space or other special characters are not allowed, because postgreSQL schemas and SQLite file names does now allow hyphen or space.

REM	====================================================================
REM	CLI of anse-importer
REM	==================================================================== 
REM
REM	USAGE:
REM	./ante-importer workspace=<string> model=<string> (db_mode=sqlite/pgsql) (validate=<true/false>) (import_into_db=<true/false>) (overwrite_in_db=<true/false>)
REM
REM	MANDATORY PARAMETERS		
REM
REM		workspace   The filepath for the folder which holds a single model (in the form of one or more .in file(s)) 
REM					to be imported. NOTE: May not include any spaces.
REM					Also: the folder path in which to write the importer logfile.
REM
REM		model		The name to give the imported model, in the destination database.
REM					NOTE: A model name must start with a letter or an underscore; the rest of the model name 
REM					can only contain letters, digits, and underscores (up to
REM					a maximum of 63 characters). No spaces nor other special characters are permitted in the model name
REM
REM	OPTIONAL PARAMETERS
REM
REM		db_mode			 A string value representing whether the model is to be imported into an SQLite
REM				database or in a PostgreSQL database. Acceptable values for this parameter are: 'sqlite' and 'pgsql'
REM						Default setting is 'sqlite'.
REM
REM		validate		A boolean value representing whether or not do do validation on the input file data (default is 'true').
REM
REM		import_into_db	A boolean value representing whether or not to create the input model (ie: import) in the user 
REM				database (default is 'true'). Although it may seem contradictory to run "ANSE_Importer.exe"
REM				 with this parameter turned off, it is useful to do this when a user wants to run import validation 
REM				on some model input files, without actually importing the model (eg. if the user does not have 
REM				the proper RDBMS installed for importing the model, but still wants to validate input files)
REM
REM		overwrite_in_db	When importing/creating model in a database, whether or not to overwrite a pre-existing model 
REM				in the database (if it exists) with the same name as the model being importing (Boolean. Default is 'false') 
REM
REM		autopopulate_universe Whether or not the system should automatically create and populate a "UNIVERSE" spatial
REM				group (and group type) when importing a model into a database. This spatial group includes every ASU defined 
REM				in the model at import time. (Boolean. Default is 'true')
REM				
REM 	presskey_at_finish	Whether or not to prompt the user to press a key when the simulation is completed,
REM				in doing so leaving the console window open until a key is press (Boolean. Default is 'true')
REM
REM
REM	NOTE: The "workspace" parameter should not contain any spaces, and we recommend using hyphen to separate words in filename and directories
REM	====================================================================
REM	SAMPLE COMMAND LINES
REM	====================================================================
REM	./anse-importer model=test_project workspace=./anse-models/test-model

REM	====================================================================
REM	CLI of anse-simulator
REM	====================================================================
REM
REM	USAGE:
REM	./anse-simulator model=<string> duration=<value> workspace=<folderpath> (dbmode=<sqlite/pgsql>) (validate=<true/false>) (overwrite_results=<true/false>)  (retention_interp=<linear/lstep>) (eventtimeseries_interp=<linear/lstep>) (phantom_results=<true/false>)  (batch_inserts=<true/false>) (cmo_crumbs_cleaning=<true/false>)(presskey_at_finish=<true/false>)
REM
REM
REM	MANDATORY PARAMETERS
REM
REM		model		Name of the target ANSE model. May not include any spaces.
REM					For Pgsql simulations only, the name of the model is the name of the pgsql schema in which the model is located.
REM					For SQLite simulations only, the filename of the SQLite DB model which the simulator will run be: [model name]+".model.db"
REM
REM
REM		duration	An integer representing the number of timesteps  for which to run a simulation, for the target model. 
REM
REM		workspace   For both Pgsql and SQLite simulations, the folder path in which to write the simulation logfile.
REM					For SQLite simulations only, the folder path of the model (SQLite DB) to be run.
REM					NOTE: for Pgsql simulations, models are NOT held in the workspace folder. They are held in the Pgsql DB. 
REM
REM	OPTIONAL PARAMETERS
REM	
REM	
REM		---------------GENERAL---------------
REM		db_mode			 A string value representing whether the simulation is to be run on a model in an SQLite
REM				database or in a PostgreSQL database. Acceptable values for this parameter are: 'sqlite' and 'pgsql'
REM						Default setting is 'sqlite'.
REM						NOTE: when the db_mode is 'sqlite' (which is also the default setting), the ''model_folder'
REM						parameter must also be provided by the user on the command line
REM
REM		validate		A boolean value representing whether or not to validate the model data (default is 'true')
REM				before starting a simulation. 
REM				NOTE: when wanting to only do data validation, without actually running a simulation, 
REM				simply set the "duration" parameter to zero.
REM
REM		overwrite_results	Whether or not to overwrite any pre-existing simulation results in the model 
REM				database. (Boolean. Default is 'false') 
REM
REM 		presskey_at_finish	Whether or not to prompt the user to press a key when the simulation is completed,
REM				in doing so leaving the console window open until a key is press (Boolean. Default is 'true')
REM
REM		---------------LINEAR INTERPOLATION PARAMETERS---------------
REM 
REM		retention_interp	The interpolation style to use for Pool retention curves; 'linear' (linear interpolation) or 'lstep' (left-justified stepwise interpolation)
REM				to use in filling Curve points which were unspecified by the user but are required for the simulation. 
REM
REM		eventtimeseries_interp	The interpolation style to use for Event timeseries data; 'linear' (linear interpolation) or 'lstep' (left-justified stepwise interpolation)
REM				to use in filling timeseries points which were unspecified by the user. 
REM
REM		---------------EVENT FLUX REPORTING PARAMETERS---------------
REM
REM			NOTE: Event Flux can record data for any combination of the following reporting parameters. 
REM			In general, the higher the level defail for Event Flux reporting [ie: via more Event Flu reporting data fields requested],
REM			the larger the EventFlux table will become during a simulation.
REM
REM		report_flux_by_source_pool		A boolean value representing whether include source pool information in Event Flux reporting.
REM						Default setting is 'false'.
REM
REM		report_flux_by_destination_pool		A boolean value representing whether include destination pool information in Event Flux reporting.
REM						Default setting is 'true'.
REM
REM		report_flux_by_source_physical_state	A boolean value representing whether include source physical state in Event Flux reporting.
REM						Default setting is 'false'.
REM
REM		report_flux_by_destination_physical_state		A boolean value representing whether include destination physical state in Event Flux reporting.
REM							Default setting is 'true'.
REM
REM		report_flux_by_initial_cmo		A boolean value representing whether include initial cmo in Event Flux reporting.
REM						Default setting is 'true'.
REM
REM		---------------POOL REPORTING PARAMETERS---------------
REM
REM		increment_endpool_cmo_age_in_pool	A boolean value representing whether or not, for an endpool (i.e., a pool which is not the sourcepool for any event),
REM				the age-in-pool of CMOs is to be incremented every timestep, by the simulator. In any model that includes any retention pools, the number 
REM				simulation records is potentially greatly reduced by having this set to false. If results analysis require knowing the age of every CMO in the
REM				endpool, this parameter should be turned on (However, users may be able to leave it turned off and infer the same information from event_fact results table.)
REM						Default setting is 'false'.
REM
REM		compress_retained_cmo_age	A boolean value representing whether or not, for a retention pool, the ages of retained CMOs
REM				should be compressed in order to potentially greatly lower number of CMOs in any simulation with cascading retention pools. 
REM				This compression/efficiency technique requires the pool to reference only one curve throughout the simulation, and for that
REM				curve to be a "first order retention" type curve, not a "gamma" curve (i.e., does retention with respect to current mass in the pool, not initial mass)
REM				For optimum results, the latter part of the retention curve should be a straight line (e.g. exponential / first order decay expressed as mostly a straight line)
REM						Default setting is 'true'.
REM
REM		---------------TROUBLESHOOTING PARAMETERS---------------
REM
REM		phantom_results		When set to 'true', disables the recording of simulation results (ie: to tables CMO_FACT, EVENT_FACT). Among other uses of this, this  
REM				allows an otherwise more time-consuming simulation to be run quickly (albeit without results recorded), so a user can check if the simulation 
REM				will run successfully to completion before devoting a larger amount of computer time to running it with results-recording turned on. Default is 'false'.
REM
REM		cmo_crumbs_cleaning 	Whether or not to do 'clean-up' of very small CMOs in the system during a simulation run. If set to 'true', the number and quantities of CMOs 
REM				affected is reported in the simulation logfile, between timesteps and cumulatively at the end of the simulation. To be cleaned, CMOs must be  
REM				smaller than the "CMO_error_buffer" parameter, as reported at the beginning of a simulation logfile.  Default setting is 'false'.
REM
REM		batch_inserts	Whether or not simulation results should be written (to database) as 'batch' inserts. If set to 'false', simulation results inserts will be done 
REM				one-by-one, slowing down simulation run times. This parameter is mainly for developer debugging purposes. Default is 'true'.
REM
REM	====================================================================
REM	SAMPLE COMMAND LINES
REM	====================================================================
REM	./anse-simulator model=test_project duration=10 workspace=./anse-models/test-model

Clone this wiki locally