--lua hvac.lua a1
--for k, v in pairs(arg) do
-- print(k, v)
--end
local name = arg[1] or "b6"
local ts = os.time()
local hour = tonumber(os.date("%H"))
local minute = tonumber(os.date("%M"))
-- 24小时等间数据
local dataArr = {
a0 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
-- 制冷机 制冷量 (kW) 冷冻水进水温度 (摄氏度) 冷冻水出水温度(摄氏度) 冷冻水温差 (摄氏度) 散热量 (kW) 冷却水进水温度 冷却水出水温度 冷却水温差 电机功率(W)
a1 = { 0, 0, 0, 0, 208250, 833000, 2082500, 3748500, 5622750, 7288750, 7996800, 8121750, 6539050, 6247500, 7038850, 8163400, 7996800, 7580300, 6664000, 5081300, 3165400, 1999200, 999600, 208250 },
a2 = { 26.70, 26.70, 26.70, 26.70, 6.55, 6.83, 7.47, 8.35, 9.25, 10.09, 10.48, 10.59, 9.71, 9.60, 10.01, 10.57, 10.46, 10.22, 9.78, 8.97, 8.00, 7.47, 6.92, 6.59 },
a3 = { 26.70, 26.70, 26.70, 26.70, 6.44, 6.41, 6.42, 6.46, 6.41, 6.42, 6.45, 6.49, 6.41, 6.45, 6.46, 6.46, 6.43, 6.40, 6.42, 6.41, 6.41, 6.46, 6.41, 6.48 },
a4 = { 0, 0, 0, 0, 0.105, 0.42, 1.05, 1.89, 2.835, 3.675, 4.032, 4.095, 3.297, 3.15, 3.549, 4.116, 4.032, 3.822, 3.36, 2.562, 1.596, 1.008, 0.504, 0.105 },
a5 = { 0, 0, 0, 0, 260312.5, 1041250, 2603125, 4685625, 7028437.5, 8776250, 9596160, 9746100, 7846860, 7448942.308, 8342340.741, 9703664.151, 9602583.133, 9264811.111, 8250666.667, 6335941.975, 3956750, 2499000, 1249500, 260312.5 },
a6 = { 26.7, 26.7, 26.7, 26.7, 22.5, 23.1, 23.9, 24.7, 25.3, 25.7, 25.98, 26.1, 26.18, 26.3, 26.26, 26.14, 25.98, 25.78, 25.5, 25.18, 24.54, 24.02, 23.18, 22.5 },
a7 = { 26.7, 26.7, 26.7, 26.7, 22.61, 23.56, 25.04, 26.76, 28.39, 29.56, 30.20, 30.38, 29.63, 29.57, 29.93, 30.41, 30.20, 29.85, 29.13, 27.97, 26.28, 25.12, 23.73, 22.61 },
a8 = { 0, 0, 0, 0, 0.11, 0.46, 1.14, 2.06, 3.09, 3.86, 4.22, 4.28, 3.45, 3.27, 3.67, 4.27, 4.22, 4.07, 3.63, 2.79, 1.74, 1.10, 0.55, 0.11 },
a9 = { 0, 0, 0, 0, 52062.50, 208250.00, 520625.00, 937125.00, 1405687.50, 1487500.00, 1599360.00, 1624350.00, 1307810.00, 1201442.31, 1303490.74, 1540264.15, 1605783.13, 1684511.11, 1586666.67, 1254641.98, 791350.00, 499800.00, 249900.00, 52062.50 },
-- 冷冻水泵 水泵出口流量 (m3/h) 运行状态 水泵进口压力 水泵出口压力 扬程 电机功率 (W)
b1 = { 0, 0, 0, 0, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700 },
b2 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
b3 = { 0, 0, 0, 0, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3, 2.3 },
b4 = { 0, 0, 0, 0, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82, 4.82 },
b5 = { 0, 0, 0, 0, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2, 25.2 },
b6 = { 0.00, 0.00, 0.00, 0.00, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80, 194350.80 },
-- 冷却水泵 水泵出口流量 (m3/h) 运行状态 水泵进口压力 水泵出口压力 扬程 电机功率
c1 = { 0, 0, 0, 0, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950, 1950 },
c2 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
c3 = { 0, 0, 0, 0, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34 },
c4 = { 0, 0, 0, 0, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45, 2.45 },
c5 = { 0, 0, 0, 0, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1, 21.1 },
c6 = { 0.00, 0.00, 0.00, 0.00, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74, 193097.74 },
}
local dataL = dataArr[name][hour]
local dataR = dataArr[name][hour + 1]
local ret = dataL + (dataR - dataL) * (minute / 60)
local bias = math.random(-50, 50) / 1000
ret = ret * (1 + bias)
-- 排除离散
if (name == "a0" or name == "b2" or name == "c2") then
ret = dataL
end
--print(name)
--print(hour .. ":" .. minute, "(" .. dataL .. ', ' .. dataR .. ")")
print(string.format("%.2f", ret))