Skip to content

Instantly share code, notes, and snippets.

View bbartling's full-sized avatar

Ben Bartling bbartling

View GitHub Profile
@bbartling
bbartling / GemeniResponce.md
Last active July 21, 2025 15:50
Python converted HVAC Fault Equation to JavaScript with AI like magic

Of course. Here is a conceptual model and implementation for an AHU Fault Condition 1 hook based on the Normal Framework (NF) architecture, designed for reusability across your other fault detection rules.

This approach translates the logic from your Python script into a serverless JavaScript function (a "hook") that runs within the NF environment. It operates on real-time data points, using configurable variables for thresholds, which is ideal for a scalable Fault Detection and Diagnostics (FDD) application.


Hook Definition (fc01-ahu-low-static.json)

First, you define the hook's configuration. This JSON file tells the Normal runtime what data to select, how to group it, when to run the code, and what settings (variables) to make available. Each fault condition will have its own definition file.

@bbartling
bbartling / discharge_air_pressure_reset.md
Last active April 16, 2025 16:11
GL36 Java Script Gists

❄️ Supply Air Temperature Reset – ASHRAE G36 Trim & Respond

This logic implements a modular supply air temperature reset strategy based on ASHRAE Guideline 36, section 5.16.2. VAVs issue SAT requests based on zone-level temperature demand, which are summed and used by the AHU to reset the discharge air temperature via trim and respond logic.


1️⃣ VAV Cooling Request – sat-calculate-requests.hook.js

Each VAV compares zone temperature against the occupied cooling setpoint and determines how many SAT reset requests to send.

@bbartling
bbartling / docker_pi_notes.md
Last active March 22, 2025 15:34
How to run Node Red with custom flows with Docker on HTTPS with custom username and password

🐳 Node-RED Docker Cheat Sheet (with HTTPS/SSL, Flows, and Password)

✅ 1. Install Docker (on Raspberry Pi or Linux)

curl -sL https://get.docker.com | sh
sudo usermod -aG docker $USER

🔁 Reboot or log out/log in after adding yourself to the docker group.

@bbartling
bbartling / main.c
Created February 18, 2025 20:18
Minimal BACnet Server Attempt
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* BACnet Stack includes */
#include "bacnet/bacdef.h"
#include "bacnet/apdu.h"
#include "bacnet/bacdcode.h"
@bbartling
bbartling / kitControls_BOptimizedStartStop.java
Last active June 21, 2025 15:55
Modernized Optimal Start Efforts based on PNNL white paper
package com.tridium.kitControl.energy;
import java.text.DecimalFormat;
import javax.baja.log.Log;
import javax.baja.nre.annotations.NiagaraActions;
import javax.baja.nre.annotations.NiagaraProperties;
import javax.baja.nre.annotations.NiagaraType;
import javax.baja.status.BStatus;
import javax.baja.status.BStatusBoolean;
import javax.baja.status.BStatusNumeric;
@bbartling
bbartling / main.py
Last active April 8, 2024 13:32
PID logic sim for a HVAC VAV box
class VavBoxController:
'''
TODO add in -
state machines for sensor reliability
air flow PID control for damper
integral windup prevention
occupancy state for unoc setpoints
'''
def __init__(
@bbartling
bbartling / bacnet_test.py
Last active May 31, 2025 17:59
simple BAC0 scripts
import asyncio
import BAC0
"""
not tested yet
"""
async def main():
bacnet = BAC0.lite()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.