Skip to content

Utility Functions

Stephen Frank edited this page May 8, 2015 · 5 revisions

MATLAB Utility Functions

In addition to the Simulink library, the Campus Energy Modeling project includes several utility functions, summarized in this wiki page. To access detailed documentation for a utility function, execute the command

doc myFunction

at the MATLAB command prompt, where myFunction is the name of the function.

Utility functions source code may be found within several subdirectories of the Library directory of the Campus Energy Modeling project.

Utility

The utility subdirectory contains a set of general utility functions for a variety of purposes. Most of these functions are intended for model initialization and automated testing.

Function Description
convertTMY3 Convert TMY3 data to useable MATLAB time series objects
fitLossModel Fit a quadratic loss model for a power electronic converter
fprintf_echo Write to file via fprint() and echo to standard out
freqToTime Convert frequency domain spectrum to time domain waveform (Inverse FFT)
runTestScript Run a MATLAB script, capture errors, and log the result
timeToFreq Convert time domain waveform to frequency domain spectrum (FFT)
toStruct Convert a name-value argument list into a MATLAB structure

SSC to MATLAB

The ssc2matlab subdirectory contains functions which extend the MATLAB interface of SSC.

Function Description
importSSC Import SSC input variables from text
runSSC Run SSC Module

DataBus to MATLAB

The databus2matlab subdirectory contains functions which provide a MATLAB interface to DataBus.

Function Description
importDataBus Import time series data from DataBus database
batchDataBus Batch import time series data from DataBus database

Note: the DataBus database is no longer actively developed within NREL and may not be supported in the future. Therefore, these functions are now deprecated.

Clone this wiki locally