Buildings.Utilities.IO.Files.BaseClasses
Package with base classes for Buildings.Utilities.IO.Files
Information
This package contains base classes that are used to construct the models in Buildings.Utilities.IO.Files.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Name | Description |
---|---|
FileWriter | Partial model for writing results to a .csv file |
FileWriterObject | Class used to ensure that each CSV writer writes to a unique file |
JSONWriterObject | Class used to ensure that each JSON writer writes to a unique file |
OutputTime | Time when results are outputted |
cacheVals | Function for caching results such that they can be written at destruction |
printRealArray | Print string to terminal or file |
writeJSON | Write a vector of Real variables to a JSON file |
Types and constants
type OutputTime = enumeration( Initial "Output results at initial() time", Terminal "Output results at terminal() time", Custom "Output results at custom time value") "Time when results are outputted";
Buildings.Utilities.IO.Files.BaseClasses.FileWriter
Partial model for writing results to a .csv file
Information
Base class for a file writer. See extending classes.
Extends from Modelica.Blocks.Icons.DiscreteBlock (Graphical layout of discrete block component icon).
Parameters
Type | Name | Default | Description |
---|---|---|---|
String | fileName | getInstanceName() + ".csv" | File name, including extension |
Time | samplePeriod | Sample period: equidistant interval for which the inputs are saved [s] | |
Advanced | |||
String | delimiter | "\t" | Delimiter for csv file |
Boolean | writeHeader | true | =true, to write header with variable names, otherwise no header will be written |
String | headerNames[nin] | {"col" + String(i) for i in ... | Header names, indices by default |
Integer | significantDigits | 6 | Number of significant digits that are used for converting inputs into string format |
Connectors
Type | Name | Description |
---|---|---|
input RealVectorInput | u[nin] | Variables that are saved |
Modelica definition
Buildings.Utilities.IO.Files.BaseClasses.FileWriterObject
Class used to ensure that each CSV writer writes to a unique file
Information
Class derived from ExternalObject
having two local external function definition,
named destructor
and constructor
respectively.
Extends from ExternalObject.
Modelica definition
Buildings.Utilities.IO.Files.BaseClasses.JSONWriterObject
Class used to ensure that each JSON writer writes to a unique file
Information
Class derived from ExternalObject
having two local external function definition,
named destructor
and constructor
respectively.
Extends from ExternalObject.
Modelica definition
Buildings.Utilities.IO.Files.BaseClasses.cacheVals
Function for caching results such that they can be written at destruction
Information
Function for writing data to cache such that the results can be written at destruction.
Inputs
Type | Name | Default | Description |
---|---|---|---|
JSONWriterObject | ID | Json writer object id | |
Real | varVals[:] | Variable values |
Modelica definition
Buildings.Utilities.IO.Files.BaseClasses.printRealArray
Print string to terminal or file
Information
Function that prints a real array to an output file.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x[:] | Input to be printed | |
String | fileName | "" | File where to print (empty string is the terminal) |
Integer | minimumLength | 1 | Minimum width of result |
Integer | significantDigits | 6 | Number of significant digits |
Outputs
Type | Name | Description |
---|---|---|
String | outStr | String to be printed |
Modelica definition
Buildings.Utilities.IO.Files.BaseClasses.writeJSON
Write a vector of Real variables to a JSON file
Information
Function for writing data to a JSON file.
Inputs
Type | Name | Default | Description |
---|---|---|---|
JSONWriterObject | ID | JSON writer object id | |
Real | varVals[:] | Variable values |