Workflow · Proposal · Revision 1
Self-improving EMS workflow
AI agents change the control logic of an EMS. A virtual building in SIMsara tests each change. A locked scorer and a person decide if a change is good.
- Document
- Workflow definition
- Date
- 2026-10-04
- Author
- Jared Bell
- Steps
- 20, in three parts
- Status
- Proposal
This document gives a workflow for an EMS that improves in a loop. An EMS is an energy management system.
AI agents change the control logic of the EMS. SIMsara tests each change on a virtual building. A locked scorer and a person decide if a change is good.
The workflow starts from a first flow of seven steps. This revision adds three primary rules and seven smaller changes. Section 13 shows where each change is in the workflow.
SIMsara has a BACnet interpreter and a lock-step interface. At this time, SIMsara has no fault library. The workflow needs all three.
| Term | Meaning in this document |
|---|---|
| EMS | The energy management system. Its control logic operates the equipment of the building. |
| Scenario | One test on the virtual building. A scenario has a building, a climate, a fault, a severity and an occupancy. |
| Seed | A number that gives one scenario. The same seed always gives the same scenario. |
| Answer key | The list of the faults that the library put in a scenario. |
| Baseline | The EMS version that is approved at this time. |
| Candidate | An EMS version on a branch. The workflow tests it against the baseline. |
| Hard limit | A condition that a candidate must always obey. |
| Scorecard | The measures and the weights that give the total score. |
| Idea log | The record of each idea, each prediction and each result. |
Without these rules, the loop makes an EMS that is good on the tests. It does not make an EMS that is good in a building.
| Rule | Rule in this workflow | Reason |
|---|---|---|
| 1 | Only the scorer reads the answer key. | A real building has no answer key. An agent that reads the key adjusts the EMS to the known faults. |
| 2 | A person sets the score before the loop starts. The agents cannot change the score. | Without hard limits, an agent can decrease the comfort or the ventilation to save energy. |
| 3 | The scenarios are in three sets. Before a real building, a candidate must pass a real-time run and an approval. | The agents never read the test set. Thus, they cannot adjust the EMS to it. |
| 4 | Each test comes from the scenario library and a seed. | Each run is repeatable. Each scenario has a version. |
| 5 | An adversary agent looks for scenarios that the EMS fails. | The library gets difficult scenarios that no person wrote. |
| 6 | Each branch has one change and one prediction. | The result of a test shows the effect of that change only. |
| 7 | The agent that writes a change does not review it. | A different agent finds errors that the author does not see. |
| 8 | The scorer compares each candidate with the baseline on the same seeds. | A difference in the score comes only from the change. |
| 9 | The library adds random variation to each scenario. | The EMS cannot depend on a perfect sensor or a perfect model. |
| 10 | Each idea and each result go in the idea log. | The loop does not try a failed idea again. |
Each role reads only the data that its job needs. The answer key and the test set stay on the locked side.
| Role | Type | Job | Reads | Does not read |
|---|---|---|---|---|
| Person | Person | Sets the hard limits and the scorecard. Approves each release. | All data. | No limit. |
| Supervisor agent | Agent | Starts the runs. Builds the EMS. Writes the change report. | Training results. All scores. | The answer key. The test set. |
| Scenario library | Program | Makes scenarios from seeds. Makes the three sets. Keeps each answer key. | Scenario values and seeds. | Not applicable. |
| Adversary agent | Agent | Finds scenarios that the baseline fails. Sends them only to the library. | The baseline. Training results. | The validation set. The test set. |
| Scorer | Program | Grades each run. Runs the test set. Compares each candidate with the baseline. | The answer key. All results. | Not applicable. |
| Specialist agent | Agent | Proposes one change. Writes it on a branch. | Training results. All scores. The idea log. | The answer key. Validation results. The test set. |
| Reviewer agent | Agent | Examines each change before a test. | The change. The prediction. The scores. | The answer key. The test set. |
All agents can read the hard limits and the scorecard. No agent can change them.
| Part | Steps | How frequently | Time |
|---|---|---|---|
| Preparation | 1 to 5 | One time for each baseline. | Not applicable. |
| Fast loop | 6 to 15 | Many cycles. One cycle for each idea. | Lock-step. The engine, the VPN tunnel and the EMS set the speed. |
| Slow loop | 16 to 20 | One time for each candidate that passes the test set. | Real time. |
Person
A person writes the hard limits and the scorecard.
The person gives a weight to each measure. Then the person locks the two items. After this step, the agents can read them but cannot change them.
Scenario library
The library makes the scenarios from seeds.
Each scenario has a building, a climate, a fault, a severity and an occupancy. The library keeps the answer key of each scenario.
Scenario library
The library adds random variation to each scenario.
The variation is sensor noise, sensor bias, actuator lag and model uncertainty. The seed sets each value.
Scenario library
The library puts each scenario in one of three sets.
The sets are the training set, the validation set and the test set. No scenario is in two sets.
Supervisor agent · Scorer
The supervisor agent runs the baseline on the training set and the validation set.
The scorer runs the baseline on the test set. The scorer records the baseline score for each seed in all three sets.
Adversary agent
The adversary agent looks for scenarios that the baseline fails.
It changes scenario values until a hard limit fails or the score is low. The library adds these scenarios to the training set.
Supervisor agent · Scorer
The supervisor agent runs the baseline on the new scenarios.
The scorer grades the training results against the answer key and the scorecard.
Specialist agent
The specialist agent reads the training results, the scores and the idea log.
It does not read the answer key. It sees only the data that the EMS had: points, trends and alarms.
Specialist agent
The specialist agent proposes one change and writes a prediction in the idea log.
The prediction gives the effect, the scenarios and the reason. An example: cooling energy decreases 3% to 5% in hot, dry scenarios, because the economizer operates for more hours.
Specialist agent
The specialist agent writes the change on a new branch.
One branch has only one change.
Automatic
Static checks examine the branch.
The build must complete. The locked items must have no changes. Section 10 gives the locked items.
Reviewer agent
A different agent examines the change.
The reviewer agent reads the change and the prediction. It makes sure that the change does only what the prediction says.
Supervisor agent · Scorer
The supervisor agent runs the branch on the training set with the baseline seeds.
The scorer compares each score with the baseline score for the same seed. The specialist agent can read all results.
Supervisor agent · Scorer
The supervisor agent runs the branch on the validation set.
The specialist agent gets only the scores.
Scorer
The scorer runs the branch on the test set.
The scorer gives back only pass or fail and the total scores. No agent reads the test results.
Gates of the fast loop
| Step | Gate | Condition for a pass | If the gate fails |
|---|---|---|---|
| 11 | Static checks | The build completes. The locked items have no changes. | The specialist agent corrects the branch. Do step 11 again. |
| 12 | Review | The reviewer agent finds no defect. | The specialist agent corrects the branch. Do steps 11 and 12 again. |
| 13 | Training set | No hard limit fails. The total score is better than the baseline. The prediction is correct. | Record the result in the idea log. Go to step 8. |
| 14 | Validation set | No hard limit fails. The total score is better than the baseline. | Record the result in the idea log. Go to step 8. |
| 15 | Test set | No hard limit fails. The total score is better than the baseline. | Record the result in the idea log. Go to step 8. |
If a branch fails the test set, start a new idea. If an agent corrects one branch many times against the test set, the test set becomes a training set.
Supervisor agent
The supervisor agent builds the candidate and runs it in real time.
The candidate operates on the real EMS or on a soft station. SIMsara is the building. The real EMS must give the same behavior as the lock-step controller, in a tolerance that a person sets.
Supervisor agent
The supervisor agent writes the change report.
- The change and its reason.
- The prediction and the result.
- The scores of the candidate and of the baseline for each set.
- The risks.
- The procedure to go back to the baseline.
Person
A person reads the change report and approves or rejects the candidate.
No candidate goes to a real building without this approval.
Person · Supervisor agent
The candidate goes into the real building in stages.
First, the candidate controls one unit or one zone. The baseline stays available. If a hard limit fails, go back to the baseline.
Scenario library
The field data goes back into the scenario library.
The candidate becomes the new baseline. The library makes a new test set. The workflow continues at step 5.
If step 16 fails or the person rejects the candidate, record the result in the idea log. Then go to step 8.
The supervisor agent does not write the tests. The library makes each scenario from a set of values and a seed. Thus, each run is repeatable.
| Scenario value | Contents |
|---|---|
| Building | The type, the size and the systems of the building. |
| Climate | The location, the weather year and the season. |
| Fault | The fault type from the fault library, and the equipment that has the fault. |
| Severity | The size of the fault, its start time and its rate of increase. |
| Occupancy | The schedule and the number of persons. |
| Set | Steps | What the agents read | Purpose |
|---|---|---|---|
| Training set | 5 to 13 | All results. | To find problems and to try ideas. |
| Validation set | 5, 14 | Scores only. | To make sure that an idea is also good on scenarios that the specialist agent did not study. |
| Test set | 5, 15 | Pass or fail, and total scores. | To measure a candidate before the slow loop. |
Make a new test set after each approved release. Also make a new test set after a number of uses that a person sets.
The score has two parts. A candidate that fails one hard limit is rejected. The scorecard gives a total score only to a candidate that passes all hard limits.
Hard limits
| Hard limit | Condition for a pass |
|---|---|
| Safeties | Each safety device stops its equipment when its limit occurs. |
| Minimum ventilation | The outdoor air flow is not less than the minimum during occupied hours. |
| Freeze protection | No coil goes below its freeze limit. |
| Minimum on and off times | No compressor starts or stops before its minimum time. |
These four limits are examples. The person adds the limits that apply to the building.
Scorecard
| Measure | Unit | A better value is |
|---|---|---|
| Energy or cost | kWh, or the cost of the energy | Lower. |
| Comfort | Occupied hours out of the comfort range | Lower. |
| Peak demand | kW | Lower. |
| Equipment cycles | Starts for each day | Lower. |
| Fault detection | Faults found, faults missed, false alarms, time to detect | More faults found. Fewer faults missed. Fewer false alarms. A shorter time. |
Each idea is one branch from the baseline. The branch goes through five gates. Each failure goes in the idea log.
Locked items
The static checks at step 11 reject a branch that changes one of these items:
- The hard limits and the scorecard.
- The scorer.
- The scenario sets and the answer keys.
- The BACnet point list.
- The safety logic in the EMS that keeps the hard limits.
Idea log
Each idea has one record. The specialist agent reads the log at step 8. Thus, it does not propose a failed idea again.
[idea.0042] branch = "sat-reset-from-zone-demand" change = "Reset the supply air temperature setpoint from the zone demand." prediction = "Cooling energy decreases 3% to 5% in hot, dry scenarios." reason = "A higher setpoint lets the economizer operate for more hours." gate = "validation set" status = "rejected" result = "Cooling energy decreased 1%. Comfort became worse in humid scenarios."
A simulation without variation has perfect sensors and exact model values. An agent can adjust the EMS to these perfect values. The result fails in a real building.
| Variation | Effect | Example range |
|---|---|---|
| Sensor noise | Each value that the EMS reads has a small random error. | ±0.1 K on a temperature |
| Sensor bias | A sensor has a constant error for the full run. | ±0.5 K on a temperature |
| Actuator lag | A damper or a valve moves slowly to its new position. | A stroke time of 60 s to 150 s |
| Model uncertainty | The envelope, the loads and the equipment capacity change for each seed. | ±10% of each value |
The ranges are examples only. A person sets each range before step 3.
The fast loop needs many runs. Thus, the controller must operate in lock-step with SIMsara. In lock-step, SIMsara completes one step and waits for the controller.
A real EMS product follows the wall clock. It cannot wait for a step. Thus, the fast loop uses the EMS logic as text, and the slow loop uses the real EMS.
| Item | Fast loop | Slow loop |
|---|---|---|
| Controller | The EMS logic as text, in lock-step. | The real EMS or a soft station. |
| Time | The engine, the VPN tunnel and the EMS set it. | Real time. |
| Runs | Many for each idea. | One for each candidate. |
| Purpose | To find a change that is good. | To make sure that the real product gives the same behavior. |
The first flow had seven steps:
- The supervisor agent makes the virtual building tests.
- The supervisor agent runs the tests.
- The specialist agent examines the results and the answer key.
- The specialist agent proposes a change to the EMS.
- The specialist agent writes the change.
- A sub-loop tests, reviews and corrects the branch.
- The supervisor agent builds the EMS and runs it on the test set.
This table shows each change and its steps in the new workflow.
| Change | Type | Rule | Steps |
|---|---|---|---|
| The answer key stays with the scorer. | Primary | 1 | 7, 8, 15 |
| A person sets the hard limits and the scorecard first. | Primary | 2 | 1, 13, 14, 15 |
| Three scenario sets, a real-time run and an approval. | Primary | 3 | 4, 13 to 16, 18, 19 |
| Tests come from a library with seeds. | Smaller | 4 | 2, 4 |
| An adversary agent adds scenarios that fail. | Smaller | 5 | 6 |
| One change for each branch, with a prediction. | Smaller | 6 | 9, 10, 13 |
| A different agent reviews each change. | Smaller | 7 | 11, 12 |
| Each candidate is compared with the baseline on the same seeds. | Smaller | 8 | 5, 13, 14, 15 |
| The simulation has random variation. | Smaller | 9 | 3 |
| An idea log keeps each idea and each result. | Smaller | 10 | 8, 9, 13 to 16, 18 |
Limits
- At this time, SIMsara has no fault library. The BACnet interpreter and the lock-step interface are available.
- The fast loop needs the EMS logic as text. An agent cannot easily edit or compare graphical logic, such as a Niagara wire sheet.
- The equipment models are quasi-steady. The workflow is applicable to schedules, resets, stages and the response to faults. It is not applicable to the adjustment of a fast valve loop.
- An agent can find a defect in the score. A person must examine each result that is much better than its prediction.
The text follows the rules of ASD-STE100 from memory. An STE checker and the official dictionary were not available.
Decisions for you
| Decision | Step |
|---|---|
| The hard limits, and the weight of each measure on the scorecard. | 1 |
| The range of each random variation. | 3 |
| The share of the scenarios in each set. | 4 |
| The number of uses before the library makes a new test set. | 15, 20 |
| The tolerance between the lock-step controller and the real EMS. | 16 |
| The person who approves a release. | 18 |