-
Notifications
You must be signed in to change notification settings - Fork 13
Simulation Clock Advancement Modes
Maggie Sullivan edited this page Jun 20, 2023
·
10 revisions
When interacting with simulation, there are two clocks to consider: real-world and simulated. All modeled output values available via Alfalfa reflect the state of the simulation at the current simulation time, which advances with a fixed timestep of one minute. For many applications, the relationship between real and simulated time is crucial. An example is hardware-in-the-loop experimentation: hardware is bound to real-world time and therefor the simulated aspects of the experiment must also remain synced to real time.
On starting a run, Alfalfa has 3 settings available that impact the rate at which the simulation clock advances: timescale, externalClock, and realtime. These modes are described below.
- 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 will advance non-interactively to the specified start time and then wait for an API call to advance.
- 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, the simulation advance one minute for every 12 seconds of real time.
- The simulation will advance non-interactively to the configured start time and then begin running at the configured timescale.
- Upon reaching the time to advance (every 12 real-world seconds in the above example), 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 until it is specifically told to stop.
- In some cases, the simulation may not be able to advance quickly enough to achieve the configured timescale. For a timescale of 5, this would be the case if the simulation takes more than 12 seconds to advance. If the simulation falls more than 2 timesteps behind it will throw an error and kill the simulation. The real-world time required to advance a model one time step depends on the complexity of the model and the compute resources allocated to the Alfalfa worker.
- 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).
- 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.
- 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