0.1.0 • Published 7 years ago
simres v0.1.0
simres
simres is a node.js package to read and write csv files that have been generated by a simulation tool.
The package is being developed and maintained by the Chair of Automation and Energy Systems at the Saarland University.
License
simres is released under the ISC license.
Installation
$ npm install simresUsage
The simres package provides four functions.
parseCsvFile
- purpose: parse the content of a simulation result file
- arguments:
- (
String): the content of the simulation result file as plain text - (
Object): the optional optionsObjectto adjust the way of parsing with the following attributes:columnSeparator(String): the character sequence that is used to separate columns (standard value is'\t')rowSeparator(String): the character sequence that is used to separate rowss (standard value is'\r\n')automaticRowEndDetection(Boolean): define whether the row ending separator shall be detected automatically (standard value istrue)
- (
- returns (
Array): the simulation result as array of timeseries objects (timestamps are a timeseries on their own). Each item in the array is anObjectwith the following attributes:label(String): the label of the timeseriestype(String): the type of the timeseriesunit(String): the unit of the timeseriesvalues(Array): the values of the timeseries
readAndParseCsvFile
- purpose: asynchronously read and parse the content of a simulation result file
- arguments:
- (
String): the path to the csv file - (
Object): the optional optionsObjectto adjust the way of parsingcolumnSeparator(String): the character sequence that is used to separate columns (standard value is'\t')rowSeparator(String): the character sequence that is used to separate rowss (standard value is'\r\n')automaticRowEndDetection(Boolean): define whether the row ending separator shall be detected automatically (standard value istrue)
- (
- returns (
Array): the simulation result as array of timeseries objects (timestamps are a timeseries on their own). Each item in the array is anObjectwith the following attributes:label(String): the label of the timeseriestype(String): the type of the timeseriesunit(String): the unit of the timeseriesvalues(Array): the values of the timeseries
composeCsvFile
- purpose: compose the content of a simulation result file
- arguments:
- (
Array): the collection of timeseries items with each item being anObjectwith the following attributes:label(String): the label of the timeseriestype(String): the type of the timeseriesunit(String): the unit of the timeseriesvalues(Array): the values of the timeseries
- (
Object): the optional optionsObjectto adjust the way of parsing with the following attributes:columnSeparator(String): the character sequence that is used to separate columns (standard value is'\t')rowSeparator(String): the character sequence that is used to separate rowss (standard value is'\r\n')
- (
- returns (
String): the simulation result converted to plain text
composeAndWriteCsvFile
- purpose: asynchronously compose the content of a simulation result and write it to a file
- arguments:
- (
String): the path to file that shall be written - (
Array): the collection of timeseries items with each item being anObjectwith the following attributes:label(String): the label of the timeseriestype(String): the type of the timeseriesunit(String): the unit of the timeseriesvalues(Array): the values of the timeseries
- (
Object): the optional optionsObjectto adjust the way of parsing with the following attributes:columnSeparator(String): the character sequence that is used to separate columns (standard value is'\t')rowSeparator(String): the character sequence that is used to separate rowss (standard value is'\r\n')
- (
- returns (
undefined)
0.1.0
7 years ago