%@ LANGUAGE="VBScript" %>
<%
' Monitoring Graph
' Written by Bolek Wyslouch, 2 January 2000
'
' This script will make One and only one graph.
'
' The plot can contain several series (separate lines). Since data from the database can
' come in separate columns or separate rows we steer the logic by using ncols and nrows
' variables. The logic is only needed to fill the measurement() array, the plotting
' will be automatic
'
' Plots with several variables plotted
' a) several columns, one row
' This is pretty straightforward, the columns are plotted in the order of selection
' b) several rows, one column
' Here the logic is pretty tricky. Select statement needs to select "irow" ranging from 0
' to nrows-1. It also assumes that the "irow" is ordered and that all "irows" are written
' at the same time. For example all ports of one FEC (0-3)
'
'
'
Dim Chart
Dim timdat()
Dim measurement()
Dim Color(8)
Color(0)=vbBlue
Color(1)=vbRed
Color(2)=vbGreen
Color(3)=vbMagenta
Color(4)=vbBlack
Color(5)=vbCyan
'
' Open Database connection, read only !
'
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd
'
' get input control parameters
'
delta=0
If IsEmpty(Request("days")) Then
days=2
Else
days=CInt(Request("days"))-1
If days<0 Then
days=0
End If
End If
If IsEmpty(Request("day_start")) Or Not IsDate(Request("day_start")) Then
day_start=""
Else
day_start=Request("day_start")
End If
If IsEmpty(Request("day_stop")) Or Not IsDate(Request("day_stop")) Then
day_stop=""
Else
day_stop=Request("day_stop")
End If
'
' sounds crazy but it is better to use Oracle to do date/time calculations
'
If Not (day_start="" Or day_stop="") Then
delta=1
SQLStmt = "select 24*(to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')-to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS')) ddif from dual "
' response.write(CStr(SQLStmt) & " ")
Set RST = Connection.Execute(SQLStmt)
hours=CDbl(RST("ddif"))
Set RST=nothing
End If
id0=CInt(Request("id0"))
id1=CInt(Request("id1"))
measurement_id=Request("measurement_id")
If IsEmpty(Request("width")) Then
width=600
Else
width=CInt(Request("width"))
End If
If IsEmpty(Request("height")) Then
height=300
Else
height=CInt(Request("height"))
End If
If IsEmpty(Request("vauto")) Then
vauto=0
Else
vauto=CInt(Request("vauto"))
End If
'
' Select the set of variables to plot. The code that follows is highly "hardwired"
'
Select Case measurement_id
Case "TEMPERATURE","HUMIDITY" ' TUNNEL_MONITORING
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'mm/dd/yyyy') tdate, "
If measurement_id="TEMPERATURE" Then
SQLStmt = SQLStmt & "0 irow,temperature to_plot0 "
description="Temperature in the tunnel"
val_min=10.0
val_max=30.0
units="C"
name="Temperature"
ncols=1
nrows=1
Elseif measurement_id="HUMIDITY" Then
SQLStmt = SQLStmt & "0 irow,HUMIDITY to_plot0 "
description="Humidity in the tunnel"
val_min=-10.0
val_max=100.0
units="Percent"
name="Humidity"
ncols=1
nrows=1
End If
SQLStmt = SQLStmt & " FROM phoffline.tunnel_monitoring "
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " where logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " where logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by logdate "
Case "COOLING_PRESSURE","COOLING_TEMPERATURE" ' COOLING SYSTEM
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'mm/dd/yyyy') tdate, "
If measurement_id="COOLING_PRESSURE" Then
ipress=id0
If Not (ipress=1 or ipress=2) Then
ipress=1
End If
SQLStmt = SQLStmt & "0 irow,press_0" & CStr(ipress) & " to_plot0 "
description="Pressure in the cooling Rack"
If ipress=1 Then
val_min=0
val_max=110
name="Vacuum Tank Pressure "
Else
val_min=80
val_max=110
name="Atmospheric Pressure "
End If
units="kPa"
ncols=1
nrows=1
Elseif measurement_id="COOLING_TEMPERATURE" Then
itemper=id0
If Not (itemper>0 and itemper<12) Then
itemper=1
End If
if itemper<10 Then
ctemper="0" & CStr(itemper)
Else
ctemper=CStr(itemper)
End If
SQLStmt = SQLStmt & "0 irow,temp_" & ctemper & " to_plot0 "
description="Temperature in the cooling system sensor " & ctemper
val_min=10
val_max=25
units="C"
name="Cooling Temp " & Cstr(itemper)
ncols=1
nrows=1
End If
SQLStmt = SQLStmt & " FROM phoffline.cooling_monitoring "
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " where logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " where logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End If
SQLStmt = SQLStmt & " order by logdate "
Case "CH_TEMPERATURE","CH_HUMIDITY" ' Counting House temperature and humidity
isensor=id0
If Not (isensor=1 or isensor=2) Then
isensor=1
End If
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'mm/dd/yyyy') tdate, "
If measurement_id="CH_TEMPERATURE" Then
If isensor=1 Then
SQLStmt = SQLStmt & "0 irow,temp_el to_plot0 "
description="Electronics Room Temperature"
name="Electronics Room Temperature "
Else
SQLStmt = SQLStmt & "0 irow,temp_sr to_plot0 "
description="Shift Room Temperature"
val_min=15
val_max=30
name="Shift Room Temperature "
End If
val_min=10
val_max=30
units="C"
ncols=1
nrows=1
Elseif measurement_id="CH_HUMIDITY" Then
If isensor=1 Then
SQLStmt = SQLStmt & "0 irow,humid_el to_plot0 "
description="Electronics Room Humidity"
name="Electronics Room Humidity "
Else
SQLStmt = SQLStmt & "0 irow,humid_sr to_plot0 "
description="Shift Room Humidity"
name="Shift Room Temperature "
End If
val_min=-10
val_max=100
units="%"
ncols=1
nrows=1
End If
SQLStmt = SQLStmt & " FROM phoffline.cooling_monitoring "
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " where logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " where logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End If
SQLStmt = SQLStmt & " order by logdate "
Case "DRY_AIR_PRESSURE","DRY_AIR_TEMPERATURE","DRY_AIR_HUMIDITY" ' DRY AIR SYSTEM
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'mm/dd/yyyy') tdate, "
If measurement_id="DRY_AIR_PRESSURE" Then
ipress=id0
If Not (ipress>0 and ipress<9) Then
ipress=1
End If
SQLStmt = SQLStmt & "0 irow,press_0" & CStr(ipress) & " to_plot0 "
description="Pressure in the dry air system"
val_min=0
val_max=110
name="Dry Air Pressure " & CStr(ipress)
units="kPa"
ncols=1
nrows=1
Elseif measurement_id="DRY_AIR_TEMPERATURE" Then
itemper=id0
If Not (itemper>0 and itemper<5) Then
itemper=1
End If
ctemper=CStr(itemper)
SQLStmt = SQLStmt & "0 irow,temp_0" & ctemper & " to_plot0 "
description="Temperature in the dry air system sensor " & ctemper
val_min=10.0
val_max=40.0
units="C"
name="Dry Air Temp " & Cstr(itemper)
ncols=1
nrows=1
Elseif measurement_id="DRY_AIR_HUMIDITY" Then
ihumid=id0
If Not (ihumid>0 and ihumid<5) Then
ihumid=1
End If
chumid=CStr(ihumid)
SQLStmt = SQLStmt & "0 irow,humid_0" & chumid & " to_plot0 "
description="Humidity in the dry air system sensor " & chumid
val_min=-10
val_max=100
units="%"
name="Dry Air Humid " & Cstr(ihumid)
ncols=1
nrows=1
End If
SQLStmt = SQLStmt & " FROM phoffline.dry_air_monitoring "
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " where logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " where logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by logdate "
Case "MAGNET_CURRENT","MAGNET_VOLTAGE","MAGNET_TEMPERATURE","MAGNET_HALL" ' MAGNET
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'mm/dd/yyyy') tdate, "
If measurement_id="MAGNET_CURRENT" Then
SQLStmt = SQLStmt & "0 irow,imag to_plot0,imag2 to_plot1 "
description="Magnet Current"
val_min=0
val_max=3800
units="A"
name="Magnet Current "
ncols=2
nrows=1
Elseif measurement_id="MAGNET_TEMPERATURE" Then
SQLStmt = SQLStmt & "0 irow,temp_in to_plot0,temp_out to_plot1 "
description="Magnet Water Temperature"
val_min=15
val_max=60
units="C"
name="Magnet Temperature "
ncols=2
nrows=1
Elseif measurement_id="MAGNET_VOLTAGE" Then
SQLStmt = SQLStmt & "0 irow,voltage to_plot0 "
description="Magnet Voltage"
val_min=0
val_max=120
units="V"
name="Magnet Voltage "
ncols=1
nrows=1
Elseif measurement_id="MAGNET_HALL" Then
SQLStmt = SQLStmt & "0 irow,hall_neg to_plot0 "
description="Magnet Hall Probe Reading"
val_min=-2.25
val_max=2.25
units="T"
name="Neg. Hall Probe "
ncols=1
nrows=1
End If
SQLStmt = SQLStmt & " FROM phoffline.magnet_monitoring "
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " where logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " where logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by logdate "
Case "VLV","ILV","VHV","IHV","LVTEMP" ' FEC_SUPPLY
' FEC supplies,
'
' a plot with similar parameters (voltages, currents) for selected supply
'
' VLV (ILV) - all Low Voltages (Currents) for selected supply
' VHV (IHV) - all High Voltages (Currents) for selected supply
'
node_id=id0
Select Case node_id
Case 0
crate_name="N Ring"
Case 1
crate_name="N Spect, Bot"
Case 2
crate_name="N Spect, Top"
Case 3
crate_name="Oct & Vert"
Case 4
crate_name="P Ring "
Case 5
crate_name="P Spect, Bot"
Case 6
crate_name="P Spect, Top"
Case Else
crate_name="Unknown "
End Select
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'MM/DD/YYYY') tdate, "
If measurement_id="VLV" Then
'
' Plot parameters
'
description="LV Supply Voltage"
val_min=-6.6
val_max=+6.6
units="V"
name="Voltage"
ncols=4
nrows=1
SQLStmt = SQLStmt & "0 irow,vpos6 to_plot0,vpos3 to_plot1,vneg3 to_plot2,vneg6 to_plot3 "
Elseif measurement_id="ILV" Then
'
' Plot parameters
'
description="LV Supply Current"
val_min=-0.5
val_max=20.0
units="A"
name="Current"
ncols=4
nrows=1
SQLStmt = SQLStmt & "0 irow,ipos6 to_plot0,ipos3 to_plot1,ineg3 to_plot2,ineg6 to_plot3 "
Elseif measurement_id="VHV" Then
'
' Plot parameters
'
description="Vbc Supply"
val_min=-0.5
val_max=150
units="V"
name="Bias Voltage"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,hv_volt to_plot0 "
Elseif measurement_id="IHV" Then
'
' Plot parameters
'
description="Ibc Supply"
val_min=-0.5
val_max=25
units="V"
name="Bias Current"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,hv_curr to_plot0 "
Elseif measurement_id="LVTEMP" Then
'
' Plot parameters
'
description="LV T Supply"
val_min=-0.5
val_max=40
units="C"
name="Temperature"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,temp to_plot0 "
End If
SQLStmt = SQLStmt & " FROM phoffline.fec_supply "
SQLStmt = SQLStmt & " where node_id=" & CStr(node_id)
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " and logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " and logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by logdate "
description = description & ", " & crate_name
Case "FEC_VBC","FEC_TEMP","FEC_OUTBIAS","FEC_IBC","FEC_PREBIAS","FEC_SHABIAS","FEC_VFP","FEC_VFS"
'
' FEC monitoring, as measured in Mercury
'
fec_number=id0
fec_port=id1
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'MM/DD/YYYY') tdate, "
If fec_port<0 Then
nrows=4
SQLStmt = SQLStmt & "fec_port irow,"
Else
nrows=1
SQLStmt = SQLStmt & "0 irow,"
End If
If measurement_id="FEC_VBC" Then
SQLStmt = SQLStmt & "1.95*(ascii(fec_vbc)-127) to_plot0 "
description="Vbc"
val_min=-10
val_max=120
units="V"
name="Bias Voltage"
ncols=1
Elseif measurement_id="FEC_TEMP" Then
SQLStmt = SQLStmt & "0.195*(ascii(fec_temp)+128) to_plot0 "
description="Hybrid T"
val_min=0
val_max=80
units="C"
name="Temperature"
ncols=1
Elseif measurement_id="FEC_OUTBIAS" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_outbias)-127) to_plot0 "
description="Outbias"
val_min=100
val_max=500
units="mV"
name="Outbias"
ncols=1
Elseif measurement_id="FEC_IBC" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_ibc)-127) to_plot0 "
description="Ibc"
val_min=-10
val_max=300
units="uA"
name="Current"
ncols=1
Elseif measurement_id="FEC_PREBIAS" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_prebias)-127) to_plot0 "
description="Prebias"
val_min=1100
val_max=1300
units="mV"
name="Prebias"
ncols=1
Elseif measurement_id="FEC_SHABIAS" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_shabias)-127) to_plot0 "
description="Shabias"
val_min=-200
val_max=0
units="mV"
name="Shabias"
ncols=1
Elseif measurement_id="FEC_VFP" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_vfp)-127) to_plot0 "
description="Vfp"
val_min=-400
val_max=-300
units="mV"
name="Vfp"
ncols=1
Elseif measurement_id="FEC_VFS" Then
SQLStmt = SQLStmt & "19.5*(ascii(fec_vfs)-127) to_plot0 "
description="Vfs"
val_min=500
val_max=900
units="mV"
name="Vfs"
ncols=1
End If
SQLStmt = SQLStmt & " FROM phoffline.fec_monitoring "
SQLStmt = SQLStmt & " where fec_number=" & CStr(fec_number)
If Not fec_port<0 Then
SQLStmt = SQLStmt & " and fec_port=" & CStr(fec_port)
End If
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " and logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " and logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End If
SQLStmt = SQLStmt & " and fec_number>0 and ascii(fec_vbc)>0 "
SQLStmt = SQLStmt & " order by logdate,irow "
If fec_port<0 Then
description = description & ", Fec #" & fec_number & " All ports"
Else
description = description & ", Fec #" & fec_number & " Port# " & fec_port
End If
Case "LCHV_VMEAS","LCHV_IMEAS","LCHV_VREQ"
'
' ToF and trigger HV supplies
' one plot for each HV_GROUP and HV_CHANNEL
'
'
hv_group=id0
hv_channel=id1
'
SQLStmt = "select to_char(logdate,'hh24:mi:ss') ttime,to_char(logdate,'MM/DD/YYYY') tdate, "
If measurement_id="LCHV_VMEAS" Then
'
' Plot parameters
'
description="Measured HV Supply Voltage"
val_min=0
val_max=1000
units="V"
name="Voltage"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,v_meas to_plot0 "
Elseif measurement_id="LCHV_IMEAS" Then
'
' Plot parameters
'
description="Measured HV Supply Current"
val_min=0
val_max=300.0
units="uA"
name="Current"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,i_meas to_plot0 "
Elseif measurement_id="LCHV_VREQ" Then
'
' Plot parameters
'
description="Requested HV Supply Voltage"
val_min=0
val_max=1000.0
units="V"
name="Voltage"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,v_req to_plot0 "
End If
SQLStmt = SQLStmt & " FROM phoffline.lecroy_hv "
SQLStmt = SQLStmt & " where hv_group=" & CStr(hv_group)
SQLStmt = SQLStmt & " and hv_channel=" & CStr(hv_channel)
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " and logdate>to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS')>logdate "
Else
SQLStmt = SQLStmt & " and logdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by logdate "
Case "RADIATION_DOSE"
'
' Radiation Dose
' one plot for each BLM Monitor
'
blm_position=id0
'
SQLStmt = "select to_char(bm.startdate,'hh24:mi:ss') ttime,to_char(bm.startdate,'MM/DD/YYYY') tdate, "
'
' Plot parameters
'
description="BLM Monitor " & CStr(blm_position)
val_min=-4
val_max=10
units="Rad/hour"
name="Radiation Dose"
ncols=1
nrows=1
SQLStmt = SQLStmt & "0 irow,bm.dose*0.001/(24*(bm.stopdate-bm.startdate)+0.0000001+(1-nvl(bm.missed_data,0))/3600.) to_plot0 "
SQLStmt = SQLStmt & " from phoffline.blm_monitoring bm,phoffline.blm_config bc "
SQLStmt = SQLStmt & " where bc.blm_name=bm.blm_name "
SQLStmt = SQLStmt & " and bm.startdate between bc.startdate and bc.stopdate "
SQLStmt = SQLStmt & " and bc.blm_position=" & CStr(blm_position)
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " and bm.startdate between to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS') "
Else
SQLStmt = SQLStmt & " and bm.startdate>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by bm.startdate "
Case "CHIPMUNK_DOSE"
'
' Chipmunk Dose
' one plot for each Chipmunk
'
position=id0
'
'
' Plot parameters
'
description="Chipmunk " & CStr(position)
val_min=-1.4
val_max=4
units="Log10(microRad/s)"
name="Chipmunk dose "
ncols=1
nrows=1
SQLStmt = "select to_char(cd.starttime,'hh24:mi:ss') ttime,to_char(cd.starttime,'MM/DD/YYYY') tdate, "
SQLStmt = SQLStmt & "0 irow,log(10,(cd.pulses*cca.microrads_per_pulse/(cd.livetime+0.0001))) to_plot0 "
SQLStmt = SQLStmt & " from phoffline.chipmunk_data cd,phoffline.chipmunk_calibration cca "
SQLStmt = SQLStmt & " where cd.id=cca.id "
SQLStmt = SQLStmt & " and cd.starttime between cca.startdate and cca.stopdate "
SQLStmt = SQLStmt & " and pulses>0 "
SQLStmt = SQLStmt & " and cd.id=" & CStr(position)
If Not (day_start="" or day_stop="") Then
SQLStmt = SQLStmt & " and cd.starttime between to_date('" & day_start & "','MM/DD/YYYY HH24:MI:SS') "
SQLStmt = SQLStmt & " and to_date('" & day_stop & "','MM/DD/YYYY HH24:MI:SS') "
Else
SQLStmt = SQLStmt & " and cd.starttime>to_date(to_char(sysdate,'MM/DD/YYYY'),'MM/DD/YYYY')-" & days
End if
SQLStmt = SQLStmt & " order by cd.starttime "
End Select
If days>0 Then
title= description & ", last " & days+1 & " days"
Else
title= description & ", today"
End if
' response.write(SQLStmt & " " )
Set RS1 = Connection.Execute(SQLStmt)
'
' Fill arrays with database data
'
If Not RS1.EOF Then
If Not (day_start="" or day_stop="") Then
time_begin=DateValue(day_start)+TimeValue(day_start)
ihour=24
Else
time_begin=DateValue(Now()-days)
ihour=1
End If
End If
vmin_auto=100000
vmax_auto=-100000
npoints=-1
irow_old=999999
Do While Not RS1.Eof
irow=CInt(RS1("irow"))
If Not (irow>irow_old) Then
npoints=npoints+1
End If
irow_old=irow
ReDim Preserve timdat(npoints)
timdat(npoints)=ihour*(TimeValue(RS1("ttime"))+DateValue(RS1("tdate"))-time_begin)
ReDim Preserve measurement(ncols-1,nrows-1,npoints)
For icols=0 To ncols-1
If Not IsNull(RS1("to_plot" & CStr(icols))) Then
meas=Cdbl(RS1("to_plot" & CStr(icols)))
Else
meas=0
End If
measurement(icols,irow,npoints)=meas
If meas>vmax_auto Then
vmax_auto=meas
End if
If meas1000000.0 Then
xmeas=1000000.
End If
Chart.AddXY Cdbl(timdat(i)),xmeas,"",Color(icols+irows Mod 6)
' response.write CStr(i) & " " & CStr(round(timdat(i),3)) & " " & CStr(CDbl(measurement(icols,irows,i))) & " " & CStr(icols) & " " & CStr(irows) & " " & vbCrLf
Next
Next ' irow
Next ' icols
rem **********************************************************************
rem * Add and format the title
rem **********************************************************************
' Chart.LineWidth = 2.0
Chart.Stairs = false
If ncols+nrows=2 Then
Chart.View3D = false
Else
Chart.View3D = false
' Chart.View3D = true
End If
Chart.LegendVisible = false
Chart.LegendStyle = cSeries
Chart.LegendPosition = cBottom
Chart.AxisGridLines = true
Chart.Frame = false
rem **********************************************************************
rem * Remove the OuterBevel, add a gradient fill to chart panel
rem **********************************************************************
Chart.BevelOuter = 0
Chart.GradientVisible = false
Chart.GradientStartColor = vbWhite
Chart.GradientEndColor = vbYellow
Chart.PanelColor = vbWhite
rem **********************************************************************
rem * Set the Width and Height of the image
rem **********************************************************************
Chart.Height = height
Chart.Width = width
Chart.ChartTitleFont.Name="Arial"
If height>200 and width>200 Then
Chart.ChartTitleFont.Size="12"
Else
Chart.ChartTitleFont.Size="9"
End If
Chart.ChartTitleAdd Description
If delta=0 Then
Chart.HorizAxisMin = 0.
Chart.HorizAxisMax = days+1
If days<3 Then
Chart.BottomAxisIncrement = 0.25
Else
Chart.BottomAxisIncrement = 1.00
End If
Axis2="Time [days]"
Else
Chart.HorizAxisMin = 0.
Chart.HorizAxisMax = hours
If hours<24 Then
Chart.BottomAxisIncrement = 1.
Else
Chart.BottomAxisIncrement = 24
End If
Axis2="Time [hours]"
End if
Set RS2 = Connection.Execute("select to_char(sysdate,'MM/DD/YY HH24:MI:SS') ddate from dual")
Axis2=Axis2 & " (Graph updated at " & CStr(RS2("ddate")) & ")"
Chart.AddAxisLabel 2 , Axis2
If vauto=0 Then
Chart.VertAxisMin = val_min
Chart.VertAxisMax = val_max
End If
Chart.AddAxisLabel 1 , name & "[" & units & "]"
'
' send binary picture to the screen
'
Chart.ProgressiveJPEGEncoding = true
Chart.JPEGQuality = 100
Response.ContentType = "image/JPEG"
Response.BinaryWrite Chart.Image
Set Chart=nothing
Connection.Close
Set Connection=nothing
Set RS0=nothing
Set RS1=nothing
Set RS2=nothing
%>
Monitoring Graph