compile subroutine rds_resrho_valid(ConvType, DataIo, Branch, ReturnedValue) begin condition pre: post: end condition declare function msg, get_property, set_property declare subroutine update_index, extract_si_keys $insert logical $insert msg_equates $insert rds_equ $insert rds_layer_info_equ equ valid$ to 0 ;* successful equ invalid_msg$ to 1 ;* bad data - print error message window equ invalid_conv$ to 2 ;* bad conversion - " " equ invalid_nomsg$ to 3 ;* bad but do not print the error message window equ CrLf$ to char(13):char(10) ReturnedValue = DataIo status() = Valid$ begin case case ConvType = 'ICONV' ResMin = get_property( @window:'.RES_MIN', 'TEXT' ) ResMax = get_property( @window:'.RES_MAX', 'TEXT' ) if get_property( @window:'.RES_UNITS', 'TEXT' ) = 'ê/Ü' then * ohms squared use the sheetRHO * entered as whole number so must add two zero's for md2 for comparison TDataIo = oconv( DataIo, 'MD2' ) if ( TDataIo >= ResMin ) and ( TDataIo <= ResMax ) else Msg = quote( TDataIo ):' does not fall into the Sheet RHO specification...':CrLf$:ResMin:' - ':ResMax:'.':Crlf$:'Please verify that this is the correct reading.' MsgInfo = '' MsgInfo = Msg MsgInfo = '!' Void = msg( '', MsgInfo ) *status() = invalid_nomsg$ * let it be valid cause it may really be out of spec end end else * use resistivity do resistivity symbollic calculation Row = get_property( @window, '@SheetRHOPos' ) if Row = '' then * problem control does not set @SheetRHOPos if entering on the top line Row = 1 end *PartNum = xlate( 'RDS', get_property( @window:'.RDS_NO', 'TEXT' ), rds_part_num$, 'X' ) * moto part # may terminate with LL or L so swap LL with '' and then if part[-1,1] = L then * set to '' *swap 'LL' with '' in PartNum *if PartNum[-1,1] = 'L' then * PartNum[-1,1] = '' *end *MotoTotThick2ndResPns = xlate( 'CONFIG', 'MOTO_TOTTHICK_2ND_RES_PNS', '', 'X' ) *locate PartNum in MotoTotThick2ndResPns using @vm setting Fpos then * * use the 2nd layer target thickness cause motorola wants this * LayerInfo = get_property( @window:'.LAYER_INFO', 'TEXT' ) * Thickness = LayerInfo<1,RLThickTarget$> * * user 2nd layer res ranges * ResMin = oconv( LayerInfo<1,RLResMin$>, 'MD2' ) * ResMax = oconv( LayerInfo<1,RLResMax$>, 'MD2' ) * AddlMsg = ' for layer 2 ' *end else AllThickness = get_property( @window:'.THICKNESS_READINGS', 'ARRAY' ) Thickness = iconv( AllThickness<1,Row>, 'MD2' ) ThickOvr = xlate( 'RDS', get_property( @window:'.RDS_NO', 'TEXT' ), rds_thick_ovr_growth_avg$, 'X' ) if ThickOvr <> '' then Thickness = ThickOvr end AddlMsg = '' *end Res = oconv( DataIo * Thickness * .00001, 'MD3' ) if ( Res >= ResMin ) and ( Res <= ResMax ) then * OK end else Msg = 'Thickness of ':oconv( Thickness, 'MD2' ):' and Sheet RHO of ':oconv( DataIo, 'MD2' ):' calculates a resistivity of ':quote( Res ):' which does not fall into the Resistivity specification...':AddlMsg:CrLf$:ResMin:' - ':ResMax:'.':Crlf$:'Please verify that this is the correct reading.' MsgInfo = '' MsgInfo = Msg MsgInfo = '!' Void = msg( '', MsgInfo ) *status() = invalid_nomsg$ * let it be valid cause it may really be out of spec end if ( @window = 'RDS_LAYERS' ) then * HAVE TO STAMP IN THE RESISTIVITY CAUSE WE CAN'T CALCULATE THE * SYMBOLLIC LIKE THE MAIN LAYER CAN CurRes = get_property( @window:'.RES_READINGS', 'ARRAY' ) CurRes<1,Row> = Res Void = set_property( @window:'.RES_READINGS', 'ARRAY', CurRes ) end end case ConvType = 'OCONV' * no output ReturnedValue = DataIo case otherwise$ ReturnedValue = '' status() = invalid_conv$ end case return