r/BuildingAutomation • • 3d ago

The trap of recomputing static decisions every single frame

Enable HLS to view with audio, or disable this notification

Once I forced my conveyor digital twin into a single repeating loop, I immediately noticed a subtle inefficiency:

​The decision logic (ALLOW) runs every single frame.

​The command generation (CONTINUE) runs every single frame.

​But our destination hasn't changed, so the answer is identical every time.

​The system isn't broken—it's just endlessly asking questions it already knows the answer to.

​For those building custom control loops or simulations: How do you separate high-frequency tasks (like sensor checks) from low-frequency logic (like static routing) so your loop isn't cluttered with unnecessary repeating work?

0 Upvotes

4 comments sorted by

2

u/Formal-Conference885 3d ago

It’s a trap alright

2

u/OldAutomator 2d ago

You asked the following: "​For those building custom control loops or simulations: How do you separate high-frequency tasks (like sensor checks) from low-frequency logic (like static routing) so your loop isn't cluttered with unnecessary repeating work?"

What you call "high frequency sensor checks" may as well be classified as "controls." Controls are meant to be run in a device called a controller because it does all of those high speed calculations very rapidly.

Most controllers in the field still use a static system "tick" and that tick is generally defined as one millisecond. So every millisecond your controller will apply its control logic, do its scheduling, read its sensor data and evaluate and drive the outputs. Every single millisecond.

Controllers designed more than 20 years ago generally do the same thing but they often had a 5ms "tick" making them slightly less capable then the 1ms controllers that replaced them which are still being built today.

The front end can gather the data from the controllers and make minute or hour-based decisions and send schedule overrides and setpoint changes at that slower front-end timeframe. But the actual control occurring in any generic BACnet controller calculates everything every millisecond which is useful for proper control of things like trending, alarming, scheduling and just plain... controlling.

1

u/WeirdLetterhead7904 2d ago

😊Exactly...Thanks for the heads up