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.

AHU MODBUS TCP VALUE
#6
Thanks for your help, I got the script to work today. When I contacted AHU, I realized that it was the wrong values I received. There were inputs 95 and 96 that I needed to compare.
Here is the final working code:

Code:
require('luamodbus') if not mb then    mb = luamodbus.tcp()    mb:open('192.168.201.53', 502)    mb:connect() end openvalue =  grp.getvalue('6/3/1', dt.uint8) tfvalue = mb:readinputregisters(94, dt.uint16) -- 3x0095 Supply air flow ffvalue = mb:readinputregisters(95, dt.uint16) -- 3x0096 Exhaust air flow if tfvalue and ffvalue == 0 then   openvalue = 0 end if tfvalue < ffvalue then   if openvalue < 220 then     openvalue = openvalue + 25   end end if tfvalue > ffvalue then if openvalue > 25 then openvalue = openvalue - 25 end end grp.write('6/3/1', openvalue, dt.int8)

it was as simple as that. Big Grin
Reply


Messages In This Thread
AHU MODBUS TCP VALUE - by Elmyran - 01.11.2018, 19:42
RE: AHU MODBUS TCP VALUE - by CHOUAIBOU - 01.11.2018, 21:10
RE: AHU MODBUS TCP VALUE - by admin - 02.11.2018, 08:17
RE: AHU MODBUS TCP VALUE [solved] - by Elmyran - 02.11.2018, 20:22

Forum Jump: