-
Notifications
You must be signed in to change notification settings - Fork 13
How to Configure Measures for Use with Alfalfa Ruby Gem
Alfalfa measures are OpenStudio measures (Model or EnergyPlus measures are supported) with extended features used to create Alfalfa points. This guide will go over how to create a measure and test it locally.
...
For information about creating a measure see here.
At the top of your measure.rb
file add the line require 'alfalfa'
. This imports the Alfalfa Gem for use in your measure.
require 'alfalfa' # add this line
class ExampleMeasure < OpenStudio::Measure::EnergyPlusMeasure
Inside your class
block add the following line depending on which measure type you are creating.
Model Measure: include OpenStudio::Alfalfa::OpenStudioMixin
EnergyPlus Measure: include OpenStudio::Alfalfa::EnergyPlusMixin
This adds relevant boilerplate to your measure to make it work well with Alfalfa.
class ExampleMeasure < OpenStudio::Measure::EnergyPlusMeasure
include OpenStudio::Alfalfa::EnergyPlusMixin # add this line. If the class is ModelMeasure refer to the information above.
At the end of the def run(..)
block before the return true
add the line report_inputs_outputs
.
This function actually writes the report files that Alfalfa needs in order to expose the correct points.
# define what happens when the measure is run
def run(workspace, runner, user_arguments)
...
report_inputs_outputs # add this line
runner.registerFinalCondition("Done")
return true
end
Comprehensive documentation for OpenStudio Workflow files can be found in the schema files and OpenStudio CLI guide. If you need help with the basic structure you can checkout the Alfalfa documentation on the topic here.
A .osw
file includes a section, steps
, which lists all of the measures to run in the workflow. Below is an example of what that section might look like.
"measure_paths": [
"./measures/"
],
"steps" : [
{
"measure_dir_name": "example_measure",
"name": "Example Measure",
"description": "Example Measure for Alfalfa",
"modeler_description": "Example Measure for Alfalfa"
}
]
To run your workflow locally you can use the OpenStudio CLI.
You need to add a --gem-path
argument to point to where the Alfalfa gem is installed on your machine.
openstudio --gem_path <path_to_gems> run ...
- Getting Started with Model Measures Part 1: Creating Inputs and Outputs
- Getting Started with Model Measures Part 2: Creating Actuators
- Getting Started with EnergyPlus Measures Part 1: Creating Inputs and Outputs
- Getting Started with EnergyPlus Measures Part 2: Creating Actuators
- How to Configure an OpenStudio Model
- How to Configure Measures for Use with Alfalfa Ruby Gem
- How to Create Inputs and Outputs With Measures
- How to Run URBANopt Output Models in Alfalfa
- How to Migrate EnergyPlus Python Plugins
- How to Integrate Python based Electric Vehicle Models with OpenStudio Workflows
- How to Locally Test OpenStudio Models
- Required Structure of OpenStudio Workflow
- List of Automatically Generated Energyplus Points
- Alfalfa EnergyPlus Mixin Methods
- Getting Started with Uploading and Running a Model Using Python
- Getting Started with Uploading and Running a Model Using the UI
- How to Install Alfalfa Client
- How to Preprocess and Upload a Model
- How to Step Through a Simulation
- How to View Historical Data in Grafana
- How to Configure an Alias
- How to Troubleshoot Models