CSE User's Manual

California Simulation Engine


IMPORTFILE allows specification of a file from which external data can be accessed using the import() and importStr() functions. This allows external values to be referenced in expressions. Any number of IMPORTFILEs can be defined and any number of import()/importStr() references can be made to a give IMPORTFILE.

Import files are text files containing an optional header and comma-separated data fields. With the header present, the structure of an import file matches that of an EXPORT file. This makes it convenient to import unmodified files EXPORTed from prior runs. The file structure is as follows (noting that the header in lines 1-4 should not be present when imHeader=NO) –

1runTitle, runNumberread but not checked
2timestampin quotes, read but not checked
3title, freqshould match imTitle and imFreq (see below)
4colName1, colName2, …comma separated column names optionally in quotes
5 ..val1, val2, …comma separated values (string values optionally in quotes)

Example import file imp1.csv

    "Test run",001
    "Fri 04-Nov-16  10:54:37 am"
    "Daily Data","Day"
    (... continues for 365 data lines ...)

Example IMPORTFILE use (reading from imp1.csv)

    // ... various input statements ...

    IMPORTFILE Example imFileName="imp1.csv" imFreq=Day imTitle="Daily Data"
    // Compute internal gain based on temperature read from import file.
    // result is 3000 W per degree temperature is above 60.
    // Note gnPower can have hourly variability, but here varies daily.
    GAIN gnPower = 3000 * max( 0, import(Example,"Tdb") - 60) / 3.412



Name of IMPORTFILE object (for reference from Import()).

UnitsLegal RangeDefaultRequiredVariability
63 charactersnoneNoconstant


Gives path name of file to be read. If directory is specified, CSE first looks for the file the current directory and searches include paths specified by the -I command line parameter (if any).

UnitsLegal RangeDefaultRequiredVariability
file name, path optionalnoneYesconstant


Title expected to be found on line 3 of the import file. A warning is issued if a non-blank imTitle does not match the import file title.

UnitsLegal RangeDefaultRequiredVariability
Text stringnoneNoconstant


Specifies the interval at which CSE reads from the import file. Data is read at the beginning of the indicated interval and buffered in memory for access in expressions via import() or importStr().

UnitsLegal RangeDefaultRequiredVariability
YEAR, MONTH, DAY, HOUR, or SUBHOURnoneYesconstant


Indicates whether the import file include a 4 line header, as described above. If NO, the import file should contain only comma-separated data rows and data items can be referenced only by 1-based column number.

UnitsLegal RangeDefaultRequiredVariability
YES NOYESNoconstant


Adds the possibility to output the file as a binary option.

UnitsLegal RangeDefaultRequiredVariability
YES NONoNoconstant


Optionally indicates the end of the import file definition. Alternatively, the end of the import file definition can be indicated by END or by beginning another object.

UnitsLegal RangeDefaultRequiredVariability

Related Probes: