Class: Outputs

September 1, 2023 ยท View on GitHub

@sdeverywhere/runtime / Outputs

Class: Outputs

Represents the outputs from a model run.

Constructors

constructor

new Outputs(varIds, startTime, endTime, saveFreq?)

Parameters

NameTypeDefault valueDescription
varIdsstring[]undefinedThe output variable identifiers.
startTimenumberundefinedThe start time for the model.
endTimenumberundefinedThe end time for the model.
saveFreqnumber1The frequency with which output values are saved (aka SAVEPER).

Properties

seriesLength

Readonly seriesLength: number

The number of data points in each series.


varSeries

Readonly varSeries: Series[]

The array of series, one for each output variable.


varIds

Readonly varIds: string[]

The output variable identifiers.


startTime

Readonly startTime: number

The start time for the model.


endTime

Readonly endTime: number

The end time for the model.


saveFreq

Readonly saveFreq: number = 1

The frequency with which output values are saved (aka SAVEPER).

Methods

updateFromBuffer

updateFromBuffer(outputsBuffer, rowLength): Result<void, "invalid-point-count">

Parse the given raw float buffer (produced by the model) and store the values into this Outputs instance.

Note that the length of outputsBuffer must be greater than or equal to the capacity of this Outputs instance. The Outputs instance is allowed to be smaller to support the case where you want to extract a subset of the time range in the buffer produced by the model.

Parameters

NameTypeDescription
outputsBufferFloat64ArrayThe raw outputs buffer produced by the model.
rowLengthnumberThe number of elements per row (one element per save point).

Returns

Result<void, "invalid-point-count">

An ok result if the buffer is valid, otherwise an err result.


getSeriesForVar

getSeriesForVar(varId): Series

Return the series for the given output variable.

Parameters

NameTypeDescription
varIdstringThe ID of the output variable (as used by SDEverywhere).

Returns

Series