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

01

Scope

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.

This workflow is a proposal

SIMsara has a BACnet interpreter and a lock-step interface. At this time, SIMsara has no fault library. The workflow needs all three.

TermMeaning in this document
EMSThe energy management system. Its control logic operates the equipment of the building.
ScenarioOne test on the virtual building. A scenario has a building, a climate, a fault, a severity and an occupancy.
SeedA number that gives one scenario. The same seed always gives the same scenario.
Answer keyThe list of the faults that the library put in a scenario.
BaselineThe EMS version that is approved at this time.
CandidateAn EMS version on a branch. The workflow tests it against the baseline.
Hard limitA condition that a candidate must always obey.
ScorecardThe measures and the weights that give the total score.
Idea logThe record of each idea, each prediction and each result.

02

Rules

Ten rules. Rules 1 to 3 are the primary rules.

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.

RuleRule in this workflowReason
1Only 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.
2A 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.
3The 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.
4Each test comes from the scenario library and a seed.Each run is repeatable. Each scenario has a version.
5An adversary agent looks for scenarios that the EMS fails.The library gets difficult scenarios that no person wrote.
6Each branch has one change and one prediction.The result of a test shows the effect of that change only.
7The agent that writes a change does not review it.A different agent finds errors that the author does not see.
8The scorer compares each candidate with the baseline on the same seeds.A difference in the score comes only from the change.
9The library adds random variation to each scenario.The EMS cannot depend on a perfect sensor or a perfect model.
10Each idea and each result go in the idea log.The loop does not try a failed idea again.

03

Roles

Four agents, two programs and one person.

Each role reads only the data that its job needs. The answer key and the test set stay on the locked side.

LOCKED SIDEAnswer keyThe faults in each scenarioTest setThe scenarios and all resultsValidation resultsThe data of each runreadsScorerA program, not an agentAgents cannot change itscoresReviewer agentExamines each changeSpecialist agentProposes and writes changesTraining resultsPoints, trends and alarmsall dataOnly scores, and pass or fail, go out of the locked side. No agent reads the answer key.
LOCKED SIDEAnswer keyThe faults in each scenarioTest setThe scenarios and all resultsValidation resultsThe data of each runreadsScorerA program, not an agent. Agents cannot change it.scoresReviewer agentExamines each changeSpecialist agentProposes and writes changesall dataTraining resultsPoints, trends and alarmsOnly scores, and pass or fail, go out of the locked side.No agent reads the answer key.
Figure 1The locked side. The specialist agent sees the data that the EMS had, and the scores. It does not see the faults.
RoleTypeJobReadsDoes not read
PersonPersonSets the hard limits and the scorecard. Approves each release.All data.No limit.
Supervisor agentAgentStarts the runs. Builds the EMS. Writes the change report.Training results. All scores.The answer key. The test set.
Scenario libraryProgramMakes scenarios from seeds. Makes the three sets. Keeps each answer key.Scenario values and seeds.Not applicable.
Adversary agentAgentFinds scenarios that the baseline fails. Sends them only to the library.The baseline. Training results.The validation set. The test set.
ScorerProgramGrades each run. Runs the test set. Compares each candidate with the baseline.The answer key. All results.Not applicable.
Specialist agentAgentProposes one change. Writes it on a branch.Training results. All scores. The idea log.The answer key. Validation results. The test set.
Reviewer agentAgentExamines 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.

04

Workflow

Twenty steps in three parts.

PREPARATION · ONE TIME FOR EACH BASELINE · STEPS 1 TO 51Set the scorePerson2Make scenariosScenario library3Add variationScenario library4Make three setsScenario library5Run the baselineSupervisor, scorerFAST LOOP · LOCK-STEP · STEPS 6 TO 156Find failuresAdversary agent7Run and gradeSupervisor, scorer8Read the resultsSpecialist agent9Propose a changeSpecialist agent10Write the changeSpecialist agentIDEA LOGEach prediction and each resultreadwrite11Static checksAutomatic12ReviewReviewer agent13Training setSupervisor, scorer14Validation setSupervisor, scorer15Test setScorer onlycorrectfailfailfailpassSLOW LOOP · REAL TIME · STEPS 16 TO 2016Real-time runEMS or soft station17Change reportSupervisor agent18ApprovalPerson19InstallationIn stages, real building20Field dataScenario librarynew baseline, new test setA failure at step 16 or a rejection at step 18 goes to the idea log. Then the loop continues at step 8.A person does this step.Only the scorer reads this set.A failure path.
PREPARATION · STEPS 1 TO 5ONE TIME FOR EACH BASELINE1Set the score2Make scenarios3Add variation4Make three sets5Run the baselineFAST LOOP · LOCK-STEP · STEPS 6 TO 156Find failures7Run and grade8Read the results9Propose a change10Write the change11Static checks12Review13Training set14Validation set15Test setIDEA LOGEach prediction and each resultA failure at step 11 or 12 goes back to step 10.A failure at steps 13 to 15 goes to the idea log.passSLOW LOOP · REAL TIME · STEPS 16 TO 2016Real-time run17Change report18Approval19Installation20Field datanew baseline, new test setA failure at step 16 or a rejection at step 18 goes to theidea log. Then the loop continues at step 8.A person does this step.Only the scorer reads this set.
Figure 2The complete workflow. The fast loop tries many ideas. The slow loop confirms one candidate on the real EMS.
PartStepsHow frequentlyTime
Preparation1 to 5One time for each baseline.Not applicable.
Fast loop6 to 15Many cycles. One cycle for each idea.Lock-step. The engine, the VPN tunnel and the EMS set the speed.
Slow loop16 to 20One time for each candidate that passes the test set.Real time.

05

Preparation

Steps 1 to 5. One time for each baseline.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

06

Fast loop

Steps 6 to 15. One cycle for each idea.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Specialist agent

    The specialist agent writes the change on a new branch.

    One branch has only one change.

  6. Automatic

    Static checks examine the branch.

    The build must complete. The locked items must have no changes. Section 10 gives the locked items.

  7. 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.

  8. 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.

  9. Supervisor agent · Scorer

    The supervisor agent runs the branch on the validation set.

    The specialist agent gets only the scores.

  10. 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

StepGateCondition for a passIf the gate fails
11Static checksThe build completes. The locked items have no changes.The specialist agent corrects the branch. Do step 11 again.
12ReviewThe reviewer agent finds no defect.The specialist agent corrects the branch. Do steps 11 and 12 again.
13Training setNo 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.
14Validation setNo hard limit fails. The total score is better than the baseline.Record the result in the idea log. Go to step 8.
15Test setNo hard limit fails. The total score is better than the baseline.Record the result in the idea log. Go to step 8.
Do not correct a branch against the test set

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.

07

Slow loop

Steps 16 to 20. One time for each candidate that passes the test set.

  1. 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.

  2. 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.
  3. Person

    A person reads the change report and approves or rejects the candidate.

    No candidate goes to a real building without this approval.

  4. 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.

  5. 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.

08

Scenario library

The source of all tests. A program, not an agent.

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 VALUESBuildingClimateFaultSeverityOccupancySeedRandom variationNoise, bias, lag, model valuesScenario libraryOne seed gives one scenario.The same seed gives the same run.Adversary agentScenarios that failField dataFrom real buildingsTraining setAgents read all results.Validation setAgents read scores only.Test setOnly the scorer reads it.Scenarios from the adversary agent go to the training set only.
SCENARIO VALUESBuildingClimateFaultSeverityOccupancySeedRandom variationNoise, bias, lag, model valuesField dataFrom real buildingsAdversary agentScenarios that failScenarios from the adversaryagent go to the training setonly.Scenario libraryOne seed gives one scenario.The same seed gives the same run.Training setAgents read all results.Validation setAgents read scores only.Test setOnly the scorer reads it.
Figure 3The scenario library makes each scenario from values and a seed, and puts it in one set.
Scenario valueContents
BuildingThe type, the size and the systems of the building.
ClimateThe location, the weather year and the season.
FaultThe fault type from the fault library, and the equipment that has the fault.
SeverityThe size of the fault, its start time and its rate of increase.
OccupancyThe schedule and the number of persons.
SetStepsWhat the agents readPurpose
Training set5 to 13All results.To find problems and to try ideas.
Validation set5, 14Scores only.To make sure that an idea is also good on scenarios that the specialist agent did not study.
Test set5, 15Pass 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.

09

Score

Hard limits first. Then a weighted scorecard.

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.

Run resultsOne scenarioHARD LIMITS · ALL MUST PASSSafeties operateMinimum ventilationFreeze protectionMinimum on and off timespassone failureCandidate rejectedSCORECARD · WEIGHTED SUMEnergy or costw1Comfortw2Peak demandw3Equipment cyclesw4Fault detectionw5Compare withthe baselineSame seedsThe scorer uses the answer key only for the fault detection measure.A person sets each weight (w1 to w5) before the loop starts.
Run resultsOne scenarioHARD LIMITS · ALL MUST PASSSafeties operateMinimum ventilationFreeze protectionMinimum on and off timespassone failureCandidate rejectedSCORECARD · WEIGHTED SUMEnergy or costw1Comfortw2Peak demandw3Equipment cyclesw4Fault detectionw5Compare with the baselineSame seedsThe scorer uses the answer key only for the faultdetection measure. A person sets each weight(w1 to w5) before the loop starts.
Figure 4The score of one run. The hard limits are a gate. The scorecard gives the total.

Hard limits

Hard limitCondition for a pass
SafetiesEach safety device stops its equipment when its limit occurs.
Minimum ventilationThe outdoor air flow is not less than the minimum during occupied hours.
Freeze protectionNo coil goes below its freeze limit.
Minimum on and off timesNo compressor starts or stops before its minimum time.

These four limits are examples. The person adds the limits that apply to the building.

Scorecard

MeasureUnitA better value is
Energy or costkWh, or the cost of the energyLower.
ComfortOccupied hours out of the comfort rangeLower.
Peak demandkWLower.
Equipment cyclesStarts for each dayLower.
Fault detectionFaults found, faults missed, false alarms, time to detectMore faults found. Fewer faults missed. Fewer false alarms. A shorter time.

10

Change control

One change, one prediction, one branch.

Each idea is one branch from the baseline. The branch goes through five gates. Each failure goes in the idea log.

BASELINEcandidatePredictionChangeStatic checksReviewTraining setValidation setTest setwritecorrectfailfailfail9101112131415IDEA LOGThe prediction, the result, and the reason for each failureAfter a failure at steps 13 to 15, the specialist agent starts a new idea at step 8.
BASELINEcandidatewritefailfailfailcorrect9Prediction10Change11Static checks12Review13Training set14Validation set15Test setIDEA LOGThe prediction, the result, and the reason for each failureAfter a failure at steps 13 to 15, the specialist agentstarts a new idea at step 8.
Figure 5One branch. The numbers are the steps of the workflow.

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-log.toml · example record · the values are examples only
[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."

11

Random variation

The EMS never sees a perfect building.

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.

ONE SCENARIOVirtual buildingThe model values changewith the seed.SensorNoiseBiasActuatorLag (stroke time)EMSReads only themeasured values.true valuemeasured valuecommandpositionEach scenario gets different values from its seed. Thus, the EMS cannot depend on a perfect simulation.
ONE SCENARIOVirtual buildingThe model values changewith the seed.true valuepositionSensorNoiseBiasActuatorLag (stroke time)measured valuecommandEMSReads only the measured values.Each scenario gets different values from its seed. Thus,the EMS cannot depend on a perfect simulation.
Figure 6The four variations. Three are between the building and the EMS. One is in the building model.
VariationEffectExample range
Sensor noiseEach value that the EMS reads has a small random error.±0.1 K on a temperature
Sensor biasA sensor has a constant error for the full run.±0.5 K on a temperature
Actuator lagA damper or a valve moves slowly to its new position.A stroke time of 60 s to 150 s
Model uncertaintyThe 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.

12

Time

Why the workflow has two loops.

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.

FAST LOOP · STEPS 6 TO 15SIMsaraVirtual buildingController in lock-stepThe EMS logic as textstep completeacknowledgeNo wait for the clockSpeed: the engine, tunnel and EMSSLOW LOOP · STEPS 16 TO 20SIMsaraVirtual buildingReal EMS or soft stationThe product, with no changesBACnet valuesBACnet commandsReal timeOne second for each second
FAST LOOP · STEPS 6 TO 15SIMsaraVirtual buildingstep completeacknowledgeController in lock-stepThe EMS logic as textNo wait for the clockSpeed: the engine, tunnel and EMSSLOW LOOP · STEPS 16 TO 20SIMsaraVirtual buildingBACnet valuesBACnet commandsReal EMS or soft stationThe product, with no changesReal timeOne second for each second
Figure 7The same building model in the two loops. Only the controller and the time are different.
ItemFast loopSlow loop
ControllerThe EMS logic as text, in lock-step.The real EMS or a soft station.
TimeThe engine, the VPN tunnel and the EMS set it.Real time.
RunsMany for each idea.One for each candidate.
PurposeTo find a change that is good.To make sure that the real product gives the same behavior.

13

Changes from the first flow

Three primary rules and seven smaller changes.

The first flow had seven steps:

  1. The supervisor agent makes the virtual building tests.
  2. The supervisor agent runs the tests.
  3. The specialist agent examines the results and the answer key.
  4. The specialist agent proposes a change to the EMS.
  5. The specialist agent writes the change.
  6. A sub-loop tests, reviews and corrects the branch.
  7. 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.

ChangeTypeRuleSteps
The answer key stays with the scorer.Primary17, 8, 15
A person sets the hard limits and the scorecard first.Primary21, 13, 14, 15
Three scenario sets, a real-time run and an approval.Primary34, 13 to 16, 18, 19
Tests come from a library with seeds.Smaller42, 4
An adversary agent adds scenarios that fail.Smaller56
One change for each branch, with a prediction.Smaller69, 10, 13
A different agent reviews each change.Smaller711, 12
Each candidate is compared with the baseline on the same seeds.Smaller85, 13, 14, 15
The simulation has random variation.Smaller93
An idea log keeps each idea and each result.Smaller108, 9, 13 to 16, 18

14

Limits and decisions

What is not ready, and what you must decide.

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.
No checker tool examined this text

The text follows the rules of ASD-STE100 from memory. An STE checker and the official dictionary were not available.

Decisions for you

DecisionStep
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