-
Notifications
You must be signed in to change notification settings - Fork 13
Running Experiments
- While Alfalfa enables simulations to be interacted with during runtime, it does not specifically coordinate co-simulation (i.e. ensuring models are time coordinated, that inputs/outputs are coordinated, etc.).
- Alfalfa is designed to step through model time at 1-minute intervals for EnergyPlus models, however, the way that the simulation steps through real time varies and is discussed below. It is mainly designed to step through a model in three different ways.
- Alfalfa uses a start and ending datetime to drive the simulation. For EnergyPlus, these get written into the IDF file before run. If none are specified, they will default to January 1st, 00:00:00 and December 31st, 23:59:00.
- While a goal of Alfalfa is to convert model objects into Haystack entities, this does not get done for all things.
As of 3/2023, Alfalfa supports upload of fmu, or zip (a zipped-up version of the OpenStudio workflow directory structure) files.
Users coming to Alfalfa likely have different backgrounds - some will come from a purely controls world, others from an energy modeling world using OpenStudio/EnergyPlus, and maybe others from the Modelica world. There are distinct advantages and disadvantages to both from an Alfalfa perspective.
Using the E+ simulation engine has distinct advantages in terms of the tooling availabe to quickly and easily generate models, typical systems, etc. (namely, OpenStudio or Eppy). That said, in order to make controls work as expected in real-life, custom EMS code must currently be developed to enable controls to behave as expected (see Alfalfa Control).
While the Modelica Buildings Library is currently being built up, there is significantly less tooling available. Most models will need to be generated by hand and significant understanding of the Modelica language is required for proficiency. That said, Modelica is significantly more robust in implementing controllability to an energy model that is in line with how real systems operate.
- In this scenario, the model will only advance when explicitly told to advance by an external call. It has no regard for real time passing but sits in an idle state until told to advance. The simulation starts at the specified start time.
- Upon call to advance, Alfalfa will look for any points written from external sources, write these into the simulation, and advance the simulation one time step (1-minute in model time).
- It then waits to advance until the next call is made.
- It will stop if the model has advanced enough times such that the end datetime has passed or if it is specifically told to stop.
- In this scenario, the timescale parameter is used to control the rate at which the internal clock advances through the simulation. It represents the integer ratio of model_time:real_time. For example, a value of 5 means that the simulation will advance at 5x the rate of real time. In other words, one minute of simulation time will occur every 12 seconds of real time.
- Regardless of the start time specified for the run, the simulation will begin running.
- Upon reaching the time to advance, Alfalfa will look for any points from external sources, write these into the simulation, and advance the simulation one time step (1-minute in model time).
- It then waits X time in real time before advancing through the next time step.
- It will proceed until it has reached the specified end datetime or if it is specifically told to stop.
- If the simulation falls more than 2 timesteps behind it will throw an error and kill the simulation.
- This scenario is similar to the timescale with the following caveats.
- The timescale parameter is always one (i.e. the model advances one minute in model time for every one minute that passes in real time).
- If the specified model start time has already passed in real time, the start time will be overwritten to the current time and the simulation will begin. However, if the specified model start time has not already passed in real time, the simulation will not begin until that time in real time is reached.
- It will then proceed until it has reached the specified end datetime or if it is specifically told to stop.
- All external calls to advance the simulation are ignored.
One of the more important aspects to understand about Alfalfa is that the actual control implementation is completely dependent on the underlying simulation engine used. While time delays, PID loops, etc. can be exposed if running a simulation with a Modelica model, these do not exist in EnergyPlus. As EnergyPlus’ default run logic is to meet loads at all times within capacity constraints, this is not necessarily how control would be implemented in the real world and generally deviates from expectations, especially for those familiar with real world controls and limited background with simulation tools. This isn’t to say that writing to a point exposed by Alfalfa can’t have the desired effect in simulation, rather, EnergyPlus experience is needed to:
- Understand the underlying simulation calculation and run order
- Design Energy Management System (EMS) logic that works behind the scenes of Alfalfa, such that writing to an exposed point has the intended effects.
Therefore, it is best practice to provide pseudocode or a narration document of expected equipment run logic such that strategies to implement this control using EMS and Erl can be discussed and appropriately developed. As part of generating the pseudocode, users should answer the following:
- Which equipment am I planning on controlling / interfacing with?
- What points am I expecting to be able to read from during the simulation?
- Which points am I expecting to write to during the simulation AND what is their desired effect on the simulation during run?
- At what point during the simulation should the write points be evaluated? Refer to the EMS Application Guide – Chapter 6 for information on EMS Calling Points.
- What other logic am I expecting out of the simulation engine after reading from / writing into?
At the end of this task, project teams should have developed a comprehensive equipment and points list, while also identifying whether those points will be read or write points. An example of this is shown below:
To support this, the project team should develop a few (1-3) experiment specific tests, which should be highly aligned to the actual experiment. These tests could be as simple as the following:
- Turn an RTU fan on/off. After actuating control point, the energy consumption is expected to increase/decrease and we expect to see air flow at the RTU discharge sensor.
- Turn the heating/cooling stages to stage 1, then stage_2. After turning the heating on, we expect the discharge air temperature to increase and for the zone air temperature to increase over time. Similar for cooling. After defining the control tests, they can be implemented, the data historized, and then visualized using the Alfalfa python client (or any other client). This will help experimentalists test and verify their experiment design and modeling implementation.
- 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