FromCSV

This block reads data from a .csv file. The first line of the .csv file should include the variable names, and the first variable name should be "time".

    FromCSV

Library

Activate/SignalImporters

Description

The FromCSV block enables data reading from CSV (comma separated values) files. The first line of the CSV file should indicate the variable names. It is mandatory that the first variable name is "time". This is, for example, compatible with the FMU result files.

The block will read as many columns as specified by the first parameter (Number of requested variables). The columns are identified by their name (located on the first line, passed as a string).

If the block is activated by external activation and time stamp is also defined, the output are displayed at event activation times. The external activation may be turned off, if time instants are provided.

Parameters

FromCSV_0

NameLabelDescriptionData TypeValid Values

fname

Filename

Defines the name (path and full name, in between quotes) of the input .csv file.

String

independent

Time variable name

The column name that is an independent variable (usually time). If left empty, no time is used and an external activation is required.

String

nout

Number of requested variables

Number of variables to read in the .csv file. One variable corresponds to one column.

Number

outports

Variable selection

Structure

outports/varname

Variable name

Name of the variable to read. String corresponding to the column name (first line).

Cell of strings

outports/vardatatype

Datatype

Cell of strings

'double'
'int32'
'int16'
'int8'
'uint32'
'uint16'
'uint8'
'boolean'

outevent

Generate events at time instants

Specifies if the block generates an activation event. When OutEvent is used, an additional event output port is added to the block. Default is off.

Number

0
1

externalActivation

External activation

Specifies whether the block receives an external activation or inherits its activation through its regular input ports. When External Activation is selected, an additional activation port is added to the block. By default, external activation is not selected.

Number

0
1

FromCSV_1

NameLabelDescriptionData TypeValid Values

Method

Interpolation method

Defines how to interpolate the data that is read in from the .csv file.

String

'ZeroOrder'
'Linear'
'Not_a_knot'
'Natural'
'Clamped_To_Zero'
'Akima'
'Fritsch_Butland'
'Steffen'

Leftside

Behavior before the data time span

String

'Zero'
'Hold'
'Extrapolation'
'Repeat'
'Error'

Rightside

Behavior after the data time span

String

'Zero'
'Hold'
'Extrapolation'
'Repeat'
'Error'

Offset

Data starts from line #

Line from which to start reading the .csv file. Default is 2.

Scalar

Separator

CSV file separator character

Enter a separator character in this field. If the field is left empty, the default separator is the first character that follows the variable time in the first line of the .csv file.

String

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

nout

Port 2

activation

input

externalActivation

Port 3

activation

output

outevent

Advanced Properties

NameValueDescription

always active

no

Time Dependency = standard mode activated

direct-feedthrough

no

zero-crossing

no

mode

no

continuous-time state

no

discrete-time state

no