Blocky plus performants que prévu ?
Publié : 02 janv. 2016, 17:39
J'avais entrepris de convertir mes blocky en lua pour gérer mon chauffage mais je me suis apercu après bon fonctionnement de ceux ci que ca demandait une bien plus grosse utilisation du CPU qu'en blocky pour faire la même chose …. je passais de moins de 2% à plus de 4% ( certes c'est peu mais ca me choque que ces blocky si décriés soit plus performants que le LUA ) certes surement plus mal écrit de ma part que les blocky vu mon faible niveau en LUA …
un souci d'optimisation de mon coté ?
un souci d'optimisation de mon coté ?
Code : Tout sélectionner
--script_device_chauffageSalon.lua
local consigneconfortsalon = 18.5 --Température de consigne
local consigneecosalon = 16.5 --Température de consigne
local sondesalon = 'Temp Salon' --Nom de la sonde de température
local modulesalon = 'Module Salon' --Nom du radiateur à allumer/éteindre
commandArray = {}
tempsalon = otherdevices_temperature[sondesalon]
-- conditions de chauffe --
-- marche confort --
if (otherdevices['Calendrier chauffage Salon']=='On') and (tempsalon < consigneconfortsalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret confort --
if (otherdevices['Calendrier chauffage Salon']=='On') and (tempsalon > consigneconfortsalon ) and (otherdevices['Module Salon']=='On') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='Off'
end
-- marche eco --
if (otherdevices['Calendrier chauffage Salon']=='Off') and (tempsalon < consigneecosalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret eco --
if (otherdevices['Calendrier chauffage Salon']=='Off') and (tempsalon > consigneecosalon) and (otherdevices['Module Salon']=='On') and (otherdevices['Eco chauffage Salon']=='Off') then
commandArray[modulesalon]='Off'
end
-- marche eco forcé --
if (otherdevices['Eco chauffage Salon']=='On') and (tempsalon < consigneecosalon ) and (otherdevices['Module Salon']=='Off') and (otherdevices['Pile Salon']=='Off') then
commandArray[modulesalon]='On'
end
-- arret eco forcé --
if (otherdevices['Eco chauffage Salon']=='On') and (tempsalon > consigneecosalon ) and (otherdevices['Module Salon']=='On') then
commandArray[modulesalon]='Off'
end
return commandArray