Blocky plus performants que prévu ?

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
oula85
Messages : 161
Inscription : 29 avr. 2015, 18:09
Localisation : Challans

Blocky plus performants que prévu ?

Message par oula85 »

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é ?

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
Dernière modification par oula85 le 03 janv. 2016, 10:38, modifié 1 fois.
patrice
Messages : 1720
Inscription : 22 sept. 2014, 21:51

Re: Blocky plus performants que prévu ?

Message par patrice »

Bonsoir
Quand on parle de performance de Lua vs Blockly , il ne s'agit pas de temps CPU consommé mais des possibilités offertes par Lua par rapport à Blocky et de l'ouverture que cela apporte.
Raspberry pi 3, Dongle RfxCom et Zigate +, plugin de pipiche, Volets Roulants profalux, contrôle d'éclairage, détecteurs de présence, alarme incendie, pilotage livebox ...
Objectif : WAF > 1
oula85
Messages : 161
Inscription : 29 avr. 2015, 18:09
Localisation : Challans

Re: Blocky plus performants que prévu ?

Message par oula85 »

Oui ca j avais bien compris mais du coup ca m a quand même bien surpris
Répondre