<%@LANGUAGE="VBScript"%> <% Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd one_keynumber=-1 If Request("keynumber_x")="" Then SQLStmt = "select distinct keynumber,tp.batch bat,tp.sensor sen,sl.rowid rowid_key from sitester.testkey_pn tp,sitester.sensor_log sl where startdate=logdate" SQLStmt = SQLStmt & " and sl.rowid='" & Request("rowid_x") & "'" Set RS = Connection.Execute(SQLStmt) keys_tested=0 Do While Not RS.EOF keys_tested=keys_tested+1 RS.MoveNext Loop RS.MoveFirst If keys_tested=1 Then keynumber_x=RS("keynumber") one_keynumber=1 End If If keys_tested>1 Then one_keynumber=0 End If Else keynumber_x=Request("keynumber_x") one_keynumber=1 End If %> <% Select Case one_keynumber%><% Case 1%>PN Data Analysis<% Case 0%>PN Key Numbers<% Case Else%>Error<% End Select %> <% Select Case one_keynumber Case 1 SQLStmt = "select * from sitester.testkey_pn tp,sitester.sensor_log sl where startdate=logdate AND sl.rowid='"+Request("rowid_x")+"' and keynumber='"+CStr(keynumber_x)+"' order by tp.bias" Set RS = Connection.Execute(SQLStmt) %> <% folderspec="d:\pub\www\PublicDatabase\ASPGraph\images" seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) %>

Batch <%= RS("Batch") %>, Sensor <%= RS("Sensor") %>, Keynumber <%= RS("keynumber") %> PN CV measurement

Measurement Date <%= RS("Logdate") %>
Measurement Type PN CV Curve
Operator <%= RS("Operator") %>
Operator's Comments <%= RS("Comments") %>
Temperature (°C) <%= RS("Temperature") %>
Humidity <%= RS("Humidity") %>

 

<% batch = CStr(RS("Batch")) sensor = CStr(RS("Sensor")) keynumber = CStr(RS("keynumber")) error2=0.0 index_start=0 index_end=0 a1=0.0 da1=0.0 b1=0.0 db1=0.0 a2=0.0 da2=0.0 b2=0.0 db2=0.0 da1b1=0.0 da2b2=0.0 pivot=0 Dim voltage() Dim capacitance() Dim log_voltage() Dim log_capacitance() ' fill the voltage and capacitance arrays i=0 Do While Not RS.EOF ReDim Preserve voltage(i) ReDim Preserve capacitance(i) voltage(i) = CDbl(RS("Bias")) capacitance(i) = CDbl(RS("Capacitance")) i=i+1 RS.MoveNext Loop ' end filling ' fill the log arrays, j is the number of elements in the arrays j=0 For n = 0 To i-1 If ((voltage(n) > 0.0) and (capacitance(n) > 0.0)) Then ReDim Preserve log_voltage(j) ReDim Preserve log_capacitance(j) log_voltage(j)=Log(voltage(n)) log_capacitance(j)=Log(capacitance(n)) j=j+1 End If Next ' end filling index_start=0 index_end=j-1 For m = 2 To j-4 x_sum1=0 x2_sum1=0 y_sum1=0 y2_sum1=0 xy_sum1=0 x_sum2=0 x2_sum2=0 y_sum2=0 y2_sum2=0 xy_sum2=0 For n = 0 To m x_sum1=x_sum1+log_voltage(n) x2_sum1=x2_sum1+log_voltage(n)*log_voltage(n) y_sum1=y_sum1+log_capacitance(n) y2_sum1=y2_sum1+log_capacitance(n)*log_capacitance(n) xy_sum1=xy_sum1+log_voltage(n)*log_capacitance(n) Next For n = m+1 To j-1 x_sum2=x_sum2+log_voltage(n) x2_sum2=x2_sum2+log_voltage(n)*log_voltage(n) y_sum2=y_sum2+log_capacitance(n) y2_sum2=y2_sum2+log_capacitance(n)*log_capacitance(n) xy_sum2=xy_sum2+log_voltage(n)*log_capacitance(n) Next error2_sum1=((m+1)*y2_sum1*x2_sum1-y2_sum1*x_sum1*x_sum1-y_sum1*y_sum1*x2_sum1-(m+1)*xy_sum1*xy_sum1+2*xy_sum1*x_sum1*y_sum1)/((m+1)*x2_sum1-x_sum1*x_sum1) error2_sum2=((j-m-1)*y2_sum2*x2_sum2-y2_sum2*x_sum2*x_sum2-y_sum2*y_sum2*x2_sum2-(j-m-1)*xy_sum2*xy_sum2+2*xy_sum2*x_sum2*y_sum2)/((j-m-1)*x2_sum2-x_sum2*x_sum2) If((error2 > (error2_sum1+error2_sum2)) or (error2 = 0.0)) Then a1=((m+1)*xy_sum1-x_sum1*y_sum1)/((m+1)*x2_sum1-x_sum1*x_sum1) b1=(x2_sum1*y_sum1-x_sum1*xy_sum1)/((m+1)*x2_sum1-x_sum1*x_sum1) a2=((j-m-1)*xy_sum2-x_sum2*y_sum2)/((j-m-1)*x2_sum2-x_sum2*x_sum2) b2=(x2_sum2*y_sum2-x_sum2*xy_sum2)/((j-m-1)*x2_sum2-x_sum2*x_sum2) da1=Sqr((m+1)*error2_sum1/((m-1)*((m+1)*x2_sum1-x_sum1*x_sum1))) db1=Sqr(x2_sum1*error2_sum1/((m-1)*((m+1)*x2_sum1-x_sum1*x_sum1))) da2=Sqr((j-m-1)*error2_sum2/((j-m-3)*((j-m-1)*x2_sum2-x_sum2*x_sum2))) db1=Sqr(x2_sum2*error2_sum2/((j-m-3)*((j-m-1)*x2_sum2-x_sum2*x_sum2))) da1b1=-1*x_sum1*error2_sum1/((m+1)*((m+1)*x2_sum1-x_sum1*x_sum1)) da2b2=-1*x_sum2*error2_sum2/((j-m-1)*((j-m-1)*x2_sum2-x_sum2*x_sum2)) error2=error2_sum1+error2_sum2 pivot=m End If Next current_error2=0.0 current_num_points=1 Do While((((current_error2/(current_num_points-2)) > (error2/(pn_points(index_start,index_end)-2))) or (current_error2 = 0.0)) and ((pivot-index_start+1)>=10)) current_error2=error2 current_num_points=pn_points(index_start,index_end) current_index_start=index_start+1 pivot_temp=pivot For current_pivot = pivot_temp-1 To pivot_temp+1 x_sum1=0 x2_sum1=0 y_sum1=0 y2_sum1=0 xy_sum1=0 x_sum2=0 x2_sum2=0 y_sum2=0 y2_sum2=0 xy_sum2=0 For n = current_index_start To current_pivot x_sum1=x_sum1+log_voltage(n) x2_sum1=x2_sum1+log_voltage(n)*log_voltage(n) y_sum1=y_sum1+log_capacitance(n) y2_sum1=y2_sum1+log_capacitance(n)*log_capacitance(n) xy_sum1=xy_sum1+log_voltage(n)*log_capacitance(n) Next For n = current_pivot+1 To j-1 x_sum2=x_sum2+log_voltage(n) x2_sum2=x2_sum2+log_voltage(n)*log_voltage(n) y_sum2=y_sum2+log_capacitance(n) y2_sum2=y2_sum2+log_capacitance(n)*log_capacitance(n) xy_sum2=xy_sum2+log_voltage(n)*log_capacitance(n) Next error2_sum1=((current_pivot-current_index_start+1)*y2_sum1*x2_sum1-y2_sum1*x_sum1*x_sum1-y_sum1*y_sum1*x2_sum1-(current_pivot-current_index_start+1)*xy_sum1*xy_sum1+2*xy_sum1*x_sum1*y_sum1)/((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1) error2_sum2=((j-current_pivot-1)*y2_sum2*x2_sum2-y2_sum2*x_sum2*x_sum2-y_sum2*y_sum2*x2_sum2-(j-current_pivot-1)*xy_sum2*xy_sum2+2*xy_sum2*x_sum2*y_sum2)/((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2) If ((error2/pn_points(index_start,index_end)) > ((error2_sum1+error2_sum2)/(j-current_index_start))) Then pivot=current_pivot a1=((current_pivot-current_index_start+1)*xy_sum1-x_sum1*y_sum1)/((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1) b1=(x2_sum1*y_sum1-x_sum1*xy_sum1)/((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1) a2=((j-current_pivot-1)*xy_sum2-x_sum2*y_sum2)/((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2) b2=(x2_sum2*y_sum2-x_sum2*xy_sum2)/((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2) da1=Sqr((current_pivot-current_index_start+1)*error2_sum1/((current_pivot-current_index_start-1)*((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1))) db1=Sqr(x2_sum1*error2_sum1/((current_pivot-current_index_start-1)*((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1))) da2=Sqr((j-current_pivot-1)*error2_sum2/((j-current_pivot-3)*((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2))) db1=Sqr(x2_sum2*error2_sum2/((j-current_pivot-3)*((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2))) da1b1=-1*x_sum1*error2_sum1/((current_pivot-current_index_start+1)*((current_pivot-current_index_start+1)*x2_sum1-x_sum1*x_sum1)) da2b2=-1*x_sum2*error2_sum2/((j-current_pivot-1)*((j-current_pivot-1)*x2_sum2-x_sum2*x_sum2)) error2=error2_sum1+error2_sum2 index_start=current_index_start End If Next Loop v_full_depletion=Exp(x_intercept(a1,a2,b1,b2)) v_full_depletion_error=v_full_depletion*dx_intercept(a1,a2,b1,b2,da1,da2,db1,db2,da1b1,da2b2) '**********************************************End of Fit filename="pnpn" & 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 = "Real Data" Chart.LineWidth = 2 For n = 0 To i-1 Chart.AddXY voltage(n), capacitance(n), "",Color(1) Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** Chart.ChartTitleAdd ("Batch " & batch & ", Sensor " & sensor & ", Keynumber " & keynumber) Chart.ChartTitleFont.Size = 18 Chart.ChartTitleFont.Name = "Times New Roman" Chart.ChartTitleFont.Italic = true Chart.ChartTitleFont.Bold = true Chart.View3D = false Chart.LegendVisible = false Chart.AxisGridLines = false Chart.Frame = false 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 = 800 Chart.AddAxisLabel 1 , "Capacitance [pF]" Chart.AddAxisLabel 2 , "Voltage [Volts]" 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 %>

 

<% '**************************************************************Create Log Chart seed = seed + 1 filename="pnpn" & cstr(int(100000.*rnd(seed))) & ".jpg" filename_full=ph_image_directory & filename Dim Log_Chart rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Log_Chart = Server.CreateObject ("ASPChart.Chart") rem ********************************************************************** rem * Create x Array rem ********************************************************************** Log_Chart.AddSeries 5 Log_Chart.SeriesTitle = "Real Data" Log_Chart.LineWidth = 1 For n = 0 To j-1 Log_Chart.AddXY log_voltage(n), log_capacitance(n), "",Color(1) Next Log_Chart.AddSeries 5 Log_Chart.SeriesTitle = "Fit Line" Log_Chart.LineWidth = 1 For n = index_start To pivot Log_Chart.AddXY log_voltage(n), (a1*log_voltage(n)+b1), "", Color(0) Next Log_Chart.AddXY x_intercept(a1,a2,b1,b2), y_intercept(a1,a2,b1,b2), "", Color(0) Log_Chart.AddSeries 5 Log_Chart.SeriesInLegend = False Log_Chart.LineWidth = 1 Log_Chart.AddXY x_intercept(a1,a2,b1,b2), y_intercept(a1,a2,b1,b2), "", Color(0) For n = pivot+1 To j-1 Log_Chart.AddXY log_voltage(n), (a2*log_voltage(n)+b2), "", Color(0) Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** Log_Chart.ChartTitleAdd ("Batch " & batch & ", Sensor " & sensor & ", Keynumber " & keynumber) Log_Chart.ChartTitleFont.Size = 18 Log_Chart.ChartTitleFont.Name = "Times New Roman" Log_Chart.ChartTitleFont.Italic = true Log_Chart.ChartTitleFont.Bold = true Log_Chart.View3D = false Log_Chart.LegendStyle = cSeries Log_Chart.AxisGridLines = true Log_Chart.Frame = false rem ********************************************************************** rem * Remove the OuterBevel, add a gradient fill to chart panel rem ********************************************************************** Log_Chart.BevelOuter = 0 rem Log_Chart.GradientVisible = true rem Log_Chart.GradientStartColor = vbWhite rem Log_Chart.GradientEndColor = vbYellow Log_Chart.PanelColor = Color(6) rem ********************************************************************** rem * Set the Width and Height of the image rem ********************************************************************** Log_Chart.Height = 400 Log_Chart.Width = 800 Log_Chart.AddAxisLabel 1 , "Log Capacitance" Log_Chart.AddAxisLabel 2 , "Log Voltage" rem ********************************************************************** rem * Set the filename, save the image and write the image tag rem ********************************************************************** Log_Chart.FileName = filename_full Log_Chart.SaveChart line="
" Response.Write (line) rem ********************************************************************** rem * Destroy the object rem ********************************************************************** Set Log_Chart = nothing %>

The full depletion voltage is <%= precision(v_full_depletion,2) %> ± <%= precision(v_full_depletion_error,2) %> Volts.

There are <%= (pivot-index_start+1) %> points in the first line fit and <%= (index_end-pivot) %> points in the second line fit.

<% For n = 0 To i-1 %> <% Next %>
Voltage[V] Capacitance[pF]
<%= voltage(n) %> <%= capacitance(n) %>
<% Case 0 %>

Batch <%= RS("bat") %>, sensor <%= RS("sen") %> Available PN CV Measurements

<% Do While Not RS.EOF %> <% RS.Movenext Loop %>
Key Number Measurement
<%= RS("keynumber") %> &keynumber_x=<%= RS("keynumber") %>">CV
<% Case Else %>

Error <% End Select %>

<% Connection.Close %>