constructor function

Requirements.Internal.CSV.File.constructor  · source

Icon of constructor

Open the file, resolve the requested column names against its header, convert the columns

Extends Modelica.Icons.Function

Reads the MA-HS-CSV file fileName completely into memory, resolves the names in realNames, booleanNames and integerNames against its header row and converts those columns to Real, Boolean and Integer values; the other columns are skipped. Called when the parameter file of Sources.PartialSignalsFromFile is evaluated (at initialization). It raises an error (ModelicaError) if the file cannot be opened or read, is empty, has a column name twice in its header, if a requested name is not in the header or names the time column, or if a field cannot be converted to the requested type. extrapolateHold and rowEvents are stored with the file and used by getReal and nextTimeEvent.

Inputs

NameTypeDescription
fileName inputStringAbsolute path of the MA-HS-CSV file
realNames[…] inputStringHeader names of the columns read as Real
booleanNames[…] inputStringHeader names of the columns read as Boolean
integerNames[…] inputStringHeader names of the columns read as Integer
extrapolateHold inputBoolean= true: hold the first/last row outside the file's time range; = false: error
rowEvents inputBoolean= true: an event at every row's time, not only where a Boolean or Integer column changes

Outputs

NameTypeDescription
file outputFileThe file, held in memory