This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to execute a script
#1
Hi everyone,

I don't understand why LM doesn't execute this Event Based script when I upload a Value. I tried to upload GA fmanually, but the result of my calcs don't change, the value is always 0.

Can someone explain me how to trigger it?

Thanks 
Code:
--Variables App. Dx
AppDx_Consumo_Radiante_Caldo = ("32/1/200")-- consumo radiante caldo Dx
AppDx_Consumo_Radiante_Freddo = ("32/1/201")-- consumo radiante freddo Dx
AppDx_Volume_ACS = ("32/1/202")-- consumo ACS Dx
Energia_Termica_Appartamento_Dx = grp.write("32/1/204") -- uscita

--Variables App. Sx
AppSx_Consumo_Radiante_Caldo = ("32/1/210")-- consumo radiante caldo Sx
AppSx_Consumo_Radiante_Freddo = ("32/1/211")-- consumo radiante freddo Sx
AppSx_Volume_ACS = ("32/1/212")-- consumo ACS Sx
Energia_Termica_Appartamento_Sx = grp.write("32/1/214") -- uscita

-- Other Variables
K = grp.write("32/1/215") -- rapporto conversione elettrico / termico

Consumo_Elettrico_PDC = ("32/1/216")-- consumo elettrico misurato
Consumo_Elettrico_Dx = grp.write("32/1/217")
Consumo_Elettrico_Sx = grp.write("32/1/218")

-------------------------------non toccare più nulla sotto questa riga------------------------------------------
Rad_Heat_Dx = grp.getvalue(AppDx_Consumo_Radiante_Caldo)
Rad_Cool_Dx = grp.getvalue(AppDx_Consumo_Radiante_Freddo)
Acs_Dx = grp.getvalue(AppDx_Volume_ACS)

Rad_Heat_Sx = grp.getvalue(AppSx_Consumo_Radiante_Caldo)
Rad_Cool_Sx = grp.getvalue(AppSx_Consumo_Radiante_Freddo)
Acs_Sx = grp.getvalue(AppSx_Volume_ACS)

Cons_Elet_PDC = grp.getvalue(Consumo_Elettrico_PDC)

-- Energia Termica Appartamento Dx
Energia_Termica_Appartamento_Dx = Rad_Heat_Dx + Rad_Cool_Dx + (Acs_Dx * 40.6)

-- Energia Termica Appartamento Sx
Energia_Termica_Appartamento_Sx = Rad_Heat_Sx + Rad_Cool_Sx + (Acs_Sx * 40.6)

-- Rapporto conversione Cons_Elet_PDC / Consumo_Termico_Totale
K = Cons_Elet_PDC / (Energia_Termica_Appartamento_Dx + Energia_Termica_Appartamento_Sx)

-- Consumo Elettrico Appartamento Dx
Consumo_Elettrico_Dx = K * Energia_Termica_Appartamento_Dx
 
-- Consumo Elettrico Appartamento Sx
Consumo_Elettrico_Sx = K * Energia_Termica_Appartamento_Sx
Reply
#2
A script runs from up to down and you first trying to write and then do the calculation. You should move the write on the bottom.
Your write commands are wrong, it should be like this grp.write("32/1/214", Energia_Termica_Appartamento_Sx)
------------------------------
Ctrl+F5
Reply
#3
(25.10.2024, 09:29)Daniel Wrote: A script runs from up to down and you first trying to write and then do the calculation. You should move the write on the bottom.
Your write commands are wrong, it should be like this  grp.write("32/1/214", Energia_Termica_Appartamento_Sx)

Thanks Daniel, your support has been very useful. I appreciate that. Here the correct script.

Code:
AppDx_Consumo_Radiante_Caldo =        ("32/1/200")-- consumo radiante caldo Dx
AppDx_Consumo_Radiante_Freddo =        ("32/1/201")-- consumo radiante freddo Dx
AppDx_Volume_ACS =            ("32/1/202")-- consumo ACS Dx

AppSx_Consumo_Radiante_Caldo =        ("32/1/210")-- consumo radiante caldo Sx
AppSx_Consumo_Radiante_Freddo =        ("32/1/211")-- consumo radiante freddo Sx
AppSx_Volume_ACS =                ("32/1/212")-- consumo ACS Sx

Consumo_Elettrico_PDC =         ("32/1/216")-- consumo elettrico misurato

-------------------------------non toccare più nulla sotto questa riga------------------------------------------
Rad_Heat_Dx = grp.getvalue(AppDx_Consumo_Radiante_Caldo)
Rad_Cool_Dx = grp.getvalue(AppDx_Consumo_Radiante_Freddo)
Acs_Dx = grp.getvalue(AppDx_Volume_ACS)

Rad_Heat_Sx = grp.getvalue(AppSx_Consumo_Radiante_Caldo)
Rad_Cool_Sx = grp.getvalue(AppSx_Consumo_Radiante_Freddo)
Acs_Sx = grp.getvalue(AppSx_Volume_ACS)

Cons_Elet_PDC = grp.getvalue(Consumo_Elettrico_PDC)

-- Energia Termica Appartamento Dx
-- kWh termici= V × ΔT × 1,16
-- C = 1,16kWh / (m3*°C) calore specifico acqua
-- ΔT = salto termico assunto come 35°C (Temp. ACS= 50°C / Temp. Ingresso= 15°C / ΔT= 35°C)
-- Kconversione = 35 * 1.16 = 40.6
Energia_Termica_Appartamento_Dx = Rad_Heat_Dx + Rad_Cool_Dx + (Acs_Dx * 40.6)
grp.write("32/1/204",Energia_Termica_Appartamento_Dx)

-- Energia Termica Appartamento Sx
Energia_Termica_Appartamento_Sx = Rad_Heat_Sx + Rad_Cool_Sx + (Acs_Sx * 40.6)
grp.write("32/1/214",Energia_Termica_Appartamento_Sx)

-- Rapporto conversione Cons_Elet_PDC / Consumo_Termico_Totale
K = Cons_Elet_PDC / (Energia_Termica_Appartamento_Dx + Energia_Termica_Appartamento_Sx)
grp.write("32/1/215", K)

-- Consumo Elettrico Appartamento Dx
Consumo_Elettrico_Dx = K * Energia_Termica_Appartamento_Dx
grp.write("32/1/217", Consumo_Elettrico_Dx)
 
-- Consumo Elettrico Appartamento Sx
Consumo_Elettrico_Sx = K * Energia_Termica_Appartamento_Sx
grp.write("32/1/218", Consumo_Elettrico_Sx)
Reply


Forum Jump: