-
Notifications
You must be signed in to change notification settings - Fork 13
How to Create Inputs and Outputs With Measures
This guide provides guidance on creating inputs and outputs using measures. This guide builds on the information in Getting Started With Alfalfa Measures Part 1 and Part 2.
Output objects wrap lower level IDF Objects and provide an interface for extended functions: display names, units, associated zones, etc.
Constructing an Output
output_variable # Either an Output Variable or an EMS Output Variable
output = OpenStudio::Alfalfa::Output.new(output_variable)
Registering an Output
Once an Output object is created it won't be exposed via Alfalfa until it is registered. This can be done as follows
register_output(output)
You can also skip the step of constructing an output by calling register_output
with the output variable
register_output(output_variable)
Similar to Output
objects Input
objects wrap lower level IDF objects and add Alfalfa specific functionality.
Constructing an Input
input_variable # Either an External Interface Variable, Actuator, or Schedule
input = OpenStudio::Alfalfa::Input.new(input_variable)
Registering an Input
Once an Input
object is created it won't be exposed via Alfalfa until it is registered. This can be done as follows
register_input(input)
You can also skip the step of constructing an output by calling register_input
with the input variable
register_input(input_variable)
Adding an Enable to an Input
An enabled input consists of two inputs. One of which conveys the value from Alfalfa, the other reports whether or not the value is currently set in Alfalfa (1 if set, 0 if unset). This is useful for actuators which need Null
to be written to them in order to not override the model logic.
This can be done Manually as follows or by utilizing the library function.
input_variable # Valid Input Variable Type
input_enable_variable # Valid Input Variable Type
# create and register Input object
input = register_input(input_variable)
# create and don't register enable Input object
input_enable = OpenStudio::Alfalfa::Input.new(input_enable_variable)
# set the enable_variable property of the input to the new input_enable object
input.enable_variable = input_enable
Now when a user writes to the input
the value of input_enable
will be 1
. This can be read by an EMS program and incorporated into control logic.
Adding an Echo to an Input
By default if you try to read the value of an Input
with the Alfalfa API you won't get anything. To associate an Output
with an Input
you can use the echo
property of the input to point it to the corresponding Output
.
input # Input object
output # Output object
# Set echo property of Input to Output
input.echo = output
# If Points are not already registered, register them
register_input(input)
register_output(output)
- 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