-
Notifications
You must be signed in to change notification settings - Fork 0
Input data
Before SymSyn simulations can be performed, input data needs to be prepared. The required structure of input data depends on the purpose of the model. SimSyn provides different data link types to implement variant types of simulations.
A data link is a link of a Vensim model element to a database table column. At the moment subscripting data links (SDL), time-series data links (TSL) as well as time-dependent subscripting links and combinations of SDL and TSL are supported.
SDL enable creating multiple instances of a Vensim model. This may be used for spatial simulations or to run and compare thousands of alternative model parametrizations (e.g. sensitivity analyses, scenario runs etc).
A SDL is used to link a Vensim constant to a database table column and run one independent simulation for every row value in this column. Multiple SDLs may be defined to link more than one constant to every independent simulation run (Fig. 1; A).
Fig. 1. Left) Database table with two subscripting data links (SDL); Right) Database table with two time series links (TSL)
A TSL is used to assign database table columns as time series to Vensim variables (Fig. 1; B). Multiple TSL of a single or of multiple database tables may be assigned to a VENSIM model.
As an additional functionality, SDL may optionally be equipped with a simulation timestamp (see also section 6). For instance, a first SDL may be assigned to the initial simulation time 0 of a VENSIM variable element and a second SDL may be assigned to a final time step 100 of the same VENSIM variable. SimSyn linearly interpolates between the first and the second SDL values in the course of its integration.
In some instances combinations of SDL and TSL are required. In cases where SDL and TSL are assigned to a VENSM model, the time series are duplicated and assigned to every single run of the SDL. SDL and TSL may refer to the same or different database tables.
For this type of data-linked simulation, larger computational overhead is to be expected (see also section 10).
- Open pgAdmin III
- Right-click the ‘Databases folder’ in the ‘Object browser’ window.
- Select ‘new database…’ and assign a name to the new database.
- Switch to ‘definition’ tab and select ‘postgres’ as a template.
- Make sure that point (‘.’) is set as decimal digit in Excel.
- Copy data columns (data only, no column name) from Excel table to an Editor textfile (.txt).
- Create an empty table and define the required columns in PostgreSQL by running the following line in the SQL query window of pgAdmin III.
CREATE TABLE 'table name' ('column name1' double precision, 'column name2' double precision,…);
- Once the empty table is created right-click the new table in the ‘Object browser’ window and select ‘Import’. Browse for the textfile and import.
- Finish the data upload by adding a primary key to the table. Use the following line.
ALTER TABLE 'table name' ADD COLUMN gid BIGSERIAL PRIMARY KEY;
Note: Please stick to the name 'gid' as primary key. Moreover, readable data types are constrained to integer and double precision type.
In order to convert existing PostgreSQL tables to integer or double precision, use the following SQL statement.
ALTER TABLE 'table name' ALTER COLUMN 'column name' TYPE 'new data type' USING 'column name'::'new data type';
Before geospatial data can be loaded to a PostgreSQL database folder, PostGIS needs to be enabled in each individual database you want to use it in. In order to enable PostGIS open the database folder and run the following SQL statement.
CREATE EXTENSION postgis;
Once PostGIS is enabled shp2pgsql command line functions can be used for uploading data (see cheatsheet). The following example demonstrates the upload of a shapefile named ‘hyde_alcc_ssm’ to a table named ‘hyde_alcc’ in database ‘Hyde’. Note: Run Windows Command Prompt as administrator!
###Home ###Installation ###Input data ###Run a simulation ###Query outputs ###Error handling ###Software performance ###References