<%@ LANGUAGE="VBScript" %> <% start_time = Time %> Chip-averaged calibration curves <% ' ' Get the two ROWID's for the measurement, the outside routine will determine which ones ! ' Dim Rowid(1) Dim Wurst(1) Dim npoints_chip(15) Dim string(15) Dim string_chip(15) Dim inp_chip(100,15) Dim out_chip(100,15) 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 For i=0 To 15 npoints_chip(i)=0 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 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(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" Set RSx = Connection.Execute(SQLStmtx) kstring=0 Do While Not RSx.EOF nstring=Cint(RSx("nstring")) onechip=Cint(RSx("onechip")) kstring=kstring+1 RSx.MoveNext Loop SQLStmt0 = "select ahl.HYBRID_ID,LOGDATE,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" ' ' Prepare for plotting data ' SQLStmt1 = "select max(ahc.hybrid_chip_pos) hpos,max(ahl.wurst_id) string,max(floor(scm.channelnum/ahc.chip_type)) stringchip," SQLStmt1 = SQLStmt1 & " max(round(scm.measurement_inp,-1)) inp,avg(scm.measurement_out) out" SQLStmt1 = SQLStmt1 & " from assembly.asm_hybrid_log ahl,assembly.string_channel_measurement scm," SQLStmt1 = SQLStmt1 & " assembly.asm_hybrid_chip ahc,assembly.asm_hybrid_id ahi " 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" SQLStmt1 = SQLStmt1 & " and ahl.logdate=scm.startdate and ahl.hybrid_id=ahi.hybrid_id and ahi.hybrid_type=ahc.hybrid_type " SQLStmt1 = SQLStmt1 & " and ahc.wurst_id=ahl.wurst_id and ahc.wurst_read_pos=floor(scm.channelnum/ahc.chip_type)" SQLStmt1 = SQLStmt1 & " and scm.measurement_id='SIGCAL' and mod(scm.channelnum,ahc.chip_type)>0 " SQLStmt1 = SQLStmt1 & " group by ahl.wurst_id,floor(scm.channelnum/ahc.chip_type),round(scm.measurement_inp,-1)" 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 %>

Calibration curves, chip-averaged, HYBRID ID : <%= RS0("HYBRID_ID")%>

<% End If Do While Not RS0.EoF wurst_id=CInt(RS0("WURST_ID")) logdate(wurst_id)=RS0("LOGDATE") 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 ' Set RS1 = Connection.Execute(SQLStmt1) Do While Not RS1.EoF ' ' Get the curves ' ichip=CInt(RS1("hpos")) String(ichip)=CInt(RS1("string")) String_chip(ichip)=CInt(RS1("stringchip")) inp_chip(npoints_chip(ichip),ichip)=CDbl(RS1("inp")) out_chip(npoints_chip(ichip),ichip)=CDbl(RS1("out")) npoints_chip(ichip)=npoints_chip(ichip)+1 RS1.MoveNext Loop For i=0 To 15 npoints_chip(i)=npoints_chip(i)-1 Next %> <% start_time = Time %> <% ' ' Prepare plot ' seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) filename="sigcurv" & 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 ********************************************************************** For i=0 To 15 If npoints_chip(i)=>0 Then Chart.AddSeries 5 Chart.SeriesTitle = "Chip " & Cstr(i) Chart.LineWidth = 1 Chart.Stairs = False Chart.SeriesInLegend = true icol=i If icol>7 Then icol=icol-8 End If For ipoints=0 To npoints_chip(i) Chart.AddXY inp_chip(ipoints,i),out_chip(ipoints,i),"",Color(icol) Next End If Next For i=0 To 15 If npoints_chip(i)=>0 Then Chart.AddSeries 6 Chart.SeriesTitle = "Chip " & Cstr(i) Chart.LineWidth = 1 Chart.Stairs = False Chart.SeriesInLegend = False icol=i If icol>7 Then icol=icol-8 End If For ipoints=0 To npoints_chip(i) Chart.AddXY inp_chip(ipoints,i),out_chip(ipoints,i),"",Color(icol) Next End If Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** 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 Chart.BottomAxisIncrement = 50. Chart.LeftAxisIncrement = 50. 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 Chart.HorizAxisMin = -100 Chart.HorizAxisMax = 4000 Chart.VertAxisMin = -100. Chart.VertAxisMax = 2500. Chart.AddAxisLabel 2 , "Input Voltage [mV]" Chart.AddAxisLabel 1 , "Output Voltage [mV]" 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%>