207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291 | def simulate_value(name: str, params: dict) -> float | int:
"""Heuristics based on AC names found in your register set."""
nm = name.lower()
# Temps
t = params.get("temperatures_c", {})
if "room_temp_c" in nm: p=t.get("room", {"min":22,"max":26,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "supply_air_temp_c" in nm: p=t.get("supply_air", {"min":10,"max":16,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "return_air_temp_c" in nm: p=t.get("return_air", {"min":24,"max":28,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "evap_inlet_temp_c" in nm: p=t.get("evap_in", {"min":16,"max":22,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "evap_outlet_temp_c" in nm: p=t.get("evap_out", {"min":6,"max":10,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "cond_inlet_temp_c" in nm: p=t.get("cond_in", {"min":30,"max":40,"jitter":0.3}); return rand_between(p["min"], p["max"], p["jitter"])
if "cond_outlet_temp_c" in nm: p=t.get("cond_out", {"min":35,"max":50,"jitter":0.4}); return rand_between(p["min"], p["max"], p["jitter"])
if "outdoor_temp_c" in nm: p=t.get("outdoor", {"min":10,"max":45,"jitter":0.5}); return rand_between(p["min"], p["max"], p["jitter"])
if "suction_line_temp_c" in nm:p=t.get("suction", {"min":5,"max":15,"jitter":0.2}); return rand_between(p["min"], p["max"], p["jitter"])
if "discharge_line_temp_c" in nm:p=t.get("discharge",{"min":60,"max":85,"jitter":0.5}); return rand_between(p["min"], p["max"], p["jitter"])
# Pressure
pr = params.get("pressures_kpa", {})
if "suction_pressure_kpa" in nm: p=pr.get("suction", {"min":250,"max":350,"jitter":3}); return rand_between(p["min"], p["max"], p["jitter"])
if "discharge_pressure_kpa" in nm: p=pr.get("discharge", {"min":1200,"max":2200,"jitter":8});return rand_between(p["min"], p["max"], p["jitter"])
# Humidity
hm = params.get("humidity_percent", {})
if "room_rh_percent" in nm: p=hm.get("room", {"min":40,"max":55,"jitter":0.5}); return rand_between(p["min"], p["max"], p["jitter"])
if "return_rh_percent" in nm: p=hm.get("return", {"min":40,"max":60,"jitter":0.5}); return rand_between(p["min"], p["max"], p["jitter"])
# Setpoints
sp = params.get("setpoints", {})
if "cooling_setpoint_c" in nm: p=sp.get("cooling_setpoint_c", {"min":18,"max":26,"jitter":0.1}); return rand_between(p["min"], p["max"], p["jitter"])
if "heating_setpoint_c" in nm: p=sp.get("heating_setpoint_c", {"min":16,"max":24,"jitter":0.1}); return rand_between(p["min"], p["max"], p["jitter"])
if "supply_air_setpoint_c" in nm: p=sp.get("supply_air_setpoint_c", {"min":10,"max":18,"jitter":0.1}); return rand_between(p["min"], p["max"], p["jitter"])
if "humidity_setpoint_percent" in nm: p=sp.get("humidity_setpoint_percent", {"min":40,"max":60,"jitter":0.5}); return rand_between(p["min"], p["max"], p["jitter"])
if "deadband_c" in nm: p=sp.get("deadband_c", {"min":0.5,"max":2.0,"jitter":0.05}); return rand_between(p["min"], p["max"], p["jitter"])
# Fan
fan = params.get("fan", {})
if "fan_speed_percent" in nm:
p = fan.get("speed_percent", {"min":30,"max":100,"jitter":1.0})
return max(0.0, min(100.0, rand_between(p["min"], p["max"], p["jitter"])))
if "fan_mode" in nm:
return pick_enum(fan.get("mode_enum", [1,2,3,4]))
# Modes
modes = params.get("modes", {})
if "system_mode" in nm:
return pick_enum(modes.get("system_mode_enum", [0,1,2,3,4,5]))
if "occupancy_mode" in nm:
return pick_enum(modes.get("occupancy_mode_enum", [0,1]))
# Status bitmap-ish INT16 flags (0/1)
if any(k in nm for k in ["unit_running","compressor","economizer","defrost","fault_active","supply_fan_running","return_fan_running","digital_input_"]):
prob = float(params.get("status_bitmap_on_prob", 0.01))
return 1 if random.random() < prob else 0
# Power / energy / runtime
if "active_power_kw" in nm:
p = params.get("power_kw", {"min":0.0,"max":40.0,"jitter":0.8})
return max(0.0, rand_between(p["min"], p["max"], p["jitter"]))
if "demand_kw" in nm:
p = params.get("demand_kw", {"min":0.0,"max":45.0,"jitter":0.8})
return max(0.0, rand_between(p["min"], p["max"], p["jitter"]))
if "energy_consumed_kwh" in nm:
inc = params.get("energy_kwh_increment", {"min":0.05,"max":0.25})
return inc["min"] + random.random()*(inc["max"]-inc["min"])
if "hours" in nm:
inc = params.get("runtime_hours_increment", {"min":0.0,"max":0.02})
return inc["min"] + random.random()*(inc["max"]-inc["min"])
# Analog outputs 0-100%
if "analog_output_" in nm and "percent" in nm:
p = params.get("analog_output_percent", {"min":0.0,"max":100.0,"jitter":1.0})
return max(0.0, min(100.0, rand_between(p["min"], p["max"], p["jitter"])))
# Alarms bitmap
if "alarm_bitmap_" in nm:
bits = 0
# low probability random alarm bits
for b in range(32):
if random.random() < 0.002:
bits |= (1 << b)
return bits
return 0.0
|