Page 3 sur 3

Re: Calcul rendement VMC double flux

Publié : 25 avr. 2019, 10:22
par Tonio16
gaston a écrit : 24 avr. 2019, 19:43 @ Tonio16
C'est une Domeo 210 DHU de chez Unelevent
Pour écrire dans les différents registres, j'utilise ce plugin python , tu devrais pouvoir t'en inspirer.
Salut

Je connais ce script mais il n'est pas pratique avec ma VMC car j'ai plusieurs adresses à lire. J'ai donc écrit un script en me basant dessus ainsi que d'autres scripts en python en lien avec le modbus. J'ai comme cela pu intégrer plusieurs valeurs disponnibles sur ma VMC.
Quand il sera fini, je le mettrais sur le forum pour un retour des pros.

Antoine

Re: Calcul rendement VMC double flux

Publié : 25 avr. 2019, 20:46
par gaston
Bon, visiblement "nan" est un nombre ...

Code : Tout sélectionner

 2019-04-25 19:33:00.568 Status: dzVents: Info: ------ Start external script: vmc.lua:, trigger: every minute
2019-04-25 19:33:00.675 Status: dzVents: Debug: Processing device-adapter for vmc Temp. soufflage - : Custom sensor device adapter
2019-04-25 19:33:00.680 Status: dzVents: Debug: Processing device-adapter for vmc Temp. interieur -: Custom sensor device adapter
2019-04-25 19:33:00.686 Status: dzVents: Debug: Processing device-adapter for vmc Temp. exterieur - : Custom sensor device adapter
2019-04-25 19:33:00.686 Status: dzVents: Debug: T_soufflage vmc : 12°C
2019-04-25 19:33:00.687 Status: dzVents: Debug: T_reprise vmc : 12°C
2019-04-25 19:33:00.687 Status: dzVents: Debug: T exterieure vmc : 12°C
2019-04-25 19:33:00.687 Status: dzVents: Debug: rendement vmc : nan%
2019-04-25 19:33:00.693 Status: dzVents: Debug: Processing device-adapter for Rendement VMC: Percentage device adapter
2019-04-25 19:33:00.693 Status: dzVents: Debug: mise à jour rendement vmc
2019-04-25 19:33:00.694 Status: dzVents: Info: ------ Finished vmc.lua
2019-04-25 19:33:01.260 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua 
Comme son copain "-inf"...

Code : Tout sélectionner

 2019-04-25 19:28:32.575 (température) Temp (Temperature)
2019-04-25 19:29:01.135 Status: dzVents: Info: ------ Start external script: vmc.lua:, trigger: every minute
2019-04-25 19:29:01.242 Status: dzVents: Debug: Processing device-adapter for vmc Temp. soufflage - : Custom sensor device adapter
2019-04-25 19:29:01.252 Status: dzVents: Debug: Processing device-adapter for vmc Temp. interieur -: Custom sensor device adapter
2019-04-25 19:29:01.259 Status: dzVents: Debug: Processing device-adapter for vmc Temp. exterieur - : Custom sensor device adapter
2019-04-25 19:29:01.259 Status: dzVents: Debug: T_soufflage vmc : 12°C
2019-04-25 19:29:01.260 Status: dzVents: Debug: T_reprise vmc : 12.5°C
2019-04-25 19:29:01.260 Status: dzVents: Debug: T exterieure vmc : 12.5°C
2019-04-25 19:29:01.260 Status: dzVents: Debug: rendement vmc : -inf%
2019-04-25 19:29:01.265 Status: dzVents: Debug: Processing device-adapter for Rendement VMC: Percentage device adapter
2019-04-25 19:29:01.266 Status: dzVents: Debug: mise à jour rendement vmc
Et forcement, plus de graphe mais c'est confirmé, c'est bien "nan" qui plante l'affichage, car il ne sait pas définir l’échelle à afficher.
Ce qui m'a fait penser que je pouvais surement faire une condition pour savoir si la valeur de rendement est comprise entre 0 et 110 (oui, 110 c'est beaucoup pour une VMC mais c'est pour savoir si elle brule :-p )
Donc voila ce qui m'a l'air de fonctionner:

Code : Tout sélectionner

if rendement_vmc ~= nil and rendement >= 0 and rendement <= 110 then
domoticz.devices(rendement_vmc).updatePercentage(rendement)
logWrite('mise à jour rendement vmc', domoticz.LOG_DEBUG)
end
J'ai testé en mettant le même Idx pour toutes les sondes et c'est bon, ça ne log pas malgré le "nan" :D

Merci Papoo tu m'a bien aidé pour ce truc ;)

Re: Calcul rendement VMC double flux

Publié : 25 avr. 2019, 21:42
par papoo
effectivement Nan est bien un nombre
par contre " la valeur Nan est considérée différente de toute valeur, y compris elle-même."
donc tu peux tester cette condition :

Code : Tout sélectionner

if rendement_vmc ~= nil and domoticz.devices(rendement_vmc).percentage ~= rendement and rendement == rendement then 

Re: Calcul rendement VMC double flux

Publié : 26 nov. 2019, 21:36
par alpin38
bonsoir

je met a jour ce post dont je me suis inspiré pour le calcul du rendement

ma version du script est en DZvent

2 commandes manuelles (vitesse lente/rapide et bypass on/off)
2 commandes virtuelles (vitesse et bypass) dans domoticz
4 sondes de T° (air neuf , extrait , vicie et souffle)
la VMC dialogue avec domoticz via un mysensors v2 sur arduino mini pro (qui recupère les temperatures et les ordres des 2 commandes manuelles , et gere egalement les actions bypass et vitesse envoyé par domoticz)

Code : Tout sélectionner

local temp_air_neuf = 'VMC Température Air Neuf' -- temperature device
local temp_air_vicie = 'VMC Température Air Vicié' -- temperature device
local temp_air_extrait = 'VMC Température Air Extrait' -- temperature device
local temp_air_souffle = 'VMC Température Air Soufflé' -- temperature device
local BP_bypass = '$BYPASS IN'
local BP_speed = '$HIGH SPEED IN'
local OUT_bypass = '$BYPASS OUT'
local OUT_speed = '$HIGH SPEED OUT'
local DZ_bypass = 'VMC BYPASS'
local DZ_speed = 'VMC SPEED'
local info_bypass = 'VMC Etat Bypass'
local info_speed = 'VMC Vitesse Ventilation'


local LOGGING = true  


return {
	on = {
		 ['timer'] = {
			 'every minute',
		 },
		devices = {
			temp_air_neuf,
			temp_air_extrait,
			BP_bypass,
			BP_speed,
			DZ_bypass,
			DZ_speed

		}
	},
	active = true,
	execute = function(domoticz, item)
		
		local mois = domoticz.time.month
		
		local sensor_AN = domoticz.devices(temp_air_neuf).temperature
		local sensor_AV = domoticz.devices(temp_air_vicie).temperature
		local sensor_AE = domoticz.devices(temp_air_extrait).temperature
		local sensor_AS = domoticz.devices(temp_air_souffle).temperature
		local sensor_rendement = domoticz.devices('VMC Rendement')
		
		local BPBYPASS = domoticz.devices(BP_bypass)
		local BPSPEED = domoticz.devices(BP_speed)
		local BYPASSOUT = domoticz.devices(OUT_bypass)
		local SPEEDOUT = domoticz.devices(OUT_speed)
		local DZBYPASS = domoticz.devices(DZ_bypass)
		local DZSPEED = domoticz.devices(DZ_speed)
		local infobypass = domoticz.devices(info_bypass)
		local infospeed = domoticz.devices(info_speed)
		
		if LOGGING then 
			domoticz.log('[VMC] ****** TEMPERATURES ****** ', domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ sensor_Air Neuf :' ..sensor_AN, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ sensor_Air Vicie :' ..sensor_AV, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ sensor_Air Extrait :' ..sensor_AE, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ sensor_Air Soufle :' ..sensor_AS, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ****** ACTIONNEURS ****** ', domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ BPBYPASS :' ..BPBYPASS.state, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ BPSPEED :' ..BPSPEED.state, domoticz.LOG_INFO)  
			domoticz.log('[VMC] ------ DZBYPASS :' ..DZBYPASS.state, domoticz.LOG_INFO) 
			domoticz.log('[VMC] ------ DZSPEED :' ..DZSPEED.state, domoticz.LOG_INFO)
			domoticz.log('[VMC] ****** ETAT VMC ******', domoticz.LOG_INFO)
 			if (BYPASSOUT.state == 'On') then domoticz.log('[VMC] ------ BYPASS : ON', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BYPASS : OFF', domoticz.LOG_INFO) end
			if (SPEEDOUT.state == 'On') then domoticz.log('[VMC] ------ VITESSE : HIGH', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ VITESSE : LOW', domoticz.LOG_INFO) end
			domoticz.log('[VMC] ****** CHANGEMENT ETAT ACTIONNEURS ******', domoticz.LOG_INFO) 
			if DZBYPASS.changed then domoticz.log('[VMC] ------ DZBYPASSchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ DZBYPASSchanged : Faux', domoticz.LOG_INFO) end
			if BPBYPASS.changed then domoticz.log('[VMC] ------ BPBYPASSchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BPBYPASSchanged : Faux', domoticz.LOG_INFO) end
			if DZSPEED.changed then domoticz.log('[VMC] ------ DZSPEEDchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ DZSPEEDchanged : Faux', domoticz.LOG_INFO) end
			if BPSPEED.changed then domoticz.log('[VMC] ------ BPSPEEDchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BPSPEEDchanged : Faux', domoticz.LOG_INFO) end
			domoticz.log('[VMC] ****** ACTIONS ******', domoticz.LOG_INFO) 
		end

		-- first check if the sensor got a new reading or the setpoint was changed:

-- //si on est en été 
-- // si temperature air neuf < temperature extraite et que temperature extraite >20degres => bypass on  //on bypass tant que air interieur est superieur a 20
-- // si on est en automne
-- //	si temperature air neuf > temperature extraite et que temperature interieure <23 = bypass on (pour recuperer la chaleur de l'exterieur)
-- // si on est en hivers 
-- //	si temperature air neuf > temperature extraite et que temperature interieure <25 = bypass on (pour recuperer la chaleur de l'exterieur)
-- // si on est au printemps
-- //	si temperature air neuf > temperature extraite et que temperature interieure <23 = bypass on (pour recuperer la chaleur de l'exterieur)

--le bp physique force automatiquement l'inter de domotics dans sont dernier etat 

if (BPBYPASS.state=='On' and BPBYPASS.changed) then 
	DZBYPASS.switchOn()
	if infobypass.text ~= 'Action manuelle BP=> Bypass On' then infobypass.updateText('Action manuelle BP=> Bypass On')end
end
if (BPBYPASS.state=='Off' and BPBYPASS.changed) then 
	DZBYPASS.switchOff()
	if infobypass.text ~= 'Action manuelle BP=> Bypass Off' then infobypass.updateText('Action manuelle BP=> Bypass Off')end
end
if (BPSPEED.state=='On' and BPSPEED.changed) then DZSPEED.switchOn()end
if (BPSPEED.state=='Off' and BPSPEED.changed) then DZSPEED.switchOff()end

-- le bp/ou l'inter domoticz est prioritaires sur le fonctionnement automatique du bypass


local hysteresis_air = 0.5
local AN_REGUL_BYPON
local AN_REGUL_BYPOFF




-- gestion du bypass
	if (DZBYPASS.state=='On') then
		if (BYPASSOUT.state == 'Off') then 
			BYPASSOUT.switchOn()
			if LOGGING then domoticz.log('[VMC] ------ Bypass Action manuelle => Bypass On', domoticz.LOG_INFO) end
		end
		if infobypass.text ~= 'Action manuelle => Bypass On' then infobypass.updateText('Action manuelle => Bypass On')end
		if LOGGING then domoticz.log('[VMC] ------ Bypass On', domoticz.LOG_INFO) end
	else
	
	
	
		if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Automatique', domoticz.LOG_INFO) end
		if (mois <4 and mois>10) then
			--mode hivers
			AN_REGUL_BYPON = sensor_AN + hysteresis_air
			AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
			if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Hivers', domoticz.LOG_INFO) end
			if (sensor_AE < 25 ) then 
				if (AN_REGUL_BYPON > sensor_AE ) then
					if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
					if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN > AE', domoticz.LOG_INFO) end
					if infobypass.text ~= '[HIVERS] ON => AN > AE' then infobypass.updateText('[HIVERS] ON => AN > AE')end
				else if (AN_REGUL_BYPOFF < sensor_AE) then
						if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
						if LOGGING then domoticz.log('[VMC] ------ Bypass Off  => AN < AE', domoticz.LOG_INFO) end
						if infobypass.text ~= '[HIVERS] OFF => AN < AE' then infobypass.updateText('[HIVERS] OFF => AN < AE')end
					end
				end
			else 
				if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
				if LOGGING then domoticz.log('[VMC] ------ Bypass Off  => sensor_AE > 25', domoticz.LOG_INFO) end
				if infobypass.text ~= '[HIVERS] OFF => AE > 25' then infobypass.updateText('[HIVERS] OFF => AE > 25')end
			end
		end
			
		if (mois ==4 or mois==10) then
			if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Printemps/Automne', domoticz.LOG_INFO) end
			--mode printemps/automne
			AN_REGUL_BYPON = sensor_AN + hysteresis_air
			AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
			if (sensor_AE < 23 ) then 
				if (AN_REGUL_BYPON > sensor_AE ) then
					if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
					if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN > AE', domoticz.LOG_INFO) end
					if infobypass.text ~= '[MI-SAISON] ON => AN > AE' then infobypass.updateText('[MI-SAISON] ON => AN > AE')end
				else if (AN_REGUL_BYPOFF < sensor_AE) then
						if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
						if LOGGING then domoticz.log('[VMC] ------ Bypass Off  => AN < AE', domoticz.LOG_INFO) end
						if infobypass.text ~= '[MI-SAISON] OFF => AN < AE' then infobypass.updateText('[MI-SAISON] OFF => AN < AE')end
					end
				end
			else 
				if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
				if LOGGING then domoticz.log('[VMC] ------ Bypass Off  => sensor_AE > 23', domoticz.LOG_INFO) end
				if infobypass.text ~= '[MI-SAISON] OFF => AE > 23' then infobypass.updateText('[MI-SAISON] OFF => AE > 23')end
			end
		end
			
		if (mois >4 and mois<10) then
			if LOGGING then domoticz.log('[VMC] ------ Bypass Mode été', domoticz.LOG_INFO) end
			--mode été
			AN_REGUL_BYPON = sensor_AN + hysteresis_air
			AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
			if (sensor_AE > 21 ) then 
				if (AN_REGUL_BYPON < sensor_AE) then
					if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
					if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN < AE', domoticz.LOG_INFO) end
					if infobypass.text ~= '[ETE] ON => AN < AE' then infobypass.updateText('[ETE] ON => AN < AE')end
				else if (AN_REGUL_BYPOFF > sensor_AE ) then
					if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
					if LOGGING then domoticz.log('[VMC] ------ Bypass Off => AN > AE', domoticz.LOG_INFO) end
					if infobypass.text ~= '[ETE] OFF => AN > AE' then infobypass.updateText('[ETE] OFF => AN > AE')end
					 end
				end		
			else 
				if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
				if LOGGING then domoticz.log('[VMC] ------ Bypass Off  => sensor_AE < 21', domoticz.LOG_INFO) end
				if infobypass.text ~= '[ETE] OFF => AE < 21' then infobypass.updateText('[ETE] OFF => AE < 21')end
			end
		end
	end		

-- gestion vitesse de ventilation
	if (DZSPEED.state=='On') then
		if (SPEEDOUT.state == 'Off') then 
			SPEEDOUT.switchOn()
			infospeed.updateText('Action manuelle => High Speed')
			if LOGGING then domoticz.log('[VMC] ------ Vitesse Action manuelle => High Speed', domoticz.LOG_INFO) end
		end
			if LOGGING then domoticz.log('[VMC] ------ Vitesse High Speed', domoticz.LOG_INFO) end
	else
		if (SPEEDOUT.state == 'On') then 
			SPEEDOUT.switchOff()
			infospeed.updateText('Action manuelle => Low Speed')
			if LOGGING then domoticz.log('[VMC] ------ Vitesse Action manuelle BP => Low Speed', domoticz.LOG_INFO) end
		end 
			if LOGGING then domoticz.log('[VMC] ------ Vitesse Low Speed', domoticz.LOG_INFO) end
	end
		
	
	
	--calcul theorique du rendement 
	
	local rendement
	rendement = (sensor_AS - sensor_AN)/(sensor_AE - sensor_AN)
	rendement = domoticz.utils.round(rendement,2)*100
	sensor_rendement.updateCustomSensor(rendement)
	if LOGGING then 
		domoticz.log('[VMC] ****** RENDEMENT ****** ', domoticz.LOG_INFO) 
		domoticz.log('[VMC] ------ rendement :' ..rendement.. '%', domoticz.LOG_INFO) 
	end

	
	
	
end
}