This repository provides ready-to-use Java algorithm blocks for Niagara 4 ProgramObjects (as .bog files) and this README itself, which serves as a model context file for Large Language Models (LLMs) such as ChatGPT or Gemini. Think of it as the instruction manual the LLM reads before it writes code for you.
Ben is actively deploying and testing these
ProgramObjectsin the field, most notably the Guideline 36 algorithms, chiller demand-based start, and Optimal Start blocks built on PNNL’s latest research for energy-efficiency projects.
Also, feel free to skip the tutorials entirely and jump right into the Prebuilt Wiresheet Examples (.bog file format) for everything shown below.
Check for demonstrations on Vibe Coding on 📺 🎥 Talk Shop With Ben on YouTube
Check out the new December 2025 YouTube playlist on optimal start/stop math and algorithms, built from short daily AI-generated lessons, plus the complete open-source GitHub repository featuring Python examples and in-depth explorations of PNNL optimal start research.
⚙️ How to Use with AI
- Download all
READMEmarkdown files (*.mdcontaining “README” in the filename) directly from GitHub including theAGENTS.mdfile. - Open your LLM chat (e.g., ChatGPT, Gemini, etc.).
- Upload all the
README.mdfiles from your downloads folder on your computer along with your idea in mind to try. The more context the LLM has — in the form of README files — the better the results you’re likely to achieve.
Comparison View ChatGPT and Gemeni with all READMEs uploaded
![]() |
![]() |
Chat with AI what you are looking to achieve
“See these READMEs — I want a
ProgramObjectthat automates my chiller plant with rocket science. 🚀🤭”
- Once the LLM confirms it understands the README, have it generate or edit your Niagara 4
ProgramObjectcode. - Paste the resulting Java code into Workbench’s Program Editor, make your slots for your block, and compile in the
ProgramObjecteditor view. - Screenshot any compile errors using the Windows Snipping Tool and send them back into the LLM chat for review.
- Repeat as needed. ♻️ If the LLM starts generating bogus code (Gemini sometimes forgets that
ProgramObjectauto-handle imports), just remind it that Workbench generates those automatically and to reference theREADME.mdfile again! - Simulate and test ♻️ the logic thoroughly in your desktop office type enivornment. When your
ProgramObjectbehaves as expected, export the.bogfile.⚠️ Important⚠️ Monitor the Application Director in Workbench for any errors. - Import the tested Wiresheet as the .bog containing the
ProgramObjectinto the JACE for live field deployment. - Finally, monitor JACE resources
⚠️ Important⚠️ See the section below JACE Resource Management – Best Practices for guidance on ensuring the JACE has sufficient free heap memory and acceptable CPU usage.
To keep this README concise, the detailed tutorials and algorithm implementations have been moved into separate sub‑guides. Use the links below to navigate to the appropriate document:
- AGENTS.md — most importantly provides the AI model context and internal notes that guide how ChatGPT or other LLMs interpret this repository, generate Niagara logic, and assist in creating new
ProgramObjects. - Beginner Tutorials — step‑by‑step examples and general algorithm blocks.
- GL36 Trim & Respond — prebuilt wiresheets for AHU Trim & Respond (T&R), chiller plant, and boiler plant trim-and-respond logic.
- GL36 Fault Detection — fault detection as defined by ASHRAE Guideline 36-2021 for AHUs and central plant systems.
- Non‑GL36 AHU Resets — simplified air-side setpoint resets, more simple than Guideline 36.
- APIs & Web Requests — examples for calling weather, holiday and iCalendar APIs or integrating external data science machine learning models running in docker containers.
- Optimal Start Algorithms — adaptive-tuning optimal start algorithms based on PNNL research, incorporating both the linear degree-per-minute model and quadratic regression.
- Demand‑Side Management — PNNL‑inspired intelligent load shedding. (NOT TESTED YET)
- Astronomical Clock — Uses Station time and site coordinates to calculate the sun's Azimuth (compass direction) and Elevation (height in the sky).
- Niagara Schedules — for Niagara Scheduleing including a NEW icalender integeration in a
ProgramObject! - Niagara AX Notes — notes on creating
ProgramObjectsin legacy Niagara AX (earlier Java-based versions).
📊 JACE Resource Management – Best Practices
To avoid Niagara runtime issues, monitor JACE system health:
- CPU Usage: Try to keep < 80% on average. Spikes are okay if brief.
- Heap Usage: Keep
heap.used< 75% ofheap.total.
What to Watch:
| Metric | Limit |
|---|---|
heap.used |
< 75% |
CPU % |
Avg < 80% |
resources.category.program |
Avoid frequent Clock.schedule() or unbounded loops. |
💛 Support This Work
If you make something cool or need help dont hesitate to reach out and I can add it as an example! Linkedin is best to reach out to me on a DM.
Everything here is MIT Licensed — free, open source, and made for the BAS community.
Use it, remix it, or improve it — just share it forward so others can benefit too. 🥰🌍
【MIT License】
Copyright 2026 Ben Bartling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



