%@ LANGUAGE="VBScript" %> <% Function ctok (C) ctok = C + 273.15 End Function Function vappress (ktemp) expo = 23.832241 - 5.02808*(log(ktemp)/log(10)) - 1.3816*10^-7 * 10^(11.334 - .0303998 * ktemp) expo = expo + 8.1328 * 10^-3 * 10^(3.49149 - 1302.8844/ktemp) - 2949.076/ktemp ' response.write("vappress ktemp=" & ktemp & " expo " & expo & "") vappress = 10^(expo) End Function Function DewPoint(temp,rh) If rh<0 Then rh=0 Elseif rh>100 Then rh=100 End If If temp<0 Then temp=0 Elseif temp>40 Then temp=40 End If ktemp=ctok(temp) etemp=vappress(ktemp) edewp = etemp * (rh/100) ' ' start guessing for the Dewpoint ' estdewp = temp incr = 5 prevsign = 1 este = 100 nloop=0 Do While (abs(edewp - este)> .01) And nloop<100 nloop=nloop+1 kestdewp=ctok(estdewp) este=vappress(kestdewp) ' response.write(" loop " & CStr(nloop) & " este= " & CDbl(este) & " edewp= " & CDbl(estdewp) & "") If estecursign Then prevsign = cursign incr = incr * .5 End If estdewp = estdewp - incr * cursign Loop DewPoint = estdewp End Function %> <% If Not IsEmpty(request.form("Close")) Then %> <% End If timedate=Request("timedate") Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd If timedate="" Or IsEmpty(request.form("Selected_Time")) Then SQLStmt = " select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') timedate from dual " Set RS = Connection.Execute(SQLStmt) timedate = CStr(RS("timedate")) Set RS=nothing End If If Not IsDate(timedate) Then message="Wrong Time/Date format " & timedate %> <% End If timedate_par=replace(timedate," ","%20") %> Tunnel Environment <% SQLStmt = " select to_char(logdate,'MM/DD/YYYY HH24:MI:SS') ddate, " SQLStmt = SQLStmt & " 24*60*(to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-logdate) ddif, " SQLStmt = SQLStmt & " to_char(temperature,'90.0') ctemp,to_char(humidity,'90') chumid, " SQLStmt = SQLStmt & " temperature,humidity " SQLStmt = SQLStmt & " from phoffline.tunnel_monitoring " SQLStmt = SQLStmt & " where logdate=(select max(logdate) from phoffline.tunnel_monitoring " SQLStmt = SQLStmt & " where logdate between to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-2 " SQLStmt = SQLStmt & " and to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')) " Set RS1 = Connection.Execute(SQLStmt) ' response.write(SQLStmt) If Not RS1.EoF Then t_temperature=CDbl(RS1("temperature")) t_humidity=CDbl(RS1("humidity")) t_dewp=DewPoint(t_temperature,t_humidity) t_ddif=CDbl(RS1("ddif")) t_ddate=CStr(RS1("ddate")) t_chumid=CStr(RS1("chumid")) t_ctemp=CStr(RS1("ctemp")) End if SQLStmt = " select to_char(logdate,'MM/DD/YYYY HH24:MI:SS') ddate, " SQLStmt = SQLStmt & " 24*60*(to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-logdate) ddif, " SQLStmt = SQLStmt & " to_char(temp_02,'90.0') ctemp,to_char(humid_02,'90') chumid, " SQLStmt = SQLStmt & " temp_02 temperature,humid_02 humidity" SQLStmt = SQLStmt & " from phoffline.dry_air_monitoring " SQLStmt = SQLStmt & " where logdate=(select max(logdate) from phoffline.dry_air_monitoring " SQLStmt = SQLStmt & " where logdate between to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-2 " SQLStmt = SQLStmt & " and to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')) " Set RS2 = Connection.Execute(SQLStmt) 'response.write(SQLStmt) If Not RS2.EoF Then e_temperature=CDbl(RS2("temperature")) e_humidity=CDbl(RS2("humidity")) e_dewp=DewPoint(e_temperature,e_humidity) e_ddif=CDbl(RS2("ddif")) e_ddate=CStr(RS2("ddate")) e_chumid=CStr(RS2("chumid")) e_ctemp=CStr(RS2("ctemp")) End if %> Location Last DB write Temperature [C] Rel. Humidity[%] Dew Point[C] <% If Not RS1.EOF Then %> Tunnel <% If t_ddif" & t_ddate & "") Else Response.write("" & t_ddate & "") End If %> <%=t_ctemp%> <%=t_chumid%> <%=Round(t_dewp,1)%> <% End If If Not RS2.EOF Then %> Enclosure <% If e_ddif" & e_ddate & "") Else Response.write("" & e_ddate & "") End If %> <%=e_ctemp%> <%=e_chumid%> <%=Round(e_dewp,1)%> <% End If Connection.Close Set RS1=nothing Set RS2=nothing Set Connection=nothing %>