Voluvessel Portable < VERIFIED >
theta = 2 * math.acos(1 - (level / radius)) segment_area = (radius**2 / 2) * (theta - math.sin(theta)) return segment_area * length def compensate_volume(raw_volume, temp_c, ref_temp_c=20, coeff_per_c=0.00095): expansion = 1 + coeff_per_c * (temp_c - ref_temp_c) return raw_volume / expansion # for mass conservation 5. Database Schema (Simplified) PostgreSQL (metadata & config) CREATE TABLE vessels ( id SERIAL PRIMARY KEY, name TEXT, shape TEXT, params JSONB, -- e.g., "radius": 1.5, "height": 3.0 ref_temp_c FLOAT, alert_high FLOAT, alert_low FLOAT ); CREATE TABLE users ( id SERIAL PRIMARY KEY, email TEXT UNIQUE, role TEXT ); InfluxDB (time-series) Measurement: vessel_reading Tags: vessel_id Fields: level_m , temp_c , volume_m3 , mass_kg , fill_percent 6. API Endpoints (REST) | Method | Endpoint | Description | |--------|------------------------------|-------------------------------------| | POST | /api/v1/reading | Ingest sensor reading | | GET | /api/v1/vessels/:id/volume | Current volume & fill % | | GET | /api/v1/vessels/:id/trend | Last 24h volume data | | POST | /api/v1/vessels | Register new vessel shape/params | | GET | /api/v1/alerts | Active alerts |