function rds_calculator_comm(Branch) declare function set_property, fieldcount, get_property, msg, dialog_box, entid, findwindow declare function memberof, send_event, post_event, repository, start_window, utility, popup declare function security_check, send_message declare subroutine make.list, yield, security_err_msg begin condition pre: post: end condition ReturnVar = 0 Branches = 'CALC_STAT_INFO' convert ',' to @fm in Branches locate Branch in Branches using @fm setting Bpos then on Bpos gosub CALC_STAT_INFO end else Void = msg( '', 'Invalid Branch ':Bpos:' passed to rds_calculator_comm' ) end return ReturnVar *==============================================================================================* CALC_STAT_INFO: ReturnVar = str( @vm, 9 ) * thickness average ThickReadings = iconv( get_property( @window:'.THICKNESS_READINGS', 'ARRAY' ), 'MD2' ) ThickAvg = '' ThickStdev = '' ResRHOStDev = '' ThickCp = '' ResRHOAvg = '' ResRHOCp = '' Counter = 0 Ans = '' LowThickRead = 9999 HighThickRead = 0 for i = 1 to 17 ThisThickRead = ThickReadings<1,i> if ThisThickRead <> "" then Counter += 1 Ans += ThisThickRead if ThisThickRead < LowThickRead then LowThickRead = ThisThickRead end if ThisThickRead > HighThickRead then HighThickRead = ThisThickRead end end next i if Counter then ThickAvg = Ans/Counter ReturnVar<1,1> = oconv( ThickAvg, 'MD2' ) end NumDp = Counter SumDp = Ans * resistivity average LowResRHORead = 99999999999 HighResRHORead = 0 Counter = '' Ans = '' if get_property( @window:'.CALC_TYPE', 'VALUE' ) = 'S' then * ohm squared use Sheet RHO ResRHOReadings = iconv( get_property( @window:'.SHEETRHO_READINGS', 'ARRAY' ), 'MD2' ) for i = 1 to 17 TVar = ResRHOReadings<1,i> if Tvar <> "" then Tvar = Tvar * 10 ResRHOReadings<1,i> = Tvar end next i end else ResRHOReadings = iconv( get_property( @window:'.RES_READINGS', 'ARRAY' ), 'MD3' ) end for i=1 to 17 ThisResRHORead = ResRHOReadings<1,i> if ThisResRHORead <> "" and ThisResRHORead <> 0 then Counter += 1 Ans += ThisResRHORead if ThisResRHORead < LowResRHORead then LowResRHORead = ThisResRHORead end if ThisResRHORead > HighResRHORead then HighResRHORead = ThisResRHORead end end next i if Counter then ResRHOAvg = Ans/Counter ReturnVar<1,2> = oconv( ResRHOAvg, 'MD3' ) end RNumDp = Counter RSumDp = Ans * thickness stdev SumDiffSq = 0 Mean = '' if SumDp and NumDp then Mean = SumDp/NumDp end for i = 1 to 17 ThisThickRead = ThickReadings<1,i> if ThisThickRead <> "" then *SumDiffSq += ( ThisThickRead - Mean )**2 SumDiffSq += ( ThisThickRead - Mean ) * ( ThisThickRead - Mean ) end next i if SumDiffSq and NumDp then Ans = sqrt( SumDiffSq/NumDp ) Ans = Ans * 10 ThickStDev = Ans ReturnVar<1,3> = oconv( Ans, 'MD3' ) end * resistivity stdev SumDiffSq = 0 Mean = '' if RSumDp and RNumDp then Mean = RSumDp/RNumDp end for i = 1 to 17 ThisResRHORead = ResRHOReadings<1,i> if ThisResRHORead <> "" and ThisResRHORead <> 0 then *SumDiffSq += ( ThisResRHORead - Mean )**2 SumDiffSq += ( ThisResRHORead - Mean ) * ( ThisResRHORead - Mean ) end next i if SumDiffSq and RNumDp then Ans = sqrt( SumDiffSq/RNumDp ) *Ans = Ans * 10 ResRHOStDev = Ans ReturnVar<1,4> = oconv( Ans, 'MD3' ) end * thickness and resistivity minimum and maximum if HighThickRead <> 0 then ReturnVar<1,5> = oconv( HighThickRead, 'MD2' ) end else ReturnVar<1,5> = '' end if HighResRHORead <> 0 then ReturnVar<1,6> = oconv( HighResRHORead, 'MD3' ) end else ReturnVar<1,6> = '' end if LowThickRead = 9999 then * they did not enter any so blank out cause it was set in code above to 9999 LowThickRead = '' end ReturnVar<1,7> = oconv( LowThickRead, 'MD2' ) if LowResRHORead = 99999999999 then * they did not enter any so blank out cause it was set in code above to 99999999999 LowResRHORead = '' end ReturnVar<1,8> = oconv( LowResRHORead, 'MD3' ) * thickness and resistivity uniformity if HighThickRead and LowThickRead then ReturnVar<1,9> = oconv(((HighThickRead - LowThickRead)/(HighThickRead + LowThickRead))*10000, 'MD2' ) end if ( HighResRHORead - LowResRHORead ) and ( HighResRHORead + LowResRHORead ) then ReturnVar<1,10>= oconv(((HighResRHORead - LowResRHORead)/(HighResRHORead + LowResRHORead))*10000, 'MD2' ) end return *==============================================================================================*