Announcement

Collapse
No announcement yet.

calculating Dewpoint

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    calculating Dewpoint

    I am working on part of a script to calculate the dewpoint, both outside and inside the house. the formula is rather complex and always seems to return back a value much lower than say an online dewpoint calculater etc..

    does VBscript have trouble handling exponents or complex numbers? ive tried relocating the paranthesis to see if I could change the order of manipulation but still cant get a good reading..

    I use this as a means to determine whether my outside air intake is open or closed and also to determine the blower speed control on my air-conditioner. on super humid days (dewpoint 69 and above) its better to allow longer cooling cycles, move less air across the coil making the air colder as it will pull more humidity.. I attached the script below possibly someonecan help me out.

    grabbing dewpoint from an XML feed is not an option here as my house typically has different humidity and temp readings than the NWS site.. plus I cant monitor interior dewpoints through that method.
    -christopher

    PHP Code:
    sub main() 
    '***************************************
    '
    Script to Calculate Indoor Dewpoint *
    '***************************************
    dim tempf
    dim tempc
    dim rh
    dim dewpointc
    dim tdewpointc
    dim dewpointf
    dim x
    tempf=cint(hs.devicevalue("^11"))    '
    Return air duct temp bobcat
    msgbox tempf
    tempc
    =cint((5/9)*(tempf-32))
    rh=cint(hs.devicevalue("^8"))    'relative humidity from bobcat
    msgbox rh
    es=6.11*10^(7.5*tempc/(237.7+tempc))
    E=(rh*Es)/100
    tdewpointc=(-430.22+237.7*log(E))/(-log(E)+19.08)
    dewpointf=cint((9/5)*tdewpointc+32)
    msgbox dewpointf
    end sub 
    PerfecTemp - the Most advanced HVAC system I've ever Built - and its in my House

    #2
    Not a vbscript expert but...

    I am not a vbscript expert but wouldin't using the cint function cause you problems since the integer itself doesn't allow decimal places? Would using the CDbl function instead give you more accuracy?
    James

    Running HS 3 on Win10 .

    Comment


      #3
      prefix all your variables in the expressions with csng to assure the calculation is performed in floating point. For examle:

      E = csng(rh) * csng(es) / 100

      Comment


        #4
        I’m looking for a plug-in, script or event calculation to determine indoor dew point and write it to a virtual device. Does anybody has a solution?

        Comment


          #5
          Here is the .vb script I use. When run it takes the temp and humidity from from my attic multi sensor and writes the dew point to a status only device I created. Then I can use that in events to do other stuff. There is another post somewhere with dew point scripts and formulas but those all gave me erroneous results. It's been awhile since you posted so hopefully this is useful to somebody.

          Sub Main(parm as object)

          DIM AtticT As Integer
          DIM AtticTC as Integer
          DIM AtticH As Integer
          DIM AtticDC as integer
          DIM AtticD as integer

          AtticH=hs.DeviceValue(4253)
          AtticT=hs.DeviceValue(4251)

          AtticTC=(AtticT-32)/(1.8) 'convert to celsius

          AtticDC = (243.04 * ((math.log(AtticH/100)) + (17.625 * AtticTC)/(243.04 + AtticTC))/(17.625 - (math.log(AtticH/100))-((17.625*AtticTC)/(243.04 + AtticTC))))

          AtticD=((AtticDC * 1.8)+32) 'convert to fahrenheit

          hs.writeLog("msg","Calculating Dew point")
          hs.writeLog("msg",AtticT & " Attic temp")
          hs.writeLog("msg",AtticH & " Attic humidity")
          hs.writelog("msg",AtticTC & " Attic Temp in Celsius")
          hs.writelog("msg",AtticDC & " dew point in Celsius")
          hs.writelog("msg",AtticD & " dew point")
          hs.setDeviceValueByRef(4230, AtticD, true)

          End Sub

          Comment

          Working...
          X