Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bbartling's full-sized avatar

Ben Bartling bbartling

  • https://slipstreaminc.org/
  • Madison, WI
View GitHub Profile
@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 / alarm_dial_out.py
Last active March 15, 2024 17:17
concept idea rest API for global share values in typical BAS contracting... Usually the boiler plant controller ALWAYS has the outside air temperature sensor hardwired and its ALWAYS needed to share that sensor value to other devices like air handling units that need that value to execute sequencing.
import requests
import random
import time
BASE_URL = "http://localhost:8000"
def simulate_sensor_reading(sensor_name):
# This function simulates reading a sensor by generating a random value.
# Replace this logic with actual sensor reading if integrating with real sensors or systems.
@bbartling
bbartling / tester.py
Last active February 19, 2024 19:20
An handy dandy compilation and then some of the bapypes3 sample apps with the bacpypes console
"""
I may expand on this so lets say this one is v0.0.1
Bring up the bacpypes3 console with debug
$ python3 tester.py --debug
run on static IP for UDP port 47820 with passing in Address arg
$ python3 tester.py --address 10.7.6.201/24:47820 --debug
See all available commands
import strawberry
from fastapi import FastAPI
from strawberry.asgi import GraphQL
from typing import Tuple
import pandas as pd
# Sample DataFrame for Zones
zone_data = {
'Zone1_Temp': [20, 21, 19],
'Zone2_Temp': [22, 23, 21],
@bbartling
bbartling / valve_select_prompt_template.py
Last active October 10, 2023 00:40
concept idea prompt engineering template for controls hardware or application engineering to select valves for a job
import openai
import json
# Example usage of a valve for a job:
flow_rate = 5 # GPM
delta_p = 3 # PSI
specific_gravity = 1
fluid_type = "water"
is_three_way = False
@bbartling
bbartling / Dockerfile
Last active February 9, 2024 17:15
bacpypes3 example of a BACnet server ran Docker on rasp pi hardware with Alpine Linux. App is a make over of legacy bacpypes mini_device.py from repo samples directory but in bacpypes3 asyncio version
# Use an Alpine Linux base image for Raspberry Pi
FROM arm32v7/alpine:latest
# Set the working directory in the container
WORKDIR /app
# Install necessary packages and dependencies
RUN apk --no-cache add python3 python3-dev py3-pip
# Install BACpypes and any other required dependencies
@bbartling
bbartling / bacnet_test.py
Last active September 18, 2023 14:58
simple BAC0 scripts
import requests
import BAC0
import time
import random
bacnet = BAC0.lite()
while True:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.