<%@ LANGUAGE="VBScript" %> <% start_time = Time %> Pedestal Measurement <% ' ' Get the two ROWID's for the measurement, the outside routine will determine which ones ! ' Dim Rowid(1) Dim Wurst(1) Dim Channel(1536) Dim Pedestal(1536) Dim Logdate(1) Dim Description(1) Dim Comments(1) Dim Nchans(1) For i=0 To 1 Rowid(i)="-" Wurst(i)=-1 Logdate(i)=" " Description(i)=" " Comments(i)=" " Nchans(i)=" " Next nrows=0 If Request("REQ_ROWID_0")<>"" And Request("REQ_ROWID_0")<>"-" Then Rowid(nrows)=Request("REQ_ROWID_0") nrows=nrows+1 End If If Request("REQ_ROWID_1")<>"" And Request("REQ_ROWID_1")<>"-" Then Rowid(nrows)=Request("REQ_ROWID_1") nrows=nrows+1 End If nrows=nrows-1 ' gsfs added lines to read xmin, xmax, ymin, ymax 6/5/00 If Not IsEmpty(Request("xmin")) Then xmin = CDbl(Request("xmin")) End If If Not IsEmpty(Request("xmax")) Then xmax = CDbl(Request("xmax")) End If If Not IsEmpty(Request("ymin")) Then ymin = CDbl(Request("ymin")) End If If Not IsEmpty(Request("ymax")) Then ymax = CDbl(Request("ymax")) End If If Not IsEmpty(Request("xtic")) Then xtic = CDbl(Request("xtic")) End If If Not IsEmpty(Request("ytic")) Then ytic = CDbl(Request("ytic")) End If ' End of gsfs addition If nrows>-1 Then Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd ' ' Get number of channels in a string ' ' SQLStmtx = "select max(ahl.action) action,max(ahc.wurst_id) istring,max(chip_type) onechip,max(chip_type)*count(wurst_read_pos) nstring" SQLStmtx = SQLStmtx & " from assembly.asm_hybrid_chip ahc,assembly.asm_hybrid_id ahi,assembly.asm_hybrid_log ahl " SQLStmtx = SQLStmtx & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmtx = SQLStmtx & " and ahl.HYBRID_ID=ahi.HYBRID_ID" SQLStmtx = SQLStmtx & " and ahc.hybrid_type=ahi.hybrid_type" SQLStmtx = SQLStmtx & " group by ahc.hybrid_type,ahc.wurst_id" ' response.write(SQLStmtx) Set RSx = Connection.Execute(SQLStmtx) kstring=0 Do While Not RSx.EOF nstring=Cint(RSx("nstring")) onechip=Cint(RSx("onechip")) action=CStr(RSx("action")) kstring=kstring+1 RSx.MoveNext Loop SQLStmt0 = "select ahl.HYBRID_ID,to_char(LOGDATE,'MM/DD/YYYY HH24:MI:SS')LDATE,ahl.WURST_ID,CONFIG,ahl.COMMENTS,aha.DESCRIPTION from ASSEMBLY.ASM_HYBRID_LOG ahl,ASSEMBLY.ASM_HYBRID_ACTION aha " SQLStmt2 = "select ahl.WURST_ID,sm.MEASUREMENT_ID,sml.DESCRIPTION,sm.MEASUREMENT_VALUE value from ASSEMBLY.ASM_HYBRID_LOG ahl,ASSEMBLY.STRING_MEASUREMENT sm, ASSEMBLY.STRING_MEASUREMENT_LIST sml" ' ' Do SQL preparation ' SQLStmt1 = "SELECT ahl.WURST_ID*" & CStr(nstring) & "+scm.CHANNELNUM ch," SQLStmt1 = SQLStmt1 & "scm.MEASUREMENT_OUT ped " SQLStmt1 = SQLStmt1 & " from ASSEMBLY.STRING_CHANNEL_MEASUREMENT scm,ASSEMBLY.ASM_HYBRID_LOG ahl " If nrows=0 Then ' ' Just one string ' SQLStmt0 = SQLStmt0 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmt1 = SQLStmt1 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmt2 = SQLStmt2 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" Else ' ' Two strings ' SQLStmt0 = SQLStmt0 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " SQLStmt1 = SQLStmt1 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " SQLStmt2 = SQLStmt2 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " End If SQLStmt0 = SQLStmt0 & " and ahl.ACTION=aha.ACTION order by ahl.WURST_ID" If action="M_s3" Then SQLStmt1 = SQLStmt1 & " and ahl.LOGDATE=scm.STARTDATE and scm.MEASUREMENT_ID='PEDSRC' order by ahl.WURST_ID,scm.CHANNELNUM" Else SQLStmt1 = SQLStmt1 & " and ahl.LOGDATE=scm.STARTDATE and scm.MEASUREMENT_ID='PEDCAL' order by ahl.WURST_ID,scm.CHANNELNUM" End If SQLStmt2 = SQLStmt2 & " and ahl.LOGDATE=sm.STARTDATE and sm.MEASUREMENT_ID=sml.MEASUREMENT_ID order by sm.MEASUREMENT_ID,ahl.WURST_ID" Set RS0 = Connection.Execute(SQLStmt0) Set RS2 = Connection.Execute(SQLStmt2) %> <% If Not RS0.EoF Then %>

Pedestal, HYBRID ID : <%= RS0("HYBRID_ID")%>

<% End If Do While Not RS0.EoF wurst_id=CInt(RS0("WURST_ID")) logdate(wurst_id)=RS0("LDATE") description(wurst_id)=RS0("DESCRIPTION") comments(wurst_id)=RS0("COMMENTS") nchans(wurst_id)=nstring RS0.MoveNext Loop %>
<% old_test="XXXXXX" Do While Not RS2.Eof If old_test<>CStr(RS2("MEASUREMENT_ID")) Then If old_test<>"XXXXXX" Then 'finish previous row %> <% End If old_test=CStr(RS2("MEASUREMENT_ID")) %> <% If CInt(RS2("WURST_ID"))=0 Then %> <% Else %> <% End If Else If CInt(RS2("WURST_ID"))=1 Then %> <% Else %> <% End If End If %> <% RS2.MoveNext Loop %>
 

String_0

String_1

Test Date <%=logdate(0)%> <%=logdate(1)%>
Test Type <%=Description(0)%> <%=Description(1)%>
Channels <%=Nchans(0)%> <%=Nchans(1)%>
Comments <%=comments(0)%> <%=comments(1)%>
<%=RS2("DESCRIPTION")%> <%=RS2("VALUE")%>   <%=RS2("VALUE")%> <%=RS2("VALUE")%> Error: Table logic messed up

 <% ' ' Do heavy duty database extraction here ' 'response.write(SQLStmt1) Set RS1 = Connection.Execute(SQLStmt1) npoints=0 Do While Not RS1.EoF ' ' Calculate calibration slope ' Channel(npoints)=CInt(RS1("CH")) Pedestal(npoints)=CDbl(RS1("PED")) npoints=npoints+1 RS1.MoveNext Loop npoints=npoints-1 %> <% start_time = Time %> <% ' ' Prepare plot ' seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) filename="pedcal" & cstr(int(100000.*rnd(seed))) & ".jpg" filename_full=ph_image_directory & filename %> <% Dim Chart Dim Color(8) Color(0) = vbRed Color(1) = vbBlue Color(2) = vbYellow Color(3) = vbGreen Color(4)= vbMagenta Color(5)= vbCyan Color(6)= vbWhite Color(7)= vbBlack rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Chart = Server.CreateObject ("ASPChart.Chart") rem ********************************************************************** rem * Create x Array rem ********************************************************************** Chart.AddSeries 5 Chart.SeriesTitle = "Channel Pedestal" Chart.LineWidth = 1 Chart.Stairs = True Chart.SeriesInLegend = true For ipoints=0 To npoints Chart.AddXY Channel(ipoints),Pedestal(ipoints),"",Color(1) Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** rem Chart.ChartTitleAdd ("Pedestal, Hybrid " & CStr(RSx("HYBRID_ID"))) Chart.ChartTitleFont.Size = 16 Chart.ChartTitleFont.Name = "Arial" Chart.ChartTitleFont.Italic = true Chart.ChartTitleFont.Bold = true Chart.View3D = false Chart.LegendVisible = false Chart.LegendStyle = cSeries Chart.AxisGridLines = true Chart.Frame = false ' gsfs added xtic, ytic option If IsEmpty(xtic) Then Chart.BottomAxisIncrement = onechip Else Chart.BottomAxisIncrement = xtic End If If IsEmpty(ytic) Then Chart.LeftAxisIncrement = 10. Else Chart.LeftAxisIncrement = ytic End If rem ********************************************************************** rem * Remove the OuterBevel, add a gradient fill to chart panel rem ********************************************************************** Chart.BevelOuter = 0 rem Chart.GradientVisible = true rem Chart.GradientStartColor = vbWhite rem Chart.GradientEndColor = vbYellow Chart.PanelColor = Color(6) rem ********************************************************************** rem * Set the Width and Height of the image rem ********************************************************************** Chart.Height = 400 Chart.Width = 600 ' If nrows<1 Then ' Single String ' Chart.HorizAxisMax =(wurst_id+1)*nstring+1 ' Chart.HorizAxisMin = wurst_id*nstring ' Else ' Chart.HorizAxisMax = kstring*nstring+1+8 ' Chart.HorizAxisMin = -8 ' End If ' Following lines added by gsfs 6/5/00 If IsEmpty(xmin) Then Chart.HorizAxisMin = -8 Else Chart.HorizAxisMin = xmin End If If IsEmpty(xmax) Then Chart.HorizAxisMax = kstring*nstring+1+8 Else Chart.HorizAxisMax = xmax End If If Not IsEmpty(ymin) Then Chart.VertAxisMin = ymin End If If Not IsEmpty(ymax) Then Chart.VertAxisMax = ymax End If ' End of gsfs addition ' Following two lines removed by gsfs 5/17/00 ' Chart.VertAxisMax = 1000. ' Chart.VertAxisMin = -1000. Chart.AddAxisLabel 1 , "Pedestal [mV]" Chart.AddAxisLabel 2 , CStr(nstring) & "*String+Channel" rem ********************************************************************** rem * Set the filename, save the image and write the image tag rem ********************************************************************** Chart.FileName = filename_full Chart.SaveChart line="

" Response.Write (line) rem ********************************************************************** rem * Destroy the object rem ********************************************************************** Set Chart = nothing ' Database is not needed anymore ! Connection.Close %> <% Else %> Both ROWID's are empty ! <%End If%>