OpenStudio:utilities
 AllClasses Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages

#include "WorkflowJSON.hpp"

Public Member Functions

std::vector< openstudio::pathabsoluteFilePaths () const
std::vector< openstudio::pathabsoluteMeasurePaths () const
openstudio::path absoluteOutPath () const
openstudio::path absoluteRootDir () const
openstudio::path absoluteRunDir () const
bool addFilePath (const openstudio::path &path)
boost::optional< BCLMeasureaddMeasure (const BCLMeasure &bclMeasure)
bool addMeasurePath (const openstudio::path &path)
bool checkForUpdates ()
WorkflowJSON clone () const
boost::optional< DateTimecompletedAt () const
boost::optional< std::string > completedStatus () const
std::string computeHash () const
boost::optional< DateTimecreatedAt () const
boost::optional< WorkflowStepcurrentStep () const
unsigned currentStepIndex () const
boost::optional< std::string > eplusoutErr () const
std::vector< openstudio::pathfilePaths () const
boost::optional< openstudio::pathfindFile (const openstudio::path &file) const
boost::optional< openstudio::pathfindFile (const std::string &fileName) const
boost::optional< openstudio::pathfindMeasure (const openstudio::path &measureDir) const
boost::optional< openstudio::pathfindMeasure (const std::string &measureDirName) const
boost::optional< BCLMeasuregetBCLMeasure (const MeasureStep &step) const
boost::optional< BCLMeasuregetBCLMeasureByUUID (const UUID &id) const
std::vector< MeasureStepgetMeasureSteps (const MeasureType &measureType) const
std::string hash () const
bool incrementStep ()
std::vector< openstudio::pathmeasurePaths () const
openstudio::path oswDir () const
boost::optional< openstudio::pathoswPath () const
openstudio::path outPath () const
void reset ()
void resetFilePaths ()
void resetMeasurePaths ()
void resetRunOptions ()
void resetSeedFile ()
void resetWeatherFile ()
void resetWorkflowSteps ()
openstudio::path rootDir () const
openstudio::path runDir () const
boost::optional< RunOptionsrunOptions () const
bool save () const
bool saveAs (const openstudio::path &p)
boost::optional< openstudio::pathseedFile () const
void setCompletedStatus (const std::string &status)
void setEplusoutErr (const std::string &eplusoutErr)
bool setMeasureSteps (const MeasureType &measureType, const std::vector< MeasureStep > &steps)
bool setOswDir (const openstudio::path &path)
bool setOswPath (const openstudio::path &path)
bool setRunOptions (const RunOptions &options)
bool setSeedFile (const openstudio::path &seedFile)
bool setWeatherFile (const openstudio::path &weatherFile)
bool setWorkflowSteps (const std::vector< WorkflowStep > &steps)
void start ()
boost::optional< DateTimestartedAt () const
std::string string (bool includeHash=true) const
boost::optional< DateTimeupdatedAt () const
boost::optional< openstudio::pathweatherFile () const
 WorkflowJSON ()
 WorkflowJSON (const std::string &s)
 WorkflowJSON (const openstudio::path &p)
std::vector< WorkflowStepworkflowSteps () const

Static Public Member Functions

static boost::optional
< WorkflowJSON
load (const std::string &s)
static boost::optional
< WorkflowJSON
load (const openstudio::path &p)

Protected Member Functions

 WorkflowJSON (std::shared_ptr< detail::WorkflowJSON_Impl > impl)

Detailed Description

Class for accessing the OpenStudio Workflow (OSW) JSON format.

Constructor & Destructor Documentation

openstudio::WorkflowJSON::WorkflowJSON ( )

Create a new, empty workflow.

openstudio::WorkflowJSON::WorkflowJSON ( const std::string &  s)

Constructor with string, will throw if string is incorrect.

openstudio::WorkflowJSON::WorkflowJSON ( const openstudio::path p)

Constructor with path, will throw if path does not exist or file is incorrect.

openstudio::WorkflowJSON::WorkflowJSON ( std::shared_ptr< detail::WorkflowJSON_Impl >  impl)
protected

Protected constructor from impl.

Member Function Documentation

std::vector<openstudio::path> openstudio::WorkflowJSON::absoluteFilePaths ( ) const
std::vector<openstudio::path> openstudio::WorkflowJSON::absoluteMeasurePaths ( ) const
openstudio::path openstudio::WorkflowJSON::absoluteOutPath ( ) const
openstudio::path openstudio::WorkflowJSON::absoluteRootDir ( ) const
openstudio::path openstudio::WorkflowJSON::absoluteRunDir ( ) const
bool openstudio::WorkflowJSON::addFilePath ( const openstudio::path path)

Add a path to the paths searched for files.

boost::optional<BCLMeasure> openstudio::WorkflowJSON::addMeasure ( const BCLMeasure bclMeasure)

Add a measure to the measure dir, replaces existing measure with same id, does not add a step to the workflow.

bool openstudio::WorkflowJSON::addMeasurePath ( const openstudio::path path)

Add a path to the paths searched for measures.

bool openstudio::WorkflowJSON::checkForUpdates ( )

Check for updates and return true if there are any, updates value of the stored hash.

WorkflowJSON openstudio::WorkflowJSON::clone ( ) const

Clones this WorkflowJSON into a separate one.

boost::optional<DateTime> openstudio::WorkflowJSON::completedAt ( ) const

Returns the time this WorkflowJSON was completed at.

boost::optional<std::string> openstudio::WorkflowJSON::completedStatus ( ) const

Returns the completion status, "Success", "Fail", "Invalid", or "Cancel".

"Success" will be set automatically if all steps in the workflow complete successfully. "Fail" will be set automatically if any step in the workflow reports an error. "Invalid" can be set by a measure if the workflow requests parameter combinations that are not valid. "Cancel" will be set automatically if a workflow is cancelled externally during execution.

std::string openstudio::WorkflowJSON::computeHash ( ) const

Compute the current hash of the workflow.

boost::optional<DateTime> openstudio::WorkflowJSON::createdAt ( ) const

Returns the time this WorkflowJSON was created at.

boost::optional<WorkflowStep> openstudio::WorkflowJSON::currentStep ( ) const

Get the current step.

unsigned openstudio::WorkflowJSON::currentStepIndex ( ) const

Get the zero based index of the current step.

If a simulation completes normally, current step index will be one higher than index of the last step. If a simulation is halted, current step index will point to the step after the last run step.

boost::optional<std::string> openstudio::WorkflowJSON::eplusoutErr ( ) const

Returns the content of eplusout.err file.

std::vector<openstudio::path> openstudio::WorkflowJSON::filePaths ( ) const

Returns the paths that will be searched in order for files, default value is '.

/files/'. Evaluated relative to rootDir if not absolute.

boost::optional<openstudio::path> openstudio::WorkflowJSON::findFile ( const openstudio::path file) const

Attempts to find a file by path.

If file is relative, searches through filePaths in order and returns first match that exists. If file is absolute, does not search for file in filePaths, only returns true it file exists.

boost::optional<openstudio::path> openstudio::WorkflowJSON::findFile ( const std::string &  fileName) const
boost::optional<openstudio::path> openstudio::WorkflowJSON::findMeasure ( const openstudio::path measureDir) const

Attempts to find a measure by path.

If measureDir is relative, searches through measurePaths in order and returns first match that exists. If measureDir is absolute, does not search for measureDir in measurePaths, only returns true it measureDir exists.

boost::optional<openstudio::path> openstudio::WorkflowJSON::findMeasure ( const std::string &  measureDirName) const
boost::optional<BCLMeasure> openstudio::WorkflowJSON::getBCLMeasure ( const MeasureStep step) const

Attempts to find the BCLMeasure for a given MeasureStep.

boost::optional<BCLMeasure> openstudio::WorkflowJSON::getBCLMeasureByUUID ( const UUID id) const

Checks BCLMeasure for each MeasureStep attempting to find by id, does not check measures that are not in the workflow.

std::vector<MeasureStep> openstudio::WorkflowJSON::getMeasureSteps ( const MeasureType measureType) const

Gets measure steps by measure type.

std::string openstudio::WorkflowJSON::hash ( ) const

Get a stored hash of the workflow.

bool openstudio::WorkflowJSON::incrementStep ( )

Increments current step, returns true if there is another step.

static boost::optional<WorkflowJSON> openstudio::WorkflowJSON::load ( const std::string &  s)
static

Attempt to load a WorkflowJSON from string.

static boost::optional<WorkflowJSON> openstudio::WorkflowJSON::load ( const openstudio::path p)
static

Attempt to load a WorkflowJSON from path.

std::vector<openstudio::path> openstudio::WorkflowJSON::measurePaths ( ) const

Returns the paths that will be searched in order for measures, default value is '.

/measures/'. Evaluated relative to rootDir if not absolute.

openstudio::path openstudio::WorkflowJSON::oswDir ( ) const

Returns the absolute path to the directory this workflow was loaded from or saved to.

Returns current working dir for new WorkflowJSON.

boost::optional<openstudio::path> openstudio::WorkflowJSON::oswPath ( ) const

Returns the absolute path this workflow was loaded from or saved to, empty for new WorkflowJSON.

openstudio::path openstudio::WorkflowJSON::outPath ( ) const

Returns the path to write output OSW, default value is 'out.osw'.

Evaluated relative to oswDir to ensure relative paths remain valid.

void openstudio::WorkflowJSON::reset ( )

Reset to re-run the workflow, does not delete steps.

void openstudio::WorkflowJSON::resetFilePaths ( )

Clear paths searched for files.

void openstudio::WorkflowJSON::resetMeasurePaths ( )

Clear paths searched for measures.

void openstudio::WorkflowJSON::resetRunOptions ( )

Reset RunOptions for this workflow.

void openstudio::WorkflowJSON::resetSeedFile ( )

Resets the seed file path.

void openstudio::WorkflowJSON::resetWeatherFile ( )

Resets the weather file path.

void openstudio::WorkflowJSON::resetWorkflowSteps ( )

Resets the workflow steps.

openstudio::path openstudio::WorkflowJSON::rootDir ( ) const

Returns the root directory, default value is '.

'. Evaluated relative to oswDir if not absolute.

openstudio::path openstudio::WorkflowJSON::runDir ( ) const

Returns the run directory, default value is '.

/run'. Evaluated relative to rootDir if not absolute.

boost::optional<RunOptions> openstudio::WorkflowJSON::runOptions ( ) const

Get RunOptions for this workflow.

bool openstudio::WorkflowJSON::save ( ) const

Saves this file to the current location.

bool openstudio::WorkflowJSON::saveAs ( const openstudio::path p)

Saves this file to a new location.

Updates the OSW path.

boost::optional<openstudio::path> openstudio::WorkflowJSON::seedFile ( ) const

Returns the seed file path.

Evaluated relative to filePaths if not absolute.

void openstudio::WorkflowJSON::setCompletedStatus ( const std::string &  status)

Sets the completion status, "Success", "Fail", "Invalid", or "Cancel".

Measure writers can call this with "Success" if all required results have been generated. Measure writers should not call this with "Fail", runner.registerError should be used instead. Measure writers can call this with "Invalid" if the workflow requests parameter combinations that are not valid. Measure writers should not call this with "Cancel", this is reserved for external cancel operations.

void openstudio::WorkflowJSON::setEplusoutErr ( const std::string &  eplusoutErr)

Sets the content of eplusout.err file.

bool openstudio::WorkflowJSON::setMeasureSteps ( const MeasureType measureType,
const std::vector< MeasureStep > &  steps 
)

Sets measure steps of a given type.

Does not change other measure steps.

bool openstudio::WorkflowJSON::setOswDir ( const openstudio::path path)

Sets the oswDir.

If oswPath is empty this does not set it. If oswPath is set, this changes directories but preserves file name.

bool openstudio::WorkflowJSON::setOswPath ( const openstudio::path path)

Sets the absolute path for this workflow.

bool openstudio::WorkflowJSON::setRunOptions ( const RunOptions options)

Set RunOptions for this workflow.

bool openstudio::WorkflowJSON::setSeedFile ( const openstudio::path seedFile)

Sets the seed file path.

bool openstudio::WorkflowJSON::setWeatherFile ( const openstudio::path weatherFile)

Sets the weather file path.

bool openstudio::WorkflowJSON::setWorkflowSteps ( const std::vector< WorkflowStep > &  steps)

Assigns the workflow steps.

void openstudio::WorkflowJSON::start ( )

Sets the started at time.

boost::optional<DateTime> openstudio::WorkflowJSON::startedAt ( ) const

Returns the time this WorkflowJSON was started at.

std::string openstudio::WorkflowJSON::string ( bool  includeHash = true) const

Get the workflow as a string.

boost::optional<DateTime> openstudio::WorkflowJSON::updatedAt ( ) const

Returns the time this WorkflowJSON was updated at.

boost::optional<openstudio::path> openstudio::WorkflowJSON::weatherFile ( ) const

Returns the weather file path.

Evaluated relative to filePaths if not absolute.

std::vector<WorkflowStep> openstudio::WorkflowJSON::workflowSteps ( ) const

Returns the workflow steps.