HDR*PowerBuilder0600MU7RAPIDS emission estimator moduleFRE*NOD*c ? ENT*0600`S3Ad_source_select.dwoENT*0600r+ ?9d_source_select.srdENT*0600ZI6!d_growth_reference_code_dddw.srdENT*0600NQAf_display_file.funENT*0600N 3A!d_growth_reference_code_dddw.dwoENT*0600k-b?f_display_file.srfENT*0600FAI6!d_growth_projected_year_dddw.srdENT*0600QAf_print_file.funENT*06008\ 3A!d_growth_projected_year_dddw.dwoENT*0600-b?f_print_file.srfENT*0600& I6d_growth_parameters.srdENT*0600-b?n_dw_multi_select.sruENT*0600]3Ad_growth_parameters.dwoENT*0600" QAn_dw_multi_select.udoENT*0600L P6d_growth_output_select.srdENT*0600 9A rapids_e.aplENT*0600zH3Ad_growth_output_select.dwoENT*0600Q]U3 rapids_e.praENT*0600V!G5d_growth_factor_select.srdENT*0600,b? rapids_e.sraENT*06002#3Ad_growth_factor_select.dwoENT*0600*-b? u_ddlbx.sruENT*0600*eI6d_growth_base_year_dddw.srdENT*0600( QA u_ddlbx.udoENT*0600= 3Ad_growth_base_year_dddw.dwoENT*0600 -b?7u_dw_unit_code.sruENT*0600eJ$P6d_growth_activity_select.srdENT*0600DPAu_dw_unit_code.udoENT*0600G3Ad_growth_activity_select.dwoENT*0600$@'uo_emission.sruENT*0600 HRK6Wd_file_display.srdENT*0600l)SAuo_emission.udoENT*0600v 3Ad_file_display.dwoENT*0600^ @,uo_toplevel.sruENT*0600:A @Md_emission_factor_matches.srdENT*0600 2TAuo_toplevel.udoENT*0600FA3Ad_emission_factor_matches.dwoENT*0600r@ w_emiss.srwENT*0600$Ǻ2d_county_select.srdENT*0600 4Ad_county_select.dwoENT*0600|» @(w_emiss_status.srwENT*0600 @Xd_composite_ef.srdENT*0600 7TAw_emiss_status.winENT*06004Ad_composite_ef.dwoENT*0600\-b?8w_file_display.srwENT*0600-) @d_calc_protocol.srdENT*0600 c)TAw_file_display.winENT*0600x+4Ad_calc_protocol.dwoENT*0600ѳ-b? w_growth.srwENT*0600B) @7!d_activity_retrieve_speciate.srdENT*0600 K TA w_growth.winENT*0600@4A!d_activity_retrieve_speciate.dwoENT*0600h -b?w_select_file_mode.srwENT*0600*p @<d_activity_retrieve.srdENT*0600T TAw_select_file_mode.winENT*0600 q4Ad_activity_retrieve.dwoENT*0600l  @w_set_max_choices.srwENT*0600, 6TAw_set_max_choices.winENT*0600hTAf_speciation_value_type.funENT*0600 -b?f_speciation_value_type.srfENT*0600 k TAu_pollutant_ee.udoENT*0600vM s@u_pollutant_ee.sruENT*0600 nUA w_emiss.winDAT*h@7)b?9A"q@q@#r@r@:@s@s@SYt@t@Y_v@v@_gu0h@h@h@`@`@j@j@k@k@l@l@m@m@@@A@@@@A@@^@^@A +p@I+@:SYpa__ili3 rapids_etransactionsqlcadynamicdescriptionareasqDAT*ldadynamicstagingareasqlsaerrormessagegl_source_ridgd_device_ridgs_user_idgs_roleapplicationstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectw_emiss2` sqlcasqldasqlsaerrormessagegl_source_ridgd_device_ridgs_user_idgs_rolerapids_e  w u ta ol tu(nv6eDAT* sD geO isW , +commandline+open+create+destroy QSQ x _initsrctransactiondynamicdescriptionareadynamicstagingareaerrormessage_globsrcapplicationrapids_estructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectw_emiss@@4DAT*n@e)b?PA n@n@@@*@@3@@C^@^@io@o@sq@q@a))av@v@[  u_dw_unit_codeu_dddwborderstyledwobjectdatawindowchildpowerobjectd_units_dddw_on_qccheckerdatastoretransactionsqlcamessage2 u_dw_unit_code o ps_msg_titleuf_check_requiredof_setneiunitslist+row+dwo+itemfocuschanged+constructor+destructorADAT*  BSLrde:?LLCdwobject. xv _initsrcu_dddwu_dw_unit_codeborderstyledwobjectdatawindowchildpowerobjectdatastoretransactionmessageglobdwerenom@awinid239 't=@int 3 @ng D<"d@erenL b@an BXe @ typbu_@efern u_@ {- DAT*_@h)b?QA_@_@d_@q'`@`@q1j@j@Q?k@k@aKl@l@q_m@m@!k@@!{@@q@@@@q^@^@$*p@ < f_display_filefunction_objectstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectw_file_display2 ! file_namef_display_file DAT* QS x function_objectf_display_filestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectw_file_display @'@1@?@K@_@k@{@  @@ @ @ @ DAT* _@i)b?QA_@_@_@q%`@`@a/j@j@q=k@k@aIl@l@]m@m@i@@ay@@@@@@a^@^@qcjtF@F@a f_print_filefunction_objectstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectpointer2  filenamef_print_file BS xDAT*  function_objectf_print_filestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectpointer@%@/@=@I@]@i@y@  @ @ @ @ DAT*$a@i)b?QAa@a@da@a*`@`@a4j@j@aBk@k@aNl@l@bm@m@n@@~@@q@@@@^@^@qktn@n@ n_dw_multi_selectnonvisualobjectstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectdatawindow2 n_dw_multi_select ` dw_argumentpl_maxselpl_selDAT*&_countcontrolclickpl_selcountshiftclick+create+destroyf  IRCdatawindow.RLRLr 8Q@ x _initsrcnonvisualobjectn_dw_multi_selectstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectdatawindowqa@j@!k@I3@m@=a@DAT*0 @K@@W@^@qkjt@F@wt@le_d@ @ @ @ser_ le@  -)81-)$8-9)88-1Y1-9)@8-1R1*DAT*`@i)b?QA@@t@ @@,@@a6@@A@@M`@`@Wj@j@ek@k@ql@l@m@m@@@a@@a@@@@^@^@@pX u_ddlbxdropdownlistboxfontcharsetfontpitchfontfamilyborderstylestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject 4 Arialr_DAT*,Selection Window for emission factor method activity recordsrelease 8; datawindow(units=0 timer_interval=0 color=67108864 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 ) header(height=72 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color=DAT*."536870912" ) detail(height=84 color="536870912" ) table(column=(type=char(12) updatewhereclause=yes name=material_code dbname="rap_activities.material_code" ) column=(type=real updatewhereclause=yes name=value_amt dbname="rap_activities.value_amt" ) column=(type=char(8) updatewhereclause=yes name=value_unit_code dbname="rap_activities.value_unit_code" ) column=(type=char(12) updatewhereclause=yes name=reference_code dbname="rap_activities.reference_code" ) column=(type=char(4) updatewheDAT*0reclause=yes name=decode dbname="decode" ) retrieve="SELECT rap_activities.material_code, rap_activities.value_amt, rap_activities.value_unit_code, rap_activities.reference_code, (if rap_activities.data_code is null then :as_null else if rap_activities.data_code = 'RO' then :as_ro else rap_activities.data_code endif endif) AS decode FROM rap_activities WHERE ( ( rap_activities.ref_rid = :al_stream_rid ) AND SUBSTR(rap_activities.metric_code,1) = :as_metric_code ) AND ((SUBSTR(rDAT*2ap_activities.material_code,1) = :as_material_code ) OR (:as_material_code <> 'VOC' AND SUBSTR(rap_activities.material_code,1) = '@')) AND ( rap_activities.start_date_time = :ad_start_date_time ) AND ( rap_activities.end_date_time = :ad_end_date_time ) AND rap_activities.value_type is NULL ORDER BY decode" arguments=(("al_stream_rid", number),("as_metric_code", string),("as_material_code", string),("ad_start_date_time", datetime),("ad_end_date_time", datetime),("as_ro", string),("as_null",DAT*4 string)) ) text(band=header alignment="2" text="Value Amount" border="0" color="8388608" x="9" y="8" height="52" width="658" html.valueishtml="0" name=value_amt_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Unit Code" border="0" color="8388608" x="677" y="8" height="52" width="489" html.valueishtml="0" name=value_unit_codeDAT*6_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Reference Code" border="0" color="8388608" x="1175" y="8" height="52" width="549" html.valueishtml="0" name=reference_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="DAT*8536870912" ) column(band=detail id=2 alignment="1" tabsequence=32766 border="0" color="0" x="9" y="8" height="64" width="658" format="[general]" html.valueishtml="0" name=value_amt visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="0" DAT*:tabsequence=32766 border="0" color="0" x="677" y="8" height="64" width="489" format="[general]" html.valueishtml="0" name=value_unit_code visible="1" edit.limit=8 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=32766 border="0" color="0" x="11DAT*<75" y="8" height="64" width="549" format="[general]" html.valueishtml="0" name=reference_code visible="1" edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="0" text="Decode" border="0" color="8388608" x="1733" y="4" height="56" width="206" html.valueishtDAT*>ml="0" name=t_1 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) text(band=header alignment="0" text="Material Code" border="0" color="8388608" x="1947" y="4" height="56" width="402" html.valueishtml="0" name=t_2 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) coluDAT*mn(band=detail id=5 alignment="0" tabsequence=32766 border="0" color="0" x="1733" y="8" height="64" width="206" format="[general]" html.valueishtml="0" name=decode visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="1947" y="8" height="64" widthDAT*BPDW0800pdwPl]^```` F$ nnaaDAT*D @HR`$DAT*F " value_amt_t$1<  $ 0%  MS Sans SerifMS Sans Serif$2$-8$700$ 536870912$DAT*H8388608$ 9$8$452$^430% ! Value Amount Value Amount"#0`/% &(*-value_unit_code_t$'b448$)^430%+,VaDAT*Jlue Unit CodeValue Unit Code".0`<$01 357:reference_code_t$2 553648127$4w887$6^430%89Reference CodeReference Code";0`G/=1>@BEDAT*Lt_1$?".1326$AF@320%CDDecodeDecode"F0`R<H1IKMPt_2$Jjw1655$L^430%NOMaterial CodeMaterial Code"Q0`GSDAT*N1TVX[t_3$U.2094$W]425%YZ Priority Priority"\0@@T_m`^aceg(kj DAT*Pvalue_amt$b 9$d@64$f^430&hi [general] [general]"l0y_n^ocqs(wvvalue_unit_code$pb448$r^430&tu DAT*R[general] [general]"x0mz^{c}s( reference_code$|w887$~^430"0y^cs decode$DAT*T".1326$F@320"0^cs material_code$jw1655$^430"0^c DAT*V priority$.2094$]425& [general] [general]"0@DAT*X _ m y  L DAT*ZgengPI\Dapl(viriecrd :as_null:as_ro:al_stream_rid:as_metric_code:as_material_code:as_material_code:as_material_code:ad_start_date_time:ad_end_date_time<al_stream_ridas_metric_codeas_material_codead_start_date_timead_end_date_timeas_roas_nullmaterial_coderap_activities.material_codeDAT*\ value_amtrap_activities.value_amt_value_unit_coderap_activities.value_unit_codemreference_coderap_activities.reference_codey priorityrap_activities.prioritydecodedecodeSELECT rap_activities.material_code, rap_activities.value_amt, rap_activities.value_unit_code, rap_activities.reference_code, 0 "priority", (if rap_activities.data_code is DAT*^null then  else if rap_activities.data_code = 'RO' then  else rap_activities.data_code endif endif) AS decode FROM rap_activities WHERE (( rap_activities.ref_rid =  ) AND SUBSTR(rap_activities.metric_code,1) =  ) AND ((SUBSTR(rap_activities.material_code,1) =  ) OR (SUBSTR(rap_activities.material_code,1,3) = 'PM,' AND  = 'PM') OR (SUBSTR(rap_activities.material_code,1,5) = 'PM10,' AND  = 'PM10')) AND ( rap_activities.start_date_time =  ) AND ( rap_activities.end_datDAT*e_time =  ) AND rap_activities.value_type is NULL ORDER BY decode, value_amt DESC\"1"1"1"1"0"0"0DAT*b K L02 u_ddlbx + wparamlparam+load_items+get_rid<  LUL $ x _initsrcdropdownlistboxu_ddlbxfontcharsetfontpitchfontfamilyborderstylestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitDAT*demconnectioninfopowerobjectTforwyppubln @ger !ckf da)w_@ment5 p@xsel? p@l_coJic@ctioVsh@lick`wi@ dw_nre@ng pz re@ng p ) @ pro @t.Se _C@edRo @sel_x(@el_c) @ I7&%GH2  +load_DAT*fitems+get_rid(2 t widthheighttaborderborderstylevscrollbartextcolortextsizeweightfacenamefontfamilyfontpitchil_rid-8*5?@HOXcagm] o DAT*GE@ @@ @@01 Gv" $HwDAT*j_@k)b?TA _@_@d_@q0`@`@q:j@j@Hk@k@aTl@l@ahm@m@at@@a@@@@@@1^@^@"j_q@q@$ 1 f_speciation_value_typefunction_objectstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjecttransactionsqlcaselect rap_value_types.type from rap_value_types where rap_value_types.naDAT* me =' ' MPTA\$TAf_sqlcheck$ \ ` 2 7 as_throughput_materialf_speciation_value_type SS x function_objectf_speciation_value_typestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjecDAT*ng@$@SA(g@g@g@X@X@+c@c@8@@D`@`@Nj@j@\k@k@hl@l@|m@m@@@@@A@@@@A^@^@n@n@@@@@4q@q@p@"F@F@  p@ llo lll g@ _ erhsa@0g@p<s@s@<6!G  8[outhqo@o@qrqv@v@arqfo#DAT*pczqX uo_emissionuserobjectuserobjectswindowobjectborderstylestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject $cdatawindowdwobject transaction EDAT*rd_calc_protocold_emission_factor_matchesw_emisspointerSELECT source_code , device_code , process_code FROM rap_scc_ams_codes WHERE code =' ' SV_c*QAQAf_db_errorf_get_sequenceSELECT code FROM rap_calculation_methods WHERE name =' ' 58TQAXQASELECT type FROM rapDAT*t_modes WHERE name =' ' '*QA4QA-SELECT material_code FROM rap_scc_ams_materials WHERE scc_ams_code =' ' DGl_pmat_curzQAM,D$-SELECT material_code FROM rap_activities , rap_streams WHERE ref_rid =rap_streams.rid AND to_process_rid =0 AND from_process_rid =0 AND ( SUBSTR ( metDAT*vric_code , 1 ) in ( 'MASS FLOW' , 'VOL FLOW' ) ) jk"act_cur@6QAdaXQAQAQA$o QASELECT code FROM rap_speciation_profiles WHERE material_code =' ' >AHQADAT*QASELECT code FROM rap_materials WHERE rid in ( SELECT child_ref_rid FROM rap_materials M , rap_group_members G WHERE M.rid =G.parent_ref_rid AND M.code ='PM' ) AND code =' ' QAQASELECT weight_perc FROM rap_speciation_split_factors WHERE profile_code =' ' AND material_code =' ' IL`c , DAT*zPDW08005pdwPl````r F$5nnaaDAT*|%& @H`$DAT*~ "rid_t$1<  $ 0%  MS Sans SerifMS Sans Serif$2$-8$700$ 536870912$DAT*8388608$ 9$8$452$<274% !RidRid"#0`/% &(*-priority_no_t$'@%293$)e462%+,Priority NumberPriority NDAT*umber".0`:$0 1358method_code_t$2763$4658%67 Method Code Method Code"90`E/; <>@C mode_type_t$=91431$?HDAT*I329%AB Mode Type Mode Type"D0`P:F GIKNthroughput_material_code_t$H1769$J782%LMThroughput Material CodeThroughput Material Code"O0`[EQ RDAT*TVYsource_code_t$S0 2560$U658%WX Source Code Source Code"Z0`fP\ ]_addevice_code_t$^ 3227$`658%bc Device Code Device Code"eDAT*0`q[g hjloprocess_code_t$iT73895$k658%mn Process Code Process Code"p0`|fr suwzemittant_material_code_t$t4562$vDAT*686%xyEmittant Material CodeEmittant Material Code"{0`q} ~scc_ams_code_t$~5257$c453% SCC AMS Code SCC AMS Code"0`| DAT* sub_type_t$W5719$>283% Sub Type Sub Type"0@@T (rid$ DAT*9$@64$<274& [general] [general]"0( priority_no$@%293$e462"0DAT*( method_code$763$658& [general] [general]"0(( mode_type$91431$DAT*HI329"02( throughput_material_code$1769$782"0<( source_codeDAT*$0 2560$658"0F( device_code$ 3227$658"0P(DAT* process_code$T73895$658"0 Z( emittant_material_code$4562$686"0DAT* d( scc_ams_code$~5257$c453"0 n( sub_type$W5719$>283"DAT*0@$  @DAT*      @   DAT* #!" rap_calculation_protocols  ridrap_calculation_protocols.rid priority_no&rap_calculation_protocols.priority_no method_code&rap_calculation_protocols.method_code mode_type$rap_calculation_protocols.mode_typethroughput_material_code3rap_calculation_protocolDAT* s.throughput_material_code source_code&rap_calculation_protocols.source_code device_code&rap_calculation_protocols.device_code process_code'rap_calculation_protocols.process_codeemittant_material_code1rap_calculation_protocols.emittant_material_code scc_ams_code'rap_calculation_protocols.scc_ams_code sub_type#rap_calculation_protocDAT*release 8; datawindow(units=0 timer_interval=0 color=67108864 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 ) header(height=72 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=84 color="536870912" ) table(cDAT*olumn=(type=decimal(0) update=yes updatewhereclause=yes name=rid dbname="rap_calculation_protocols.rid" ) column=(type=decimal(0) update=yes updatewhereclause=yes key=yes name=priority_no dbname="rap_calculation_protocols.priority_no" ) column=(type=char(12) update=yes updatewhereclause=yes key=yes name=method_code dbname="rap_calculation_protocols.method_code" ) column=(type=char(6) update=yes updatewhereclause=yes name=mode_type dbname="rap_calculation_protocols.mode_type" ) column=(typeDAT*=char(12) update=yes updatewhereclause=yes key=yes name=throughput_material_code dbname="rap_calculation_protocols.throughput_material_code" ) column=(type=char(15) update=yes updatewhereclause=yes key=yes name=source_code dbname="rap_calculation_protocols.source_code" ) column=(type=char(15) update=yes updatewhereclause=yes key=yes name=device_code dbname="rap_calculation_protocols.device_code" ) column=(type=char(15) update=yes updatewhereclause=yes key=yes name=process_code dbname="rap_caDAT*lculation_protocols.process_code" ) column=(type=char(12) update=yes updatewhereclause=yes key=yes name=emittant_material_code dbname="rap_calculation_protocols.emittant_material_code" ) column=(type=char(10) update=yes updatewhereclause=yes key=yes name=scc_ams_code dbname="rap_calculation_protocols.scc_ams_code" ) column=(type=char(1) update=yes updatewhereclause=yes key=yes name=sub_type dbname="rap_calculation_protocols.sub_type" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"rap_calcDAT*ulation_protocols~" ) COLUMN(NAME=~"rap_calculation_protocols.rid~") COLUMN(NAME=~"rap_calculation_protocols.priority_no~") COLUMN(NAME=~"rap_calculation_protocols.method_code~") COLUMN(NAME=~"rap_calculation_protocols.mode_type~") COLUMN(NAME=~"rap_calculation_protocols.throughput_material_code~") COLUMN(NAME=~"rap_calculation_protocols.source_code~") COLUMN(NAME=~"rap_calculation_protocols.device_code~") COLUMN(NAME=~"rap_calculation_protocols.process_code~") COLUMN(NAME=~"rap_calculation_protocDAT*ols.emittant_material_code~") COLUMN(NAME=~"rap_calculation_protocols.scc_ams_code~") COLUMN(NAME=~"rap_calculation_protocols.sub_type~")WHERE( EXP1 =~"rap_calculation_protocols.throughput_material_code~" OP =~"is not~" EXP2 =~"NULL~" ) ) ORDER(NAME=~"rap_calculation_protocols.priority_no~" ASC=yes ) " update="rap_calculation_protocols" updatewhere=1 updatekeyinplace=no ) text(band=header alignment="2" text="Rid" border="0" color="8388608" x="9" y="8" height="52" width="274" html.valueishtml="0" DAT* name=rid_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Priority Number" border="0" color="8388608" x="293" y="8" height="52" width="462" html.valueishtml="0" name=priority_no_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.cDAT*olor="536870912" ) text(band=header alignment="2" text="Method Code" border="0" color="8388608" x="763" y="8" height="52" width="658" html.valueishtml="0" name=method_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Mode Type" border="0" color="8388608" x="1431" y="8" height="52" width="329" html.valueishtml="0" name=mode_type_DAT*t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Throughput Material Code" border="0" color="8388608" x="1769" y="8" height="52" width="782" html.valueishtml="0" name=throughput_material_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1"DAT* background.color="536870912" ) text(band=header alignment="2" text="Source Code" border="0" color="8388608" x="2560" y="8" height="52" width="658" html.valueishtml="0" name=source_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Device Code" border="0" color="8388608" x="3227" y="8" height="52" width="658" html.valueishtml="0" DAT* name=device_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Process Code" border="0" color="8388608" x="3895" y="8" height="52" width="658" html.valueishtml="0" name=process_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" backgDAT*round.color="536870912" ) text(band=header alignment="2" text="Emittant Material Code" border="0" color="8388608" x="4562" y="8" height="52" width="686" html.valueishtml="0" name=emittant_material_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="SCC AMS Code" border="0" color="8388608" x="5257" y="8" height="52" width="453" htmlDAT*.valueishtml="0" name=scc_ams_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Sub Type" border="0" color="8388608" x="5719" y="8" height="52" width="283" html.valueishtml="0" name=sub_type_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.modeDAT*="1" background.color="536870912" ) column(band=detail id=1 alignment="1" tabsequence=10 border="0" color="0" x="9" y="8" height="64" width="274" format="[general]" html.valueishtml="0" name=rid visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 DAT*alignment="1" tabsequence=20 border="0" color="0" x="293" y="8" height="64" width="462" format="[general]" html.valueishtml="0" name=priority_no visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="0" tabsequence=30 border="0" color="0" xDAT*="763" y="8" height="64" width="658" format="[general]" html.valueishtml="0" name=method_code visible="1" edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=40 border="0" color="0" x="1431" y="8" height="64" width="329" format="[genDAT*eral]" html.valueishtml="0" name=mode_type visible="1" edit.limit=6 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=5 alignment="0" tabsequence=50 border="0" color="0" x="1769" y="8" height="64" width="782" format="[general]" html.valueishtml="0" name=throughput_materiaDAT*l_code visible="1" edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=6 alignment="0" tabsequence=60 border="0" color="0" x="2560" y="8" height="64" width="658" format="[general]" html.valueishtml="0" name=source_code visible="1" edit.limit=15 edit.case=any edDAT*it.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=7 alignment="0" tabsequence=70 border="0" color="0" x="3227" y="8" height="64" width="658" format="[general]" html.valueishtml="0" name=device_code visible="1" edit.limit=15 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autDAT*ohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=8 alignment="0" tabsequence=80 border="0" color="0" x="3895" y="8" height="64" width="658" format="[general]" html.valueishtml="0" name=process_code visible="1" edit.limit=15 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans DAT*Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=9 alignment="0" tabsequence=90 border="0" color="0" x="4562" y="8" height="64" width="686" format="[general]" html.valueishtml="0" name=emittant_material_code visible="1" edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="7DAT*PDW0800pdwPll>?k````D F$nnaaDAT*vw @X<1`$DAT* "t_3$1<  $ 0%  MS Sans SerifMS Sans Serif$2$-8$700$ 79741120$DAT*8388608$1051$20$@64$y)553% ! Method Type Method Type"#0`1% &(*,/t_1$' 67108864$) 9$+i480%-DAT*. Process Rid Process Rid"00`$2 &357:t_2$4m498$6w 544%89Material CodeMaterial Code";0$= 536870912@<@H<@bDAT*VA?B JLNP TS method_type<C F H%DEArialArial$G-10$I400$K1051$M0$Oy)553DAT*&QR [general] [general]"U0b@W?B &XLZ\ `_ process_rid$Y 9$[i480&]^ [currency] [currency]"a0Vc?B &dLDAT*fP ihmaterial_code$em498$gw 544"j0@<DAT* oVmn rbpq u@st process_rid process_ridVmaterial_codematerial_codeb method_type method_type@\xz|DAT*Stores the factor_type and pollutant for composite emission factors used in calculationsrelease 8; datawindow(units=0 timer_interval=0 color=67108864 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 ) header(height=88 color="536870912" ) summary(height=0 color="53687091DAT*2" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(type=long updatewhereclause=no name=process_rid dbname="process_rid" ) column=(type=char(12) updatewhereclause=no name=material_code dbname="material_code" ) column=(type=char(2) updatewhereclause=no name=method_type dbname="method_type" ) ) text(band=header alignment="0" text="Method Type" border="0" color="8388608" x="1051" y="20" height="64" width="553" html.valueishtml="0" name=t_3 visible="1DAT*" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="79741120" ) column(band=detail id=3 alignment="0" tabsequence=32766 border="0" color="0" x="1051" y="0" height="64" width="553" format="[general]" html.valueishtml="0" name=method_type visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" fonDAT*t.charset="0" background.mode="2" background.color="79741120" ) text(band=header alignment="0" text="Process Rid" border="0" color="8388608" x="9" y="20" height="64" width="480" html.valueishtml="0" name=t_1 visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) text(band=header alignment="0" text="Material Code" border="0" color="8388608" x="498" y="20" height="64" width="544" DAT*html.valueishtml="0" name=t_2 visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="9" y="0" height="64" width="480" format="[currency]" html.valueishtml="0" name=process_rid visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="4DAT*00" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) column(band=detail id=2 alignment="0" tabsequence=32766 border="0" color="0" x="498" y="0" height="64" width="544" format="[general]" html.valueishtml="0" name=material_code visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="6710886DAT*PDW0800<pdwPl0/````@ F$<nnaaDAT* @$DAT* 536870912@@I##   ("rid< $ 0% MS Sans SerifMS Sans Serif$DAT*2$-8$700$1$1966$ 12$A65$275& ! [general] [general]$  %') +(.2DAT*name$& 10$(4$*961&,- [general] [general]@13;DAT*756 :#893 ct2e:pl_rid a_4pl_ridridrap_geographic_locations.ridnamerap_geographic_locations.name#YPBSELECT( VERSION(400) TABLE(NAME="rap_geographic_locations" ) COLUMN(NAME="rap_geographic_locaDAT*tions.rid") COLUMN(NAME="rap_geographic_locations.name")WHERE( EXP1 ="rap_geographic_locations.parent_rid" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_geographic_locations.type" OP ="=" EXP2 ="'COUNTY'" ) ) ARG(NAME = "pl_rid" TYPE = number) DAT*release 4; datawindow(units=0 timer_interval=0 color=1073741824 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no ) header(height=1 color="536870912" ) summary(height=5 color="536870912" ) footer(height=1 color="536870912" ) detail(height=73 color="536870912" ) table(column=(type=decimal(0) name=rid dbname="rap_geographic_locationsDAT*.rid" ) column=(type=char(50) name=name dbname="rap_geographic_locations.name" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"rap_geographic_locations~" ) COLUMN(NAME=~"rap_geographic_locations.rid~") COLUMN(NAME=~"rap_geographic_locations.name~")WHERE( EXP1 =~"rap_geographic_locations.parent_rid~" OP =~"=~" EXP2 =~":pl_rid~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_geographic_locations.type~" OP =~"=~" EXP2 =~"'COUNTY'~" ) ) ARG(NAME = ~"pl_rid~" TYPE = number) " arguments=(("pl_rid", number)) ) DAT* column(band=detail id=1 alignment="1" tabsequence=32766 border="0" color="0" x="1966" y="12" height="65" width="275" format="[general]" name=rid edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="0" tabsequence=32766 border="0" color="0" x="10" y="4" height="65"DAT*, width="961" format="[general]" name=name edit.limit=50 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) DAT*PDW0800pdwPlvu````# F$nnaaDAT* @H`$DAT* "factor_type_t$1<  $ 0%  MS Sans SerifMS Sans Serif$2$-8$700$ 536870912$DAT*8388608$+197$8$452$Oi361% ! Factor Type Factor Type"#0`/% &(*-control_1_device_code_t$'|7567$)704%+,DAT*Primary Control DevicePrimary Control Device".0`:$0 1358control_2_device_code_t$21280$4773%67Secondary Control DeviceSecondary Control Device"90`E/; <>@CDAT* amt_t$=2062$?`439%ABAmountAmount"D0`P:F GIKNexponent_amt_t$H% 2510$J`439%LM Exponent Exponent"O0`[EQDAT*  RTVYemittant_material_code_t$S 2958$U713%WXEmittant Material CodeEmittant Material Code"Z0`fP\ ]_ad unit_code_t$^%`3680$`V393%bDAT*c Unit Code Unit Code"e0`q[g hjlothroughput_unit_code_t$i}4082$k663%mnThroughput Unit CodeThroughput Unit Code"p0`|fr suwzthroughput_materiDAT*al_code_t$t4754$v782%xyThroughput Material CodeThroughput Material Code"{0`q}~ t_1$ 553648127$5545$[416% Quality Type Quality TypDAT*e"0`|~ t_2<  %ArialArial$R5970$856$;270% Epa Date Epa Date"0`DAT*~t_3$6601$.210% Profile Code Profile Code"0`~t_4$Wi6249$KW343% Scc Ams Code Scc Ams Code"DAT*0`~t_5$6821$1193% Process Rid Process Rid"0`~t_6$W8023$1152%DAT*Factor PriorityFactor Priority"0@@Pin~ emission_factor$ 9$@64$'178& DAT*[GENERAL] [GENERAL]$#:if( IsNull(exponent_amt), amt, amt * 10^ exponent_amt )    0  $@ "0 ( factor_type$+197$DAT*Oi361& [general] [general]"0 (control_1_device_code$|7567$704"0 DAT*(control_2_device_code$1280$773"0  (amt$2062$`439& [general] [general]" DAT* 0   ( exponent_amt$ % 2510$`439"0  ( emittant_material_code$ 2958$DAT*"713"0%  (#" unit_code$%`3680$!V393"$00&')+ (.-throughput_uDAT*$nit_code$(}4082$* 12$,663"/09%124  (76 throughput_material_code$34754$5782"80B0:DAT*&~;=   @? quality_type$<5545$>[416"A0N9CDF H LK epa_date$ER5970$G;270&IJ [geDAT*(neral] [general]"M0WBOPR  UT profile_code$Q6601$S.210"V0`NXY[  ^] scc_ams_code$ZDAT**Wi6249$\KW343"_0iWabd  gf process_rid$c6821$e1193"h0`jkmo sDAT*,rfactor_priority$lW8023$n1152&pq [general] [general]"t0@wDAT*.    DAT*0 % 0 9 W N `  BDAT*2 i|xyz{|} ~    :as_emittant_material_code:as_specific_factor_type:ad_process_rid:as_generic_factor_type:as_state_factor_type:ad_state_rid:as_county_factor_type:ad_county_rid:as_source_factor_type:ad_source_rid:as_scc_ams_code:as_profile_code:as_thrDAT*4oughput_material_code:as_throughput_material_code:ad_cutoff_datet as_emittant_material_codeas_throughput_material_codeas_specific_factor_typead_process_ridas_generic_factor_typeas_scc_ams_codeas_profile_codeas_state_factor_typeas_county_factor_typeas_source_factor_type ad_state_ridad_county_ridad_source_ridDAT*6ad_cutoff_daterap_emission_factors   factor_type!rap_emission_factors.factor_typecontrol_1_device_code+rap_emission_factors.control_1_device_codecontrol_2_device_code+rap_emission_factors.control_2_device_codeamtrap_emission_factors.amt exponent_amt"rap_emission_factors.exponent_amt DAT*8emittant_material_code,rap_emission_factors.emittant_material_code unit_coderap_emission_factors.unit_codethroughput_unit_code*rap_emission_factors.throughput_unit_code%throughput_material_code.rap_emission_factors.throughput_material_code0 quality_type"rap_emission_factors.quality_type9 scc_ams_code"rap_emission_factors.scc_ams_codeWDAT*  profile_code"rap_emission_factors.profile_codeN process_rid!rap_emission_factors.process_rid` epa_daterap_emission_factors.epa_dateBfactor_priority%rap_emission_factors.factor_priorityiSELECT rap_emission_factors.factor_type, rap_emission_factors.control_1_device_code, rap_emission_factors.control_2_device_code, rap_emission_factors.amt, rap_emission_factors.exponent_aDAT*<DW to display source-specific and generic emission factors matching pollutantrelease 8; datawindow(units=0 timer_interval=0 color=67108864 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=1 ) header(height=72 color="536870912" ) summary(height=0 color="536870912" ) footeDAT*>r(height=0 color="536870912" ) detail(height=80 color="536870912" ) table(column=(type=char(1) updatewhereclause=yes key=yes name=factor_type dbname="rap_emission_factors.factor_type" ) column=(type=char(15) updatewhereclause=yes key=yes name=control_1_device_code dbname="rap_emission_factors.control_1_device_code" ) column=(type=char(15) updatewhereclause=yes key=yes name=control_2_device_code dbname="rap_emission_factors.control_2_device_code" ) column=(type=decimal(6) updatewhereclause=DAT*@yes key=yes name=amt dbname="rap_emission_factors.amt" ) column=(type=decimal(0) updatewhereclause=yes key=yes name=exponent_amt dbname="rap_emission_factors.exponent_amt" ) column=(type=char(12) updatewhereclause=yes key=yes name=emittant_material_code dbname="rap_emission_factors.emittant_material_code" ) column=(type=char(8) updatewhereclause=yes key=yes name=unit_code dbname="rap_emission_factors.unit_code" ) column=(type=char(8) updatewhereclause=yes key=yes name=throughput_unit_code DAT*Bdbname="rap_emission_factors.throughput_unit_code" ) column=(type=char(12) updatewhereclause=yes key=yes name=throughput_material_code dbname="rap_emission_factors.throughput_material_code" ) column=(type=char(1) updatewhereclause=yes name=quality_type dbname="rap_emission_factors.quality_type" ) column=(type=char(10) updatewhereclause=yes key=yes name=scc_ams_code dbname="rap_emission_factors.scc_ams_code" ) column=(type=char(5) updatewhereclause=yes key=yes name=profile_code dbname="rap_DAT*Demission_factors.profile_code" ) column=(type=decimal(0) updatewhereclause=yes key=yes name=process_rid dbname="rap_emission_factors.process_rid" ) column=(type=datetime updatewhereclause=yes key=yes name=epa_date dbname="rap_emission_factors.epa_date" ) column=(type=number updatewhereclause=yes name=factor_priority dbname="rap_emission_factors.factor_priority" ) retrieve="SELECT rap_emission_factors.factor_type, rap_emission_factors.control_1_device_code, rap_emission_factors.controDAT*Fl_2_device_code, rap_emission_factors.amt, rap_emission_factors.exponent_amt, rap_emission_factors.emittant_material_code, rap_emission_factors.unit_code, rap_emission_factors.throughput_unit_code, rap_emission_factors.throughput_material_code, rap_emission_factors.quality_type, rap_emission_factors.scc_ams_code, rap_emission_factors.profile_code, rap_emission_factors.process_rid, rap_emission_factors.epa_date, 0 as factor_priority FROM rap_emission_factors WHERE (rDAT*Hap_emission_factors.emittant_material_code = :as_emittant_material_code ) AND ( (rap_emission_factors.factor_type = :as_specific_factor_type AND rap_emission_factors.process_rid = :ad_process_rid) OR ( ( rap_emission_factors.factor_type = :as_generic_factor_type OR (rap_emission_factors.factor_type = :as_state_factor_type AND rap_emission_factors.process_rid = :ad_state_rid) OR (rap_emission_factors.factor_type = :as_county_factor_type AND rap_emission_faDAT*Jctors.process_rid = :ad_county_rid) OR (rap_emission_factors.factor_type = :as_source_factor_type AND rap_emission_factors.process_rid = :ad_source_rid) ) AND ( rap_emission_factors.scc_ams_code = :as_scc_ams_code OR ( (rap_emission_factors.profile_code is not NULL) AND (rap_emission_factors.profile_code = :as_profile_code) ) ) ) ) AND (rap_emission_factors.throughput_material_code is not NULL) AND (rap_emission_fDAT*Lactors.throughput_material_code = :as_throughput_material_code OR :as_throughput_material_code = '@') AND (rap_emission_factors.epa_date <= :ad_cutoff_date) " update="rap_emission_factors" updatewhere=0 updatekeyinplace=no arguments=(("as_emittant_material_code", string),("as_throughput_material_code", string),("as_specific_factor_type", string),("ad_process_rid", number),("as_generic_factor_type", string),("as_scc_ams_code", string),("as_profile_code", string),("as_state_factor_type", string),DAT*N("as_county_factor_type", string),("as_source_factor_type", string),("ad_state_rid", number),("ad_county_rid", number),("ad_source_rid", number),("ad_cutoff_date", date)) ) text(band=header alignment="2" text="Factor Type" border="0" color="8388608" x="197" y="8" height="52" width="361" html.valueishtml="0" name=factor_type_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" DAT*P) text(band=header alignment="2" text="Primary Control Device" border="0" color="8388608" x="567" y="8" height="52" width="704" html.valueishtml="0" name=control_1_device_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Secondary Control Device" border="0" color="8388608" x="1280" y="8" height="52" width="773" html.valueishtml="DAT*R0" name=control_2_device_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Amount" border="0" color="8388608" x="2062" y="8" height="52" width="439" html.valueishtml="0" name=amt_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" backgroDAT*Tund.color="536870912" ) text(band=header alignment="2" text="Exponent" border="0" color="8388608" x="2510" y="8" height="52" width="439" html.valueishtml="0" name=exponent_amt_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Emittant Material Code" border="0" color="8388608" x="2958" y="8" height="52" width="713" html.valueishtml="0"DAT*V name=emittant_material_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Unit Code" border="0" color="8388608" x="3680" y="8" height="52" width="393" html.valueishtml="0" name=unit_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1"DAT*X background.color="536870912" ) text(band=header alignment="2" text="Throughput Unit Code" border="0" color="8388608" x="4082" y="8" height="52" width="663" html.valueishtml="0" name=throughput_unit_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Throughput Material Code" border="0" color="8388608" x="4754" y="8" height="52" wiDAT*Zdth="782" html.valueishtml="0" name=throughput_material_code_t visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Quality Type" border="0" color="8388608" x="5545" y="8" height="52" width="416" html.valueishtml="0" name=t_1 visible="1" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charDAT*\set="0" background.mode="1" background.color="553648127" ) text(band=header alignment="2" text="Epa Date" border="0" color="8388608" x="5970" y="8" height="56" width="270" html.valueishtml="0" name=t_2 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=header alignment="0" text="Profile Code" border="0" color="8388608" x="6601" y="8" height="56" width="210" html.valueishtDAT*^ml="0" name=t_3 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=header alignment="0" text="Scc Ams Code" border="0" color="8388608" x="6249" y="8" height="56" width="343" html.valueishtml="0" name=t_4 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) texDAT*`t(band=header alignment="0" text="Process Rid" border="0" color="8388608" x="6821" y="8" height="56" width="1193" html.valueishtml="0" name=t_5 visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=header alignment="0" text="Factor Priority" border="0" color="8388608" x="8023" y="8" height="56" width="1152" html.valueishtml="0" name=t_6 visible="1" font.face="Arial" font.heDAT*bight="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) compute(band=detail alignment="2" expression="if( IsNull(exponent_amt), amt, amt * 10^ exponent_amt ) "border="0" color="0" x="9" y="8" height="64" width="178" format="[GENERAL]" html.valueishtml="0" name=emission_factor visible="1" font.face="Arial" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.coloDAT*dr="553648127" ) column(band=detail id=1 alignment="2" tabsequence=32766 border="0" color="0" x="197" y="8" height="64" width="361" format="[general]" html.valueishtml="0" name=factor_type visible="1" edit.limit=1 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignmeDAT*fnt="2" tabsequence=32766 border="0" color="0" x="567" y="8" height="64" width="704" format="[general]" html.valueishtml="0" name=control_1_device_code visible="1" edit.limit=15 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="2" tabsequence=32766 border="0" cDAT*holor="0" x="1280" y="8" height="64" width="773" format="[general]" html.valueishtml="0" name=control_2_device_code visible="1" edit.limit=15 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="2" tabsequence=32766 border="0" color="0" x="2062" y="8" height="64" DAT*jwidth="439" format="[general]" html.valueishtml="0" name=amt visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=5 alignment="2" tabsequence=32766 border="0" color="0" x="2510" y="8" height="64" width="439" format="[general]" html.valueishtml="0" naDAT*lme=exponent_amt visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=6 alignment="2" tabsequence=32766 border="0" color="0" x="2958" y="8" height="64" width="713" format="[general]" html.valueishtml="0" name=emittant_material_code visible="1" edit.limDAT*nit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=7 alignment="2" tabsequence=32766 border="0" color="0" x="3680" y="8" height="64" width="393" format="[general]" html.valueishtml="0" name=unit_code visible="1" edit.limit=8 edit.case=any edit.focusrectangle=no edit.aDAT*putoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=8 alignment="2" tabsequence=32766 border="0" color="0" x="4082" y="12" height="64" width="663" format="[general]" html.valueishtml="0" name=throughput_unit_code visible="1" edit.limit=8 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edDAT*rit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=9 alignment="2" tabsequence=32766 border="0" color="0" x="4754" y="8" height="64" width="782" format="[general]" html.valueishtml="0" name=throughput_material_code visible="1" edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="MS Sans DAT*tSerif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=10 alignment="2" tabsequence=32766 border="0" color="0" x="5545" y="8" height="64" width="416" format="[general]" html.valueishtml="0" name=quality_type visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0DAT*" background.mode="1" background.color="553648127" ) column(band=detail id=14 alignment="2" tabsequence=32766 border="0" color="0" x="5970" y="8" height="64" width="270" format="[general]" html.valueishtml="0" name=epa_date visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=12 alignment="0" DAT*xPDW0800/pdwPl&%````@ F$/DAT*z* @@DAT*|$ 536870912@8 !$line< $ 255%  Terminal Terminal$DAT*~1$-9$400$ 553648127$0$18$4$048$ 8160&"# [GENERAL] [GENERAL]@DAT*)'(lineline+-",no".yesDAT*DAT*Datawindow used by f_display_file. Displays contents of a .txt file previously stored.release 6; datawindow(units=0 timer_interval=0 color=1073741824 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 0 print.margin.right = 0 print.margin.top = 0 print.margin.bottom = 0 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=56 color=DAT*"536870912" ) table(column=(type=char(255) updatewhereclause=yes name=line dbname="line" ) ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="18" y="4" height="48" width="8160" format="[GENERAL]" name=line edit.limit=0 edit.case=any edit.autoselect=no font.face="Terminal" font.height="-9" font.weight="400" font.family="1" font.pitch="1" font.charset="255" background.mode="1" background.color="553648127" ) htmltable(border="1" cellpadding="0" cellspacing="0" gDAT*eneratecss="no" nowrap="yes") DAT*PDW0800pdwPlrq```` F$nnaaDAT* @`DAT* < $0% ArialArial$ 2$ -10$700$1$ 536870912$ 9$DAT*4$128$F@320% State Rid State Rid`'  "$$!N1102$#D7311%%& Activity Rid Activity Rid`/ (*,DAT*$)71422$+]425%-.Creation Date TimeCreation Date Time`7' 024$1@1856$3]425%56 Metric Code Metric Code`?/ 8:<$9DAT*2290$;g471%=>Metric Level TypeMetric Level Type`G7 @BD$A^ 2770$CE;315%EFRef RidRef Rid`O? HJL$IDAT* 3095$K]425%MNStart Date TimeStart Date Time`WG PRT$Q 3529$SE;315%UVUser IdUser Id`_O XZ\$YK3854DAT*$[E;315%]^ValueValue`gW `bd$aR4178$c]425%ef Comment Text Comment Text`o_ hjl$i4613$k]DAT*425%mnConfidential FlagConfidential Flag`wg prt$qP5047$s-206%uv Data Code Data Code`o xz|$y5262${\421%DAT*}~End Date TimeEnd Date Time`w $;5691$^430%Material CodeMaterial Code` $=6130$-206%DAT* Method Type Method Type` $l6345$]425%Reference CodeReference Code` ${6779$E;315%DAT*Reference TypeReference Type` $7104$E;315% Value Amt Value Amt` $Y7429$-206% Value Type ValDAT*ue Type` $7643$]425%Value Unit CodeValue Unit Code` $JR338$E;315% County Rid County Rid`DAT* $663$^430% Scc Code Scc Code@@Hj DAT*state_rid< $400$ 9$@64$F@320& [general] [general] rid$N1102$DAT*D7311 creation_date_time$71422$]425&[shortdate] [time][shortdate] [time] DAT* metric_code$@1856$]425& [general] [general] metric_level_type$2290$g471DAT* ref_rid$^ 2770$E;315  start_date_time$ 3095$]425   DAT*  user_id$  3529$ E;315  value$K3854$E;315  DAT* comment_text$R4178$]425$!  #confidential_flag$ 4613$"]425+%&( DAT** data_code$'P5047$)-2062$,-/ 1end_date_time$.5262$0\4219+346 8DAT*material_code$5;5691$7^430@2:;= ? method_type$<=6130$>-206G9ABD FDAT*reference_code$Cl6345$E]425N@HIK Mreference_type$J{6779$LE;315UGOPR T value_DAT*amt$Q7104$SE;315\NVWY [ value_type$XY7429$Z-206cU]^` bvalue_unit_code$DAT*_7643$a]425j\deg i county_rid$fJR338$hE;315ckln p scc_code$mDAT*663$o^430@swDAT* c j     DAT*     $+ 2 9DAT*@ GN U\ tuv:as_referenceCode:adt_startDateTime:adt_endDateTimeL gexyz{DAT*|}~adt_startDateTimeadt_endDateTimeas_referenceCodeal_nationArrayal_stateArrayal_countyArrayal_sourceArrayal_sourceSub1Arrayal_sourceSub2Array state_ridv_rap_ss_scc.state_rid county_ridv_rap_ss_scc.county_ridc scc_codev_rap_ss_scc.scc_codejridrap_activities.ridcreation_date_time"rap_activitieDAT*s.creation_date_time metric_coderap_activities.metric_codemetric_level_type!rap_activities.metric_level_typeref_ridrap_activities.ref_ridstart_date_timerap_activities.start_date_timeuser_idrap_activities.user_idvaluerap_activities.value comment_textrap_activities.comment_textDAT*confidential_flag!rap_activities.confidential_flag data_coderap_activities.data_code$end_date_timerap_activities.end_date_time+material_coderap_activities.material_code2 method_typerap_activities.method_type9reference_coderap_activities.reference_code@reference_typerap_activities.reference_typeG DAT*value_amtrap_activities.value_amtN value_typerap_activities.value_typeUvalue_unit_coderap_activities.value_unit_code\PBSELECT( VERSION(400) TABLE(NAME="v_rap_ss_scc" ) TABLE(NAME="rap_activities" ) TABLE(NAME="rap_streams" ) COLUMN(NAME="v_rap_ss_scc.state_rid") COLUMN(NAME="v_rap_ss_scc.county_rid") COLUMN(NAME="v_rap_ss_scc.scc_code") COLUMN(NAME="rap_activities.rid") COLUMN(NAME="rap_activities.creation_datDAT*e_time") COLUMN(NAME="rap_activities.metric_code") COLUMN(NAME="rap_activities.metric_level_type") COLUMN(NAME="rap_activities.ref_rid") COLUMN(NAME="rap_activities.start_date_time") COLUMN(NAME="rap_activities.user_id") COLUMN(NAME="rap_activities.value") COLUMN(NAME="rap_activities.comment_text") COLUMN(NAME="rap_activities.confidential_flag") COLUMN(NAME="rap_activities.data_code") COLUMN(NAME="rap_activities.end_date_time") COLUMN(NAME="rap_activities.material_code") COLUMN(NAME="rap_activitieDAT*s.method_type") COLUMN(NAME="rap_activities.reference_code") COLUMN(NAME="rap_activities.reference_type") COLUMN(NAME="rap_activities.value_amt") COLUMN(NAME="rap_activities.value_type") COLUMN(NAME="rap_activities.value_unit_code") JOIN (LEFT="rap_streams.rid" OP ="="RIGHT="rap_activities.ref_rid" ) JOIN (LEFT="rap_streams.from_process_rid" OP ="="RIGHT="v_rap_ss_scc.source_sub2_rid" )WHERE( EXP1 ="rap_activities.reference_code" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXDAT* P1 ="rap_activities.start_date_time" OP =">=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_activities.end_date_time" OP ="<=" EXP2 ="" ) ) ORDER(NAME="v_rap_ss_scc.county_rid" ASC=yes ) ORDER(NAME="v_rap_ss_scc.scc_code" ASC=yes ) ORDER(NAME="rap_activities.material_code" ASC=yes ) ARG(NAME = "adt_startDateTime" TYPE = datetime) ARG(NAME = "adt_endDateTime" TYPE = datetime) ARG(NAME = "as_referenceCode" TYPE = string) ARG(NAME = "al_nationArray" TYPE = numberlist) ARG(NAME = "DAT*release 6; datawindow(units=0 timer_interval=0 color=16777215 processing=1 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 ) header(height=148 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(tyDAT*pe=decimal(0) updatewhereclause=yes name=state_rid dbname="v_rap_ss_scc.state_rid" ) column=(type=decimal(0) updatewhereclause=yes name=county_rid dbname="v_rap_ss_scc.county_rid" ) column=(type=char(10) updatewhereclause=yes name=scc_code dbname="v_rap_ss_scc.scc_code" ) column=(type=decimal(0) updatewhereclause=yes name=rid dbname="rap_activities.rid" ) column=(type=datetime updatewhereclause=yes name=creation_date_time dbname="rap_activities.creation_date_time" ) column=(type=char(12)DAT* updatewhereclause=yes name=metric_code dbname="rap_activities.metric_code" ) column=(type=char(3) updatewhereclause=yes name=metric_level_type dbname="rap_activities.metric_level_type" ) column=(type=decimal(0) updatewhereclause=yes name=ref_rid dbname="rap_activities.ref_rid" ) column=(type=datetime updatewhereclause=yes name=start_date_time dbname="rap_activities.start_date_time" ) column=(type=char(4) updatewhereclause=yes name=user_id dbname="rap_activities.user_id" ) column=(type=cDAT*har(12) updatewhereclause=yes name=value dbname="rap_activities.value" ) column=(type=char(255) updatewhereclause=yes name=comment_text dbname="rap_activities.comment_text" ) column=(type=char(1) updatewhereclause=yes name=confidential_flag dbname="rap_activities.confidential_flag" ) column=(type=char(4) updatewhereclause=yes name=data_code dbname="rap_activities.data_code" ) column=(type=datetime updatewhereclause=yes name=end_date_time dbname="rap_activities.end_date_time" ) column=(tyDAT*pe=char(12) updatewhereclause=yes name=material_code dbname="rap_activities.material_code" ) column=(type=char(2) updatewhereclause=yes name=method_type dbname="rap_activities.method_type" ) column=(type=char(12) updatewhereclause=yes name=reference_code dbname="rap_activities.reference_code" ) column=(type=char(6) updatewhereclause=yes name=reference_type dbname="rap_activities.reference_type" ) column=(type=decimal(11) updatewhereclause=yes name=value_amt dbname="rap_activities.value_amtDAT*" ) column=(type=char(3) updatewhereclause=yes name=value_type dbname="rap_activities.value_type" ) column=(type=char(8) updatewhereclause=yes name=value_unit_code dbname="rap_activities.value_unit_code" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"v_rap_ss_scc~" ) TABLE(NAME=~"rap_activities~" ) TABLE(NAME=~"rap_streams~" ) COLUMN(NAME=~"v_rap_ss_scc.state_rid~") COLUMN(NAME=~"v_rap_ss_scc.county_rid~") COLUMN(NAME=~"v_rap_ss_scc.scc_code~") COLUMN(NAME=~"rap_activities.rid~") COLUMN(NDAT*AME=~"rap_activities.creation_date_time~") COLUMN(NAME=~"rap_activities.metric_code~") COLUMN(NAME=~"rap_activities.metric_level_type~") COLUMN(NAME=~"rap_activities.ref_rid~") COLUMN(NAME=~"rap_activities.start_date_time~") COLUMN(NAME=~"rap_activities.user_id~") COLUMN(NAME=~"rap_activities.value~") COLUMN(NAME=~"rap_activities.comment_text~") COLUMN(NAME=~"rap_activities.confidential_flag~") COLUMN(NAME=~"rap_activities.data_code~") COLUMN(NAME=~"rap_activities.end_date_time~") COLUMN(NAME=~"raDAT*p_activities.material_code~") COLUMN(NAME=~"rap_activities.method_type~") COLUMN(NAME=~"rap_activities.reference_code~") COLUMN(NAME=~"rap_activities.reference_type~") COLUMN(NAME=~"rap_activities.value_amt~") COLUMN(NAME=~"rap_activities.value_type~") COLUMN(NAME=~"rap_activities.value_unit_code~") JOIN (LEFT=~"rap_streams.rid~" OP =~"=~"RIGHT=~"rap_activities.ref_rid~" ) JOIN (LEFT=~"rap_streams.from_process_rid~" OP =~"=~"RIGHT=~"v_rap_ss_scc.source_sub2_rid~" )WHERE( EXP1 =~"rapDAT*_activities.reference_code~" OP =~"=~" EXP2 =~":as_referenceCode~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_activities.start_date_time~" OP =~">=~" EXP2 =~":adt_startDateTime~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_activities.end_date_time~" OP =~"<=~" EXP2 =~":adt_endDateTime~" ) ) ORDER(NAME=~"v_rap_ss_scc.county_rid~" ASC=yes ) ORDER(NAME=~"v_rap_ss_scc.scc_code~" ASC=yes ) ORDER(NAME=~"rap_activities.material_code~" ASC=yes ) ARG(NAME = ~"adt_startDateTime~" TYPE = datetiDAT*me) ARG(NAME = ~"adt_endDateTime~" TYPE = datetime) ARG(NAME = ~"as_referenceCode~" TYPE = string) ARG(NAME = ~"al_nationArray~" TYPE = numberlist) ARG(NAME = ~"al_stateArray~" TYPE = numberlist) ARG(NAME = ~"al_countyArray~" TYPE = numberlist) ARG(NAME = ~"al_sourceArray~" TYPE = numberlist) ARG(NAME = ~"al_sourceSub1Array~" TYPE = numberlist) ARG(NAME = ~"al_sourceSub2Array~" TYPE = numberlist) " arguments=(("adt_startDateTime", datetime),("adt_endDateTime", datetime),("as_referenceCode"DAT*, string),("al_nationArray", numberlist),("al_stateArray", numberlist),("al_countyArray", numberlist),("al_sourceArray", numberlist),("al_sourceSub1Array", numberlist),("al_sourceSub2Array", numberlist)) ) text(band=header alignment="2" text="State Rid"border="0" color="0" x="9" y="4" height="128" width="320" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" texDAT*t="Activity Rid"border="0" color="0" x="1102" y="4" height="128" width="311" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Creation Date Time"border="0" color="0" x="1422" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912"DAT* ) text(band=header alignment="2" text="Metric Code"border="0" color="0" x="1856" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Metric Level Type"border="0" color="0" x="2290" y="4" height="128" width="471" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mDAT*ode="1" background.color="536870912" ) text(band=header alignment="2" text="Ref Rid"border="0" color="0" x="2770" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Start Date Time"border="0" color="0" x="3095" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2"DAT* font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="User Id"border="0" color="0" x="3529" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value"border="0" color="0" x="3854" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.familDAT*y="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Comment Text"border="0" color="0" x="4178" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Confidential Flag"border="0" color="0" x="4613" y="4" height="128" width="425" font.face="Arial" font.heighDAT*t="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Data Code"border="0" color="0" x="5047" y="4" height="128" width="206" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="End Date Time"border="0" color="0" x="5262" y="4" height="128" width="421"DAT* font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Material Code"border="0" color="0" x="5691" y="4" height="128" width="430" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Method Type"border="0" color="0" x="6130DAT*" y="4" height="128" width="206" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Reference Code"border="0" color="0" x="6345" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="ReferenDAT*ce Type"border="0" color="0" x="6779" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Amt"border="0" color="0" x="7104" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=heaDAT*der alignment="2" text="Value Type"border="0" color="0" x="7429" y="4" height="128" width="206" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Unit Code"border="0" color="0" x="7643" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.cDAT*olor="536870912" ) text(band=header alignment="2" text="County Rid"border="0" color="0" x="338" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Scc Code"border="0" color="0" x="663" y="4" height="128" width="430" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" backgrouDAT*nd.mode="1" background.color="536870912" ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="9" y="4" height="64" width="320" format="[general]" name=state_rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=32766 border="0" color="0" x="1102" y="4" height="64" widDAT*th="311" format="[general]" name=rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=5 alignment="0" tabsequence=32766 border="0" color="0" x="1422" y="4" height="64" width="425" format="[shortdate] [time]" name=creation_date_time edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weiDAT*ght="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=6 alignment="0" tabsequence=32766 border="0" color="0" x="1856" y="4" height="64" width="425" format="[general]" name=metric_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=7 alignment="DAT*0" tabsequence=32766 border="0" color="0" x="2290" y="4" height="64" width="471" format="[general]" name=metric_level_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=8 alignment="0" tabsequence=32766 border="0" color="0" x="2770" y="4" height="64" width="315" format="[general]" name=ref_rid edit.limit=0 edit.case=anyDAT* edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=9 alignment="0" tabsequence=32766 border="0" color="0" x="3095" y="4" height="64" width="425" format="[shortdate] [time]" name=start_date_time edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" backgrouDAT*nd.mode="1" background.color="536870912" ) column(band=detail id=10 alignment="0" tabsequence=32766 border="0" color="0" x="3529" y="4" height="64" width="315" format="[general]" name=user_id edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=11 alignment="0" tabsequence=32766 border="0" color="0" x="3854" y="4" height="64" DAT* width="315" format="[general]" name=value edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=12 alignment="0" tabsequence=32766 border="0" color="0" x="4178" y="4" height="64" width="425" format="[general]" name=comment_text edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400"DAT*  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=13 alignment="0" tabsequence=32766 border="0" color="0" x="4613" y="4" height="64" width="425" format="[general]" name=confidential_flag edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=14 alignment="0DAT*" tabsequence=32766 border="0" color="0" x="5047" y="4" height="64" width="206" format="[general]" name=data_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=15 alignment="0" tabsequence=32766 border="0" color="0" x="5262" y="4" height="64" width="421" format="[shortdate] [time]" name=end_date_time edit.limit=0 edit.cDAT*ase=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=16 alignment="0" tabsequence=32766 border="0" color="0" x="5691" y="4" height="64" width="430" format="[general]" name=material_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.DAT*mode="1" background.color="536870912" ) column(band=detail id=17 alignment="0" tabsequence=32766 border="0" color="0" x="6130" y="4" height="64" width="206" format="[general]" name=method_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=18 alignment="0" tabsequence=32766 border="0" color="0" x="6345" y="4" height="64"DAT* width="425" format="[general]" name=reference_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=19 alignment="0" tabsequence=32766 border="0" color="0" x="6779" y="4" height="64" width="315" format="[general]" name=reference_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.DAT*weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=20 alignment="0" tabsequence=32766 border="0" color="0" x="7104" y="4" height="64" width="315" format="[general]" name=value_amt edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=21 alignmenDAT*t="0" tabsequence=32766 border="0" color="0" x="7429" y="4" height="64" width="206" format="[general]" name=value_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=22 alignment="0" tabsequence=32766 border="0" color="0" x="7643" y="4" height="64" width="425" format="[general]" name=value_unit_code edit.limit=0 edit.casDAT*e=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="0" tabsequence=32766 border="0" color="0" x="338" y="4" height="64" width="315" format="[general]" name=county_rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1DAT*" background.color="536870912" ) column(band=detail id=3 alignment="0" tabsequence=32766 border="0" color="0" x="663" y="4" height="64" width="430" format="[general]" name=scc_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*PDW08004pdwPl$#````I F$4nn``DAT* / @@DAT*"$ 536870912@H   (" base_year< $ 0% MS Sans SerifMS Sans Serif$DAT*$2$-8$700$1$18$4$@64$7311& ! [General] [General]@%(DAT*&.-+, og& S':an_projectedYearLowerBound:an_projectedYearUpperBound)*an_projectedYearLowerBoundan_projectedYearUpperBouDAT*(nd base_yearrap_growth_factors.base_yearPBSELECT( VERSION(400) DISTINCT ()TABLE(NAME="rap_growth_factors" ) COLUMN(NAME="rap_growth_factors.base_year")WHERE( EXP1 ="rap_growth_factors.projected_year" OP =">=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.projected_year" OP ="<=" EXP2 ="" ) ) ORDER(NAME="rap_growth_factors.base_year" ASC=yes ) ARG(NAME = "an_projectedYearLowerBound" TYPE = number) ARG(NAME = "an_projectedYearUpperBoDAT*yund" TYPE = number) 02 "1no"3yesDAT*,release 6; datawindow(units=0 timer_interval=0 color=16777215 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(type=decimal(0) updatewhereclause=yes name=base_year dDAT*.bname="rap_growth_factors.base_year" ) retrieve="PBSELECT( VERSION(400) DISTINCT ()TABLE(NAME=~"rap_growth_factors~" ) COLUMN(NAME=~"rap_growth_factors.base_year~")WHERE( EXP1 =~"rap_growth_factors.projected_year~" OP =~">=~" EXP2 =~":an_projectedYearLowerBound~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.projected_year~" OP =~"<=~" EXP2 =~":an_projectedYearUpperBound~" ) ) ORDER(NAME=~"rap_growth_factors.base_year~" ASC=yes ) ARG(NAME = ~"an_projectedYearLowerBound~" DAT*0TYPE = number) ARG(NAME = ~"an_projectedYearUpperBound~" TYPE = number) " arguments=(("an_projectedYearLowerBound", number),("an_projectedYearUpperBound", number)) ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="18" y="4" height="64" width="311" format="[General]" name=base_year edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" backgrDAT*ound.mode="1" background.color="536870912" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*4PDW0800pdwPl_````` F$nnaaDAT*6 @IV` DAT*8  state_rid_t< $0%  MS Sans SerifMS Sans Serif$ 2$-8$700$1$ 536870912$ DAT*:9$8$553$s526%Geographic StateGeographic State`)! "$& county_rid_t$#w 544$%};571%'(Geographic CountyGeographic County`2 *DAT*< +-/scc_ams_code_t$,e1125$.^430%01 Scc Ams Code Scc Ams Code`;)3 468material_code_t$5V1563$7[416%9:Material CodeMaterial Code`DDAT*>2< =?Afactor_type_t$>1989$@Oi361%BC Factor Type Factor Type`M;E FHJ base_year_t$G7 2359$IC2306%KL Base Year Base YeaDAT*@r`VDN OQSprojected_year_t$PIr 2674$Rb448%TUProjected YearProjected Year`MW XZ\growth_factor_t$Y; 3131$[]425%]^DAT*BGrowth FactorGrowth Factor@@Iawb`ckmoqs (v state_rid<d g i%efArialArial$h-10$jDAT*D400$l 9$n4$pA65$rs526&tu [General] [General]ax`cymo{}( scc_ams_code$ze1125$|^430&~DAT*F [general] [general]w`cmo}(( material_code$V1563$[417`cmo}2( factor_type$1989$ODAT*Hj362`cmos<( base_year$7 2359$C3307`cmosF(projected_year$Ir 2674$bDAT*J449`cmosP(growth_factor$; 3131$]426`cmos( county_rid$w 544$}<572DAT*L@D a DAT*N w     @4 :an_stateRid:an_countyRiDAT*Pd:as_sccAmsCode:as_materialCode :as_baseYear:as_projectedYear4 an_stateRid an_countyRidas_sccAmsCodeas_materialCode as_baseYearas_projectedYearrap_growth_factors state_ridrap_growth_factors.state_rida county_ridrap_growth_factors.county_rid scc_ams_code rap_growth_factors.scc_ams_codewmDAT*Raterial_code!rap_growth_factors.material_code factor_typerap_growth_factors.factor_type base_yearrap_growth_factors.base_yearprojected_year"rap_growth_factors.projected_yeargrowth_factor!rap_growth_factors.growth_factorPBSELECT( VERSION(400) TABLE(NAME="rap_growth_factors" ) COLUMN(NAME="rap_growth_factors.state_rid") COLUMN(NAME="rap_growth_factors.countDAT*Ty_rid") COLUMN(NAME="rap_growth_factors.scc_ams_code") COLUMN(NAME="rap_growth_factors.material_code") COLUMN(NAME="rap_growth_factors.factor_type") COLUMN(NAME="rap_growth_factors.base_year") COLUMN(NAME="rap_growth_factors.projected_year") COLUMN(NAME="rap_growth_factors.growth_factor")WHERE( EXP1 ="rap_growth_factors.state_rid" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.county_rid" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.DAT* scc_ams_code" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.material_code" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.base_year" OP ="=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.projected_year" OP ="=" EXP2 ="" ) ) ORDER(NAME="rap_growth_factors.factor_type" ASC=no) ARG(NAME = "an_stateRid" TYPE = number) ARG(NAME = "an_countyRid" TYPE = number) ARG(NAME = "as_sccAmsCode" TYPE = string) ARG(NAME =DAT*Xrelease 5; datawindow(units=0 timer_interval=0 color=16777215 processing=1 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no grid.lines=0 ) header(height=73 color="536870912" ) summary(height=1 color="536870912" ) footer(height=1 color="536870912" ) detail(height=73 color="536870912" ) table(column=(type=decimal(0) update=yes updatewhereclause=DAT*Zyes key=yes name=state_rid dbname="rap_growth_factors.state_rid" ) column=(type=decimal(0) update=yes updatewhereclause=yes key=yes name=county_rid dbname="rap_growth_factors.county_rid" ) column=(type=char(10) update=yes updatewhereclause=yes key=yes name=scc_ams_code dbname="rap_growth_factors.scc_ams_code" ) column=(type=char(12) update=yes updatewhereclause=yes key=yes name=material_code dbname="rap_growth_factors.material_code" ) column=(type=char(1) update=yes updatewhereclause=yes kDAT*\ey=yes name=factor_type dbname="rap_growth_factors.factor_type" ) column=(type=decimal(0) update=yes updatewhereclause=yes key=yes name=base_year dbname="rap_growth_factors.base_year" ) column=(type=decimal(0) update=yes updatewhereclause=yes key=yes name=projected_year dbname="rap_growth_factors.projected_year" ) column=(type=decimal(4) update=yes updatewhereclause=yes name=growth_factor dbname="rap_growth_factors.growth_factor" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"rap_growth_fDAT*^actors~" ) COLUMN(NAME=~"rap_growth_factors.state_rid~") COLUMN(NAME=~"rap_growth_factors.county_rid~") COLUMN(NAME=~"rap_growth_factors.scc_ams_code~") COLUMN(NAME=~"rap_growth_factors.material_code~") COLUMN(NAME=~"rap_growth_factors.factor_type~") COLUMN(NAME=~"rap_growth_factors.base_year~") COLUMN(NAME=~"rap_growth_factors.projected_year~") COLUMN(NAME=~"rap_growth_factors.growth_factor~")WHERE( EXP1 =~"rap_growth_factors.state_rid~" OP =~"=~" EXP2 =~":an_stateRid~" LOGIC =~"and~" DAT*`) WHERE( EXP1 =~"rap_growth_factors.county_rid~" OP =~"=~" EXP2 =~":an_countyRid~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.scc_ams_code~" OP =~"=~" EXP2 =~":as_sccAmsCode~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.material_code~" OP =~"=~" EXP2 =~":as_materialCode~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.base_year~" OP =~"=~" EXP2 =~":as_baseYear~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.projected_year~" ODAT*bP =~"=~" EXP2 =~":as_projectedYear~" ) ) ORDER(NAME=~"rap_growth_factors.factor_type~" ASC=no) ARG(NAME = ~"an_stateRid~" TYPE = number) ARG(NAME = ~"an_countyRid~" TYPE = number) ARG(NAME = ~"as_sccAmsCode~" TYPE = string) ARG(NAME = ~"as_materialCode~" TYPE = string) ARG(NAME = ~"as_baseYear~" TYPE = number) ARG(NAME = ~"as_projectedYear~" TYPE = number) " update="rap_growth_factors" updatewhere=1 updatekeyinplace=no arguments=(("an_stateRid", number),("an_countyRid", number),("as_sccAmsDAT*dCode", string),("as_materialCode", string),("as_baseYear", number),("as_projectedYear", number)) ) text(band=header alignment="2" text="Geographic State"border="0" color="0" x="10" y="8" height="53" width="526" name=state_rid_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Geographic County"border="0" color="0" x="545" y="8" height="53" width="DAT*f572" name=county_rid_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Scc Ams Code"border="0" color="0" x="1125" y="8" height="53" width="430" name=scc_ams_code_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header aligDAT*hnment="2" text="Material Code"border="0" color="0" x="1564" y="8" height="53" width="417" name=material_code_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Factor Type"border="0" color="0" x="1989" y="8" height="53" width="362" name=factor_type_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" fontDAT*j.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Base Year"border="0" color="0" x="2359" y="8" height="53" width="307" name=base_year_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Projected Year"border="0" color="0" x="2675" y="8" height="53" width="449" name=projected_year_t font.face="MSDAT*l Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Growth Factor"border="0" color="0" x="3132" y="8" height="53" width="426" name=growth_factor_t font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=1 alignment="1" tabsequence=10 bordDAT*ner="0" color="0" x="10" y="4" height="65" width="526" format="[General]" name=state_rid edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="0" tabsequence=30 border="0" color="0" x="1125" y="4" height="65" width="430" format="[general]" name=scc_ams_code edit.limit=10 eDAT*pdit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=40 border="0" color="0" x="1564" y="4" height="65" width="417" format="[general]" name=material_code edit.limit=12 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.hDAT*reight="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=5 alignment="0" tabsequence=50 border="0" color="0" x="1989" y="4" height="65" width="362" format="[general]" name=factor_type edit.limit=1 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" backgrDAT*tound.color="536870912" ) column(band=detail id=6 alignment="1" tabsequence=60 border="0" color="0" x="2359" y="4" height="65" width="307" format="[General]" name=base_year edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=7 alignment="1" tabsequence=70 border="0" color="0" x="2675DAT*v" y="4" height="65" width="449" format="[General]" name=projected_year edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=8 alignment="1" tabsequence=80 border="0" color="0" x="3132" y="4" height="65" width="426" format="[General]" name=growth_factor edit.limit=0 edit.case=any editDAT*x.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="1" tabsequence=20 border="0" color="0" x="545" y="4" height="65" width="572" format="[General]" name=county_rid edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-10" font.weighDAT*ot="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) DAT*|PDW0800pdwPlrq```` F$nnaaDAT*~ @`DAT* < $0% ArialArial$ 2$ -10$700$1$ 536870912$ 9$DAT*4$128$F@320% State Rid State Rid`'  "$$!N1102$#D7311%%& Activity Rid Activity Rid`/ (*,DAT*$)71422$+]425%-.Creation Date TimeCreation Date Time`7' 024$1@1856$3]425%56 Metric Code Metric Code`?/ 8:<$9DAT*2290$;g471%=>Metric Level TypeMetric Level Type`G7 @BD$A^ 2770$CE;315%EFRef RidRef Rid`O? HJL$IDAT* 3095$K]425%MNStart Date TimeStart Date Time`WG PRT$Q 3529$SE;315%UVUser IdUser Id`_O XZ\$YK3854DAT*$[E;315%]^ValueValue`gW `bd$aR4178$c]425%ef Comment Text Comment Text`o_ hjl$i4613$k]DAT*425%mnConfidential FlagConfidential Flag`wg prt$qP5047$s-206%uv Data Code Data Code`o xz|$y5262${\421%DAT*}~End Date TimeEnd Date Time`w $;5691$^430%Material CodeMaterial Code` $=6130$-206%DAT* Method Type Method Type` $l6345$]425%Reference CodeReference Code` ${6779$E;315%DAT*Reference TypeReference Type` $7104$E;315% Value Amt Value Amt` $Y7429$-206% Value Type ValDAT*ue Type` $7643$]425%Value Unit CodeValue Unit Code` $JR338$E;315% County Rid County Rid`DAT* $663$^430% Scc Code Scc Code@@Hj DAT*state_rid< $400$ 9$@64$F@320& [general] [general] rid$N1102$DAT*D7311 creation_date_time$71422$]425&[shortdate] [time][shortdate] [time] DAT* metric_code$@1856$]425& [general] [general] metric_level_type$2290$g471DAT* ref_rid$^ 2770$E;315  start_date_time$ 3095$]425   DAT*  user_id$  3529$ E;315  value$K3854$E;315  DAT* comment_text$R4178$]425$!  #confidential_flag$ 4613$"]425+%&( DAT** data_code$'P5047$)-2062$,-/ 1end_date_time$.5262$0\4219+346 8DAT*material_code$5;5691$7^430@2:;= ? method_type$<=6130$>-206G9ABD FDAT*reference_code$Cl6345$E]425N@HIK Mreference_type$J{6779$LE;315UGOPR T value_DAT*amt$Q7104$SE;315\NVWY [ value_type$XY7429$Z-206cU]^` bvalue_unit_code$DAT*_7643$a]425j\deg i county_rid$fJR338$hE;315ckln p scc_code$mDAT*663$o^430@sw@DAT* c j   @ @@ @DAT* @ @ @ @ @$@+ @2 @9DAT*@@ @G@N @U@\ @tuv:as_referenceCode:adt_startDateTime:adt_endDateTimeL gexyz{DAT*|}~adt_startDateTimeadt_endDateTimeas_referenceCodeal_nationArrayal_stateArrayal_countyArrayal_sourceArrayal_sourceSub1Arrayal_sourceSub2Arrayrap_activities state_ridv_rap_ss_scc.state_rid county_ridv_rap_ss_scc.county_ridc scc_codev_rap_ss_scc.scc_codejridrap_activities.ridcreation_DAT*date_time"rap_activities.creation_date_time metric_coderap_activities.metric_codemetric_level_type!rap_activities.metric_level_typeref_ridrap_activities.ref_ridstart_date_timerap_activities.start_date_timeuser_idrap_activities.user_idvaluerap_activities.value comment_textrap_activities.commDAT*ent_textconfidential_flag!rap_activities.confidential_flag data_coderap_activities.data_code$end_date_timerap_activities.end_date_time+material_coderap_activities.material_code2 method_typerap_activities.method_type9reference_coderap_activities.reference_code@reference_typerap_activities.reference_tDAT*ypeG value_amtrap_activities.value_amtN value_typerap_activities.value_typeUvalue_unit_coderap_activities.value_unit_code\PBSELECT( VERSION(400) TABLE(NAME="v_rap_ss_scc" ) TABLE(NAME="rap_activities" ) TABLE(NAME="rap_streams" ) COLUMN(NAME="v_rap_ss_scc.state_rid") COLUMN(NAME="v_rap_ss_scc.county_rid") COLUMN(NAME="v_rap_ss_scc.scc_code") COLUMN(NAME="rap_activities.rid") COLUMN(NAME="DAT*rap_activities.creation_date_time") COLUMN(NAME="rap_activities.metric_code") COLUMN(NAME="rap_activities.metric_level_type") COLUMN(NAME="rap_activities.ref_rid") COLUMN(NAME="rap_activities.start_date_time") COLUMN(NAME="rap_activities.user_id") COLUMN(NAME="rap_activities.value") COLUMN(NAME="rap_activities.comment_text") COLUMN(NAME="rap_activities.confidential_flag") COLUMN(NAME="rap_activities.data_code") COLUMN(NAME="rap_activities.end_date_time") COLUMN(NAME="rap_activities.material_code")DAT* COLUMN(NAME="rap_activities.method_type") COLUMN(NAME="rap_activities.reference_code") COLUMN(NAME="rap_activities.reference_type") COLUMN(NAME="rap_activities.value_amt") COLUMN(NAME="rap_activities.value_type") COLUMN(NAME="rap_activities.value_unit_code") JOIN (LEFT="rap_streams.rid" OP ="="RIGHT="rap_activities.ref_rid" ) JOIN (LEFT="rap_streams.from_process_rid" OP ="="RIGHT="v_rap_ss_scc.source_sub2_rid" )WHERE( EXP1 ="rap_activities.reference_code" OP ="=" EXP2 =" " DAT*  LOGIC ="and" ) WHERE( EXP1 ="rap_activities.start_date_time" OP =">=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_activities.end_date_time" OP ="<=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_activities.reference_type" OP ="=" EXP2 ="'GROWTH'" ) ) ORDER(NAME="v_rap_ss_scc.state_rid" ASC=yes ) ORDER(NAME="v_rap_ss_scc.county_rid" ASC=yes ) ORDER(NAME="v_rap_ss_scc.scc_code" ASC=yes ) ORDER(NAME="rap_activities.material_code" ASC=yes ) ARG(NAME = "adt_startDateTime" DAT*release 6; datawindow(units=0 timer_interval=0 color=16777215 processing=1 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 ) header(height=148 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(tyDAT*pe=decimal(0) updatewhereclause=yes name=state_rid dbname="v_rap_ss_scc.state_rid" ) column=(type=decimal(0) updatewhereclause=yes name=county_rid dbname="v_rap_ss_scc.county_rid" ) column=(type=char(10) updatewhereclause=yes name=scc_code dbname="v_rap_ss_scc.scc_code" ) column=(type=decimal(0) update=yes updatewhereclause=yes key=yes name=rid dbname="rap_activities.rid" ) column=(type=datetime update=yes updatewhereclause=yes name=creation_date_time dbname="rap_activities.creation_date_tDAT*ime" ) column=(type=char(12) update=yes updatewhereclause=yes name=metric_code dbname="rap_activities.metric_code" ) column=(type=char(3) update=yes updatewhereclause=yes name=metric_level_type dbname="rap_activities.metric_level_type" ) column=(type=decimal(0) update=yes updatewhereclause=yes name=ref_rid dbname="rap_activities.ref_rid" ) column=(type=datetime update=yes updatewhereclause=yes name=start_date_time dbname="rap_activities.start_date_time" ) column=(type=char(4) update=yes DAT*updatewhereclause=yes name=user_id dbname="rap_activities.user_id" ) column=(type=char(12) update=yes updatewhereclause=yes name=value dbname="rap_activities.value" ) column=(type=char(255) update=yes updatewhereclause=yes name=comment_text dbname="rap_activities.comment_text" ) column=(type=char(1) update=yes updatewhereclause=yes name=confidential_flag dbname="rap_activities.confidential_flag" ) column=(type=char(4) update=yes updatewhereclause=yes name=data_code dbname="rap_activities.dDAT*ata_code" ) column=(type=datetime update=yes updatewhereclause=yes name=end_date_time dbname="rap_activities.end_date_time" ) column=(type=char(12) update=yes updatewhereclause=yes name=material_code dbname="rap_activities.material_code" ) column=(type=char(2) update=yes updatewhereclause=yes name=method_type dbname="rap_activities.method_type" ) column=(type=char(12) update=yes updatewhereclause=yes name=reference_code dbname="rap_activities.reference_code" ) column=(type=char(6) updateDAT*=yes updatewhereclause=yes name=reference_type dbname="rap_activities.reference_type" ) column=(type=decimal(11) update=yes updatewhereclause=yes name=value_amt dbname="rap_activities.value_amt" ) column=(type=char(3) update=yes updatewhereclause=yes name=value_type dbname="rap_activities.value_type" ) column=(type=char(8) update=yes updatewhereclause=yes name=value_unit_code dbname="rap_activities.value_unit_code" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"v_rap_ss_scc~" ) TABLE(NAMDAT*E=~"rap_activities~" ) TABLE(NAME=~"rap_streams~" ) COLUMN(NAME=~"v_rap_ss_scc.state_rid~") COLUMN(NAME=~"v_rap_ss_scc.county_rid~") COLUMN(NAME=~"v_rap_ss_scc.scc_code~") COLUMN(NAME=~"rap_activities.rid~") COLUMN(NAME=~"rap_activities.creation_date_time~") COLUMN(NAME=~"rap_activities.metric_code~") COLUMN(NAME=~"rap_activities.metric_level_type~") COLUMN(NAME=~"rap_activities.ref_rid~") COLUMN(NAME=~"rap_activities.start_date_time~") COLUMN(NAME=~"rap_activities.user_id~") COLUMN(NAME=~"rap_acDAT*tivities.value~") COLUMN(NAME=~"rap_activities.comment_text~") COLUMN(NAME=~"rap_activities.confidential_flag~") COLUMN(NAME=~"rap_activities.data_code~") COLUMN(NAME=~"rap_activities.end_date_time~") COLUMN(NAME=~"rap_activities.material_code~") COLUMN(NAME=~"rap_activities.method_type~") COLUMN(NAME=~"rap_activities.reference_code~") COLUMN(NAME=~"rap_activities.reference_type~") COLUMN(NAME=~"rap_activities.value_amt~") COLUMN(NAME=~"rap_activities.value_type~") COLUMN(NAME=~"rap_activities.valDAT*ue_unit_code~") JOIN (LEFT=~"rap_streams.rid~" OP =~"=~"RIGHT=~"rap_activities.ref_rid~" ) JOIN (LEFT=~"rap_streams.from_process_rid~" OP =~"=~"RIGHT=~"v_rap_ss_scc.source_sub2_rid~" )WHERE( EXP1 =~"rap_activities.reference_code~" OP =~"=~" EXP2 =~":as_referenceCode ~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_activities.start_date_time~" OP =~">=~" EXP2 =~":adt_startDateTime~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_activities.end_date_time~" OP =~"<=~" EXP2 =~":adDAT*t_endDateTime~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_activities.reference_type~" OP =~"=~" EXP2 =~"'GROWTH'~" ) ) ORDER(NAME=~"v_rap_ss_scc.state_rid~" ASC=yes ) ORDER(NAME=~"v_rap_ss_scc.county_rid~" ASC=yes ) ORDER(NAME=~"v_rap_ss_scc.scc_code~" ASC=yes ) ORDER(NAME=~"rap_activities.material_code~" ASC=yes ) ARG(NAME = ~"adt_startDateTime~" TYPE = datetime) ARG(NAME = ~"adt_endDateTime~" TYPE = datetime) ARG(NAME = ~"as_referenceCode~" TYPE = string) ARG(NAME = ~"al_nationArray~"DAT* TYPE = numberlist) ARG(NAME = ~"al_stateArray~" TYPE = numberlist) ARG(NAME = ~"al_countyArray~" TYPE = numberlist) ARG(NAME = ~"al_sourceArray~" TYPE = numberlist) ARG(NAME = ~"al_sourceSub1Array~" TYPE = numberlist) ARG(NAME = ~"al_sourceSub2Array~" TYPE = numberlist) " update="rap_activities" updatewhere=2 updatekeyinplace=yes arguments=(("adt_startDateTime", datetime),("adt_endDateTime", datetime),("as_referenceCode", string),("al_nationArray", numberlist),("al_stateArray", numberlist),(DAT*"al_countyArray", numberlist),("al_sourceArray", numberlist),("al_sourceSub1Array", numberlist),("al_sourceSub2Array", numberlist)) ) text(band=header alignment="2" text="State Rid"border="0" color="0" x="9" y="4" height="128" width="320" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Activity Rid"border="0" color="0" x="1102" y="4" height="128" width="DAT*311" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Creation Date Time"border="0" color="0" x="1422" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Metric Code"border="0" color="0DAT*" x="1856" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Metric Level Type"border="0" color="0" x="2290" y="4" height="128" width="471" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" tDAT*ext="Ref Rid"border="0" color="0" x="2770" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Start Date Time"border="0" color="0" x="3095" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) teDAT*xt(band=header alignment="2" text="User Id"border="0" color="0" x="3529" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value"border="0" color="0" x="3854" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.colDAT*or="536870912" ) text(band=header alignment="2" text="Comment Text"border="0" color="0" x="4178" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Confidential Flag"border="0" color="0" x="4613" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="DAT*0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Data Code"border="0" color="0" x="5047" y="4" height="128" width="206" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="End Date Time"border="0" color="0" x="5262" y="4" height="128" width="421" font.face="Arial" font.height="-10" font.weight="700" font.family="2"DAT* font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Material Code"border="0" color="0" x="5691" y="4" height="128" width="430" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Method Type"border="0" color="0" x="6130" y="4" height="128" width="206" font.face="Arial" font.height="-10" foDAT*nt.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Reference Code"border="0" color="0" x="6345" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Reference Type"border="0" color="0" x="6779" y="4" height="128" width="315" foDAT*nt.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Amt"border="0" color="0" x="7104" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Type"border="0" color="0" x="7429" y="4" hDAT*eight="128" width="206" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Unit Code"border="0" color="0" x="7643" y="4" height="128" width="425" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="County Rid"bordDAT*er="0" color="0" x="338" y="4" height="128" width="315" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Scc Code"border="0" color="0" x="663" y="4" height="128" width="430" font.face="Arial" font.height="-10" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=1 aligDAT*nment="0" tabsequence=32766 border="0" color="0" x="9" y="4" height="64" width="320" format="[general]" name=state_rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=32766 border="0" color="0" x="1102" y="4" height="64" width="311" format="[general]" name=rid edit.limit=0 edit.case=any edit.auDAT*toselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=5 alignment="0" tabsequence=32766 border="0" color="0" x="1422" y="4" height="64" width="425" format="[shortdate] [time]" name=creation_date_time edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.moDAT*de="1" background.color="536870912" ) column(band=detail id=6 alignment="0" tabsequence=32766 border="0" color="0" x="1856" y="4" height="64" width="425" format="[general]" name=metric_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=7 alignment="0" tabsequence=32766 border="0" color="0" x="2290" y="4" height="64" widDAT*th="471" format="[general]" name=metric_level_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=8 alignment="0" tabsequence=32766 border="0" color="0" x="2770" y="4" height="64" width="315" format="[general]" name=ref_rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="4DAT*00" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=9 alignment="0" tabsequence=32766 border="0" color="0" x="3095" y="4" height="64" width="425" format="[shortdate] [time]" name=start_date_time edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=10 aliDAT*gnment="0" tabsequence=32766 border="0" color="0" x="3529" y="4" height="64" width="315" format="[general]" name=user_id edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=11 alignment="0" tabsequence=32766 border="0" color="0" x="3854" y="4" height="64" width="315" format="[general]" name=value edit.limit=0 edit.case=any edDAT*it.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=12 alignment="0" tabsequence=32766 border="0" color="0" x="4178" y="4" height="64" width="425" format="[general]" name=comment_text edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" baDAT*ckground.color="536870912" ) column(band=detail id=13 alignment="0" tabsequence=32766 border="0" color="0" x="4613" y="4" height="64" width="425" format="[general]" name=confidential_flag edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=14 alignment="0" tabsequence=32766 border="0" color="0" x="5047" y="4" height="64" widtDAT*h="206" format="[general]" name=data_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=15 alignment="0" tabsequence=32766 border="0" color="0" x="5262" y="4" height="64" width="421" format="[shortdate] [time]" name=end_date_time edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weDAT*ight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=16 alignment="0" tabsequence=32766 border="0" color="0" x="5691" y="4" height="64" width="430" format="[general]" name=material_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=17 alignmDAT*ent="0" tabsequence=32766 border="0" color="0" x="6130" y="4" height="64" width="206" format="[general]" name=method_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=18 alignment="0" tabsequence=32766 border="0" color="0" x="6345" y="4" height="64" width="425" format="[general]" name=reference_code edit.limit=0 edit.cDAT*ase=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=19 alignment="0" tabsequence=32766 border="0" color="0" x="6779" y="4" height="64" width="315" format="[general]" name=reference_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" backgroundDAT* .mode="1" background.color="536870912" ) column(band=detail id=20 alignment="0" tabsequence=32766 border="0" color="0" x="7104" y="4" height="64" width="315" format="[general]" name=value_amt edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=21 alignment="0" tabsequence=32766 border="0" color="0" x="7429" y="4" height="64" DAT* width="206" format="[general]" name=value_type edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=22 alignment="0" tabsequence=32766 border="0" color="0" x="7643" y="4" height="64" width="425" format="[general]" name=value_unit_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weigDAT*ht="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="0" tabsequence=32766 border="0" color="0" x="338" y="4" height="64" width="315" format="[general]" name=county_rid edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="0" DAT*tabsequence=32766 border="0" color="0" x="663" y="4" height="64" width="430" format="[general]" name=scc_code edit.limit=0 edit.case=any edit.autoselect=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*PDW0800pdwPlrq```` F$nnaaDAT* @@DAT*$ 536870912@(i`%  "< $ 0%  MS Sans SerifMS Sans Serif$2$DAT*-8$700$1$ 553648127$8388608$18$4$@64$!N334%#$ Base Year: Base Year:`- &(*DAT*$'t116$)457%+,Projected Year:Projected Year:`7% .024$/228$1p112$3475%56Input Data Reference Code:Input Data Reference Code:`=-DAT* 802:$9t372%;<Output Data Reference Code:Output Data Reference Code:V7>?G IK MO 0 R base_year< @CE%ABArialArial$D-10$FDAT*400$H 16777215$J512$L439$N5&PQ [general] [general]STUdd_growth_base_year_dddw base_year base_year\=W?G I&K MO0 Xprojected_yearYZ[dDAT* d_growth_projected_year_dddwprojected_yearprojected_yeariV]?G I^` Mb0 einput_reference$_260$a640&cd [general] [general]fghdd_growth_reference_code_dddwcodecode\j?G DAT*"Ik` Mb(0 moutput_reference$l404nopdd_growth_reference_code_dddwcodecode@DDAT*$u=stxVvw{\yz!~i|}! base_year base_year=projected_yearprojected_yearVinput_referenceinputDAT*_reference\output_referenceoutput_referencei "no"yesDAT*(release 6; datawindow(units=0 timer_interval=0 color=79741120 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=4 color="536870912" ) footer(height=0 color="536870912" ) detail(height=552 color="536870912" ) table(column=(type=number updatewhereclause=no name=base_year dbnamDAT**e="base_year" ) column=(type=number updatewhereclause=no name=projected_year dbname="projected_year" ) column=(type=char(32) updatewhereclause=no name=input_reference dbname="input_reference" ) column=(type=char(32) updatewhereclause=no name=output_reference dbname="output_reference" ) ) text(band=detail alignment="0" text="Base Year:"border="0" color="8388608" x="18" y="4" height="64" width="334" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2DAT*," font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="Projected Year:"border="0" color="8388608" x="18" y="116" height="64" width="457" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="Input Data Reference Code:"border="0" color="8388608" x="18" y="228" height="112" width="475" font.face="MS SanDAT*.s Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="Output Data Reference Code:"border="0" color="8388608" x="18" y="372" height="112" width="475" font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) column(band=detail id=1 alignment="0" tabsequence=10 border="5DAT*0" color="0" x="512" y="4" height="64" width="439" format="[general]" name=base_year dddw.name=d_growth_base_year_dddw dddw.displaycolumn=base_year dddw.datacolumn=base_year dddw.percentwidth=100 dddw.lines=8 dddw.limit=0 dddw.allowedit=no dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) column(band=detail id=2 alignment="0" tabsequence=20DAT*2 border="5" color="0" x="512" y="116" height="64" width="439" format="[general]" name=projected_year dddw.name=d_growth_projected_year_dddw dddw.displaycolumn=projected_year dddw.datacolumn=projected_year dddw.percentwidth=100 dddw.lines=8 dddw.limit=0 dddw.allowedit=no dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) column(band=detail iDAT*4d=3 alignment="0" tabsequence=30 border="5" color="0" x="512" y="260" height="64" width="640" format="[general]" name=input_reference dddw.name=d_growth_reference_code_dddw dddw.displaycolumn=code dddw.datacolumn=code dddw.percentwidth=100 dddw.lines=8 dddw.limit=0 dddw.allowedit=no dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" ) column(DAT*6band=detail id=4 alignment="0" tabsequence=40 border="5" color="0" x="512" y="404" height="64" width="640" format="[general]" name=output_reference dddw.name=d_growth_reference_code_dddw dddw.displaycolumn=code dddw.datacolumn=code dddw.percentwidth=100 dddw.lines=8 dddw.limit=0 dddw.allowedit=no dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="167772DAT*\15" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*:PDW08006pdwPl&%````I F$6nn``DAT*<1 @@DAT*>$ 536870912@H   ! $projected_year< $ 0% MS Sans SerifMS Sans Serif$DAT*@2$-8$700$1$ 553648127$18$4$@64$ 7311&"# [General] [General]@DAT*B'*0/-. (cd):an_baseYearLowerBound:an_baseYearUpperBound+,an_baseYearLowDAT*DerBoundan_baseYearUpperBoundprojected_year"rap_growth_factors.projected_yearPBSELECT( VERSION(400) DISTINCT ()TABLE(NAME="rap_growth_factors" ) COLUMN(NAME="rap_growth_factors.projected_year")WHERE( EXP1 ="rap_growth_factors.base_year" OP =">=" EXP2 ="" LOGIC ="and" ) WHERE( EXP1 ="rap_growth_factors.base_year" OP ="<=" EXP2 ="" ) ) ORDER(NAME="rap_growth_factors.projected_year" ASC=yes ) ARG(NAME = "an_baseYearLowerBound" TYPE = number) DAT* ARG(NAME = "an_baseYearUpperBound" TYPE = number) 24 "3no"5yesDAT*Hrelease 6; datawindow(units=0 timer_interval=0 color=16777215 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(type=decimal(0) updatewhereclause=yes name=projected_yDAT*Jear dbname="rap_growth_factors.projected_year" ) retrieve="PBSELECT( VERSION(400) DISTINCT ()TABLE(NAME=~"rap_growth_factors~" ) COLUMN(NAME=~"rap_growth_factors.projected_year~")WHERE( EXP1 =~"rap_growth_factors.base_year~" OP =~">=~" EXP2 =~":an_baseYearLowerBound~" LOGIC =~"and~" ) WHERE( EXP1 =~"rap_growth_factors.base_year~" OP =~"<=~" EXP2 =~":an_baseYearUpperBound~" ) ) ORDER(NAME=~"rap_growth_factors.projected_year~" ASC=yes ) ARG(NAME = ~"an_baseYearLowerBound~" TYPE DAT*L= number) ARG(NAME = ~"an_baseYearUpperBound~" TYPE = number) " arguments=(("an_baseYearLowerBound", number),("an_baseYearUpperBound", number)) ) column(band=detail id=1 alignment="0" tabsequence=32766 border="0" color="0" x="18" y="4" height="64" width="311" format="[General]" name=projected_year edit.limit=0 edit.case=any edit.autoselect=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="5536DAT*_48127" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*PPDW08000pdwPl$#```` F$0nn``DAT*R+ @@DAT*T$ 536870912@H    (" code< $ 0% MS Sans SerifMS Sans Serif$DAT*V2$-8$700$1$18$4$@64$640& ! [general] [general]@&%DAT*X*)'( rap_reference_codescoderap_reference_codes.codePBSELECT( VERSION(400) DISTINCT ()TABLE(NAME="rap_reference_codes" ) COLUMN(NAME="DAT*rap_reference_codes.code")) ORDER(NAME="rap_reference_codes.code" ASC=yes ) ,. "-no"/yesDAT*\release 6; datawindow(units=0 timer_interval=0 color=16777215 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=72 color="536870912" ) table(column=(type=char(12) update=yes updatewhereclause=yes key=yesDAT*^ name=code dbname="rap_reference_codes.code" ) retrieve="PBSELECT( VERSION(400) DISTINCT ()TABLE(NAME=~"rap_reference_codes~" ) COLUMN(NAME=~"rap_reference_codes.code~")) ORDER(NAME=~"rap_reference_codes.code~" ASC=yes ) " update="rap_reference_codes" updatewhere=1 updatekeyinplace=no ) column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="0" x="18" y="4" height="64" width="640" format="[general]" name=code edit.limit=12 edit.case=any edit.autoselect=yes edit.autohscroll=yes DAT*font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*bPDW0800updwPlVU````I F$unnaaDAT*dp @@DAT*f$ 536870912@<=#   (" id< $ 0% MS Sans SerifMS Sans Serif$DAT*h2$-8$700$1$22098$h104$@64$439& ! [general] [general],$  %') (+2DAT*jname$&2 2610$(`96$*7918#-  .02 4 (7rid$/2258$18$3274&56 [general] [general]=,9DAT*l  :02 4((<geographic_county_rid$;. 2606n8> ? ACEGIL  disp_name$@ 553648127$B 9$D4$F452$HDAT*n`1120&JK [GENERAL] [GENERAL]%MN!rightTrim( id ) + " | " + name ^OT ^PRhQ S | @DWY\[oDAT*p_,]^` @cabeh#fgj3@m8kln @ viXe:pl_rid viZpl_rid rap_sourcesridrap_sources.ridDAT* ,nullidrap_sources.idd=cnullnamerap_sources.namei=h#nullgeographic_county_rid"rap_sources.geographic_county_rid8null*PBSELECT( VERSION(400) TABLE(NAME="rap_sources" ) COLUMN(NAME="rap_sources.rid") COLUMN(NAME="rap_sources.id") COLUMN(NAME="rap_sources.name") COLUMN(NAME="rap_sources.geographic_county_rid")WHERE( EXP1 ="rap_sources.geographDAT*trelease 6; datawindow(units=0 timer_interval=0 color=16777215 processing=0 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 97 print.margin.bottom = 97 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no ) summary(height=4 color="536870912" ) footer(height=0 color="536870912" ) detail(height=60 color="536870912" ) table(column=(type=decimal(0) update=yes updatewhereclause=yes name=DAT*vrid dbname="rap_sources.rid" initial="null" ) column=(type=char(15) update=yes updatewhereclause=yes key=yes name=id dbname="rap_sources.id" initial="null" ) column=(type=char(50) update=yes updatewhereclause=yes name=name dbname="rap_sources.name" initial="null" ) column=(type=decimal(0) update=yes updatewhereclause=yes name=geographic_county_rid dbname="rap_sources.geographic_county_rid" initial="null" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"rap_sources~" ) COLUMN(NAME=~"rap_sourDAT*xces.rid~") COLUMN(NAME=~"rap_sources.id~") COLUMN(NAME=~"rap_sources.name~") COLUMN(NAME=~"rap_sources.geographic_county_rid~")WHERE( EXP1 =~"rap_sources.geographic_county_rid~" OP =~"=~" EXP2 =~":pl_rid~" ) ) ARG(NAME = ~"pl_rid~" TYPE = number) " update="rap_sources" updatewhere=1 updatekeyinplace=no arguments=(("pl_rid", number)) ) column(band=detail id=2 alignment="0" tabsequence=20 border="0" color="0" x="2098" y="104" height="64" width="439" format="[general]" name=id edit.limit=10 edit.caDAT*zse=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=3 alignment="0" tabsequence=30 border="0" color="0" x="2610" y="96" height="64" width="791" format="[general]" name=name edit.limit=50 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.DAT*|height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=1 alignment="1" tabsequence=10 border="0" color="0" x="2258" y="8" height="64" width="274" format="[general]" name=rid edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" backgroDAT*~und.color="536870912" ) column(band=detail id=4 alignment="1" tabsequence=40 border="0" color="0" x="2606" y="8" height="64" width="274" format="[general]" name=geographic_county_rid edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) compute(band=detail alignment="0" expression="rightTrim( id ) +DAT*g ~" | ~" + name "border="0" color="0" x="9" y="4" height="52" width="1120" format="[GENERAL]" name=disp_name font.face="MS Sans Serif" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes") DAT*QA QAselect scc_ams_code from rap_processes where rid =0 23F  QA L QAM- SELECT record_group_no , sequence_no , item_type , operator_type , numer_material_code , denom_material_code , metric_code , input_output_flag FROM rap_method_metrics WHERE protocol_rid =0 ORDER BY record_group_no , sequence_no DAT* meth_metric_listrc  QA QAX QAw_emiss_statussqlcauo_toplevelDGy   QA QAT QAgs_databasegs_roleDAT*SELECT value FROM rap_activities , rap_streams WHERE ref_rid =rap_streams.rid AND from_process_rid =0 AND SUBSTR ( metric_code , 1 ) ='SCC AMS CODE' de scc_ams_curXN TQAQA1QA<%,SELECT distinct ( emittant_material_code ) FROM rap_emission_factors WHERE profile_code =' ' Y\pollutanDAT*Displays the specified file.global type f_display_file from function_object end type forward prototypes global subroutine f_display_file (string file_name) end prototypes global subroutine f_display_file (string file_name);/////////////////////////////////////////////////////////////////////// // // Function: F_Display_File // // Purpose: Displays a text file. // // Date: March 4, 1993 // // Scope: Public // // Arguments: string file_name - the name of theDAT* text file to be // displayed ( must have the .TXT // extension ) // // Returns: Nothing // // Log : // // DATE WHO WHAT // -------- ----- ------------------------------------------- // Powersoft Company initial version // //////////////////////////////////////////////////////////////////////// // Calls f_push_parm function which pushes the file to be displayed // onto the pDAT*arameter stack contained in the window w_hold_parm. openwithparm (w_file_display, file_name) return end subroutine DAT*t_cur@4*QA8QAz QAselect rap_devices.code from rap_processes , rap_devices , rap_device_codes where rap_processes.rid =0 and rap_processes.device_rid =rap_devices.rid and rap_devices.code =rap_device_codes.code and rap_device_codes.metric_map_code ='CONTROL' ef6N\RATDAT*RASELECT rap_device_codes.code FROM rap_activities , rap_device_codes WHERE rap_activities.value =rap_device_codes.afs_control_code AND rap_activities.value <> '099' AND ref_rid =0 AND SUBSTR ( metric_code , 1 ) ='EPA CNTL CO' AND SUBSTR ( material_code , 1 ) =' ' AND ( start_date_time ='2005-01-31 15:29:38.030000' OR start_date_time < '2005-01-31 15:29:38.030000' ) AND ( end_date_time ='2005-01-31 15:29:38.030000' OR end_date_time > '2005-01-31 15:29:38DAT*.030000' OR end_date_time is null ) AND rap_activities.value_type =' ' :Pl RA,RAgs_user_idu_class_source_groupu_class_ss_clientSELECT meas_code FROM rap_units WHERE code =' ' ,/RAzRASELECT rid FROM rap_streams WHERE from_process_rid =0 AND to_proceDAT*ss_rid is null 45DRARASELECT rid FROM rap_streams WHERE from_process_rid =0 AND to_process_rid is not null 45fRAlRASELECT rid FROM rap_streams WHERE from_process_rid =0 45RATDAT*RA45RARASELECT value_amt , rid FROM rap_activities WHERE ref_rid =0 AND SUBSTR ( metric_code , 1 ) =' ' AND SUBSTR ( material_code , 1 ) =' ' AND value_type =' ' AND data_code =' ' AND start_date_time ='2005-01-31 15:29:38.155000' AND end_date_time ='2005-01-31 15:29:38.155000' AND reference_code =' ' :;\_#&0DAT*Prints the specified file.global type f_print_file from function_object end type forward prototypes global function boolean f_print_file (string filename) end prototypes global function boolean f_print_file (string filename);//////////////////////////////////////////////////////////////////// // // Function : Print_File // // Description : Sends a specified file to the default printer. // // Date : September 9, 1993 // // Arguments : string - filename ; name of file toDAT* be printed // // Returns : boolean ; indicating success or failure of the print // operation // // Log : // // DATE WHO WHAT // -------- ----- ------------------------------------------- // Powersoft Company Initial Version. // /////////////////////////////////////////////////////////////////////// string ls_line integer li_fn, li_num_chars long ll_cnt boolean lb_done long ll_prt //changed to long to match return typDAT*e of printOpen() MDY 12/17/98 integer li_rc //added to allow return code checking in debugger MDY 12/17/98 SetPointer( HourGlass!) li_fn = FileOpen( filename ) IF li_fn < 0 THEN MessageBox( "File Print", "Unable to open file: " + filename) Return false END IF ll_prt = PrintOpen( filename ) IF ll_prt < 0 THEN MessageBox( "File Print", "Unable to open printer.") FileClose( li_fn ) Return false END IF ll_cnt = 0 DO li_num_chars = FileDAT*Read( li_fn, ls_line ) lb_done = ( li_num_chars < 0 ) IF NOT lb_done THEN li_rc = Print( ll_prt, 250, ls_line) //added 250 to print 1/4" from left edge MDY ll_cnt = ll_cnt + 1 // Display_Message ("Printing ls_line " + String( ll_cnt,"0" ) ) END IF LOOP UNTIL lb_done li_rc = FileClose( li_fn ) li_rc = PrintClose( ll_prt ) // Display_Message( "Printing Complete" ) // SetPointer( Arrow!) Return true end function DAT*forward global type n_dw_multi_select from nonvisualobject end type end forward global type n_dw_multi_select from nonvisualobject end type global n_dw_multi_select n_dw_multi_select forward prototypes public function integer controlclick (ref datawindow dw_argument, ref long pl_maxsel, ref long pl_sel_count) public function integer shiftclick (ref datawindow dw_argument, ref long pl_maxsel, ref long pl_selcount) end prototypes public function integer controlclick (ref datawindow DAT*dw_argument, ref long pl_maxsel, ref long pl_sel_count);LONG ll_clickedRow ll_clickedRow = dw_argument.getRow() IF ll_clickedRow > 0 THEN IF dw_argument.IsSelected(ll_ClickedRow) THEN dw_argument.SelectRow(ll_ClickedRow, FALSE) pl_sel_count = max(pl_sel_count - 1,0) ELSE dw_argument.SelectRow(ll_ClickedRow, TRUE) pl_sel_count = pl_sel_count + 1 END IF END IF Return(0) end function public function integer shiftclick (ref datawindow dw_argument, ref DAT*long pl_maxsel, ref long pl_selcount);LONG l_OldRow, l_NewRow, l_StartRow, l_EndRow, ll_i l_OldRow = dw_argument.GetSelectedRow(0) l_NewRow = dw_argument.GetRow() IF (l_NewRow = 0 OR l_OldRow = 0) THEN Return(0) END IF // Windows standard Shift-Click IF l_OldRow > l_NewRow THEN l_StartRow=l_NewRow l_EndRow=l_OldRow ELSE l_StartRow=l_OldRow l_EndRow=l_NewRow END IF // Check if max Row selections are exceeded IF l_StartRow - l_EndRow > pl_maxSel THEN messageBox("Cannot DAT*Select","Maximum of " + string(pl_maxSel) + " rows may be selected") RETURN(0) END IF // Select rows within the clicked range FOR ll_i = l_StartRow to l_EndRow IF NOT dw_argument.isSelected(ll_i) THEN dw_argument.SelectRow(ll_i,TRUE) pl_selcount = pl_selcount + 1 END IF NEXT dw_argument.SetRow(l_NewRow) dw_argument.SetColumn(1) Return(0) end function on n_dw_multi_select.create TriggerEvent( this, "constructor" ) end on on n_dw_multi_select.destroy TriggerEvent( DAT* this, "destructor" ) end on DAT*RAPRASELECT value_amt , rid FROM rap_activities WHERE ref_rid =0 AND SUBSTR ( metric_code , 1 ) =' ' AND SUBSTR ( material_code , 1 ) =' ' AND value_type is NULL AND data_code =' ' AND start_date_time ='2005-01-31 15:29:38.186000' AND end_date_time ='2005-01-31 15:29:38.186000' AND reference_code =' ' :;\_&)RAD DAT*RASELECT value_amt , rid FROM rap_activities WHERE ref_rid =0 AND SUBSTR ( metric_code , 1 ) =' ' AND SUBSTR ( material_code , 1 ) =' ' AND value_type =' ' AND data_code =' ' AND start_date_time ='2005-01-31 15:29:38.186000' AND end_date_time ='2005-01-31 15:29:38.186000' AND reference_code =' ' :;\_#&RARA:;\_&)DAT*<RAXRAupdate rap_activities set value_amt =0 , value_unit_code =' ' , creation_date_time ='2005-01-31 15:29:38.202000' , value =' ' , user_id =' ' , data_code =' ' , reference_type =' ' , method_type =' ' where rid =0 %&:=Tpz} RA45DRA<DAT*RASELECT count ( rid ) FROM rap_streams WHERE from_process_rid =0 AND to_process_rid is not null >?xRA RA45P RA T RA45 DRA! RA45DAT*@!RA|!D!RAINSERT INTO rap_activities ( rid , creation_date_time , metric_code , metric_level_type , ref_rid , start_date_time , user_id , value , confidential_flag , data_code , end_date_time , material_code , method_type , reference_code , reference_type , value_amt , value_type , value_unit_code ) VALUES ( 0 , '2005-01-31 15:29:38.233000' , ' ' , ' ' , 0 , '2005-01-31 15:29:38.233000' , ' ' , ' ' DAT*, ' ' , ' ' , '2005-01-31 15:29:38.233000' , ' ' , ' ' , ' ' , ' ' , 0 , NULL , ' ' ) ,-0LORUX[\_{~#!RAINSERT INTO rap_activities ( rid , creation_date_time , metric_code , metric_level_type , ref_rid , start_date_time , user_id , value , confidential_flag , data_code , end_date_time , material_code , method_type , reference_code , reference_type , value_amt , value_type , value_unit_code )DAT* VALUES ( 0 , '2005-01-31 15:29:38.233000' , ' ' , ' ' , 0 , '2005-01-31 15:29:38.233000' , ' ' , ' ' , ' ' , ' ' , '2005-01-31 15:29:38.233000' , ' ' , ' ' , ' ' , ' ' , 0 , ' ' , ' ' ) ,-0LORUX[\_{~%$RAselect rid from rap_streams where from_process_rid =0 and to_process_rid is not null 45&t&RA'&DAT*RAselect rid from rap_streams where from_process_rid =0 and to_process_rid is null 45'D'RA''RA45(D'RAL((RA45(t&RA((RAselect rid , value_amt , creation_DAT*date_time from rap_activities where ref_rid =0 and SUBSTR ( metric_code , 1 ) =' ' and SUBSTR ( material_code , 1 ) =' ' and start_date_time ='2005-01-31 15:29:38.248000' and end_date_time ='2005-01-31 15:29:38.248000' and value_amt is not null and value_unit_code is not null and value_type is NULL and data_code =' ' and reference_code =' ' OPqt]`uxz*)RA**RAselect rDAT*id , value_amt , creation_date_time from rap_activities where ref_rid =0 and SUBSTR ( metric_code , 1 ) ='DISCHARGE' and SUBSTR ( material_code , 1 ) =' ' and start_date_time ='2005-01-31 15:29:38.311000' and end_date_time ='2005-01-31 15:29:38.311000' and value_amt is not null and value_unit_code is not null and value_type is NULL and data_code =' ' and reference_code =' ' OPeh},+RA,,DAT*RASELECT conversion_factor_amt , standard_code FROM rap_units WHERE code =' ' AND conversion_factor_amt <> 0 AND conversion_factor_amt IS NOT NULL AND standard_code IS NOT NULL HK-$-RA.-RASELECT conversion_factor_amt FROM rap_units WHERE code =' ' AND standard_code =' ' AND conversion_factor_amt <> 0 AND conversion_factor_amt IS NOT NULL 8;OR.DAT*L.RA(/.RAselect creation_date_time from rap_activities , rap_streams where ref_rid =rap_streams.rid and rap_streams.from_process_rid =0 and ( SUBSTR ( metric_code , 1 ) ='MASS FLOW' or SUBSTR ( metric_code , 1 ) ='DISCHARGE' ) and start_date_time ='2005-01-31 15:29:38.389000' and ( end_date_time is null or end_date_time ='2005-01-31 15:29:38.389000' ) aDAT*nd SUBSTR ( material_code , 1 ) =' ' and reference_code =' ' and value_type is NULL and value_amt is not null and value_unit_code is not null }~ :V{~d/n/x///est_input_cur11//1RA1RAselect value_amt , value_unit_code from rap_activities , rap_streams where ref_rid =rap_streams.rid and rap_streams.from_process_rid =0 and SUBSTR ( metric_code , 1 ) ='CNTL EFFIC' andDAT* start_date_time ='2005-01-31 15:29:38.405000' and ( end_date_time is null or end_date_time ='2005-01-31 15:29:38.405000' ) and SUBSTR ( material_code , 1 ) =' ' and value_amt is not null and value_unit_code is not null 1VY382RA43RAselect value_amt , value_unit_code from rap_activities , rap_streams where ref_rid =rap_streams.rid and rap_streams.from_process_rid =0 and SUBSTRDAT*Qf fwf?=d? _q2.fwfadmQ&Y_`?=d Q2wf]U3?=dTQ?=d?` _f/d<=?=du ?h fwfXQ,Q"Arial"Arial"Arial"ArialDAT*RAPIDS Emission Applicationforward global transaction sqlca global dynamicdescriptionarea sqlda global dynamicstagingarea sqlsa global error error global message message end forward global variables LONG gl_source_rid LONG gd_device_rid //DECIMAL gd_process_rid STRING gs_user_id STRING gs_role end variables global type rapids_e from application end type global rapids_e rapids_e on open;open( w_emiss ) end on on rapids_e.create appname = "rapids_e" sqlca = create traDAT* nsaction sqlda = create dynamicdescriptionarea sqlsa = create dynamicstagingarea error = create error message = create message end on on rapids_e.destroy destroy( sqlca ) destroy( sqlda ) destroy( sqlsa ) destroy( error ) destroy( message ) end on DAT*forward global type u_ddlbx from dropdownlistbox end type end forward global type u_ddlbx from dropdownlistbox int Width=257 int Height=149 int TabOrder=1 BorderStyle BorderStyle=StyleLowered! boolean VScrollBar=true long TextColor=33554432 int TextSize=-8 int Weight=700 string FaceName="Arial" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! event load_items pbm_custom40 event get_rid pbm_custom41 end type global u_ddlbx u_ddlbx type variables Long il_rid // HolDAT*4ds Rid value for this control end variables DAT* ( metric_code , 1 ) ='CNTL EFFIC' and start_date_time ='2005-01-31 15:29:38.405000' and ( end_date_time ='2005-01-31 15:29:38.405000' or end_date_time is null ) and SUBSTR ( material_code , 1 ) ='@' and value_amt is not null and value_unit_code is not null 5T4RA065RA>?l6xRA6p6DAT*RAselect value_amt , value_unit_code from rap_activities , rap_streams where ref_rid =rap_streams.rid and rap_streams.from_process_rid =0 and rap_streams.to_process_rid is not null and SUBSTR ( metric_code , 1 ) ='CAPT EFFIC' and start_date_time ='2005-01-31 15:29:38.405000' and ( end_date_time ='2005-01-31 15:29:38.405000' or end_date_time is null ) and SUBSTR ( material_code , 1 ) =' ' and value_amt is not null and value_unit_code is not null 'C86DAT*RA88RAselect value_amt , value_unit_code from rap_activities , rap_streams where ref_rid =rap_streams.rid and rap_streams.from_process_rid =0 and rap_streams.to_process_rid is not null and SUBSTR ( metric_code , 1 ) ='CAPT EFFIC' and start_date_time ='2005-01-31 15:29:38.420000' and ( end_date_time ='2005-01-31 15:29:38.420000' or end_date_time is null ) and SUBSTR ( material_code , 1 ) ='@' and value_amt is not null aDAT*nd value_unit_code is not null 'C:(9RA,;:RA>?h;xRA;l;RASELECT count ( rid ) FROM rap_streams WHERE from_process_rid =0 AND to_process_rid is null >?<<;RAx<@<RAdynamicstaDAT*gingareasqlsa,"grp_pol_cur<<RA<RAT=RA=RA=RA >RAselect rid from rap_materials where code =' ' *-|>L>RADAT*>>RA,"parent_cur>>RA>RA|?RA?RA45?D'RA0@?RA45l@t&RADAT*@p@RAselect value_amt , value_unit_code , creation_date_time , rid from rap_activities where ref_rid =0 and SUBSTR ( metric_code , 1 ) =' ' and value_type is NULL and SUBSTR ( material_code , 1 ) =' ' and start_date_time ='2005-01-31 15:29:38.498000' and end_date_time ='2005-01-31 15:29:38.498000' and value_amt is not null and value_unit_code is not null and reference_code =' ' and data_code =' ' ab %twpBDAT*@RABBRAupdate rap_activities set value_amt =0 , creation_date_time ='2005-01-31 15:29:38.514000' , value =' ' , reference_type =' ' , user_id =' ' , value_unit_code =' ' , method_type =' ' where rid =0 %&=Ycfy|CCRAM,D$SELECT DISTINCT material_code FROM rap_activitieDAT*s , rap_streams WHERE rap_activities.ref_rid =rap_streams.rid AND rap_streams.to_process_rid =0 AND rap_streams.from_process_rid =0 AND SUBSTR ( metric_code , 1 ) in ( 'MASS FLOW' , 'VOL FLOW' ) AND reference_code =' ' AND ( method_type =' ' OR SUBSTR ( method_type , 1 , 1 ) =' ' )  !EH D*D>DHDRDEfD\DERAFRAPFRADAT*MM,Select rid , id FROM rap_streams Where to_process_rid =0 UNION Select rid , id FROM rap_streams Where from_process_rid =0 78xyFFdata_cur8G&GFF0GRA|GRAGRAf_speciation_value_type,"profile_curH HRAHDAT*RAHRAHRA,"emittant_curIISAISAISAISA ,SELECT material_code FROM rap_activities , rap_streams WHEREDAT* SUBSTR ( metric_code , 1 ) in ( 'MASS FLOW' , 'VOL FLOW' ) AND rap_activities.ref_rid =rap_streams.rid AND rap_streams.to_process_rid =0 AND start_date_time ='2005-01-31 15:29:39.077000' AND end_date_time ='2005-01-31 15:29:39.077000' AND SUBSTR ( material_code , 1 ) IS NOT NULL AND value_amt IS NOT NULL AND value_unit_code IS NOT NULL AND value_type IS NULL 'JJ(Jinflow_curKKecimal equivalent of the // activity_value string // // Returns: Success -> Activity value (decimal type) // Failure -> 0 // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables DECIMAL ld_value // Convert ld_activity_value from string to DAT*@decimal // (0 if activity_value is not a valid number) ld_value = Dec( ps_activity_value ) IF ld_value = 0 THEN // Error on conversion IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Error converting activity" + & " value: " + ps_activity_value, Information!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Error converting activity value: " + & ps_activity_value ) END IF END IDAT*BF Return( ld_value ) // end uof_activity_value() end function public function int uof_source_device_process (string ps_scc_ams_code, ref string ps_source_code, ref string ps_device_code, ref string ps_process_code, int pi_log_file, ref transaction pt_trans_object);// INTEGER uof_source_device_process( STRING ps_scc_ams_code, // STRING VAR ps_source_code, // STRING VAR ps_device_code, // DAT*D STRING VAR ps_process_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function retrieves the source, device, and process code // for a given scc_ams_code // // Returns: 1 Success // 0 Record not found or source/device/process is null // -1 SQL Error // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the CaDAT*Fncel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Retreive source, device, and process code for given scc_ams code SELECT source_code, device_code, process_code INTO :ps_source_code, :ps_device_code, :ps_process_code FROM rap_scc_ams_codes WHERE code = :ps_scc_ams_code USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // ErDAT*Hror-scc_ams record not found! IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "SCC/AMS record not found for " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SCC/AMS record not found for " + & ps_scc_ams_code ) END IF Return( 0 ) ELSEIF IsNull( ps_source_code ) THEN // Error-source_code is null IF NOT w_emiss.cbx_background.checked THEN DAT*J MessageBox( "Emission Estimator", "No source code for SCC/AMS code " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No source code for SCC/AMS code " + & ps_scc_ams_code ) END IF Return( 0 ) ELSEIF IsNull( ps_device_code ) THEN // Error-device_code is null IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No device code for SCC/AMS code " +DAT*L & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No device code for SCC/AMS code " + & ps_scc_ams_code ) END IF Return( 0 ) ELSEIF IsNull( ps_process_code ) THEN // Error-process_code is null IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No process code for SCC/AMS code " + & ps_scc_ams_code, Exclamation!, OK! ) END IF DAT*N IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No process code for SCC/AMS code " + & ps_scc_ams_code ) END IF Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_source_device_process()", pi_log_file, & pt_trans_object ) Return( -1 ) ELSE // Record retrieved successfully Return( 1 ) END IF // end uof_source_device_process() end function public function int uof_sql_error (striDAT*Png ps_calling_func, int pi_log_file, transaction pt_trans_object);// INTEGER uof_sql_error( STRING ps_calling_func, // INTEGER pi_log_file, // TRANSACTION pt_trans_object ) // // This function displays a message box with the function name // and the SQL error. // // Returns: 1 Success // // Modification History // When Who What // ------- --- ----------------------------------------------- // 17AUG94 PER Reformatted erDAT*Rror messages. // 23AUG94 PER Switched to use f_db_error(). // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Switched to use PowerBuilder Application Library f_db_error function //// Display message box regardless of background/foreground mode //MessageBox( "Emission EstimDAT*Tator", & // "SQL Error " + String( pt_trans_object.SQLDBCode ) + & // " in " + ps_calling_func + "~r~n~r~n" + & // pt_trans_object.SQLErrText, StopSign!, OK! ) // Display error message f_db_error( pt_trans_object, "SQL Error in " + ps_calling_func ) // Put SQL error in log file (if log is open) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "SQL Error " + String( pt_trans_object.SQLDBCode ) + & " in " + ps_callingDAT*V_func ) FileWrite( pi_log_file, & pt_trans_object.SQLErrText ) END IF Return( 1 ) // end uof_sql_error() end function public function long uof_get_rid (integer pi_log_file, ref transaction pt_trans_object);// LONG wf_get_rid( INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function returns the next rid from the rid_storage table // // Returns: Success-> the next rid from the rid_storage table // FailureDAT*X-> -1 (SQL Error) // // Modification History // When Who What // ------- --- --------------------------------------------- // 21SEP94 PER Modified to use the rid_storage table for // Oracle instead of the sequence. // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! DAT*Z) END IF // Declare local variables LONG ll_last_rid LONG ll_next_rid //// Determine if this is an Oracle database or a Watcom database. //IF gs_database = 'ORACLE' THEN // // Oracle database. Use sequence generator for next rid. // SELECT rid_seq.nextval // INTO :ll_next_rid // FROM dual; // // IF pt_trans_object.sqlcode <> 0 THEN // // Error getting nextval // uof_sql_error( "uof_get_rid()", pi_log_file, pt_trans_object ) // ROLLBADAT*\CK USING pt_trans_object; // Return( -1 ) // ELSE // // Commit the transaction // COMMIT USING pt_trans_object; // // IF pt_trans_object.sqlcode <> 0 THEN // // Error committing nextval // uof_sql_error( "uof_get_rid()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( -1 ) // END IF // END IF // //ELSE // ORACLE OR WATCOM // Watcom database. Use rid_storage table for next rid. //SELECT ridDAT*^ // INTO :ll_last_rid // FROM rid_storage // FOR UPDATE OF rid // USING pt_trans_object; // //IF pt_trans_object.sqlcode <> 0 THEN // // Error getting rid record // uof_sql_error( "uof_get_rid()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( -1 ) //END IF // //// Set new rid //ll_next_rid = ll_last_rid + 1 // //// Update the record in the database //UPDATE rid_storage // SET rid = :ll_next_rid // USING pt_trans_object; // //IF pt_DAT*`trans_object.sqlcode <> 0 THEN // // Error updating rid record // uof_sql_error( "uof_get_rid()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( -1 ) //END IF // //// Commit the transaction //COMMIT USING pt_trans_object; // //IF pt_trans_object.sqlcode <> 0 THEN // // Error committing rid record // uof_sql_error( "uof_get_rid()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( -1 ) //END IF //END IF //DAT*b Return new rid ll_next_rid = f_get_sequence() Return( ll_next_rid ) // end end function public function int uof_get_calc_prots (ref int pi_num_calc_prots, ref string ps_calc_prots[], int pi_log_file, ref transaction pt_trans_object);// INTEGER uof_get_calc_prots( INTEGER VAR pi_num_calc_prots, // STRING VAR ps_calc_prots[], // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_objectDAT*d ) // // Returns: 1 Success // 0 No calculation protocols selected // -1 SQL Error // // Set up an array with the user-selected calculation protocols // // Modification History // When Who What // ------- --- ------------------------------------------------- // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN DAT*fSetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Local variables INTEGER li_item STRING ls_code STRING ls_name pi_num_calc_prots = 0 // Loop through listbox items FOR li_item = 1 TO w_emiss.lb_calc_methods.TotalItems() IF w_emiss.lb_calc_methods.State( li_item ) = 1 THEN // This item is selected -- get method code for item ls_name = w_emiss.lb_calc_methods.Text( li_item ) SELECT code INTO :ls_code FROM rap_calculation_meDAT*hthods WHERE name = :ls_name USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_calc_prots()", pi_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF // Stow the emission calc protocol in the array pi_num_calc_prots++ ps_calc_prots[ pi_num_calc_prots ] = ls_code END IF NEXT IF pi_num_calc_proDAT*jts = 0 THEN // User didn't select ANY protocols //// mas rev. set default values // ls_name = w_emiss.lb_calc_methods.Text(1) // SELECT code // INTO :ls_code // FROM rap_calculation_methods // WHERE name = :ls_name // USING pt_trans_object; // // IF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uof_sql_error( "uof_get_calc_prots()", pi_log_file, & // pt_trans_object ) // ROLLBACK USING pDAT*lt_trans_object; // Return( -1 ) // END IF // // // Stow the emission calc protocol in the array // pi_num_calc_prots ++ // ps_calc_prots[pi_num_calc_prots] = ls_code // //// mas end of rev // // User didn't select ANY protocols MessageBox( "Emission Estimator", "You must select at least one " + & "calculation method", Information!, OK! ) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No calculation methods selected"DAT*n ) END IF Return( 0 ) ELSE COMMIT USING pt_trans_object; Return( 1 ) END IF // end uof_get_calc_prots() end function public function int uof_use_calc_prot (string ps_test_prot, int pi_num_prots, string ps_calc_prot[]);// INTEGER uof_use_calc_prot( STRING ps_test_prot, // INTEGER pi_num_prots, // STRING ps_calc_prot[] ) // // Returns: 1 Protocol was selected by the user // 0 Protocol wasn't selected by thDAT*pe user // // Return a code that indicates whether the user wants to use // this type of calculation protocol method // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Local variables INTEGER li_item // Loop through the user-selected protocols FOR li_item = 1 TO pi_num_DAT*rprots IF ps_test_prot = ps_calc_prot[ li_item ] THEN // User wants to use this protocol Return( 1 ) END IF NEXT // Protocol was not matched Return( 0 ) // end uof_use_calc_prot() end function public function integer uof_begin_log (integer pi_log_file);// INTEGER uof_begin_log( INTEGER pi_log_file ) // // Returns 1 : Success // 0 : Failure (log file isn't open) // // Writes the beginning line in the log file // Set the pointer to the regular arrowDAT*t for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables STRING ls_log_begin INTEGER li_i //ls_log_begin = "***** Emission Log Beginning on " + & // String( Today(), "mmm dd, yyyy" ) + " " + & // String( Now(), "h:mm:ss am/pm" ) + " for User " + & // gsDAT*v_user_id + " *****" FOR li_i = 1 TO 4 CHOOSE CASE li_i CASE 1 ls_log_begin = "RAPIDS Emission Estimator Log File" CASE 2, 4 ls_log_begin = "======================================================================" CASE 3 ls_log_begin = "USER SELECTION" END CHOOSE IF pi_log_file <> -1 THEN // Write beginning line FileWrite( pi_log_file, ls_log_begin ) ELSE // Error-log file isn't open Return( 0 ) END IF NEXT // Write 4 lines REJ 20FEB96 ReDAT*xturn( 1 ) // end end function public function integer uof_end_log (integer pi_log_file);// INTEGER uof_end_log( INTEGER pi_log_file ) // // Returns 1 : Success // 0 : Failure (log file isn't open) // // Writes the ending line in the log file // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetDAT*zPointer( HourGlass! ) END IF // Declare local variables STRING ls_log_end INTEGER li_i //ls_log_end = "***** Emission Log Ending on " + & // String( Today(), "mmm dd, yyyy" ) + " " + & // String( Now(), "h:mm:ss am/pm" ) + " for User " + & // gs_user_id + " *****" FOR li_i = 1 TO 5 CHOOSE CASE li_i CASE 1 ls_log_end = "Emission Estimator Complete" CASE 2, 4 ls_log_end = "===========================================================DAT*|===========" CASE 3 ls_log_end = "Execution End Date/Time: " + & String(Today(), "mmm dd, yyyy") + " " + String(Now(), "h:mm:ss am/pm") CASE 5 ls_log_end = "End of RAPIDS Emission Estimator Log File" END CHOOSE IF pi_log_file <> -1 THEN // Write ending line FileWrite( pi_log_file, ls_log_end) ELSE // Error-log file isn't open Return( 0 ) END IF NEXT // Write 5 lines REJ 20FEB96 Return( 1 ) // end end function public function int uof_get_mDAT*~odes (ref int pi_num_modes, ref string ps_modes[], int pi_log_file, ref transaction pt_trans_object);// INTEGER uof_get_modes( INTEGER VAR pi_num_modes, // STRING VAR ps_modes[], // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // Returns: 1 Success // 0 No modes selected // -1 SQL Error // // Set up an array with the user-selected modes // Set the pointer to the regDAT*ular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Local variables INTEGER li_item STRING ls_type STRING ls_name pi_num_modes = 0 // Loop through listbox items FOR li_item = 1 TO w_emiss.lb_modes.TotalItems() IF w_emiss.lb_modes.State( li_item ) = 1 THEN // This item is selected -- getDAT* mode code for item ls_name = w_emiss.lb_modes.Text( li_item ) SELECT type INTO :ls_type FROM rap_modes WHERE name = :ls_name USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_modes()", pi_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF // Stow the mode in the array pi_DAT*num_modes++ ps_modes[ pi_num_modes ] = ls_type END IF NEXT IF pi_num_modes = 0 THEN // User didn't select ANY modes MessageBox( "Emission Estimator", "You must select at least one " + & "mode", Information!, OK! ) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No modes selected" ) END IF Return( 0 ) ELSE COMMIT USING pt_trans_object; Return( 1 ) END IF // end uof_get_modes() end function public function integer uof_use_DAT*mode_type (string ps_test_mode, integer pi_num_modes, string ps_modes[]);// INTEGER uof_use_mode_type( STRING ps_test_mode, // INTEGER pi_num_modes, // STRING ps_modes[] ) // // Returns: 1 Mode type was selected by the user // 0 Mode type wasn't selected by the user // // Return a code that indicates whether the user wants to use // this type of mode // Set the pointer to the regular arrow for background estimation // runDAT*s (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Local variables INTEGER li_item // Loop through the user-selected modes FOR li_item = 1 TO pi_num_modes IF ps_test_mode = ps_modes[ li_item ] OR ps_test_mode = '@' THEN // User wants to use this mode Return( 1 ) END IF NEXT // Mode type was not matched Return( 0 ) //DAT* end uof_use_mode_type() end function public function integer uof_get_pollutants (ref integer pi_num_pollutants, ref string ps_pollutants[], string ps_scc_ams_code, integer pi_log_file, ref transaction pt_trans_object, decimal pd_process_rid);// INTEGER uof_get_pollutants( INTEGER VAR pi_num_pollutants, // STRING VAR ps_pollutants[], // STRING ps_scc_ams_code, // INTEGER pi_log_fileDAT*, // TRANSACTION VAR pt_trans_object, // DECIMAL pd_process_rid ) // // Returns: 1 Success *OR* // no polllutant specified and no input // pollutants found. // 0 No pollutants specified by user AND no default // pollutants were found in rap_scc_ams_materials. // -1 SQL Error // // Set up an array with the user-selected pollutants // // Modification History // When DAT* Who What // ------- --- ----------------------------------------------- // 20JUL94 MAS If scc_ams is blank the default pollutants are // retrieved from the input stream activity -- // control device. // 16AUG94 PER General code cleanup. // Added SCC/AMS code to error message. // 20AUG94 MAS check the code instead of name for pollutant // // Set the pointer to the regular arrow for background estimation // runs (so the user can cDAT*lick on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables INTEGER li_item STRING ls_code STRING ls_name BOOLEAN lb_scc_ams_null // Initialize local variables lb_scc_ams_null = IsNull(ps_scc_ams_code) // Cursor for scc_ams/materials DECLARE mat_cur CURSOR FOR SELECT material_code FROM rap_scc_ams_materials WHERE scc_ams_code = :DAT*ps_scc_ams_code USING pt_trans_object; DECLARE act_cur CURSOR FOR SELECT material_code FROM rap_activities, rap_streams WHERE ref_rid = rap_streams.rid AND to_process_rid = :pd_process_rid AND from_process_rid = :w_emiss.il_prev_process_rid AND (SUBSTR(metric_code,1) in ('MASS FLOW','VOL FLOW')) USING pt_trans_object; IF NOT lb_scc_ams_null THEN // User didn't select ANY pollutants from the list box. // Use SCC/AMS to get defaults from rap_scDAT*c_ams_materials table. IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No pollutants specified. Retrieving " + & "defaults from rap_scc_ams_materials." ) END IF OPEN mat_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) END IF // Retrieve first record FETCH mat_cur INTO DAT* :ps_pollutants[1]; IF pt_trans_object.sqlcode = 100 THEN // Error-No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No pollutants specified and " + & "no defaults found for SCC/AMS code: " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No pollutants specified and no " + & DAT* "defaults found for SCC/AMS code: " + ps_scc_ams_code ) END IF ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) ELSE pi_num_pollutants = 1 END IF // Loop through the rest of the pollutant (material) records DO WHDAT*ILE pt_trans_object.sqlcode = 0 // Retrieve the next record FETCH mat_cur INTO :ps_pollutants[ pi_num_pollutants + 1 ]; IF pt_trans_object.sqlcode = 100 THEN // No more records to retrieve EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) ELSE DAT* pi_num_pollutants++ END IF LOOP // end materials loop // Close materials cursor CLOSE mat_cur; // Normal return IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Using default pollutants" ) END IF Return( 1 ) ELSE // when scc_ams code is null // User didn't select ANY pollutants from the list box. // Get defaults from input stream of this process activity table. IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No DAT*pollutants specified. Using " + & "defaults from Input stream(s)." ) FileWrite( pi_log_file, " ") END IF OPEN act_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; // Changed to act_cur 16AUG94 PER Return( -1 ) END IF // Retrieve first record FETCH act_cur INTO :ps_pollutants[1]; DAT* IF pt_trans_object.sqlcode = 100 THEN // Error-No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No pollutants specified and " + & "no input pollutants found", Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No pollutants specified and no " + & "input pollutants found" ) FileWrite( pi_log_file, " ") ENDAT*D IF ROLLBACK USING pt_trans_object; CLOSE act_cur; // Return( 0 ) // when scc_ams_code = null and no input found this is either an error // or input storage facility // In our example 7747.. OUTDOOR COAL PILE has no input but the // output is the main input to the whole process // So we need to go on with the source estimation even if we have // no input stream to this kind of process Return(1) ELSEIF pt_trans_object.sqlcode <> 0 THEN //DAT* SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; Return( -1 ) ELSE pi_num_pollutants = 1 END IF // Loop through the rest of the pollutant (material) records DO WHILE pt_trans_object.sqlcode = 0 // Retrieve the next record FETCH act_cur INTO :ps_pollutants[ pi_num_pollutants + 1 ]; IF pt_trans_object.sqlcode = 100 THEN // NoDAT* more records to retrieve EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_pollutants()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; Return( -1 ) ELSE pi_num_pollutants++ END IF LOOP // end materials loop // Close materials cursor CLOSE act_cur; // Normal return IF pi_log_file <> -1 THEN FileWrite( pi_log_fDAT*ile, "Using input pollutants ") FileWrite( pi_log_file, " ") END IF Return( 1 ) END IF // end uof_get_pollutants() end function public function integer uof_get_spec_profile (string ps_input_material, ref string ps_profile_code, integer pi_log_file, transaction pt_trans_object);// int function uof_get_spec_profile(STRING ps_input_material, // STRING VAR ps_profile_code, // INTEGER pi_log_file, DAT*// TRANSACTION pt_trans_object // // Return: 1 Success // 0 Failure // -1 SQL error // // // Retrieves profile code from rap_speciation_profiles // ONLY ONE PRODUCT PROFILE MAY EXIST. // // Modification History // // WHO WHEN WHAT // === ==== ==== // MAS 07/23/94 Created. // PER 08/16/94 Added error messages. // REJ 02/26/96 Removed stray , after "select code" if w_emiss.cbx_background.checked tDAT*hen SetPointer ( Arrow!) else SetPointer ( HourGlass!) end if // Declare local variables // Initialize local variables SELECT code INTO :ps_profile_code FROM rap_speciation_profiles WHERE material_code = :ps_input_material USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // record not found IF( NOT w_emiss.cbx_background.checked ) THEN MessageBox( "Emission Estimator", "No profile code for " + & "input material: " + ps_iDAT*nput_material, & Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, & " No profile code for input material: " + ps_input_material ) END IF Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL error uof_sql_error( "uof_get_spec_profile()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) ELSE // Record found DAT*Return( 1 ) END IF end function public function integer uof_pm (string ps_pollutant, transaction pt_trans_object, integer pi_log_file);// int function uof_pm(STRING ps_pollutant, // TRANSACTION pt_trans_object, // INTEGER pi_log_file) // // Return: 1 Succes // 0 Failure // -1 SQL error // // Check to see if the pollutant is in the PM group // // WHO WHEN WHAT // === ======= ===DAT*= // MAS 07/25/94 Created // PER 08/16/94 Added error messages. // Changed error message box to only display // on interactive runs. // REJ 02/26/96 "PM GROUP" is now only "PM" IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass!) END IF // Declare local variable(s) STRING ls_code // Initialize local variables(s) SELECT code INTO :ls_code FROM rap_materials DAT* WHERE rid in ( SELECT child_ref_rid FROM rap_materials M, rap_group_members G WHERE M.rid = G.parent_ref_rid AND M.code = 'PM' ) AND code = :ps_pollutant USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // No records found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Pollutant " + ps_pollutant + " is not in PM group ", & StopSign!, OK! ) DAT* END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, & " Pollutant " + ps_pollutant + " is not in PM group " ) END IF ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pm()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF // Normal return COMMIT USING pt_trans_object; Return( 1 ) DAT* // end uof_pm() end function public function int uof_get_mass_fractions (string ps_profile_code, string ps_emittant, ref decimal pd_weight_perc, int pi_log_file, transaction pt_trans_object);//// int function uof_get_mass_fractions( // STRING ps_profile_code, // STRING ps_emittant, // DECIMAL VAR pd_weight_perc, // INTEGER pi_log_file, // DAT* TRANSACTION pt_trans_object ) // // Return: 1 Success // 0 Failure // -1 SQL error // // // Retrieves split factor for the profile_code // // Modification History // // WHO WHEN WHAT // === ==== ==== // MAS 07/23/94 Created. // PER 08/16/94 Added error messages. if w_emiss.cbx_background.checked then SetPointer ( Arrow!) else SetPointer ( HourGlass!) end if // Declare variables SELECT weighDAT*t_perc INTO :pd_weight_perc FROM rap_speciation_split_factors WHERE profile_code = :ps_profile_code AND material_code = :ps_emittant USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // No data found. IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "No weight percent found for profile code: " + & ps_profile_code + " material code: " + ps_emittant, & InformatDAT*ion!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "No weight percent found for profile code: " + & ps_profile_code ) FileWrite( pi_log_file, & " material code: " + & ps_emittant ) END IF Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_mass_fractions()", pi_log_file, pt_trans_object ) Return( -1 ) DAT* ELSE // Record retrieved successfully Return( 1 ) END IF // end uof_get_mass_fractions() IF pt_trans_object.sqlcode = -1 THEN Return (-1) ELSEIF pt_trans_object.sqlcode = 100 THEN Return (0) ELSEIF pt_trans_object.sqlcode = 0 THEN return (1) END IF end function public function int uof_speciation_scc_ams (decimal pd_process_rid, ref string ps_scc_ams_code, int pi_log_file, ref transaction pt_trans_object);// int uof_speciation_scc_ams (DECIMAL DAT* pd_process_rid, // STRING ps_scc_ams_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object) // // This function retreives the SCC/AMS code for a given process. // // Returns: 1 Success // 0 Record not found // -1 SQL Error // // Modification History // When Who What // ------- --- ------------------------------------------------ // 17AUG94 PEDAT*R Added error messages. // Added pi_log_file and pt_trans_object. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables select scc_ams_code into :ps_scc_ams_code from rap_processes where rid = :pd_process_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "DAT*SCC/AMS code not found " + & "for process " + String( pd_process_rid ), & Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SCC/AMS code not found for process " + & String( pd_process_rid ) ) END IF ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_speciation_scc_ams()", pi_log_file, pt_trans_object ) ROLLBACDAT*K USING pt_trans_object; Return( -1 ) ELSE // Record retrieved successfully COMMIT USING pt_trans_object; Return( 1 ) END IF // end uof_speciation_scc_ams() end function public function integer uof_metrics (decimal pd_protocol_rid, ref integer pi_num_metrics, ref integer pi_num_metric_groups, ref decimal pd_record_group_no[], ref decimal pd_sequence_no[], ref string ps_item_type[], ref string ps_operator_type[], ref string ps_numer_material_code[], ref string ps_denom_maDAT*terial_code[], ref string ps_metric_code[], ref string ps_input_output_flag[], integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_metrics( DECIMAL pd_protocol_rid, // INTEGER VAR pi_num_metrics, // INTEGER VAR pi_num_metric_groups, // DECIMAL VAR pd_record_group_no[], // DECIMAL VAR pd_sequence_no[], // STRING VAR ps_item_type[], // STRING VAR DAT*ps_operator_type[], // STRING VAR ps_numer_material_code[], // STRING VAR ps_denom_material_code[], // STRING VAR ps_metric_code[], // STRING VAR ps_input_output_flag[], // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function returns the metrics for a given method // // Returns: 1 Success // 0 Record not found // DAT* -1 SQL Error // // Who When What // --- --------- ------------------------------------------------- // PER 18 MAY 94 Modified for new table schema. // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF INTEGER li_metr_ub = 300 // Cursor to retrieve the metrics DAT*for this method DECLARE meth_metric_list CURSOR FOR SELECT record_group_no, sequence_no, item_type, operator_type, numer_material_code, denom_material_code, metric_code, input_output_flag FROM rap_method_metrics WHERE protocol_rid = :pd_protocol_rid ORDER BY record_group_no, sequence_no USING pt_trans_object; // Retrieve the metrics for this method pi_num_metrics = 0 pi_num_metric_grDAT*oups = 0 OPEN meth_metric_list; IF pt_trans_object.sqlcode <> 0 THEN // Error opening cursor uof_sql_error( "uof_metrics()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE meth_metric_list; Return( -1 ) END IF // Retrieve the first record FETCH meth_metric_list INTO :pd_record_group_no[1], :pd_sequence_no[1], :ps_item_type[1], :ps_operator_type[1], :ps_numer_material_code[1], :ps_denom_material_code[1], DAT* :ps_metric_code[1], :ps_input_output_flag[1]; IF pt_trans_object.sqlcode = 100 THEN // Error-calculations protocols record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No method metrics records " + & "found for protocol " + String( pd_protocol_rid ), & Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "No method metrics records " + & DAT* "found for protocol " + String( pd_protocol_rid ) ) END IF ROLLBACK USING pt_trans_object; CLOSE meth_metric_list; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_metrics()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE meth_metric_list; Return( -1 ) ELSE pi_num_metrics = 1 pi_num_metric_groups = 1 END IF // Loop through method metric records DO WHILE pt_trans_object.sqlcode = 0 DAT* // Retrieve the next record FETCH meth_metric_list INTO :pd_record_group_no[pi_num_metrics + 1], :pd_sequence_no[pi_num_metrics + 1], :ps_item_type[pi_num_metrics + 1], :ps_operator_type[pi_num_metrics + 1], :ps_numer_material_code[pi_num_metrics + 1], :ps_denom_material_code[pi_num_metrics + 1], :ps_metric_code[pi_num_metrics + 1], :ps_input_output_flag[pi_num_metrics +1]; IF pt_trans_object.sqlcode = 100 THEN // No moreDAT* records to retrieve EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_metrics()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE meth_metric_list; Return( -1 ) ELSE pi_num_metrics++ IF pi_num_metrics >= li_metr_ub THEN uof_increment_array_dec(pd_record_group_no[], li_metr_ub, 100) pd_sequence_no[li_metr_ub] = 0 ps_item_type[li_metr_ub] = 'END' ps_operator_type[li_DAT*metr_ub] = 'END' ps_numer_material_code[li_metr_ub] = 'END' ps_denom_material_code[li_metr_ub] = 'END' ps_metric_code[li_metr_ub] = 'END' ps_input_output_flag[li_metr_ub] = 'END' END IF pi_num_metric_groups = pd_record_group_no[pi_num_metrics] END IF LOOP // end method metric loop // Close method metric cursor CLOSE meth_metric_list; // Normal return Return( 1 ) // end uof_metrics() end function public function integer uof_emissions_mDAT*ain (datetime pd_start_date_time, datetime pd_end_date_time, decimal pd_process_rid, string ps_reference_code, string ps_ini_file, string ps_ini_section, integer pi_log_file, ref long pl_next_process_rid, integer pi_num_calc_prots, string ps_calc_prots[], integer pi_num_modes, string ps_modes[], integer pi_num_pollutants, string ps_pollutants[]);// INT uof_emissions_main( DATETIME pd_start_date_time, // DATETIME pd_end_date_time, // DECIMAL pd_process_rid, // STRING ps_DAT*reference_code, // STRING ps_ini_file, // STRING ps_ini_section, // INTEGER pi_log_file , // LONG VAR pl_next_process_rid, // INTEGER pi_num_calc_prots, // STRING ps_calc_prots[], // INTEGER pi_num_modes, // STRING ps_modes[], // INTEGER pi_num_pollutants, // STRING ps_pollutants[]) // // This function is the main driver for emissions calculation // // Returns: 1 Success // 0 Failure //DAT* // Modification History // // When Who What // ------- --- ------------------------------------------------ // 15JUL94 MAS Added support for emission calculation using // default protocol // // 19JUL94 PER Added support for user cancel during calculation // procedure. // // 19JUL94 MAS Added support for Speciation method // // 25JUL94 PER Added new source, device, and process id return // parameters from uof_process_name(). // // 28JUL94 MAS Current datDAT*e for activity insert is done in this // function instead of uof_cal_emiss_factor // This date_time(ld_today) is used in downstreaming // process. One argument(ld_today) is added to // uof_calc_emission_factor // // 17AUG94 PER Reformatted error messages. // Added error messages. // Removed commented-out transaction creation code. // // 26AUG94 MAS Move uof_calc_prots and uof_modes calls to clicked // event of cb_ok control in w_emiss window. // HaDAT*ve a new function call to uof_process_info // Separated process info gathering from this routine. // // 31AUG94 MAS Modularized the control emission portions of the code // // 09FEB96 REJ Added code to skip user identified pollutants without emission or // speciation factors in uof_build_poll_list // // 13MAY98 MDY Added calls to new object functions to load instance variables with // with geographic rid info for current process and seasonal adjustment // factDAT*or for current process // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables BOOLEAN lb_calc_success // Flag for successful calculation BOOLEAN lb_scc_at_str // Flag for scc_ams code at str. STRING ls_source_code, ls_device_code, ls_process_code SDAT*TRING ls_emission_unit_code STRING ls_input_output_flag[], ls_method_code[], ls_throughput_material_code[], & ls_metric_code[], ls_mode_type[], ls_item_type[], ls_operator_type[], & ls_numer_material_code[], ls_denom_material_code[] INTEGER li_scc_ams_loop, li_ret_status, li_num_protocols, & li_prot_loop, li_num_metrics, li_num_metric_groups, li_poll_loop, li_profile_loop DECIMAL ld_protocol_rid[] INTEGER li_priority_no[] DOUBLE ldb_est_emission DECIMAL ld_record_group_noDAT*[] DECIMAL ld_sequence_no[] BOOLEAN lb_control_process_flag DECIMAL ld_orig_process_rid DECIMAL ld_input_value[] STRING ls_input_unit[] STRING ls_scc_ams_codes[] DOUBLE ldb_cont_emiss // controlled emission value DOUBLE ldb_fug_emiss // fugitive emission value STRING ls_spec_scc_ams_code // scc_ams code for speciation STRING ls_profile_codes[] // profile code for speciation STRING ls_spec_filter[] // filter for controls INTEGER li_num_profile_codes // number DAT*of profile codes INTEGER li_input_act_count // number of input value(s) DATETIME ld_today // This is used for controlled emiss. // used to be done in _calc_emiss INTEGER li_num_scc_ams INTEGER li_num_inputs // number of input activities for Cont. Emiss INTEGER li_input_act // loop control for input act. values LONG ll_discharge_proc_rid // downstrdischarge emission INTEGER li_method // number of method user chose STRING ls_methDAT*od_used STRING ls_gen_spec_thruputs // Clause to restrict use of generic speciation profiles STRING ls_thruput, ls_null INTEGER li_thruput, li_i string ls_curDeviceCode boolean lb_specThruput ls_method_code[50] = 'End' ls_throughput_material_code[50] = 'End' ls_mode_type[50] = 'End' ls_input_output_flag[300] = 'End' ls_metric_code[300] = 'End' ls_item_type[300] = 'End' ls_operator_type[300] = 'End' ls_numer_material_code[300] = 'End' ls_denom_material_code[300] = 'End' INTEDAT*GER li_metrics_ub = 300 // Initialize variables ib_controlsRetrieved = FALSE //mdy 2/99 ib_controlsByPollutant = FALSE //mdy 2/99 idt_startDateTime = pd_start_date_time //mdy 12/98 idt_endDateTime = pd_end_date_time //mdy 12/98 ld_today = DateTime(Today(), Now()) lb_control_process_flag = FALSE SetNull(ls_null) // Update background processing status screen IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_material.text = " " END IF //get process information loaded, andDAT* log current status li_ret_status = uof_process_info(pd_process_rid, lb_control_process_flag, pi_log_file) IF li_ret_status <> 1 THEN // error in retrieving process info: source, device, etc. return (0) END IF // Following code was added to handle scc_amc_code at stream level. // (this code was taken from the old uof_device_scc_ams() function. MDY 2/99) IF is_curSccCode = "@STREAM" THEN // scc_ams @ stream level lb_scc_at_str = TRUE //Retrieve the scc_ams_code at streamDAT*(s) //from rap_activities table li_ret_status = uof_get_scc_at_stream(pd_process_rid, & ls_scc_ams_codes[], li_num_scc_ams, & sqlca, pi_log_file) if li_ret_status <= 0 then return 0 end if is_curSccCode = ls_scc_ams_codes[1] ELSE // scc_ams @ process level lb_scc_at_str = FALSE li_num_scc_ams = 1 ls_scc_ams_codes[1] = is_curSccCode END IF //determine if this is considered a control process (no scc/amDAT*s code) IF lb_scc_at_str THEN lb_control_process_flag = FALSE ELSE if trim(is_curSccCode) = "" OR isNull(is_curSccCode) then lb_control_process_flag = TRUE else lb_control_process_flag = FALSE end if END IF //get seasonal adjustment factor for current process //the function loads the instance variable in_curSeasonalAdjFactor //*** MDY 05/13/98 if uof_get_seasonal_adj_factor(pd_process_rid) < 0 then IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " Error rDAT*etrieving Seasonal Adjustment factor; Ending emission estimation for " + & "process: " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF return 0 end if IF lb_control_process_flag then //control process IF w_emiss.il_process_rid > 0 THEN MessageBox("RAPIDS","Process Level Estimation not supported for connected processes") IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " Ending emissiDAT*on estimation for " + & "process " + String(pd_process_rid)) FileWrite(pi_log_file, " ") END IF Return(0) END IF FOR li_method = 1 TO w_emiss.ii_num_methods CHOOSE CASE w_emiss.is_method_types[li_method] CASE 'F' ls_method_used = 'EMIS FACTOR' CASE 'P' ls_method_used = 'SPECIATION' CASE 'BC' ls_method_used = 'MASS BALANCE' END CHOOSE is_curCalcMethod = ls_method_used //MDY 2/99 IF pi_log_file <> -1 AND DecDAT*(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " METHOD USED: "+ls_method_used) END IF li_ret_status = uof_control_emission_main(& pd_process_rid, ps_pollutants[],& pi_num_pollutants, ps_reference_code,& pd_start_date_time, pd_end_date_time,& pi_log_file, sqlca, ldb_fug_emiss, ldb_cont_emiss,& lb_calc_success, pl_next_process_rid, ld_today,& w_emiDAT*ss.is_method_types[li_method]) IF li_ret_status = -2 THEN Return (-2) ELSEIF li_ret_status <> 1 THEN // need to return next process IF w_emiss.uo_tl.uof_downstream_process(pd_process_rid, sqlca,& pl_next_process_rid ) = -1 then Return( -1 ) ELSE Return (0) END IF END IF NEXT ELSE // non-control process w_emiss.dw_composite_ef.Reset() ls_profile_codes[50] = 'End' ls_spec_filter[50] = 'End' // added this line to identifyDAT* process rid that has already been attempted, so // that processes with multiple input streams will only be attempted once. // indicator previously only marked successful calculations REJ 07MAR96 w_emiss.il_uncontrolled_process_rid = pd_process_rid FOR li_scc_ams_loop = 1 TO li_num_scc_ams // loop to handle more than one output streams // with SCC_AMS_CODE metric is_curSccCode = ls_scc_ams_codes[li_scc_ams_loop] IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.DAT*text) > 0 THEN FileWrite(pi_log_file, " SCC/AMS: " + is_curSccCode) END IF LONG ll_spec_target_process_rid li_ret_status = uof_build_poll_list (pd_process_rid, ps_pollutants[], & pi_num_pollutants, is_curSccCode, w_emiss.is_poll_calc_fail[], "", & pd_start_date_time, pd_end_date_time, pi_log_file, ls_profile_codes[], & li_num_profile_codes, ls_spec_filter[], ll_spec_target_process_rid) IF li_ret_status <> 1 THEN // need to return next process IF w_emissDAT*.uo_tl.uof_downstream_process(pd_process_rid, sqlca,& pl_next_process_rid ) = -1 then Return( -1 ) ELSE // to keep track immediate previous process w_emiss.il_prev_process_rid = pd_process_rid Return (0) END IF END IF //Retrieve source, device, and process-code for given scc_ams code IF uof_source_device_process(is_curSccCode, ls_source_code, & ls_device_code, ls_process_code, pi_log_file, sqlca) <> 1 THEN // DAT*Error retrieving record or record not found ROLLBACK USING sqlca; IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " Retrieval Error - Ending emission estimation for " + & "process " + String(pd_process_rid)) FileWrite(pi_log_file, " ") END IF Return (0) END IF IF w_emiss.uo_tl.uof_downstream_process(pd_process_rid, sqlca, & ll_disDAT* charge_proc_rid) = 1 THEN IF w_emiss.il_process_rid > 0 AND ll_discharge_proc_rid > 0 THEN MessageBox("RAPIDS","Process Level Estimation not supported for connected processes") IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " ENDING emission estimation for " + & "process " + String(pd_process_rid)) FileWrite(pi_log_file, " ") END IF Return(0) END IF w_emDAT* iss.il_discharge_proc_rid = pd_process_rid END IF FOR li_poll_loop = 1 TO pi_num_pollutants gd_total_fug_emission = 0 is_curPollutant = ps_pollutants[li_poll_loop] //MDY 12/8/98 // Check to see if user wants to abort estimation process Yield() IF w_emiss.cbx_background.checked AND w_emiss.ib_abort THEN IF MessageBox( "Emission Estimator", "Abort estimation process?", & Question!, YesNo! ) = 1 THEN /DAT*/ User wants to abort out of estimation process IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & "***** ESTIMATION RUN ABORTED BY USER *****" ) FileWrite( pi_log_file, " " ) END IF ROLLBACK USING sqlca; pl_next_process_rid = 0 Return( -2 ) // changed from 0 to -2 to make it distinct // MAS 14JUN95 DAT* ELSE // Continue with estimation w_emiss.ib_abort = FALSE END IF END IF // Check that this pollutant has not been eliminated from possible calculations IF w_emiss.is_poll_calc_fail[li_poll_loop] = 'M' THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & " No factors available for emittant: " + ps_pollutants[li_poll_loop]) FileWriteDAT*( pi_log_file, " ...Continuing with next emittant. ") END IF CONTINUE ELSE IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "~r~n FOR EMITTANT: " + ps_pollutants[li_poll_loop]) END IF END IF // Clear the successful calculation flag for this emittant lb_calc_success = FALSE // Update background processing status screen IF w_emiss.cbx_background.checked THEN w_emiss_statuDAT*s.sle_material.text = ps_pollutants[li_poll_loop] END IF // Retreive emission calculation methods for this process/pollutant // in priority order. // protocol_rid, priority_no, method_code, throughput_material_code, // and emittant_material_code values are returned in their respective // arrays. li_num_methods contains the number of methods returned. li_ret_status = uof_priority_list( ls_source_code, ls_device_code, & ls_process_code,DAT* is_curSccCode, ps_pollutants[li_poll_loop], & pi_num_modes, ps_modes[], ld_protocol_rid[], li_priority_no[], & ls_mode_type[], ls_method_code[], ls_throughput_material_code[], & li_num_protocols, pi_log_file, sqlca ) IF li_ret_status = -1 THEN // SQL error retrieving records ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " Retrieval Error - Ending emission estimation for " + & DAT* "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF ELSEIF li_ret_status = 0 THEN // no protocol records found // continue with next pollutant CONTINUE ELSEIF li_ret_status = 1 THEN // Loop through emission calculation protocols FOR li_prot_loop = 1 TO li_num_protocols // Check to see if we have already successfully estimated an // emission for this pollutanDAT*t, and the user specified to // stop after the first successful estimation IF w_emiss.cbx_stop.checked AND lb_calc_success THEN // Go on to next pollutant. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " ...Continuing with next pollutant. ") END IF EXIT END IF // Check to see if we have exceeded the user-specified calculation // methodDAT* priority level IF li_priority_no[li_prot_loop] > Integer( w_emiss.em_priority.text) THEN // We have passed the specified ENDing priority level (Protocols are // sorted by priority). // Go on to next pollutant. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " User-specified priority limit exceeded" ) FileWrite( pi_log_file, " ...Continuing with next polluDAT*tant. ") END IF EXIT END IF // Check to see if user wants to use this type of protocol IF uof_use_calc_prot( ls_method_code[li_prot_loop], & pi_num_calc_prots, ps_calc_prots[] ) = 0 THEN // User hasn't selected to use this type of method. // Try next protocol. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " PriorDAT* ity: " + & String( li_priority_no[li_prot_loop] ) + "; Method: " + & ls_method_code[li_prot_loop] + "; method not chosen by user." ) END IF CONTINUE END IF // Check to see if user wants to use this type of operation mode IF uof_use_mode_type( ls_mode_type[li_prot_loop], & pi_num_modes, ps_modes[] ) = 0 THEN // User hasn't selected to use this mode type. DAT*" // Try next protocol. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " Mode Type " + ls_mode_type[li_prot_loop] +& " not chosen by user.~r~n" ) END IF CONTINUE END IF // Retrieve the metrics for this protocol li_ret_status = uof_metrics ( ld_protocol_rid[li_prot_loop], & li_num_metrics,li_num_metriDAT*$c_groups,& ld_record_group_no[],ld_sequence_no[], & ls_item_type[],ls_operator_type[], & ls_numer_material_code[],ls_denom_material_code[],& ls_metric_code[],ls_input_output_flag[],& pi_log_file, sqlca ) IF li_ret_status = -1 THEN // Error retrieving records ROLLBACK USING sqlca; IF pi_loDAT*&g_file <> -1 THEN FileWrite( pi_log_file, " Retrieval Error - ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF Return( 0 ) ELSEIF li_ret_status = 0 THEN // No metrics records found // Try next protocol IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_fileDAT*(, " No metrics found for protocol rid " +& String(ld_protocol_rid[li_prot_loop])) END IF CONTINUE END IF // Call appropriate emission estimation function IF ls_method_code[li_prot_loop] = "EMIS FACTOR" THEN w_emiss.is_method_type = 'F' //16FEB95 MAS IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Priority: " + & String( li_priority_no[li_prot_loop] ) + "; MDAT**ethod: " + & ls_method_code[li_prot_loop] + "; Throughput: " + & ls_throughput_material_code[li_prot_loop]) END IF // Check possibility of calculation IF POS(w_emiss.is_poll_calc_fail[li_poll_loop],'E') = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & " No factors available for emittant: " + ps_pollutants[li_poll_loop]) FileWrite( pi_log_filDAT*,e, " ...Continuing with next protocol. ") END IF CONTINUE END IF // Call emission factor calc function // profile code for emission factor is null li_ret_status = uof_calc_emission_factor( pd_process_rid, & is_curSccCode, ps_reference_code, & pd_start_date_time, pd_END_date_time, & li_num_metrics, li_num_metric_groups, & DAT*. ld_record_group_no[], & ld_sequence_no[], ls_item_type[], & ls_operator_type[],ls_input_output_flag[], & ls_numer_material_code[], & ls_denom_material_code[], ls_metric_code[],& ls_throughput_material_code[li_prot_loop], & ps_pollutants[li_poll_loop], & ldb_est_emission, ls_emission_unDAT*0it_code, & pi_log_file, sqlca, this.uoit_emiss_tran, & this.uoit_rid_tran,& pl_next_process_rid,ls_null, ls_null, & ld_today, 'F',lb_scc_at_str,ls_method_code[li_prot_loop],& li_priority_no[li_prot_loop], w_emiss.id_cutoffDate) IF li_ret_status = 1 THEN // Successful estimation // Result is in ldb_est_emissionDAT*2 and ls_emission_unit_code lb_calc_success = TRUE IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Emission estimation " + & "successful using priority " + & String( li_priority_no[li_prot_loop] ) + & ", Method " + ls_method_code[li_prot_loop] + & ", Throughput material " + & ls_DAT*4throughput_material_code[li_prot_loop] + & ", Emittant material " + & ps_pollutants[li_poll_loop] + " " + & uof_activity_get_value(ldb_est_emission) + " " + & ls_emission_unit_code, Information!, OK! ) END IF ELSEIF li_ret_status = 0 THEN ROLLBACK USING sqlca; CONTINUE ELSE // SQL Error DAT*6 ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " Retrieval Error - ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF Return( 0 ) END IF ELSEIF ls_method_code[li_prot_loop] = "SPECIATION" THEN w_emiss.is_method_type = 'P' IF piDAT*8_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Priority: " + & String( li_priority_no[li_prot_loop] ) + "; Method: " + & ls_method_code[li_prot_loop] + "; Throughput: " + & ls_throughput_material_code[li_prot_loop]) END IF // Check possibility of calculation IF POS(w_emiss.is_poll_calc_fail[li_poll_loop],'S') = 0 THEN //only speciation method chDAT*:osen IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & " Either factors or activity unavailable") FileWrite( pi_log_file, " ...Continuing with next protocol. ") END IF CONTINUE ELSE //speciation and emission factor methods chosen li_thruput = POS(w_emiss.is_poll_calc_fail[li_poll_loop],'S,') IF li_thruput > 0 THEN lb_specThruput = faDAT*<lse //added this optimization using instance speciation thruput array MDY 11/99 //looks for any "usable" speciate material in is_poll_calc_fail[] string for li_i = 1 to ii_usedSpecThruputs IF POS(w_emiss.is_poll_calc_fail[li_poll_loop], "," + is_usedSpecThruputs[li_i]) > 0 THEN lb_specThruput = true exit END IF next //if above loop failed, then try the old way MDY 11/99 //looks for any ps_pollutant[] name iDAT*>n is_poll_calc_fail[] string //should only need to look up to current pollutant, since speciate //pollutants have been moved to the front of ps_pollutants[], if present if not lb_specThruput then FOR li_i = 1 TO li_poll_loop IF POS(w_emiss.is_poll_calc_fail[li_poll_loop], "," + ps_pollutants[li_i]) > 0 THEN IF w_emiss.is_poll_calc_fail[li_i] <> 'F' THEN lb_specThruput = true exit END IF END IF NEXT DAT*@ end if IF not lb_specThruput THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & " Speciation throughput activity unavailable") FileWrite( pi_log_file, " ...Continuing with next protocol. ") END IF CONTINUE END IF END IF END IF // get scc_ams code for ps_process_rid li_ret_status DAT*B= uof_speciation_scc_ams(pd_process_rid, & ls_spec_scc_ams_code, pi_log_file, sqlca) IF li_ret_status = -1 THEN // SQL error // Added log file message. 17AUG94 PER IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FDAT*DileWrite( pi_log_file, " " ) END IF return (-1) ELSEIF li_ret_status = 0 THEN // no scc_ams found // need to know how to handle this IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 then FileWrite( pi_log_file, "SCC/AMS code for process " + & String(pd_process_rid) + & " not found in process table" ) FiDAT*FleWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF Return (0) END IF FOR li_profile_loop = 1 to li_num_profile_codes // Call emission factor calc function // REJ 24JUN96 Only one calculation per pollutant and method can be stored. li_ret_status = 0 IF (NOT lb_calc_success) THDAT*HEN li_ret_status = uof_calc_emission_factor( pd_process_rid, & is_curSccCode, ps_reference_code, & pd_start_date_time, pd_END_date_time, & li_num_metrics, li_num_metric_groups, & ld_record_group_no[], & ld_sequence_no[], ls_item_type[], & ls_operator_type[], ls_input_output_flag[],& DAT*J ls_numer_material_code[], & ls_denom_material_code[], ls_metric_code[], & ls_throughput_material_code[li_prot_loop], & ps_pollutants[li_poll_loop], & ldb_est_emission, ls_emission_unit_code, & pi_log_file, sqlca, & this.uoit_emiss_tran, this.uoit_rid_tran, & pl_next_process_riDAT*Ld, & ls_profile_codes[li_profile_loop], ls_spec_filter[li_profile_loop], & ld_today, 'P', lb_scc_at_str, ls_method_code[li_prot_loop], & li_priority_no[li_prot_loop], w_emiss.id_cutoffDate) END IF IF li_ret_status = 1 THEN // Successful estimation // Result is in ldb_est_emission and ls_emission_unit_code //MDY 9/99 if we have been calculating non-standard (additive) proDAT*Nfiles //(indicated by ii_firstStandardProfile > 1), if the next profile would //be a standard (non-additive) profile, then calculation should end here. //ii_firstStandardProfile is set in uof_get_profile() if li_profile_loop + 1 >= ii_firstStandardProfile then lb_calc_success = TRUE if ii_firstStandardProfile > 1 then //write a message to the log file that a non-standard profile //was calculated instead of a standard DAT*Pprofile IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " Additive speciation profile(s) have " +& "overridden standard profile(s).") END IF end if end if IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Emission estimation " + & "successful using priority " DAT*R+ & String( li_priority_no[li_prot_loop] ) + & ", Method " + ls_method_code[li_prot_loop] + & ", Throughput material " + & ls_throughput_material_code[li_prot_loop] + & ", Emittant material " + & ps_pollutants[li_poll_loop] + " " + & String(Round(Dec(string(ldb_est_emission)),4) ) + " " + & DAT*T ls_emission_unit_code, Information!, OK! ) END IF ELSEIF li_ret_status = -1 THEN // SQL Error ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF RetuDAT*Vrn( 0 ) END IF // Speciation NEXT // li_profile_loop ELSEIF ls_method_code[li_prot_loop] = "MASS BALANCE" THEN w_emiss.is_method_type = 'BC' IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Priority: " + & String( li_priority_no[li_prot_loop] ) + "; Method: " + & ls_method_code[li_prot_loop] + "; Throughput: " + &DAT*X ls_throughput_material_code[li_prot_loop]) END IF IF POS(w_emiss.is_poll_calc_fail[li_poll_loop],'B') = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, & " Input activity unavailable for emittant: " + ps_pollutants[li_poll_loop]) FileWrite( pi_log_file, " ...Continuing with next protocol. ") END IF CONTINUE DAT*Z END IF li_ret_status = uof_calc_mass_balance( pd_process_rid, & is_curSccCode, ps_reference_code, & pd_start_date_time, pd_END_date_time, & li_num_metrics, li_num_metric_groups, & ld_record_group_no[], & ld_sequence_no[], ls_item_type[], & ls_operator_type[], ls_numer_material_code[], & DAT*\ ls_denom_material_code[], ls_metric_code[], & ls_throughput_material_code[li_prot_loop], & ps_pollutants[li_poll_loop], & ldb_est_emission, ls_emission_unit_code, & pi_log_file, sqlca, this.uoit_emiss_tran, this.uoit_rid_tran, & pl_next_process_rid,lb_scc_at_str,li_priority_no[li_prot_loop]) IF liDAT*^_ret_status = 1 THEN // Successful estimation // Result is in ldb_est_emission and ls_emission_unit_code lb_calc_success = TRUE IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Emission estimation " + & "successful using priority " + & String( li_priority_no[li_prot_loop] ) + & ", Method " + lsDAT*`_method_code[li_prot_loop] + & ", Throughput material " + & ls_throughput_material_code[li_prot_loop] + & ", Emittant material " + & ps_pollutants[li_poll_loop] + " " + & uof_activity_get_value(ldb_est_emission) + " " + & ls_emission_unit_code, Information!, OK! ) END IF ELSEIF li_ret_sDAT*btatus = -1 THEN // SQL Error ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF Return( 0 ) END IF ELSE // UNKNOWN METHOD IF pi_log_file <> -1 THEN FDAT*dileWrite( pi_log_file, "Unknown emission estimation " + & "type " + ls_method_code[li_prot_loop] + " found!" ) FileWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF END IF // method NEXT // li_prot_loop END IF // Mark calculation failure for reference IF NOT lb_calc_success THEN DAT*f w_emiss.is_poll_calc_fail[li_poll_loop] = 'F' END IF NEXT // li_poll_loop // Clear is_poll_calc_fail FOR li_i = 1 TO pi_num_pollutants w_emiss.is_poll_calc_fail[li_i] = "" NEXT NEXT // li_scc_ams_loop END IF // if control_flag COMMIT USING sqlca; IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " ENDING emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file,DAT*h " " ) END IF // need to return next process IF w_emiss.uo_tl.uof_downstream_process(pd_process_rid, sqlca,& pl_next_process_rid ) = -1 then Return( -1 ) ELSE // to keep track immediate previous process w_emiss.il_prev_process_rid = pd_process_rid Return (1) END IF // END uof_emissions_main() end function public function integer uof_uncont_poll_list (ref integer pi_num_pollutants, ref string ps_pollutants[], string ps_scc_ams_code, integer pi_log_fDAT*jile, transaction pt_trans_object);// INTEGER uof_uncont_poll_list(INTEGER VAR pi_num_pollutants, // STRING VAR ps_pollutants[], // STRING ps_scc_ams_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object) // // Returns: 1 Success *OR* // default pollutant(s) found // 0 no default // pollutants were found DAT*lin rap_scc_ams_materials. // -1 SQL Error // // Set up an array of default pollutant list for the scc_ams_code // // Modification History // When Who What // ------- --- ----------------------------------------------- // 27AUG94 MAS CREATED // // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSEDAT*n SetPointer( HourGlass! ) END IF pi_num_pollutants = 0 // Cursor for scc_ams/materials DECLARE mat_cur CURSOR FOR SELECT material_code FROM rap_scc_ams_materials WHERE scc_ams_code = :ps_scc_ams_code USING pt_trans_object; IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Retrieving " + & "default emittants from rap_scc_ams_materials." ) END IF OPEN mat_cur; IF pt_trans_object.sqlcode <> 0 THDAT*pEN // SQL Error uof_sql_error( "uof_uncont_poll_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) END IF // Retrieve first record FETCH mat_cur INTO :ps_pollutants[1]; IF pt_trans_object.sqlcode = 100 THEN // Error-No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No pollutants specified and " + & "no defaults found for SCC/AMS cDAT*rode: " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " No emittants specified and no " + & "defaults found for SCC/AMS code: " + ps_scc_ams_code ) END IF ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_uncont_poll_list()", pi_log_file, pt_DAT*ttrans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) ELSE pi_num_pollutants = 1 END IF // Loop through the rest of the pollutant (material) records DO WHILE pt_trans_object.sqlcode = 0 // Retrieve the next record FETCH mat_cur INTO :ps_pollutants[ pi_num_pollutants + 1 ]; IF pt_trans_object.sqlcode = 100 THEN // No more records to retrieve EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error DAT*v uof_sql_error( "uof_uncont_poll_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) ELSE pi_num_pollutants++ END IF LOOP // end materials loop // Close materials cursor CLOSE mat_cur; // Normal return Return( 1 ) // end uof_uncont_poll_list() end function public function integer uof_create_trans_object (integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_create_trans_object( DAT*xINTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function creates a transaction object // // Returns: 1 Success // -1 SQL Error // // Modification History // When Who What // ------- --- ------------------------------------------------- // 23AUG94 PER Added roles support for Oracle transactions. // 13SEP94 PER Modified to use database info in sqlca. // Removed input parameters from .ini file. // 2DAT*z6SEP96 REJ Added IsValid check to avoid creating when handle is already in use // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Start transaction object IF NOT IsValid(pt_trans_object) THEN pt_trans_object = CREATE TRANSACTION pt_trans_object.dbms DAT*|= sqlca.dbms pt_trans_object.servername = sqlca.servername pt_trans_object.database = sqlca.database pt_trans_object.userid = sqlca.userid pt_trans_object.dbpass = sqlca.dbpass pt_trans_object.logid = sqlca.logid pt_trans_object.logpass = sqlca.logpass pt_trans_object.dbparm = sqlca.dbparm CONNECT USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN // Error connecting to database uof_sql_error( "uof_create_trans_object()", pi_log_file, & DAT*~ pt_trans_object ) Return( -1 ) END IF IF gs_database = 'ORACLE' THEN // Oracle database. Issue role command. EXECUTE IMMEDIATE :gs_role USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error setting role uof_sql_error( "uof_create_trans_object()", pi_log_file, & pt_trans_object ) Return( -1 ) END IF END IF END IF // Normal function return Return( 1 ) // end uof_create_transDAT*_object() end function public function integer uof_get_scc_at_stream (long pl_process_rid, ref string ps_scc_ams_codes[], ref integer pi_num_scc_ams, transaction pt_trans_object, integer pi_log_file);// int uof_get_scc_at_stream(STRING var ps_scc_ams_codes[] // INTEGER var pi_num_scc_ams) // // Description: // This function retrieves scc_ams_codes at the stream level if // scc_ams code process is @STREAM. // // Return: 1 Success // DAT* 0 Failure // -1 SQL error // // // History: // // WHO WHEN WHAT // === ======= ==== // IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer ( HourGlass!) END IF // Initialize variables pi_num_scc_ams = 0 DECLARE scc_ams_cur CURSOR FOR SELECT value FROM rap_activities, rap_streams WHERE ref_rid = rap_streams.rid AND from_process_rid = :pl_process_rid // AND from_process_rid = :w_eDAT*miss.il_prev_process_rid AND SUBSTR(metric_code,1) = 'SCC AMS CODE' USING pt_trans_object; OPEN scc_ams_cur; IF pt_trans_object.sqlcode <> 0 then ROLLBACK USING pt_trans_object; CLOSE scc_ams_cur; END IF FETCH scc_ams_cur INTO :ps_scc_ams_codes[1] ; IF pt_trans_object.sqlcode = 100 THEN // no record found ROLLBACK USING pt_trans_object; CLOSE scc_ams_cur; IF pi_log_file <> -1 THEN FileWrite(pi_log_file, "Failure retrieving ") FilDAT*eWrite(pi_log_file, "SCC_AMS code(s) at stream level.") END IF ps_scc_ams_codes[1] = "" Return (0) ELSEIF pt_trans_object.sqlcode <> 0 THEN // error ROLLBACK USING pt_trans_object; CLOSE scc_ams_cur; Return (-1) END IF DO WHILE pt_trans_object.sqlcode = 0 pi_num_scc_ams++ if isNull(ps_scc_ams_codes[pi_num_scc_ams]) or trim(ps_scc_ams_codes[pi_num_scc_ams]) = "" then ps_scc_ams_codes[pi_num_scc_ams] = "" end if FETCH scc_ams_cur INTO :psDAT*_scc_ams_codes[pi_num_scc_ams + 1]; LOOP IF pt_trans_object.sqlcode = 100 THEN IF pi_num_scc_ams > 0 THEN // successfully retrieve at least one record IF pi_log_file <> -1 THEN FileWrite(pi_log_file, "Successful retrieving ") FileWrite(pi_log_file, "SCC_AMS code(s) at stream level.") END IF COMMIT USING pt_trans_object; Return (1) END IF ELSE // Error Condition IF pi_log_file <> -1 THEN FileWrite(pi_log_file, "FDAT*ailure retrieving ") FileWrite(pi_log_file, "SCC_AMS code(s) at stream level.") END IF ROLLBACK USING pt_trans_object; Return (-1) END IF end function public function integer uof_speciation_pollutant_list (string ps_profile[], integer pi_num_profiles, integer pi_log_file, transaction pt_trans_obj, ref string ps_pollutants[], ref integer pi_num_pollutants);INTEGER li_profiles FOR li_profiles = 1 TO pi_num_profiles DECLARE pollutant_cur CURSOR FOR SELECT dDAT*istinct (emittant_material_code) FROM rap_emission_factors WHERE profile_code = :ps_profile[li_profiles]; OPEN pollutant_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_speciation_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE pollutant_cur; Return( -1 ) END IF IF pi_num_pollutants = 0 THEN pi_num_pollutants = 1 END IF // Retrieve first record FETCH pollutant_cur INTO :ps_pollutants[pi_num_pollutants]; IF sqlca.sDAT*qlcode = 100 THEN ROLLBACK USING sqlca; ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_speciation_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE pollutant_cur; Return( -1 ) ELSE // Loop through the rest of the pollutant(emission factors) DO WHILE sqlca.sqlcode = 0 // Retrieve the next record FETCH pollutant_cur INTO :ps_pollutants[ pi_num_pollutants + 1 ]; IF sqlca.sqlcode = 100 THEN // No more records to DAT*retrieve EXIT ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_speciation_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE pollutant_cur; Return( -1 ) ELSE pi_num_pollutants++ END IF LOOP // end materials loop] END IF CLOSE pollutant_cur; NEXT Return (1) end function public function integer uof_control_device_code (decimal pd_process_rid, ref string ps_device_code, ref string ps_cntl_co_tDAT*ype, string ps_pollutant, datetime pd_start_date_time, datetime pd_end_date_time, integer pi_log_file, transaction pt_trans_obj);// int uof_control_device_code (DECIMAL pd_process_rid, // STRING ps_device_code, // INTEGER pi_log_file, // TRANSACTION pt_trans_obj) // // Return: 1 Success // 0 Failure // -1 SQL error // // Retrieve the device code of the input process. // ModiDAT*fies ps_device_code // // Modification History // When Who What // ------- --- ------------------------------------------------- // 15AUG94 PER Added error messages. // Added pi_log_file. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables // Initialize local variables STRING ls_device_code DOUBLE ldb_null SetNull(ldb_null) IF ps_cntl_co_type <> '2ND' THEN // Retrieve thDAT*e control device code for the device that the given process // is associated with, if any. select rap_devices.code into :ps_device_code from rap_processes, rap_devices, rap_device_codes where rap_processes.rid = :pd_process_rid and rap_processes.device_rid = rap_devices.rid and rap_devices.code = rap_device_codes.code and rap_device_codes.metric_map_code = 'CONTROL' using pt_trans_obj; IF pt_trans_obj.sqlcode = 100 THEN // Error-Record not found IF NOT w_eDAT*miss.cbx_background.checked THEN MessageBox( "Emission Estimator", " Could not find control device" + & " code for process_rid = " + String( pd_process_rid ), & StopSign!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " Could not find control device code " + & "for process_rid = " + String( pd_process_rid ) ) END IF Return( 0 ) DAT* ELSEIF pt_trans_obj.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_control_device_code()", pi_log_file, pt_trans_obj ) Return( -1 ) ELSEIF ps_device_code = 'CONTROL' THEN // If device is generic control device or control device group, then // look for specific control device codes stored at the control process // (Don't Return) ps_cntl_co_type = '1ST' ELSE // Record retrieved successfully Return( 1 ) END IF END IF SELECT rap_device_codes.code IDAT*NTO :ps_device_code FROM rap_activities, rap_device_codes WHERE rap_activities.value = rap_device_codes.afs_control_code AND rap_activities.value <> '099' AND ref_rid = :pd_process_rid AND SUBSTR(metric_code,1) = 'EPA CNTL CO' AND SUBSTR(material_code,1) = :ps_pollutant AND (start_date_time = :pd_start_date_time OR start_date_time < :pd_start_date_time) AND (end_date_time = :pd_end_date_time OR end_date_time > :pd_end_date_time OR end_date_time is null) AND DAT* rap_activities.value_type = :ps_cntl_co_type using pt_trans_obj; IF pt_trans_obj.sqlcode = 100 THEN // EPA CNTL CO record not found, look for CNTL CO GRP ls_device_code = ps_cntl_co_type IF uof_choose_group_activities (pd_process_rid, ps_pollutant, 'CNTL CO GRP', ldb_null, & ls_device_code, pd_start_date_time, pd_end_date_time, pi_log_file, pt_trans_obj) THEN // Record retrieved successfully ps_device_code = ls_device_code ps_cntl_co_type = '2ND' Return( 1 ) ELDAT*SE // Error-Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", " Could not find " + ps_cntl_co_type + & " control device code for process_rid = " + String( pd_process_rid ), & StopSign!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " Could not find control device code " + & "for process_rid = " + StriDAT*ng( pd_process_rid ) ) END IF Return( 0 ) END IF ELSEIF pt_trans_obj.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_control_device_code() ..EPA CNTL CO selection", & pi_log_file, pt_trans_obj ) Return( -1 ) ELSE // Record retrieved successfully ps_cntl_co_type = '2ND' Return( 1 ) END IF end function public function integer uof_log_inputs (string ps_ref_code, integer pi_log_file, integer pi_num_pollutants, string ps_pollutants[]);// Write User inpDAT*uts to log file // Declare Locals BOOLEAN lb_writing STRING ls_log_line, ls_log_line2, ls_log_line3, ls_log_line4, ls_log_line5, ls_log_line6, & ls_blank_line, ls_tf, ls_method, ls_detail_desc LONG ll_i INTEGER ll_pos STRING ls_id STRING ls_name STRING ls_part_id STRING ls_part_name ls_log_line = "Log File Name: " + w_emiss.is_logname + " User ID: " + gs_user_id ls_log_line2 = "Reference Code: " + ps_ref_code + " " + & "Output Units: " + wDAT*_emiss.is_user_unit IF NOT IsNull(w_emiss.is_input_ref_code) THEN ls_log_line3 = "Input Reference Code: " + w_emiss.is_input_ref_code + & "~r~nTime Period: " + String(Year(Date(w_emiss.em_start.text))) + & " Start Date/Time: " + w_emiss.em_start.text ELSE ls_log_line3 = "Time Period: " + String(Year(Date(w_emiss.em_start.text))) + & " Start Date/Time: " + w_emiss.em_start.text END IF ls_blank_line = " " ls_log_line4 = " End Date/Time: " +DAT* w_emiss.em_end.text IF w_emiss.cbx_stop.checked THEN ls_tf = "Y" ELSE ls_tf = "N" END IF ls_log_line5 = "Lowest Priority: " + w_emiss.em_priority.text + & " Stop at 1st Successful Method?: " + ls_tf ls_log_line6 = "Selected Methods:" IF pi_log_file <> -1 THEN // Write line FileWrite( pi_log_file, ls_log_line) FileWrite( pi_log_file, ls_log_line2) FileWrite( pi_log_file, ls_blank_line) FileWrite( pi_log_file, ls_log_line3) FileWrite( pi_log_fileDAT*, ls_log_line4) FileWrite( pi_log_file, ls_blank_line) FileWrite( pi_log_file, ls_log_line5) FileWrite( pi_log_file, ls_log_line6) ELSE // Error-log file isn't open Return( 0 ) END IF FOR ll_i = 1 TO w_emiss.ii_num_methods CHOOSE CASE w_emiss.is_method_types[ll_i] CASE 'F' ls_method = 'EMIS FACTOR' CASE 'P' ls_method = 'SPECIATION' CASE 'BC' ls_method = 'MASS BALANCE' END CHOOSE ls_log_line = " " + ls_method IF pi_log_fiDAT*le <> -1 THEN // Write line FileWrite( pi_log_file, ls_log_line) ELSE // Error-log file isn't open Return( 0 ) END IF NEXT //FileWrite( pi_log_file, ls_log_line) IF pi_log_file <> -1 THEN // Write line FileWrite( pi_log_file, ls_blank_line) IF upperBound(w_emiss.uo_ss.iclass_group.il_CountyArray) > 1 OR & upperBound(w_emiss.uo_ss.iclass_group.il_SourceArray) > 1 THEN ls_id = w_emiss.uo_ss.st_data_level.text ls_name = ' ' //w_emiss.sle_id_desDAT*c.text FileWrite( pi_log_file, "Number of Levels selected: " + & String(max(upperBound(w_emiss.uo_ss.iclass_group.il_CountyArray), & upperBound(w_emiss.uo_ss.iclass_group.il_SourceArray)))) FileWrite( pi_log_file, "Levels: Level IDs:") DO UNTIL ls_id = "" ll_pos = Pos(ls_id, ";") IF ll_pos > 0 then ls_part_id = Left(ls_id, ll_pos - 1) ls_id = Mid(ls_id, ll_pos + 1) ELSE ls_part_id = ls_id ls_id = "" END IF ll_pos = Pos(DAT*ls_name, ";") IF ll_pos > 0 then ls_part_name = Left(ls_name, ll_pos - 1) ls_name = Mid(ls_name, ll_pos + 1) ELSE ls_part_name = ls_name ls_name = "" END IF FileWrite( pi_log_file, & string(ls_part_id,"@@@@@@@@@@@@@@@@@@") + & ls_part_name) IF NOT w_emiss.cbx_log_list.checked THEN ls_id = "" END IF LOOP ELSE FileWrite( pi_log_file, "Level: " + w_emiss.uo_ss.st_data_level.text + & " Level ID: ")// + w_eDAT*miss.sle_level_id.text) END IF FileWrite( pi_log_file, ls_blank_line) ELSE // Error-log file isn't open Return( 0 ) END IF IF pi_num_pollutants = 0 THEN ls_log_line = "Selected Emittants: ALL" ELSE ls_log_line = "Selected Emittants:" END IF IF pi_log_file <> -1 THEN // Write line FileWrite( pi_log_file, ls_log_line) ELSE // Error-log file isn't open Return( 0 ) END IF FOR ll_i = 1 TO pi_num_pollutants ls_log_line = " " + ps_pollutants[lDAT*l_i] IF pi_log_file <> -1 THEN // Write line FileWrite( pi_log_file, ls_log_line) ELSE // Error-log file isn't open Return( 0 ) END IF NEXT ls_log_line = "======================================================================" ls_log_line2 = "EXECUTION DATA" ls_log_line3 = "Execution Start Date/Time: " + String(Today(), "mmm dd, yyyy") + & " " + String(Now(), "h:mm:ss am/pm") CHOOSE CASE w_emiss.em_log_detail.text CASE "1" ls_detail_desc = " - Errors/WaDAT*rnings" CASE "2" ls_detail_desc = " - Basic Documentation" CASE "3" ls_detail_desc = " - Complete Documentation" END CHOOSE ls_log_line4 = "Log File Detail Level " + w_emiss.em_log_detail.text + ls_detail_desc IF pi_log_file <> -1 THEN // Write lines FileWrite( pi_log_file, ls_blank_line) FileWrite( pi_log_file, ls_log_line) FileWrite( pi_log_file, ls_log_line2) FileWrite( pi_log_file, ls_log_line) FileWrite( pi_log_file, ls_log_line3) FileWrite( pi_DAT*log_file, ls_log_line4) FileWrite( pi_log_file, ls_blank_line) ELSE // Error-log file isn't open Return( 0 ) END IF Return (1) end function public function integer uof_compare_factors (integer pi_num_factors, string ps_throughput_unit_code[], string ps_throughput_material[], integer pi_log_file, transaction pt_trans_object);// uof_compare_factors // // Compares material and measurement codes of multiple emission factors chosen for a // given emittant and control device cDAT*onfiguration for duplicates // // Who When What // ---- ------ ------ // REJ 27FEB96 Initial Coding // STRING ls_meas_code[] INTEGER li_i, li_j, li_k, li_ub ls_meas_code[15] = 'End' li_ub = 15 FOR li_i = 1 TO pi_num_factors SELECT meas_code into :ls_meas_code[li_i] FROM rap_units WHERE code = :ps_throughput_unit_code[li_i] USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN uof_sql_error ("uof_compare_meas_codes", pi_log_file, pt_trans_object) ROLLBDAT*ACK USING pt_trans_object; Return( -1 ) END IF li_j = li_i - 1 FOR li_k = 1 TO li_j IF ls_meas_code[li_i] = ls_meas_code[li_k] AND & ps_throughput_material[li_i] = ps_throughput_material[li_k] THEN RETURN (0) END IF NEXT IF li_i >= li_ub THEN uof_increment_array(ls_meas_code, 20) li_ub = li_ub + 20 END IF NEXT // All measurement code - throughput material pairs are unique RETURN (1) end function public function string uof_activity_get_value (ref douDAT*ble pdb_value);// int function uof_activity_get_value(DECIMAL pdb_value) // // Returns: string containing the activity value // // Calculates string activity value from value_amt. // If length is greater than 12, truncates or uses // scientific notation. // // Modification History // When Who What // ------- --- ------------------------------------------------ // 03AUG95 SJS Initial code. // 28FEB96 REJ Removed zeroes at end of values and revised condition for using // DAT* scientific notation // Declare local variables BOOLEAN lb_sci STRING ls_value, ls_last, ls_exp INTEGER li_sig_fig, li_decimal, li_left, li_right, li_e, li_length, li_max, li_i DECIMAL ld_test // First, try to get the value into a straight decimal format // (doubles are in scientific notation) ld_test = Dec(String(pdb_value)) IF Real(String(ld_test)) = Real(String(pdb_value)) THEN ls_value = String(Dec(String(pdb_value))) ELSE ls_value = String(Real(String(pdb_value))) END IF DAT* li_e = POS(ls_value,'E') IF li_e > 0 THEN ls_exp = MID(ls_value,li_e + 1, 3) li_length = Len(ls_value) li_decimal = Pos(ls_value,'.') // Make sure all appropriate numbers are expressed as decimals IF (-5 < Real(ls_exp) AND Real(ls_exp) < 12 AND li_e > 0) THEN IF li_e = 11 THEN li_e = 10 // For correct calculation ls_value = String(Round(Real(ls_value),MIN(10 - li_e, 10))) li_e = POS(ls_value,'E') //ELSEIF li_e = 0 AND 0.00001 < Real(ls_value) AND Real(ls_value) < (1000000 * 1000DAT*0000) & // AND li_length > 12 THEN // ls_value = String(Round(Real(ls_value),12 - li_decimal)) // li_e = POS(ls_value,'E') END IF li_length = Len(ls_value) li_decimal = Pos(ls_value,'.') // Loop to round to minimum number of characters that retains value within 0.00001% li_max = 12 - li_decimal IF li_decimal <> 0 THEN FOR li_i = 0 TO li_max ld_test = Round(Dec(ls_value), li_i) IF Dec(ls_value) = 0 THEN EXIT END IF IF (ABS((ld_test - Dec(ls_value)))/Dec(ls_value)) < DAT*0.0000001 THEN ls_value = String(ld_test) EXIT END IF NEXT END IF li_decimal = Pos(ls_value,'.') li_length = Len(ls_value) li_e = POS(ls_value,'E') ls_last = MID(ls_value, li_length, 1) DO WHILE (ls_last = '0' OR ls_last = '.') AND li_decimal > 0 AND li_e = 0 ls_last = MID(ls_value, li_length, 1) IF ls_last = '0' OR ls_last = '.' THEN ls_value = LEFT(ls_value,li_length - 1) li_length -- IF ls_last = '.' THEN EXIT END IF LOOP // length > 12 means scientific DAT*notation that doesn't fit into value column IF li_length > 12 THEN ls_value = String(pdb_value, '0.000000E+00') END IF RETURN ls_value end function public function integer uof_activity_replace (double pdb_value, datetime pd_rev_date, long pl_process_rid, string ps_metric_code, string ps_pollutant, datetime pd_start_date_time, datetime pd_end_date_time, ref transaction pt_trans_object, integer pi_log_file, string ps_method_type, string ps_reference_code, string ps_input_unit, boolean pbDAT*_scc_at_str, boolean pb_last_device, string ps_data_code);// int function uof_activity_replace(DOUBLE pdb_value, // DATETIME pd_rev_date, // DECIMAL pd_process_rid, // STRING ps_metric_code, // STRING ps_pollutant, // DATETIME pd_start_date_time, // DATETIME pd_end_date_time, /DAT*/ TRANSACTION VAR pt_trans_object, // INTEGER pi_log_file, // STRING ps_method_type, // STRING ps_reference_code, // STRING ps_input_unit, // BOOLEAN pb_scc_at_str) // Return: 1 Success // 0 Failure // -1 SQL error // // REPLACE the emissions of the oDAT*ut stream of the input // process // // Modification History // When Who What // ------- --- ------------------------------------------------ // 12AUG94 PER Cleaned up code. // Added error message if update fails. // Added update of unit_code. // Added error checks for stream_rid select. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables LONG ll_DAT*stream_rid LONG ll_activity_rid //MDY 9/99 INTEGER li_ret_status DECIMAL ld_activity_value STRING ls_null_value STRING ls_value // Initialize local variables SetNull(ls_null_value) // REJ Round ls_value ls_value = uof_activity_get_value(pdb_value) // SJS 03AUG95 IF ps_metric_code = 'DISCHARGE' THEN SELECT rid INTO :ll_stream_rid FROM rap_streams WHERE from_process_rid = :pl_process_rid AND to_process_rid is null USING pt_trans_object; ELSEIF ps_metDAT*ric_code = 'DOWNSTRMDIS' THEN IF not pb_last_device THEN SELECT rid INTO :ll_stream_rid FROM rap_streams WHERE from_process_rid = :pl_process_rid AND to_process_rid is not null USING pt_trans_object; ELSE SELECT rid INTO :ll_stream_rid FROM rap_streams WHERE from_process_rid = :pl_process_rid USING pt_trans_object; END IF ELSE SELECT rid INTO :ll_stream_rid FROM rap_streams WHERE from_DAT*process_rid = :pl_process_rid AND to_process_rid is not null USING pt_trans_object; END IF if pt_trans_object.sqlcode = 100 then // Stream rid not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Could not find stream_rid " + & "for from_process_rid = " + String( pl_process_rid ), & StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Could not find stream_riDAT*d " + & "for from_process_rid = " + String( pl_process_rid ) ) END IF Return (0) elseif pt_trans_object.sqlcode = -1 then // sql error if pt_trans_object.sqlerrtext = "Select returned more than one row" then IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " More than one stream_rid " + & "for from_process_rid = " + String( pl_process_rid ) + & "~r~n Multiple output streams not currently supported by emission estimator") ENDAT*D IF ELSE uof_sql_error( "uof_activity_replace()", pi_log_file, pt_trans_object ) end if return (-1) END IF IF NOT pb_scc_at_str THEN if is_speciationValueType <> "" then //MDY 9/99 SELECT value_amt, rid INTO :ld_activity_value, :ll_activity_rid FROM rap_activities WHERE ref_rid = :ll_stream_rid AND SUBSTR(metric_code,1) = :ps_metric_code AND SUBSTR(material_code,1) = :ps_pollutant AND value_type = :is_speciationValueType // MDY 9/9DAT*9 AND data_code = :ps_data_code // REJ 03JUN96 AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND reference_code = :ps_reference_code // MAS 19AUG94 USING pt_trans_object; else SELECT value_amt, rid INTO :ld_activity_value, :ll_activity_rid FROM rap_activities WHERE ref_rid = :ll_stream_rid AND SUBSTR(metric_code,1) = :ps_metric_code AND SUBSTR(material_code,1) = :ps_pollutant AND DAT*value_type is NULL // REJ 31MAY96 AND data_code = :ps_data_code // REJ 03JUN96 AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND reference_code = :ps_reference_code // MAS 19AUG94 USING pt_trans_object; end if ELSE if is_speciationValueType <> "" then //MDY 9/99 SELECT value_amt, rid INTO :ld_activity_value, :ll_activity_rid FROM rap_activities WHERE ref_rid = :ll_stream_rid AND SUBSTR(mDAT*etric_code,1) = :ps_metric_code AND SUBSTR(material_code,1) = :ps_pollutant AND value_type = :is_speciationValueType // MDY 9/99 AND data_code = :ps_data_code // REJ 03JUN96 AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND reference_code = :ps_reference_code // MAS 19AUG94 USING pt_trans_object; else SELECT value_amt, rid INTO :ld_activity_value, :ll_activity_rid FROM rap_activities DAT* WHERE ref_rid = :ll_stream_rid AND SUBSTR(metric_code,1) = :ps_metric_code AND SUBSTR(material_code,1) = :ps_pollutant AND value_type is NULL // REJ 31MAY96 AND data_code = :ps_data_code // REJ 03JUN96 AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND reference_code = :ps_reference_code // MAS 19AUG94 USING pt_trans_object; end if END IF IF pt_trans_object.sqlcode = 100 THEN // No acDAT*tivity data found. // Try to insert activity data. li_ret_status = & uof_activity_insert (pd_rev_date, & ps_metric_code, 'STR', pl_process_rid, & pd_start_date_time, gs_user_id, pdb_value, 'N', & ps_data_code, pd_end_date_time, ps_pollutant, & ps_method_type, ps_reference_code, 'EE', ls_null_value, & ps_input_unit, pi_log_file, pt_trans_object ) IF li_ret_status = 1 THEN // Record was inserted successfullyDAT* COMMIT USING pt_trans_object; Return( 1 ) ELSE ROLLBACK USING pt_trans_object; Return( -1 ) END IF ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error during select uof_sql_error( "uof_activity_replace()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF // Record retrieved successfully--Need to update existing record. // Added update of unit code. PER 12AUG94 string ls_ref_type ls_ref_type = "EE" DAT* update rap_activities set value_amt = :pdb_value, value_unit_code = :ps_input_unit, creation_date_time = :pd_rev_date, value = :ls_value, user_id = :gs_user_id, // MAS 19AUG94 data_code = :ps_data_code, reference_type = :ls_ref_type, method_type = :ps_method_type where rid = :ll_activity_rid //MDY 9/99 using pt_trans_object; //MDY 9/99 removed this where clause above in favor of select by rid // where reDAT*f_rid = :ll_stream_rid // and SUBSTR(metric_code,1) = :ps_metric_code // and value_type is NULL // REJ 31MAY96 // and SUBSTR(material_code,1) = :ps_pollutant // and start_date_time = :pd_start_date_time // and end_date_time = :pd_end_date_time // AND data_code = :ps_data_code // REJ 03JUN96 // and reference_code = :ps_reference_code IF pt_trans_object.sqlcode <> 0 THEN // SQL ERROR MessageBox( "Emission Estimator", "Could not update emissionDAT* " + & "estimation record in the activities table " + & "Error " + String( pt_trans_object.SQLDBCode ) + & ": " + pt_trans_object.SQLErrText, StopSign!, OK! ) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Could not update emission estimate" + & " record in the activities table" ) FileWrite( pi_log_file, & " Error " + String( pt_trans_object.SQLDBCode ) + & ": " + pt_trans_DAT*object.SQLErrText ) END IF ROLLBACK USING pt_trans_object; RETURN (-1) ELSE // Update successful COMMIT USING pt_trans_object; RETURN (1) END IF // end uof_activity_replace() end function public function integer uof_activity_insert (datetime pd_creation_date_time, string ps_metric_code, string ps_metric_level_type, decimal pd_ref_rid, datetime pd_start_date_time, string ps_user_id, double pdb_value, string ps_confidential_flag, string ps_data_code, datetime pd_end_daDAT*te_time, string ps_material_code, string ps_method_type, string ps_reference_code, string ps_reference_type, string ps_value_type, string ps_value_unit_code, integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_activity_insert(DATETIME pd_creation_date_time, // STRING ps_metric_code, // STRING ps_metric_level_type, // DECIMAL pd_ref_rid, // DATETIME pd_start_DAT*date_time, // STRING ps_user_id, // DOUBLE pdb_value, // STRING ps_confidential_flag, // STRING ps_data_code, // DATETIME pd_end_date_time, // STRING ps_material_code, // STRING ps_method_type, // STRING ps_reference_code, // DAT* STRING ps_reference_type, // STRING ps_value_type, // STRING ps_value_unit_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function inserts a record in rap_activities with the emission // estimation information // // Returns: 1 Success // -1 SQL Error on insert // // Modification History // // Date User DescrDAT*iption // --------- --- ----------------------------------------------- // 10 MAY 94 PER Removed input_output_flag column. // Removed device_rid column. // Added insert on value_amt column. // 12 AUG 94 PER Reformatted log file message. // Added error checks on stream_rid select. // 26 FEB 96 REJ Rounded pdb_value to fit into Oracle value data field // 31 MAY 96 REJ Added capability to add null value_types // Set the poinDAT*ter to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables DECIMAL ld_stream_rid LONG ll_rid STRING ls_value INTEGER li_count // 27DEC94 now new gettin new rid is handled here instead of // outside of this routine ll_rid = uof_get_rid(pi_log_file,pt_trans_obDAT*ject) IF ll_rid = -1 THEN //SQL Error getting next rid ROLLBACK USING pt_trans_object; Return(0) END IF // REJ Round for Oracle ls_value = uof_activity_get_value(pdb_value) IF ps_metric_code = 'DISCHARGE' THEN SELECT rid INTO :ld_stream_rid FROM rap_streams WHERE from_process_rid = :pd_ref_rid AND to_process_rid is null USING pt_trans_object; ELSEIF ps_metric_code = 'DOWNSTRMDIS' THEN //08DEC94 handles one device case // handles case where downDAT*stream device and fugitive stream exits // check to see there is a connection SELECT count(rid) INTO :li_count FROM rap_streams WHERE from_process_rid = :pd_ref_rid AND to_process_rid is not null USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN ROLLBACK USING pt_trans_object; RETURN(0) END IF IF li_count = 1 THEN // case with connected device 28DEC94 SELECT rid INTO :ld_stream_rid FROM rap_streamDAT*s WHERE from_process_rid = :pd_ref_rid AND to_process_rid is not null USING pt_trans_object; ELSEIF li_count > 1 THEN IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Multiple output stream not supported. ") END IF Return(0) ELSE // case of one device 28DEC94 SELECT rid INTO :ld_stream_rid FROM rap_streams WHERE from_process_rid = :pd_ref_rid AND to_process_rid is null USING pt_trans_object; END IF /DAT*/ downstrmdis case ELSE SELECT rid INTO :ld_stream_rid FROM rap_streams WHERE from_process_rid = :pd_ref_rid AND to_process_rid is not null USING pt_trans_object; END IF if pt_trans_object.sqlcode = 100 then // Stream rid not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Could not find stream_rid " + & "for from_process_rid = " + String( pd_ref_rid ), & StopSign!, OK! ) DAT* END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Could not find stream_rid " + & "for from_process_rid = " + String( pd_ref_rid ) ) END IF // Force to SQL Error (should be 0) Return (-1) elseif pt_trans_object.sqlcode = -1 then // sql error if pt_trans_object.sqlerrtext = "Select returned more than one row" then IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " More than one stream_rid " + & "for from_procDAT*ess_rid = " + String( pd_ref_rid ) + & "~r~n Multiple output streams not currently supported by emission estimator") END IF ELSE uof_sql_error( "uof_activity_insert()", pi_log_file, pt_trans_object ) END IF return (-1) END IF // MDY 9/99 check is_speciationValueType to determine if we should assign // a value_type to this record if is_speciationValueType <> "" then ps_value_type = is_speciationValueType end if // Insert record into rap_activities with emission eDAT*stimation information IF IsNull(ps_value_type) THEN INSERT INTO rap_activities ( rid, creation_date_time, metric_code, metric_level_type, ref_rid, start_date_time, user_id, value, confidential_flag, data_code, end_date_time, material_code, method_type, reference_code, reference_type, value_amt, value_type, value_unit_code ) VALUES ( :ll_rid, // 27DEC94 chanDAT*ged from pd_rid :pd_creation_date_time, :ps_metric_code, :ps_metric_level_type, :ld_stream_rid, // changed from pd_ref_rid :pd_start_date_time, :ps_user_id, :ls_value, :ps_confidential_flag, :ps_data_code, :pd_end_date_time, :ps_material_code, :ps_method_type, :ps_reference_code, :ps_reference_type, :pdb_value, NULL, :ps_value_unit_code ) USING pt_trans_object; ELDAT*SE INSERT INTO rap_activities ( rid, creation_date_time, metric_code, metric_level_type, ref_rid, start_date_time, user_id, value, confidential_flag, data_code, end_date_time, material_code, method_type, reference_code, reference_type, value_amt, value_type, value_unit_code ) VALUES ( :ll_rid, // 27DEC94 changed from pd_rid :pd_creation_date_time, DAT*  :ps_metric_code, :ps_metric_level_type, :ld_stream_rid, // changed from pd_ref_rid :pd_start_date_time, :ps_user_id, :ls_value, :ps_confidential_flag, :ps_data_code, :pd_end_date_time, :ps_material_code, :ps_method_type, :ps_reference_code, :ps_reference_type, :pdb_value, :ps_value_type, :ps_value_unit_code ) USING pt_trans_object; END IF IF pt_trans_object.sqlcode <> 0 DAT* THEN // Error inserting record MessageBox( "Emission Estimator", "Could not insert emission " + & "estimation record into the activities table " + & "Error " + String( pt_trans_object.SQLDBCode ) + & ": " + pt_trans_object.SQLErrText, StopSign!, OK! ) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Could not insert emission estimate" + & " record into the activities table" ) FileWrite( pi_log_file, " EDAT*rror " + & String( pt_trans_object.SQLDBCode ) + ": " + & pt_trans_object.SQLErrText ) END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSE // Record inserted successfully Return( 1 ) END IF // end uof_activity_insert() end function public function integer uof_default_calc_success (decimal pd_process_rid, double pdb_fug_emiss, double pdb_cont_emiss, datetime pd_start_date, datetime pd_end_date, string ps_pollutant, string ps_unitDAT*, integer pi_log_file, ref transaction pt_rid_object, string ps_reference_code, boolean pb_cont_at_orig, datetime pd_emiss_start_date_time, ref boolean pb_last_device, boolean pb_from_last_device, string ps_method_type, string ps_data_code);// int uof_default_calc_success() // Return: 1 Success // 0 Failure // -1 SQL error // // Update the control emissions of the output stream of this process // if the process was visted. // Otherwise create a new record in the rap_activitDAT*ies table. // // // Modification History // When Who What // ------- --- -------------------------------------------------- // 15AUG94 PER Reformatted error messages. // Added check of return code from uof_get_rid(). // Removed unused variable ld_null_value. // Changed to return -1 on SQL error. // Added SQL error messages. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass!DAT* ) END IF // Declare local variables BOOLEAN lb_init_flag BOOLEAN lb_fug_stream INTEGER li_ret_status DECIMAL ld_rid, ld_fug_rid DECIMAL ld_value_amt DECIMAL ld_new_rid STRING ls_metric_code STRING ls_null_value DATETIME ld_today DATETIME ld_create_date_time //STRING ls_source_name //STRING ls_source_id //STRING ls_device_name //STRING ls_device_id //STRING ls_process_name //STRING ls_process_id LONG ll_stream_rid INTEGER li_count long ll_rc // InDAT*itialize local variables SetNull(ls_null_value) // create necessary data for the activity record // creation datetime ld_today = DateTime(Today(), Now()) /* REMOVED: the values obtained by uof_process_name() are already stored in instance variables by uof_get_process_info(). (not to mention the the fact that the data obtained by uof_process_name() are not ever used in this function!) MDY 2/99 li_ret_status = uof_process_name( pd_process_rid, lDAT*s_source_name, & ls_source_id, ls_device_name, ls_device_id, & ls_process_name, ls_process_id, pi_log_file, sqlca ) // 13FEB95 following code was extracted from above. IF li_ret_status = -1 THEN // SQL Error IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "SQL Error occurred on process: " + & String( pd_process_rid ), StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN DAT* FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "SQL Error occurred on process: " + & String( pd_process_rid ) ) END IF uof_sql_error( "uof_default_calc_success()", pi_log_file, & pt_rid_object ) // Changed to return -1 15AUG94 PER Return( -1 ) END IF */ //following if statement is added for the case of control emission //value at originating process if pb_cont_at_orig then ls_metric_code = 'DOWNSTRMDIS' else DAT* // metric for the activity data select rid into :ld_rid from rap_streams where from_process_rid = :pd_process_rid and to_process_rid is not null using pt_rid_object; // check query status if pt_rid_object.sqlcode = 0 then // record found and there is a downstream process // it is a MASS FLOW ls_metric_code = 'MASS FLOW' // check to see if there is a stream for fugitive emission // check condition: downstream device exits aDAT*nd a stream with // to_process_rid = null // select rid into :ld_fug_rid from rap_streams where from_process_rid = :pd_process_rid and to_process_rid is null using pt_rid_object; IF pt_rid_object.sqlcode <> 0 THEN lb_fug_stream = FALSE IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Default Process: " + & String( pd_process_rid ) + "~r~n" + & DAT*  "No stream for fugitive emission defined ",StopSign!, OK! ) END IF ELSE // fug stream found lb_fug_stream = TRUE END IF elseif pt_rid_object.sqlcode = 100 then // no record found ls_metric_code = 'DISCHARGE' pb_last_device = TRUE else // SQL error uof_sql_error( "uof_default_calc_success()", pi_log_file, & pt_rid_object ) return (-1) end if end if // if pb_cont_at_origDAT*" // Does activity record for the output stream of this process exist? IF ls_metric_code = 'DISCHARGE' THEN // 09DEC94 MAS select rid into :ll_stream_rid from rap_streams where from_process_rid = :pd_process_rid and to_process_rid is null using pt_rid_object; ELSE select rid into :ll_stream_rid from rap_streams where from_process_rid = :pd_process_rid and to_process_rid is not null using pt_rid_object; END IF select rDAT*$id, value_amt, creation_date_time into :ld_rid, :ld_value_amt, :ld_create_date_time from rap_activities where ref_rid = :ll_stream_rid and SUBSTR(metric_code,1) = :ls_metric_code and SUBSTR(material_code,1) = :ps_pollutant and start_date_time = :pd_start_date and end_date_time = :pd_end_date and value_amt is not null and value_unit_code is not null and value_type is NULL and data_code = :ps_data_code and reference_code = :psDAT*&_reference_code using pt_rid_object; if pt_rid_object.sqlcode = -1 then // SQL ERROR IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Default Process: " + & String( pd_process_rid ) + "~r~n" + & "SQL ERROR finding output stream metric: " + & ls_metric_code, StopSign!, OK! ) END IF uof_sql_error( "uof_default_calc_success()", pi_log_file, & pt_rid_object ) ROLLBACDAT*(K USING pt_rid_object; return (-1) elseif pt_rid_object.sqlcode = 100 then // no activity record found // insert the new activity record IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Default Process: " + String( pd_process_rid ) + "~r~n" + & "Output stream metric " + ls_metric_code + & " NOT FOUND.~r~nNEW STREAM ACTIVITY WILL BE CREATED.", & StopSign!, OK! ) ENDDAT** IF // 16FEB95 IF NOT pb_cont_at_orig THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN // FileWrite( pi_log_file, & // " output stream metric " + ls_metric_code + & // " NOT FOUND.") FileWrite( pi_log_file, " NEW STREAM ACTIVITY WILL BE CREATED For" +& " Pollutant " + ps_pollutant) END IF ELSE IF pb_from_last_device THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_DAT*,detail.text) > 3 THEN // FileWrite( pi_log_file, & // " output stream metric " + ls_metric_code + & // " NOT FOUND.") FileWrite( pi_log_file, " NEW STREAM ACTIVITY WILL BE CREATED For" +& " Pollutant " + ps_pollutant) END IF END IF END IF // hard coded arguments // confidentiality_flag = 'N' // method_type = 'E' need to revisit // reference_type = 'EE' // value_type = NULL DAT*. // Add total fugitive emission 30DEC94 IF ls_metric_code = 'DOWNSTRMDIS' THEN IF NOT pb_last_device THEN // no connected stream - this is the last device 04JAN95 // pdb_cont_emiss = pdb_cont_emiss + gd_total_fug_emission pdb_cont_emiss = pdb_cont_emiss ELSE // pdb_cont_emiss = gd_total_fug_emission pdb_cont_emiss = pdb_fug_emiss //17JAN95 END IF END IF li_ret_status = uof_activity_insert(ld_today,ls_metric_DAT*0code,& 'STR',pd_process_rid,& pd_start_date, gs_user_id, pdb_cont_emiss, & 'N', ps_data_code,pd_end_date, ps_pollutant, & ps_method_type, ps_reference_code, & 'EE',ls_null_value, ps_unit, & pi_log_file, pt_rid_object) IF li_ret_status <> 1 THEN // SQL error on insert // Error message handled in uof_activity_insert() ROLLBACK USING pt_rid_objecDAT*2t; RETURN (-1) ELSE // New activity record inserted successfully IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "New Emission Value: " + & String(Round(Dec(String(pdb_cont_emiss)),2)) + " " + ps_unit, & StopSign!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, & " DAT*4 Pollutant: " + ps_pollutant + "; New Emission Value: " + & String(Round(Dec(String(pdb_cont_emiss)),4)) + " " + ps_unit) END IF COMMIT using pt_rid_object; // RETURN (1) END IF elseif pt_rid_object.sqlcode = 0 then // activity record exists // ok to update? // if pd_emiss_start_date_time >= ld_create_date_time then if w_emiss.id_estimator_time_stamp >= ld_create_date_time then // stream outdated, clear the value lb_init_fDAT*6lag = TRUE end if if (ls_metric_code <> 'DISCHARGE') AND & (ls_metric_code <> 'DOWNSTRMDIS') then // we don't want to update the streams in the middle of // the train of processes lb_init_flag = TRUE end if // Add total fugitive emission IF ls_metric_code = 'DOWNSTRMDIS' THEN IF pb_last_device THEN // pdb_cont_emiss = pdb_cont_emiss + gd_total_fug_emission pdb_cont_emiss = pdb_cont_emiss ELSE // pdb_cont_emiss DAT*8= gd_total_fug_emission pdb_cont_emiss = pdb_fug_emiss //17JAN95 MAS END IF END IF li_ret_status = uof_activity_update(lb_init_flag,ld_today,& pd_process_rid, pd_start_date,pd_end_date, & pdb_cont_emiss, ps_reference_code, ps_pollutant, & ls_metric_code,ps_unit, & pi_log_file,pt_rid_object,ps_method_type, ps_data_code) IF li_ret_status <> 1 THEN // SQL ERROR // ErroDAT*:r message handled by uof_activity_update() IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Default Process: " + String( pd_process_rid ) + & "~r~nSQL Failure during activity value update", & StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "Default Process: " + String( pd_process_rid ) ) FileWrite( pi_loDAT*<g_file, & "SQL Failure during activity value update" ) END IF ROLLBACK USING pt_rid_object; RETURN (-1) ELSE // Record updated successfully IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Pollutant: " + ps_pollutant + "~r~nEmission Value: " + & uof_activity_get_value(pdb_cont_emiss) + " " + & ps_unit + " updated.", StopSign!, OK!DAT*> ) END IF // 16FEB95 IF NOT pb_cont_at_orig THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Pollutant " + ps_pollutant + " " + & ls_metric_code + " Emission Value " + & uof_activity_get_value(pdb_cont_emiss) + " " + & ps_unit + " updated." ) END IF ELSE IF pb_from_last_device THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detDAT*@ail.text) > 2 THEN FileWrite( pi_log_file, " Pollutant " + ps_pollutant + " " + & ls_metric_code + " Emission Value " + uof_activity_get_value(pdb_cont_emiss) + & " " + ps_unit + " updated." ) END IF END IF END IF COMMIT using pt_rid_object; // RETURN (1) END IF end if // Does activity record for the output stream of this process exist? // do fug emissions IF lb_fug_stream THEN select rid, DAT*B value_amt, creation_date_time into :ld_rid, :ld_value_amt, :ld_create_date_time from rap_activities where ref_rid = :ld_fug_rid and SUBSTR(metric_code,1) = 'DISCHARGE' and SUBSTR(material_code,1) = :ps_pollutant and start_date_time = :pd_start_date and end_date_time = :pd_end_date and value_amt is not null and value_unit_code is not null and value_type is NULL and data_code = :ps_data_code DAT*D and reference_code = :ps_reference_code using pt_rid_object; if pt_rid_object.sqlcode = -1 then // SQL ERROR IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Default Process: " + & String( pd_process_rid ) + "~r~n" + & "SQL ERROR finding output stream metric: " + & ls_metric_code, StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite(DAT*F pi_log_file, " Default Process: " + String( pd_process_rid ) ) FileWrite( pi_log_file, " SQL ERROR finding output stream metric: " + & ls_metric_code) END IF uof_sql_error( "uof_default_calc_success()", pi_log_file, & pt_rid_object ) ROLLBACK USING pt_rid_object; return (-1) elseif pt_rid_object.sqlcode = 100 then // no activity record found // insert the new activity record IF NOT w_emisDAT*Hs.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Default Process: " + String( pd_process_rid ) + "~r~n" + & "Output stream metric " + ls_metric_code + & " NOT FOUND.~r~nNEW FUGITIVE STREAM ACTIVITY WILL BE CREATED.", & StopSign!, OK! ) END IF // 16FEB95 IF NOT pb_cont_at_orig THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pDAT*Ji_log_file, " Pollutant " + & ps_pollutant ) // FileWrite( pi_log_file, & // " output stream metric " + ls_metric_code + & // " NOT FOUND.") FileWrite( pi_log_file, " NEW FUGITIVE STREAM ACTIVITY WILL BE CREATED." ) END IF ELSE IF pb_from_last_device THEN IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " NEW FUGITIVE STREAM ACTIVITY WILL BE DAT*L" + & "CREATED For Pollutant " + ps_pollutant) // FileWrite( pi_log_file, & // "output stream metric " + ls_metric_code + & // " NOT FOUND.") END IF END IF END IF // hard coded arguments // confidentiality_flag = 'N' // reference_type = 'EE' // value_type = NULL li_ret_status = uof_activity_insert(& ld_today, 'DISCHARGE', 'STR',pd_process_rid,& DAT*N pd_start_date, gs_user_id, pdb_fug_emiss, & 'N', ps_data_code,pd_end_date, ps_pollutant, & ps_method_type, ps_reference_code, 'EE',ls_null_value, ps_unit, & pi_log_file, pt_rid_object) IF li_ret_status <> 1 THEN // SQL error on insert // Error message handled in uof_activity_insert() ROLLBACK USING pt_rid_object; RETURN (-1) ELSE // New activity record inserted successfullDAT*Py IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "New Fugitive Emission Value: " + & String(Round(Dec(string(pdb_fug_emiss)),2)) + " " + ps_unit, & StopSign!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, & " New Fugitive Emission Value: " + & DAT*R String(Round(Dec(String(pdb_cont_emiss)),2)) + " " + ps_unit ) END IF COMMIT using pt_rid_object; RETURN (1) END IF elseif pt_rid_object.sqlcode = 0 then // activity record exists // ok to update? if w_emiss.id_estimator_time_stamp >= ld_create_date_time then // stream outdated, clear the value lb_init_flag = TRUE end if if (ls_metric_code <> 'DISCHARGE') AND & (ls_metric_code <> 'DOWNSTRMDIS') then DAT*T // we don't want to update the streams in the middle of // the train of processes lb_init_flag = TRUE end if li_ret_status = uof_activity_update(lb_init_flag,ld_today,& pd_process_rid, pd_start_date,pd_end_date, & pdb_fug_emiss, ps_reference_code, ps_pollutant, & 'DISCHARGE',ps_unit, & pi_log_file,pt_rid_object,ps_method_type, ps_data_code) IF li_ret_status <> 1 THEN // DAT*VSQL ERROR // Error message handled by uof_activity_update() IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Default Process: " + String( pd_process_rid ) + & "~r~nSQL Failure during activity value update", & StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "Default Process: " + String( pd_proDAT*Xcess_rid ) ) FileWrite( pi_log_file, & "SQL Failure during activity value update" ) END IF ROLLBACK USING pt_rid_object; RETURN (-1) ELSE // Record updated successfully IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Pollutant: " + ps_pollutant + "~r~nEmission Value: " + & uof_activity_get_value(pdb_fug_emiss) + " " + & DAT*Z ps_unit + " updated.", StopSign!, OK! ) END IF // 16FEB95 IF NOT pb_cont_at_orig THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Pollutant " + & ps_pollutant ) FileWrite( pi_log_file, " Fugitive Emission Value " + & uof_activity_get_value(pdb_fug_emiss) + " " + & ps_unit + " updated." DAT*\) FileWrite(pi_log_file, " ") END IF ELSE IF pb_from_last_device THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Pollutant " + & ps_pollutant ) FileWrite( pi_log_file, " Fugitive Emission Value " + & uof_activity_get_value(pdb_fug_emiss) + " " + & ps_unit + " updated.DAT*^" ) FileWrite(pi_log_file, " ") END IF END IF END IF COMMIT using pt_rid_object; RETURN (1) END IF end if ELSE RETURN (1) END IF end function public function integer uof_unit_convert (string ps_activity_unit_code, string ps_throughput_unit_code, ref decimal pd_activity_value, ref double pdb_activity_value, string ps_data_type, integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_uniDAT*`t_convert( STRING ps_activity_unit_code, // STRING ps_throughput_unit_code, // DECIMAL VAR pd_activity_value, // DOUBLE pdb_activity_value, // STRING ps_data_type // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function retrieves the specified unit conversion records // and converts the activity value from activity units to // throDAT*bughput units (via standard unit). // // NOTE: No offsets or material-specific conversions. // // Returns: 1 Success // 0 Record not found // -1 SQL Error // // Modification History // When Who What // ------- --- ------------------------------------------------- // 20JUL94 PER Changed function to use rap_units table and // intermediate "standard" units. // Set the pointer to the regular arrow for background estimation // runs (so the user DAT*dcan click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables DECIMAL ld_factor_amt STRING ls_std_unit // Convert from activity unit to standard unit SELECT conversion_factor_amt, standard_code INTO :ld_factor_amt, :ls_std_unit FROM rap_units WHERE code = :ps_activity_unit_code AND conversion_factor_amt <> 0 AND convDAT*fersion_factor_amt IS NOT NULL AND standard_code IS NOT NULL USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No unit conversion " + & "information found for " + & ps_activity_unit_code, Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " DAT*hNo standard unit conversion information " + & "found for:") FileWrite( pi_log_file, " From unit: " + ps_activity_unit_code +& " to(standard unit) unit: " + ls_std_unit) END IF Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_unit_convert()", pi_log_file, pt_trans_object ) Return( -1 ) END IF // Make first conversion from activity units to standard units. IF ps_data_type = 'DECIMAL' THDAT*jEN pd_activity_value = pd_activity_value * ld_factor_amt ELSE pdb_activity_value = pdb_activity_value * ld_factor_amt END IF // See if standard unit = throughput unit. IF ls_std_unit = ps_throughput_unit_code THEN // Standard unit is the same as our target unit conversion. // We are done. Return( 1 ) END IF // Convert from standard unit to throughput unit SELECT conversion_factor_amt INTO :ld_factor_amt FROM rap_units WHERE code = :ps_throughput_unit_code ADAT*lND standard_code = :ls_std_unit AND conversion_factor_amt <> 0 AND conversion_factor_amt IS NOT NULL USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No unit conversion " + & "information found for " + & ps_throughput_unit_code, Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 TDAT*nHEN FileWrite( pi_log_file, " No unit conversion information " + & "found for " + ps_throughput_unit_code ) FileWrite( pi_log_file, " From(standard unit): " + ls_std_unit +& " To unit: " + ps_throughput_unit_code ) END IF Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_unit_convert()", pi_log_file, pt_trans_object ) Return( -1 ) END IF // Make second conversion from stDAT*pandard units to throughput units. // (Check for ld_factor_amt = 0 already made in SQL statement.) IF ps_data_type = 'DECIMAL' THEN pd_activity_value = pd_activity_value / ld_factor_amt ELSE pdb_activity_value = pdb_activity_value / ld_factor_amt END IF // Successfull return Return( 1 ) // end uof_unit_convert() end function public function integer uof_default_parameters (long pl_process_rid, double pdb_emission, string ps_pollutant, datetime pd_start_date_time, datetime pd_eDAT*rnd_date_time, integer pi_log_file, transaction pt_trans_object, datetime pd_input_creation_date_time, string ps_ref_code, ref double pdb_mass_flow_value, ref double pdb_downstrmdis_value, ref double pdb_fugitive_discharge, boolean pb_org_process, string ps_method_type);// int uof_default_parameters(LONG pl_process_rid // DOUBLE pdb_emission // STRING ps_pollutant // DATETIME pd_start_date_time // DATETIME pd_end_date_time // DAT*tINTEGER pi_log_file // TRANSACTION pt_trans_object // DOUBLE VAR pdb_mass_flow_value // DOUBLE VAR pdb_downstrmdis_value // DOUBLE VAR pdb_fugitive_discharge // // Returns: 1 Success // -1 SQL err // 0 Fail // // Compute estimation emissions using default protocol. // This routine calculates the controlled emissions. // // Modification History // When Who What // ------- --- -----------------------------------------------DAT*v-- // 27DEC94 MAS created // 31JAN96 REJ changed ib_composite_ef to datawindow to correctly perform composite // factor test, moved test to not retrieve a control efficiency if we intend // to ignore it // 23MAY96 REJ added returns for SQL errors, changed ACT to NULL, // ACT value_type will be removed from RAPIDS in version 1.6a IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables DOUBLDAT*xE ldb_capture_eff, ldb_control_eff DECIMAL ld_control_eff_term DECIMAL ld_rid, ld_pollutant_rid DECIMAL ld_input_value STRING ls_unit, ls_parent_material INTEGER li_count INTEGER li_num_open_str INTEGER li_num_connect_str BOOLEAN lb_found BOOLEAN lb_input_found DATETIME ld_creation_date_time LONG ll_composite_ef // Row of pollutant and method type in datawindow of composite emission factors long ll_i lb_input_found = FALSE IF NOT pb_org_process THEN DECLARE est_input_cur CURDAT*zSOR FOR select creation_date_time from rap_activities, rap_streams where ref_rid = rap_streams.rid and rap_streams.from_process_rid = :pl_process_rid and (SUBSTR(metric_code,1) = 'MASS FLOW' or SUBSTR(metric_code,1) = 'DISCHARGE') and start_date_time = :pd_start_date_time and (end_date_time is null or end_date_time = :pd_end_date_time) and SUBSTR(material_code,1) = :ps_pollutant and reference_code = :ps_ref_code and value_tDAT*|ype is NULL and value_amt is not null and value_unit_code is not null using pt_trans_object; // sql status checking if (pt_trans_object.sqlcode <> 0 and pt_trans_object.sqlcode <> 100) then // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) end if open est_input_cur; if pt_trans_object.sqlcode <> 0 then uof_sql_error("uof_default_parameters().. open cursor",& pi_log_file, pt_trans_objDAT*~ect) RETURN (-1) end if IF w_emiss.il_uncontrolled_process_rid <> pl_process_rid THEN DO UNTIL lb_found fetch est_input_cur into :ld_creation_date_time; if pt_trans_object.sqlcode = 0 then lb_found = TRUE IF ld_creation_date_time > pd_input_creation_date_time THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, & " No estimation on input stream." ) END IF DAT* close est_input_cur; Return(0) END IF elseif pt_trans_object.sqlcode = 100 then EXIT else uof_sql_error("uof_default_parameters()..fetch error",& pi_log_file, pt_trans_object) RETURN (-1) end if LOOP END IF END IF // pb_org_process close est_input_cur; // 31JAN96 changed test from boolean to datawindow to handle composite emission factors // for some pollutants and methods and uncontroDAT*lled factors for others // 02FEB99 added process_rid to the information stored in the buffer, and remove row from the // buffer when it has been used -- MDY ll_composite_ef = w_emiss.dw_composite_ef.find("process_rid = " + string(il_curProcessRid) +& " AND material_code = '" + ps_pollutant + "'" + "AND method_type = '" + ps_method_type + "'", & 1, w_emiss.dw_composite_ef.rowCount()) IF ll_composite_ef > 0 THEN // 20FEB95 composite emission factor case, ignore the coDAT*ntrol efficiency ldb_control_eff = 1 //discard the row from w_emiss.dw_composite_ef w_emiss.dw_composite_ef.rowsDiscard(ll_composite_ef, ll_composite_ef, primary!) //note what happened in the log file IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) >= 2 THEN FileWrite( pi_log_file, " Using default control efficiency for" +& " process " + string(il_curProcessRid)) FileWrite( pi_log_file, " Controlled emission faDAT*ctor " +& "was applied to upstream process.") END IF ELSE // retrieve control efficiency // control efficiency found for a pollutant select value_amt, value_unit_code into :ldb_control_eff, :ls_unit from rap_activities, rap_streams where ref_rid = rap_streams.rid and rap_streams.from_process_rid = :pl_process_rid and SUBSTR(metric_code,1) = 'CNTL EFFIC' and start_date_time = :pd_start_date_time DAT* and (end_date_time is null or end_date_time = :pd_end_date_time) and SUBSTR(material_code,1) = :ps_pollutant and value_amt is not null and value_unit_code is not null using pt_trans_object; // sql status checking if pt_trans_object.sqlcode = 0 then lb_found = TRUE elseif pt_trans_object.sqlcode = 100 then lb_found = FALSE else // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1DAT* ) end if // control efficiency for a specific material not found // try to find a control group efficieny for the material or one of its parent groups IF not lb_found THEN // search for applicable CNTL EFF GRP records lb_found = uof_choose_group_activities(pl_process_rid, ps_pollutant, 'CNTL EFF GRP', & ldb_control_eff, ls_unit, pd_start_date_time, pd_end_date_time, pi_log_file, & pt_trans_object) END IF // individual material control efficiency not found // if stillDAT* no success, try to find a control efficiency for any material with an @ sign if not lb_found then select value_amt, value_unit_code into :ldb_control_eff, :ls_unit from rap_activities, rap_streams where ref_rid = rap_streams.rid and rap_streams.from_process_rid = :pl_process_rid and SUBSTR(metric_code,1) = 'CNTL EFFIC' and start_date_time = :pd_start_date_time and (end_date_time = :pd_end_date_time or end_datDAT*e_time is null) and SUBSTR(material_code,1) = '@' and value_amt is not null and value_unit_code is not null using pt_trans_object; // sql status checking if pt_trans_object.sqlcode = 0 then lb_found = TRUE elseif pt_trans_object.sqlcode = 100 then lb_found = FALSE else // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) end if end if if not lb_found then // coDAT*ntrol efficiency not found // Default to 0% ldb_control_eff = 0 IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Using default control efficiency of 0%", & StopSign!, OK! ) END IF ls_unit = 'WT/WT' end if // Is control efficiency value in WT% or WT/WT? IF ls_unit = 'WT%' THEN // (0 <= ldb_control_eff <= 100) ldb_control_eff = ( 1 - ( ldb_control_eff / 100.0 ) ) ELSEIF ls_unit = 'DAT*WT/WT' THEN ldb_control_eff = (1 - ldb_control_eff) ELSE IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Unknown control efficiency unit." ) END IF RETURN(0) END IF END IF // retrieve control efficiency // Multiple output stream case // This case needs to be handled later for partitioning devices. // 27DEC94 SELECT count(rid) INTO :li_num_connect_str FROM rap_streams WHERE from_process_rid = :pl_procDAT*ess_rid AND to_process_rid is not null USING pt_trans_object; IF pt_trans_object.sqlcode <> 0 THEN // sql error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) END IF //IF li_num_connect_str > 1 THEN // IF pi_log_file <> -1 THEN // FileWrite( pi_log_file, " Multiple Output streams(capture eff) Not Supported." ) // END IF // Return(0) //END IF // retrieve capture efficiency // 09FEB95 capture efficiency is only appliDAT*cable to connected streams select value_amt, value_unit_code into :ldb_capture_eff, :ls_unit from rap_activities, rap_streams where ref_rid = rap_streams.rid and rap_streams.from_process_rid = :pl_process_rid and rap_streams.to_process_rid is not null and SUBSTR(metric_code,1) = 'CAPT EFFIC' and start_date_time = :pd_start_date_time and (end_date_time = :pd_end_date_time or end_date_time is null) and SUBSTR(material_code,1) = :ps_polluDAT*tant and value_amt is not null and value_unit_code is not null using pt_trans_object; // sql status checking if pt_trans_object.sqlcode = 0 then lb_found = TRUE elseif pt_trans_object.sqlcode = 100 then lb_found = FALSE else // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) end if // capture efficiency for a specific material not found // try to find a capture efficiency for the material as a group or oneDAT* of its parent groups IF not lb_found THEN // search for applicable CAPT EFF GRP records lb_found = uof_choose_group_activities(pl_process_rid, ps_pollutant, 'CAPT EFF GRP', & ldb_capture_eff, ls_unit, pd_start_date_time, pd_end_date_time, pi_log_file, & pt_trans_object) END IF // individual material control efficiency not found // capture efficiency for a specific material not found // try to find a capture efficiency for any material with an @ sign if not lb_found then select DAT* value_amt, value_unit_code into :ldb_capture_eff, :ls_unit from rap_activities, rap_streams where ref_rid = rap_streams.rid and rap_streams.from_process_rid = :pl_process_rid and rap_streams.to_process_rid is not null and SUBSTR(metric_code,1) = 'CAPT EFFIC' and start_date_time = :pd_start_date_time and (end_date_time = :pd_end_date_time or end_date_time is null) and SUBSTR(material_code,1) = '@' and DAT* value_amt is not null and value_unit_code is not null using pt_trans_object; // sql status checking if pt_trans_object.sqlcode = 0 then lb_found = TRUE elseif pt_trans_object.sqlcode = 100 then lb_found = FALSE else // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) end if end if IF not lb_found THEN // capture efficiency not found // Default to 100% actual value used in the eq. is 1 ldb_DAT*capture_eff = 1 IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Using default capture efficiency of 100%", & StopSign!, OK! ) END IF ELSE // capture efficiency found // Is capture efficiency value in WT% or WT/WT? IF ls_unit = 'WT%' THEN // (0 <= ldb_capture_eff <= 100) ldb_capture_eff =ldb_capture_eff / 100.0 ELSEIF ls_unit = 'WT/WT' THEN ldb_capture_eff = ldb_capture_eff ELSE DAT* IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Unknown capture efficiency unit." ) END IF RETURN(0) END IF // output connection exist SELECT count(rid) INTO :li_count FROM rap_streams WHERE from_process_rid = :pl_process_rid AND to_process_rid is not null USING pt_trans_object; // sql status checking IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_defaDAT*ult_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) END IF IF li_count <= 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Capture Efficiency found. " + & "No output connection found.") FileWrite( pi_log_file, " Calculation Terminated.") END IF RETURN(0) END IF // any fugitive stream exist? SELECT count(rid) INTO :li_count FROM rap_streams WHERE DAT* from_process_rid = :pl_process_rid AND to_process_rid is null USING pt_trans_object; // sql status checking IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_default_parameters()", pi_log_file, pt_trans_object ) Return( -1 ) END IF IF li_count <= 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Capture Efficiency found." + & " No fugitive stream found.") DAT* FileWrite( pi_log_file, " Calculation Terminated.") END IF RETURN(0) ELSEIF li_count > 1 THEN IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " Multiple open streams." ) FileWrite( pi_log_file, " Not supported. Calculation Terminated.") END IF RETURN(0) END IF END IF // end of capture efficiency retrieval pdb_mass_flow_value = pdb_emission * ldb_control_eff * ldb_capture_eff pdb_downstrmdis_value = pdb_emissioDAT*n * ldb_control_eff pdb_fugitive_discharge = pdb_emission * ldb_control_eff * (1 - ldb_capture_eff) IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 1 THEN IF Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " Pollutant: " + ps_pollutant) END IF FileWrite( pi_log_file, " Control Efficiency = " + String(Round(Dec(String(1 - ldb_control_eff)),2)) + & " WT/WT Capture Efficiency = " + String(Round(Dec(string(ldb_capture_eff)),2)) + ' WT/WDAT*T') END IF return (1) end function public function boolean uof_choose_group_activities (long pl_process_rid, string ps_pollutant, string ps_metric_code, ref double pdb_efficiency, ref string ps_unit, datetime pd_start_date_time, datetime pd_end_date_time, integer pi_log_file, transaction pt_trans_object); // uof_choose_group_activities // // Function to choose CNTL EFF GRP or CAPT EFF GRP records based on group hierarchy. // If none match the specific pollutant, go up onDAT*e level at a time until a match is // found // // RETURNS boolean // TRUE if efficiency found // FALSE if not found or error // // Modification History // When Who What // ------- --- ------------------------------------------------- // 13FEB96 REJ created // 27FEB96 REJ Adapted to look up CNTL CO GRP device codes as well BOOLEAN lb_checked DOUBLE ldb_value_amt[] DECIMAL ld_pollutant_rid, ld_parent_rid STRING ls_grp_pol[], ls_unit_code[], ls_checked[], ls_sql, lsDAT*_sql_start, ls_sql_end, & ls_sql_children, ls_parent_code LONG ll_factor_cnt, ll_check_cnt, ll_match_cnt, ll_i, ll_match_idx[] INTEGER li_ub, li_m_ub, li_c_ub DECLARE grp_pol_cur DYNAMIC CURSOR FOR SQLSA; IF ps_metric_code = 'CAPT EFF GRP' THEN // CAPT EFF records apply only to connected streams ls_sql = "select material_code, value_amt, value_unit_code " + & "from rap_streams, rap_activities " + & "where rap_streams.from_process_rid = ? " + & "and rap_activities.DAT*ref_rid = rap_streams.rid " + & "and rap_streams.to_process_rid is not null " + & "and SUBSTR(metric_code,1) = ? " + & "and (start_date_time = ? or start_date_time < ?) " + & "AND (end_date_time = ? or end_date_time > ? or end_date_time is null) " + & "and value_amt is not null " + & "and value_unit_code is not null" ELSEIF ps_metric_code = 'CNTL EFF GRP' THEN ls_sql = "select material_code, value_amt, value_unit_code " + & "from rap_stDAT*reams, rap_activities " + & "where rap_streams.from_process_rid = ? " + & "and rap_activities.ref_rid = rap_streams.rid " + & "and SUBSTR(metric_code,1) = ? " + & "and (start_date_time = ? or start_date_time < ?) " + & "AND (end_date_time = ? or end_date_time > ? or end_date_time is null) " + & "and value_amt is not null " + & "and value_unit_code is not null" ELSEIF ps_metric_code = 'CNTL CO GRP' THEN ls_sql = "select material_code, rap_dDAT*evice_codes.code " + & "from rap_activities, rap_device_codes " + & "where rap_activities.value = rap_device_codes.afs_control_code " + & "and rap_activities.value <> '099' " + & "and ref_rid = ? " + & "and SUBSTR(metric_code,1) = ? " + & "and (start_date_time = ? or start_date_time < ?) " + & "and (end_date_time = ? or end_date_time > ? or end_date_time is null) " + & "and rap_activities.value_type = '" + ps_unit + "'" ELSEIF ps_metric_cDAT*ode = 'TRAN EFF GRP' THEN ls_sql = "select material_code, value_amt, value_unit_code " + & "from rap_streams, rap_activities " + & "where rap_streams.from_process_rid = ? " + & "and rap_activities.ref_rid = rap_streams.rid " + & "and rap_streams.to_process_rid is not null " + & "and SUBSTR(metric_code,1) = ? " + & "and (start_date_time = ? or start_date_time < ?) " + & "AND (end_date_time = ? or end_date_time > ? or end_date_time is null) " + DAT*& "and value_amt is not null " + & "and value_unit_code is not null" END IF PREPARE SQLSA FROM :ls_sql USING pt_trans_object; // CLOSE cursor in case of previous ungraceful exit CLOSE grp_pol_cur; OPEN DYNAMIC grp_pol_cur USING :pl_process_rid, :ps_metric_code, :pd_start_date_time, & :pd_start_date_time, :pd_end_date_time, :pd_end_date_time; IF pt_trans_object.sqlcode <> 0 THEN uof_sql_error("uof_choose_group_activities().. open cursor", pi_log_file, pt_trans_obDAT*ject) RETURN FALSE END IF IF ps_metric_code = 'CNTL CO GRP' THEN FETCH grp_pol_cur into :ls_grp_pol[1], :ls_unit_code[1]; ELSE FETCH grp_pol_cur into :ls_grp_pol[1], :ldb_value_amt[1], :ls_unit_code[1]; END IF IF pt_trans_object.sqlcode = 100 THEN // No potential matches RETURN FALSE ELSEIF pt_trans_object.sqlcode <> 0 THEN uof_sql_error("uof_choose_group_activities().. fetch cursor", & pi_log_file, pt_trans_object) CLOSE grp_pol_cur; RETURN FALSE END IF DO WHILEDAT* pt_trans_object.sqlcode = 0 ll_factor_cnt++ IF ll_factor_cnt >= li_ub THEN uof_increment_array(ls_grp_pol, 100) li_ub = li_ub + 100 ldb_value_amt[li_ub] = 0 ls_unit_code[li_ub] = 'End' ls_checked[li_ub] = 'End' ll_match_idx[li_ub] = 0 END IF IF ls_grp_pol[ll_factor_cnt] = ps_pollutant THEN IF ps_metric_code = 'CNTL CO GRP' THEN ps_unit = ls_unit_code[ll_factor_cnt] ELSE pdb_efficiency = ldb_value_amt[ll_factor_cnt] ps_unit = ls_unit_code[ll_factor_cnDAT*t] END IF RETURN TRUE END IF IF ps_metric_code = 'CNTL CO GRP' THEN FETCH grp_pol_cur into :ls_grp_pol[ll_factor_cnt+1], :ls_unit_code[ll_factor_cnt+1]; ELSE FETCH grp_pol_cur into :ls_grp_pol[ll_factor_cnt+1], :ldb_value_amt[ll_factor_cnt+1], & :ls_unit_code[ll_factor_cnt+1]; END IF LOOP IF pt_trans_object.sqlcode <> 0 and pt_trans_object.sqlcode <> 100 THEN uof_sql_error("uof_choose_group_activities().. fetch cursor", & pi_log_file, pt_trans_object) CLOSE grp_DAT*pol_cur; RETURN FALSE END IF CLOSE grp_pol_cur; ls_checked[1] = ps_pollutant ll_check_cnt = 1 select rid into :ld_pollutant_rid from rap_materials where code = :ps_pollutant using pt_trans_object; // sql status checking if pt_trans_object.sqlcode <> 0 then // SQL Error uof_sql_error( "uof_choose_group_activities().. pollutant rid", pi_log_file, pt_trans_object ) RETURN FALSE end if ls_sql_start = "select code, rap_group_members.parent_ref_rid " + & "from rap_grDAT*oup_members, rap_materials " + & "where rap_group_members.child_ref_rid in (" ls_sql_children = String(ld_pollutant_rid) ls_sql_end = ") and rap_materials.rid = rap_group_members.parent_ref_rid " DECLARE parent_cur DYNAMIC CURSOR FOR SQLSA; DO UNTIL IsNull(ls_sql_children) ls_sql = ls_sql_start + ls_sql_children + ls_sql_end PREPARE SQLSA FROM :ls_sql USING pt_trans_object; // sql status checking IF pt_trans_object.sqlcode <> 0 THEN uof_sql_error("uof_choose_group_actDAT*ivities().. prepare parent cursor", & pi_log_file, pt_trans_object) RETURN FALSE END IF OPEN DYNAMIC parent_cur; // sql status checking IF pt_trans_object.sqlcode <> 0 THEN uof_sql_error("uof_choose_group_activities().. open parent cursor", & pi_log_file, pt_trans_object) CLOSE parent_cur; RETURN FALSE END IF FETCH parent_cur into :ls_parent_code, :ld_parent_rid; // sql status checking IF pt_trans_object.sqlcode = 100 THEN // No more parent materials DAT* CLOSE parent_cur; RETURN FALSE ELSEIF pt_trans_object.sqlcode <> 0 THEN uof_sql_error("uof_choose_group_activities().. fetch parent cursor", & pi_log_file, pt_trans_object) CLOSE parent_cur; RETURN FALSE END IF SetNull(ls_sql_children) ll_match_cnt = 0 DO WHILE pt_trans_object.sqlcode = 0 FOR ll_i = 1 TO ll_factor_cnt IF ls_parent_code = ls_grp_pol[ll_i] THEN ll_match_cnt++ IF ll_match_cnt >= li_m_ub THEN w_emiss.uo_tl.uof_incr_unb_array (ll_DAT*match_idx, & li_m_ub, 100) li_m_ub += 100 //mdy 2/99 END IF ll_match_idx[ll_match_cnt] = ll_i END IF NEXT lb_checked = FALSE FOR ll_i = 1 TO ll_check_cnt IF ls_parent_code = ls_checked[ll_i] THEN lb_checked = TRUE END IF NEXT IF NOT lb_checked THEN IF IsNull(ls_sql_children) THEN ls_sql_children = String(ld_parent_rid) ELSE ls_sql_children = ls_sql_children + ', ' + String(ld_parent_rid) END IF ll_check_cnt++ DAT* IF ll_check_cnt >= li_c_ub THEN uof_increment_array (ls_checked,100) li_c_ub = li_c_ub+100 END IF ls_checked[ll_check_cnt] = ls_parent_code END IF FETCH parent_cur into :ls_parent_code, :ld_parent_rid; LOOP IF pt_trans_object.sqlcode <> 0 and pt_trans_object.sqlcode <> 100 THEN uof_sql_error("uof_choose_group_actvities().. fetch parent cursor", & pi_log_file, pt_trans_object) CLOSE parent_cur; RETURN FALSE END IF CLOSE parent_cur; IF ll_matcDAT*h_cnt = 1 THEN // applicable efficiency found IF ps_metric_code = 'CNTL CO GRP' THEN ps_unit = ls_unit_code[ll_match_idx[1]] ELSE pdb_efficiency = ldb_value_amt[ll_match_idx[1]] ps_unit = ls_unit_code[ll_match_idx[1]] END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN IF ps_metric_code = 'CNTL CO GRP' THEN FileWrite(pi_log_file, " " + ps_metric_code + " record for " + & ls_grp_pol[ll_match_idx[1]] + " group found: " + & DAT* ls_unit_code[ll_match_idx[1]]) ELSE FileWrite(pi_log_file, " " + ps_metric_code + " record for " + & ls_grp_pol[ll_match_idx[1]] + " group found: " + STRING(pdb_efficiency) + " " + & ls_unit_code[ll_match_idx[1]]) END IF END IF RETURN TRUE ELSEIF ll_match_cnt > 1 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " More than one applicable " + ps_metric_code + "record.") END IF RETURDAT*N FALSE END IF LOOP // prepare sql for next generation of parent material groups CLOSE parent_cur; RETURN FALSE end function public function integer uof_activity_update (boolean pb_init_flag, datetime pd_rev_date, long pl_process_rid, datetime pd_start_date_time, datetime pd_end_date_time, ref double pdb_value_amt, string ps_reference_code, string ps_pollutant, string ps_metric_code, string ps_unit, integer pi_log_file, transaction pt_trans_obj, string ps_method_type, string ps_data_cDAT*ode);// int function uof_activity_update(BOOLEAN pb_init_flag, // DATETIME pd_rev_date, // DECIMAL pd_process_rid, // DATETIME pd_start_date_time, // DATETIME pd_end_date_time, // DOUBLE pdb_value_amt, // STRING ps_reference_code, // STRING ps_pollutDAT*ant, // STRING ps_metric_code, // STRING ps_unit, // INTEGER pi_log_file, // TRANSACTION pt_trans_obj // STRING ps_method_type, ps_data_code) // // Return: 1 Success // 0 Failure // -1 SQL error // // Update the control emissions of the out stream of the input // process // // Modification History // When WDAT*ho What // ------- --- ----------------------------------------------- // 12AUG94 PER Reformatted log file messages. // Added error checks for stream_rid select. // Added error checks for activity select. // Added error message for update failure. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables Decimal ld_stream_rid DOUBLE ldb_value STRING ls_value_sDAT*tring STRING ls_unit DATETIME ld_creation_date long ll_activity_rid //MDY 9/99 // Retrieve output stream rid of this process IF ps_metric_code = 'DISCHARGE' THEN select rid into :ld_stream_rid from rap_streams where from_process_rid = :pl_process_rid and to_process_rid is null using pt_trans_obj; ELSE select rid into :ld_stream_rid from rap_streams where from_process_rid = :pl_process_rid and to_process_rid is not null usiDAT*ng pt_trans_obj; END IF if pt_trans_obj.sqlcode = 100 then // Stream rid not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Could not find stream_rid " + & "for from_process_rid = " + String( pl_process_rid ), & StopSign!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Could not find stream_rid " + & "for from_process_rid = " + String( pl_process_rid ) ) DAT* END IF Return (0) elseif pt_trans_obj.sqlcode = -1 then // sql error IF pt_trans_obj.sqlerrtext = "Select returned more than one row" then IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " More than one stream_rid " + & "for from_process_rid = " + String( pl_process_rid ) + & "~r~n Multiple output streams not currently supported by emission estimator") END IF ELSE uof_sql_error( "uof_activity_update()", pi_log_file, pt_trans_obj) EDAT*ND IF return (-1) END IF // retrieve the value amount select value_amt, value_unit_code, creation_date_time, rid into :ldb_value, :ls_unit, :ld_creation_date, :ll_activity_rid from rap_activities where ref_rid = :ld_stream_rid and SUBSTR(metric_code,1) = :ps_metric_code and value_type is NULL // REJ 31MAY96 and SUBSTR(material_code,1) = :ps_pollutant and start_date_time = :pd_start_date_time and end_date_time = :DAT*pd_end_date_time and value_amt is not null and value_unit_code is not null and reference_code = :ps_reference_code and data_code = :ps_data_code // REJ 16JUL96 using pt_trans_obj; if pt_trans_obj.sqlcode = 100 then // Activity data not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & "Could not find activity data for Stream: " + & String( ld_stream_rid ) + "~r~n" + & DAT* " Metric Code: " + & ps_metric_code + "~r~n" + & " Material Code: " + & ps_pollutant + "~r~n" + & " Start Date: " + & String( pd_start_date_time ) + "~r~n" + & " End Date: " + & String( pd_end_date_time ), StopSign!, OK! ) DAT* END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "Could not find activity data for Stream: " + & String( ld_stream_rid ) ) FileWrite( pi_log_file, & " Metric Code: " + & ps_metric_code ) FileWrite( pi_log_file, & " Material Code: " + & ps_pollutant ) FileWrite( pi_log_filDAT*e, & " Start Date: " + & String( pd_start_date_time ) ) FileWrite( pi_log_file, & " End Date: " + & String( pd_end_date_time ) ) END IF Return (0) elseif pt_trans_obj.sqlcode = -1 then // SQL error uof_sql_error( "uof_activity_update()", pi_log_file, pt_trans_obj ) return (-1) END IF //IF ls_unit = ps_unit THEN // 29MAR9DAT*5 // is this value outdated? or middle of the process train? if pb_init_flag then // ldb_value = 0 ldb_value = pdb_value_amt else ldb_value = ldb_value + pdb_value_amt end if // add new amount to the old amount // NEED TO CHECK UNITS! PER 12AUG94 // Units are the same because activity units for this reference code are // chosen by the user. REJ 26FEB96 // Round for Oracle ls_value_string = uof_activity_get_value(ldb_valuDAT*e) // SJS 03AUG95 STRING ls_ref_type = "EE" // update the record update rap_activities set value_amt = :ldb_value, creation_date_time = :pd_rev_date, value = :ls_value_string, // value = :ldb_value, // SJS 03AUG95 reference_type = :ls_ref_type , user_id = :gs_user_id, value_unit_code = :ps_unit, method_type = :ps_method_type // REJ 03OCT96 where rid = :ll_activity_rid //MDY 9/DAT*99 using pt_trans_obj; // MDY 9/99 removed this where clause in favor of selection by rid // where ref_rid = :ld_stream_rid // and SUBSTR(metric_code,1) = :ps_metric_code // and value_type is NULL // REJ 31MAY96 // and SUBSTR(material_code,1) = :ps_pollutant // and start_date_time = :pd_start_date_time // and end_date_time = :pd_end_date_time // and value_amt is not null // and value_unit_code is not null // and refDAT*erence_code = :ps_reference_code // and data_code = :ps_data_code // REJ 16JUL96 if pt_trans_obj.sqlcode <> 0 then MessageBox( "Emission Estimator", & "Could not update control emission" + & " record in the activities table.~n~r" + & "Error " + String (pt_trans_obj.SQLDBCode) + ": " + & pt_trans_obj.SQLErrText, StopSign!, OK! ) if pi_log_file <> -1 then FileWrite(pi_log_file, "Could not update control eDAT*mission" + & " record in the activities table." ) FileWrite( pi_log_file, & "Error " + String (pt_trans_obj.SQLDBCode) + ": " + & pt_trans_obj.SQLErrText) end if Rollback using pt_trans_obj; return (-1) else COMMIT USING pt_trans_obj; // 15FEB95 write back a update value pdb_value_amt = ldb_value return (1) end if //ELSE //// unit comparison failed // MessageBox( "Emission EstimatorDAT*", & // "Did not update control emission" + & // " record in the activities table.~n~r" + & // "unit mismatch.~n~r" + & // "Old unit = " + ls_unit +"~n~r"+& // "New unit = " + ps_unit, StopSign!, OK! ) // if pi_log_file <> -1 then // FileWrite(pi_log_file, "did not update control emission" + & // " record in the activities table." ) // FileWrite( pi_log_file,"Unit mismatch") // FileWriteDAT*( pi_log_file,"Old unit = " + ls_unit + "~n~r") //// FileWrite( pi_log_file, "New unit = " + ps_unit) // // end if // return(0) //END IF end function public function integer uof_cont_poll_list (decimal pd_process_rid, ref integer pi_num_pollutants, ref string ps_pollutants[], string ps_method_type, string ps_ref_code, integer pi_log_file, transaction pt_trans_object);// INTEGER uof_cont_poll_list INTEGER VAR pi_num_pollutants, // STDAT*RING VAR ps_pollutants[], // STRING ps_scc_ams_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object, // DECIMAL pd_process_rid ) // // Returns: 1 Success *OR* // no polllutant specified and no input // pollutants found. // 0 (Never actually returns 0 - see comment below) // -1 SQL Error // /DAT*/ Set up an array with the user-selected pollutants // // Modification History // When Who What // ------- --- ----------------------------------------------- // 20JUL94 MAS If scc_ams is blank the default pollutants are // retrieved from the input stream activity -- // control device. // 16AUG94 PER General code cleanup. // Added SCC/AMS code to error message. // 20AUG94 MAS check the code instead of name for pollutant // 21FEB96DAT* REJ Changed select to join for improved performance // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF pi_num_pollutants = 0 DECLARE act_cur CURSOR FOR SELECT DISTINCT material_code FROM rap_activities, rap_streams WHERE rap_activities.ref_rid = rap_streams.rid DAT*AND rap_streams.to_process_rid = :pd_process_rid AND rap_streams.from_process_rid = :w_emiss.il_prev_process_rid AND SUBSTR(metric_code,1) in ('MASS FLOW','VOL FLOW') AND reference_code = :ps_ref_code AND (method_type = :ps_method_type OR SUBSTR(method_type,1,1) = :ps_method_type) USING pt_trans_object; // User didn't select ANY pollutants from the list box. // Get defaults from input stream of this process activity table. OPEN act_cur; IF pt_trans_oDAT*bject.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_cont_poll_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; // Changed to act_cur 16AUG94 PER Return( -1 ) END IF // Retrieve first record FETCH act_cur INTO :ps_pollutants[1]; IF pt_trans_object.sqlcode = 100 THEN // Error-No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No " + & DAT* "input pollutants found", Exclamation!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) = 0 THEN STRING ls_method_used = 'UNKNOWN' IF LEFT(ps_method_type,1) = 'F' THEN ls_method_used = 'EMIS FACTOR' ELSEIF LEFT(ps_method_type,1) = 'P' THEN ls_method_used = 'SPECIATION' ELSEIF ps_method_type = 'BC' THEN ls_method_used = 'MASS BALANCE' END IF FileWrite( pi_log_file, " No estimates found for " + ls_method_used + " methDAT*od") ELSEIF Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " No estimates found.") END IF ROLLBACK USING pt_trans_object; CLOSE act_cur; // Return( 0 ) // when scc_ams_code = null and no input found this is either an error // or input storage facility // In our example 7747.. OUTDOOR COAL PILE has no input but the // output is the main input to the whole process // So we need to go on with the source estimation even if we have //DAT* no input stream to this kind of process Return(1) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_cont_poll_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; Return( -1 ) ELSE pi_num_pollutants = 1 END IF // Loop through the rest of the pollutant (material) records DO WHILE pt_trans_object.sqlcode = 0 // Retrieve the next record FETCH act_cur INTO :ps_pollutants[ pi_num_pollutantsDAT* + 1 ]; IF pt_trans_object.sqlcode = 100 THEN // No more records to retrieve EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_cont_poll_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE act_cur; Return( -1 ) ELSE pi_num_pollutants++ END IF LOOP // end materials loop // Close materials cursor CLOSE act_cur; // Normal return IF pi_log_file <> -1 AND Dec(DAT* w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Using input pollutants ") FileWrite( pi_log_file, " ") END IF Return( 1 ) end function public function integer uof_control_emission_main (decimal pd_process_rid, string ps_pollutants[], integer pi_num_pollutants, string ps_reference_code, datetime pd_start_date_time, datetime pd_end_date_time, integer pi_log_file, transaction pt_trans_object, ref double pdb_fug_emiss, ref double pdb_cont_emiss, ref boolean pb_calDAT* c_success, ref long pl_next_process_rid, datetime pd_today, string ps_method_type);// int uof_control_emission_main(DECIMAL pd_process_rid // STRING ps_pollutants[] // INTEGER pi_num_pollutants // STRING ps_reference_code // DATETIME pd_start_date_time // DATETIME pd_end_date_time IF w_emiss.cbx_background.checked THEN SetPointer( ArrowDAT*!) ELSE SetPointer( HourGlass! ) END IF BOOLEAN lb_success INTEGER li_ret_status INTEGER li_num_inputs INTEGER li_poll_loop DOUBLE ldb_input_values[], ldb_downstrmdis_value STRING ls_input_units[] BOOLEAN lb_last_device DATETIME ld_creation_date_time BOOLEAN lb_from_last_device STRING ls_data_code, ls_method_type lb_last_device = FALSE lb_success = FALSE lb_from_last_device = FALSE IF pi_num_pollutants = 0 THEN li_ret_status = uof_cont_poll_list(pd_process_rid, & DAT* pi_num_pollutants, ps_pollutants[],& ps_method_type, ps_reference_code,pi_log_file,& pt_trans_object) IF li_ret_status <> 1 THEN Return (0) END IF END IF // REJ 07OCT96 - Remember method_type passed to this function for each pollutant ls_method_type = ps_method_type FOR li_poll_loop = 1 TO pi_num_pollutants ps_method_type = ls_method_type IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_DAT*material.text = ps_pollutants[li_poll_loop] END IF // Check to see if user wants to abort estimation process Yield() Yield() IF w_emiss.cbx_background.checked AND w_emiss.ib_abort THEN IF MessageBox( "Emission Estimator", "Abort estimation process?", & Question!, YesNo! ) = 1 THEN // User wants to abort out of estimation process IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_fiDAT*le, & "***** ESTIMATION RUN ABORTED BY USER *****" ) FileWrite( pi_log_file, " " ) END IF ROLLBACK USING sqlca; pl_next_process_rid = 0 Return( -2 ) // changed from 0 to -2 to make it distinct // MAS 14JUN95 ELSE // Continue with estimation w_emiss.ib_abort = FALSE END IF END IF li_ret_status = uof_get_input_activity_value(pd_process_rid,& ps_pDAT*ollutants[li_poll_loop],& ps_reference_code, pd_start_date_time,& pd_end_date_time, ldb_input_values[1], & ls_input_units[1], li_num_inputs, ld_creation_date_time,& pi_log_file, pt_trans_object,ps_method_type,ls_data_code) IF li_ret_status = -1 THEN // SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " Ending emission estimation for " + & "process DAT*" + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF return (-1) ELSEIF li_ret_status = 0 THEN // no input activity value found // need to look for rest of the pollutants 29JAN96 REJ CONTINUE // input value must be available to continue with downstream // IF w_emiss.uo_tl.uof_downstream_process(pd_process_rid, sqlca,& // pl_next_process_rid) = -1 THEN // // Added this log file update 17PER94 PER // IF pi_logDAT*_file <> -1 THEN // FileWrite( pi_log_file, " Ending emission estimation for " + & // "process " + String( pd_process_rid ) ) // FileWrite( pi_log_file, " " ) // END IF // return (-1) // ELSE // // Added this log file update 17PER94 PER // IF pi_log_file <> -1 THEN // FileWrite( pi_log_file, " Ending emission estimation for " + & // "process " + String( pd_procesDAT*s_rid ) ) // FileWrite( pi_log_file, " " ) // END IF // return (0) // end IF ELSEIF li_ret_status = 1 THEN // input activity value found // proceed li_ret_status = uof_default_parameters(pd_process_rid,& ldb_input_values[1],& ps_pollutants[li_poll_loop],pd_start_date_time,& pd_end_date_time, pi_log_file, & this.uoit_rid_tran,& ld_creation_daDAT*te_time,ps_reference_code,& pdb_cont_emiss, ldb_downstrmdis_value, pdb_fug_emiss,& FALSE, ps_method_type) IF li_ret_status = 0 THEN // can't calculate default emission for this pollutant // 13FEB95 if not able to calculate the default, something is wrong CONTINUE // Return(0) ELSEIF li_ret_status = -1 THEN // // SQL error retrieving records IF pi_log_fiDAT* le <> -1 THEN FileWrite( pi_log_file, " Ending emission estimation for " + & "process " + String( pd_process_rid ) ) FileWrite( pi_log_file, " " ) END IF Return (-1) ELSEIF li_ret_status = 1 THEN // calculation using default protocol successful li_ret_status = uof_default_calc_success(pd_process_rid, & pdb_fug_emiss, pdb_cont_emiss,& pd_start_date_time, pd_DAT*"end_date_time,& ps_pollutants[li_poll_loop],& ls_input_units[1], & pi_log_file,this.uoit_rid_tran,& ps_reference_code,FALSE,pd_today,lb_last_device,& lb_from_last_device,ps_method_type,ls_data_code) IF li_ret_status = 1 THEN // write control emission back to the output stream of // source process IF (w_emiss.is_start_level <> "Process") THEN DAT*$ lb_from_last_device = lb_last_device li_ret_status = uof_default_calc_success(& w_emiss.il_discharge_proc_rid,& pdb_fug_emiss, pdb_cont_emiss,& pd_start_date_time, pd_end_date_time,& ps_pollutants[li_poll_loop],& ls_input_units[1], & pi_log_file,this.uoit_rid_tran,& ps_reference_code,TRUE,pd_today,lb_last_deDAT*&vice,& lb_from_last_device,ps_method_type,ls_data_code) // CHECK li_ret_status from uof_default_calc_success? // 17AUG94 PER end IF // called from process? pb_calc_success = TRUE // CHECK li_ret_status from uof_default_calc_success? 17AUG94 PER end IF // checking status of uof_default_calc_success CONTINUE END IF // checking status of uof_default_parameters // NEXT // num oDAT*(f activity input records end IF // end of checking the return status of uof_get_input_activity_value NEXT // pollutants loop Return (1) end function public function integer uof_activity_data (string ps_metric_code, ref string ps_throughput_material_code, decimal pd_process_rid, datetime pd_start_date_time, datetime pd_end_date_time, string ps_input_output_flag, ref double pdb_activity_value, ref string ps_activity_unit, string ps_method, string ps_reference_code, integer pi_log_file, refDAT** transaction pt_trans_object);// INTEGER uof_activity_data( STRING ps_metric_code, // STRING ps_throughput_material_code, // DECIMAL pd_process_rid, // DATETIME pd_start_date_time, // DATETIME pd_end_date_time, // STRING ps_input_output_flag, // DECIMAL VAR pdb_activity_value, // DAT*,STRING VAR ps_activity_unit, // STRING ps_method, // STRING ps_reference_code, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function retrieves the specified activity record // // Returns: 1 Success // 0 Record not found // -1 SQL Error // // Modification History // // Date User Description // --------- --- ------------------------------------------DAT*.---- // 10 MAY 94 PER Removed input_output_flag column. // Changed value to value_amt. // 12 AUG 94 PER Reformatted log file message. // Changed printing of process_rid to stream_rid. // Added error checks to stream_rid select. // 21 NOV 94 MAS Multiple input/output streams implemented // 06 FEB 96 REJ Added ps_method to arguments so that speciation would not accept // null reference codes // 14 MAY 96 REJ DAT*0 Changed data window for speciation to find 'PM,%' and 'PM10,%' species. // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF DECIMAL ld_null Double ldb_value_sum = 0 String ls_convert_to_unit, ls_no_activity, ls_data_code_remap Integer li_ret_status INTEGER li_count BOOLEAN lbDAT*2_value_found = FALSE // Retrieve the activity data for the specified time period // and throughput material // (Ignore date intervals, units) // (NO RESTRICTION ON METRIC_LEVEL_TYPE) // Declare local variables long ll_stream_rids[] decimal ld_to_rid, ld_from_rid string ls_stream_ids[] int li_num_streams = 0 int i string ls_sql_statement datetime ldt_start_date_time, ldt_end_date_time // Intialize boundary of dynamic arrays INTEGER li_ub = 10 ll_stream_rids[li_ub] = 0 ls_streaDAT*4m_ids[li_ub] = 'End' //MDY 9/99 added for specialized speciation processing of EXPM, EXHC, EVHC, BW10, TW10 is_speciationValueType = "" IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 4 THEN FileWrite(pi_log_file, String(Now()) + " Creating cursor of streams") END IF // follwing first select was added by MAS 6/21/94 // change select to use bind variables for Oracle performance REJ 5/09/96 IF ps_input_output_flag = 'I' THEN ld_to_rid = pd_process_rid ld_from_rDAT*6id = 0 // activity data @ input stream // ls_sql_statement = "Select rid,id FROM rap_streams " + & // "Where to_process_rid = " + String(pd_process_rid) ELSE ld_to_rid = 0 ld_from_rid = pd_process_rid // activity data @ output stream // ls_sql_statement = "Select rid,id FROM rap_streams " + & // "Where from_process_rid = " + String(pd_process_rid) END IF //DECLARE data_cur DYNAMIC CURSOR FOR SQLSA; //PREPARE SQLSA FROM :ls_sql_statemenDAT*8t USING pt_trans_object; //OPEN DYNAMIC data_cur; DECLARE data_cur CURSOR FOR Select rid,id FROM rap_streams Where to_process_rid = :ld_to_rid UNION Select rid,id FROM rap_streams Where from_process_rid = :ld_from_rid; OPEN data_cur; IF pt_trans_object.sqlcode <> 0 THEN uof_sql_error( "uof_activity_data()", pi_log_file, pt_trans_object ) CLOSE data_cur; return (-1) END IF FETCH data_cur INTO :ll_stream_rids[1], :ls_stream_ids[1]; if pt_trans_object.sqlcode =DAT*: 100 then // Stream rid not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No stream found " + & "for to_process_rid = " + String( pd_process_rid ), & StopSign!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " No stream found " + & "for to_process_rid = " + String( pd_process_rid ) ) END IF CLOSE data_cuDAT*<r; Return (0) elseif pt_trans_object.sqlcode = -1 then // sql error uof_sql_error( "uof_activity_data()", pi_log_file, pt_trans_object ) CLOSE data_cur; return (-1) elseif pt_trans_object.sqlcode = 0 then li_num_streams = 1 end if DO WHILE pt_trans_object.sqlcode = 0 FETCH data_cur INTO :ll_stream_rids[li_num_streams+1], :ls_stream_ids[li_num_streams+1]; IF pt_trans_object.sqlcode = 100 then // No more stream rids found Exit ELSEIF DAT*>pt_trans_object.sqlcode = -1 then // sql error uof_sql_error( "uof_activity_data()", pi_log_file, pt_trans_object ) CLOSE data_cur; return (-1) ELSEIF pt_trans_object.sqlcode = 0 THEN li_num_streams++ IF li_num_streams >= li_ub THEN uof_increment_array(ls_stream_ids, 50) li_ub = li_ub + 50 ll_stream_rids[li_ub] = 0 END IF END IF LOOP CLOSE data_cur; // Set up activity data window based on method IF pi_log_file <> -1 AND Dec(w_emiss.DAT*@em_log_detail.text) > 4 THEN FileWrite(pi_log_file, String(Now()) + " Setting datawindow") END IF IF ps_method = 'SPECIATION' THEN this.dw_activity.DataObject = 'd_activity_retrieve_speciate' ELSE this.dw_activity.DataObject = 'd_activity_retrieve' END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 4 THEN FileWrite(pi_log_file, String(Now()) + " Datawindow is Set") END IF // Retrieve for all streams FOR i=1 TO li_num_streams li_ret_status = uof_activity_retrievDAT*Be (pdb_activity_value, ps_activity_unit, & ps_metric_code, ps_throughput_material_code, ll_stream_rids[i], pd_start_date_time, & pd_end_date_time, ps_reference_code, pi_log_file, pt_trans_object) IF li_ret_status = 0 THEN // No activity data found. IF NOT w_emiss.cbx_background.checked THEN ls_no_activity = "No activity record found for" + & " Metric " + ps_metric_code + & " Throughput Material " + ps_throughput_material_code + & " Stream " + String( ll_stream_rDAT*Dids[1] ) + & " Start date " + String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End date " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) MessageBox( "Emission Estimator", ls_no_activity, & Information!, OK! ) END IF ELSEIF li_ret_status = -1 THEN // SQL Error uof_sql_error( "uof_activity_retrieve()", pi_log_file, pt_trans_object ) Return( -1 ) ELSE // Record retrieved successfully // requires unit cDAT*Fonversion IF NOT lb_value_found THEN ls_convert_to_unit = ps_activity_unit ELSE li_ret_status = uof_unit_convert(ps_activity_unit, ls_convert_to_unit, ld_null, & pdb_activity_value, 'DOUBLE', pi_log_file, pt_trans_object) IF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF lb_value_found = TRUE ldb_value_sum = ldb_value_sum DAT*H+ pdb_activity_value END IF NEXT //FOR LOOP //MDY 9/99 added for specialized speciation processing of EXPM, EXHC, EVHC, BW10, TW10 if ps_method = 'SPECIATION' then is_speciationValueType = f_speciation_value_type(ps_throughput_material_code) end if IF (lb_value_found) and (ldb_value_sum >= 0) THEN pdb_activity_value = ldb_value_sum ps_activity_unit = ls_convert_to_unit return (1) ELSE return (0) END IF // end uof_activity_data() end function public funcDAT*Jtion integer uof_activity_retrieve (ref double pdb_value_amt, ref string ps_activity_unit, string ps_metric_code, ref string ps_material_code, long pl_stream_rid, datetime pd_start_date_time, datetime pd_end_date_time, string ps_reference_code, ref integer pi_log_file, transaction pt_trans_object);// uof_activity_retrieve // retrieves appropriate values into activity data_window and filters down to one value // // 14MAR96 REJ Created // 07MAY96 REJ "@" material_code activity data can be useDAT*Ld as a match INTEGER li_num_rows, li_pos, li_priority[] LONG ll_length, ll_row, ll_row2, ll_discardCount STRING ls_filter, ls_sql, ls_decode, ls_select, ls_rest1, ls_rest, ls_char, ls_dw_syntax, & ls_error, ls_mat_filter, ls_material, ls_materialCode[], ls_referenceCode[], ls_dataCode[] boolean lb_discardRow[] this.dw_activity.SetTransObject(pt_trans_object) // Make sure filter is clear this.dw_activity.SetFilter("") this.dw_activity.Filter() // If connected to Oracle, have tDAT*No alter select statement on dw_activity IF gs_database = 'ORACLE' THEN ls_sql = this.dw_activity.Describe("DataWindow.Table.select") //MDY 10/98 See if the sql has already been changed for Oracle ls_decode = "DECODE(data_code,NULL,'" + w_emiss.is_null_code_map + & "','RO','" + w_emiss.is_ro_code_map + "',data_code)" li_pos = POS(ls_sql,ls_decode) if li_pos <= 0 then ls_decode = "if rap_activities.data_code is null then :as_null else if " + & "rap_activities.data_code DAT*P= 'RO' then :as_ro else rap_activities.data_code endif endif" ll_length = LEN(ls_decode) li_pos = POS(ls_sql,ls_decode) IF li_pos > 0 THEN ls_select = LEFT(ls_sql,li_pos - 1) ls_rest1 = MID(ls_sql, li_pos + ll_length) ls_decode = "DECODE(data_code,NULL,~~~'" + w_emiss.is_null_code_map + & "~~~',~~~'RO~~~',~~~'" + w_emiss.is_ro_code_map + "~~~',data_code)" // add tildes to ls_rest for parsing in DwModify REJ 22FEB96 li_pos = 1 DO UNTIL li_pos = 0 DAT*R li_pos = POS(ls_rest1,"'") IF li_pos = 0 THEN ls_rest = ls_rest + ls_rest1 ELSE ls_char = LEFT(ls_rest1,li_pos - 1) ls_rest = ls_rest + ls_char + "~~~'" ls_rest1 = MID(ls_rest1,li_pos + 1) END IF LOOP ls_dw_syntax = "DataWindow.Table.select='" + ls_select + ls_decode + ls_rest + "'" ls_error = this.dw_activity.Modify(ls_dw_syntax) IF ls_error <> '' THEN MessageBox("Activity DataWindow",ls_error + "~rSelect unchanged. Contact TechnicalDAT*T Support.") RETURN -1 END IF ELSE //the search string ls_decode was not found in the SQL messageBox("Error", "uo_emission::uof_activity_retrieve(); " +& "string ls_decode not found in SQL for dw_activity.", exclamation!) END IF end if END IF //oracle li_num_rows = this.dw_activity.Retrieve(pl_stream_rid, ps_metric_code, & ps_material_code, pd_start_date_time, pd_end_date_time, w_emiss.is_ro_code_map, & w_emiss.is_null_code_map) //openWithDAT*VParm(w_data_viewer, this.dw_activity) //added prioritization logic for speciation MDY 2/99 if li_num_rows > 1 and this.dw_activity.DataObject = 'd_activity_retrieve_speciate' then li_priority[li_num_rows] = 0 ls_materialCode[li_num_rows] = "" ls_referenceCode[li_num_rows] = "" ls_dataCode[li_num_rows] = "" lb_discardRow[li_num_rows] = false //prioritize each row for ll_row = 1 to li_num_rows //grab the data needed for prioritization ls_materialCode[ll_row] = thiDAT*Xs.dw_activity.getItemString(ll_row, "material_code") ls_referenceCode[ll_row] = this.dw_activity.getItemString(ll_row, "reference_code") ls_dataCode[ll_row] = this.dw_activity.getItemString(ll_row, "decode") //determine row priority based on speciation pollutant hierarchy choose case ls_materialCode[ll_row] case "PM,TOTAL" li_priority[ll_row] = 60 case "PM" li_priority[ll_row] = 50 case "PM,FLTRBLE" li_priority[ll_row] = 40 case "PM10,TOTAL" li_DAT*Zpriority[ll_row] = 30 case "PM10" li_priority[ll_row] = 20 case "PM10,FLTRBLE" li_priority[ll_row] = 10 case else li_priority[ll_row] = 0 end choose //set row priority if this.dw_activity.setItem(ll_row, "priority", li_priority[ll_row]) < 0 then return -1 end if next //openWithParm(w_data_viewer, this.dw_activity) //compare buffer rows to determine if rows need to be discarded ll_discardCount = 0 for ll_row = 1 to (li_num_rows - 1) DAT*\ if lb_discardRow[ll_row] then continue for ll_row2 = (ll_row + 1) to li_num_rows if lb_discardRow[ll_row2] then continue if li_priority[ll_row] = li_priority[ll_row2] then continue //if rows have been prioritized and only the material codes //differ, then keep only the highest priority row of the two by //setting the decode field to "_" -- this value can be sorted //to the top of the buffer for a block discard if li_priority[ll_row] > 0 and lDAT*^i_priority[ll_row2] > 0 and & ls_materialCode[ll_row] <> ls_materialCode[ll_row2] and & ls_referenceCode[ll_row] = ls_referenceCode[ll_row2] and & ls_dataCode[ll_row] = ls_dataCode[ll_row2] then if li_priority[ll_row] > li_priority[ll_row2] then lb_discardRow[ll_row2] = true if this.dw_activity.setItem(ll_row2, "decode", "_") < 0 then return -1 ll_discardCount ++ else lb_discardRow[ll_row] = true if this.dw_activity.setItem(ll_row, "decDAT*`ode", "_") < 0 then return -1 ll_discardCount ++ ll_row2 = li_num_rows + 1 end if end if next next //openWithParm(w_data_viewer, this.dw_activity) //discard any unwanted rows from the buffer if ll_discardCount > 0 then if this.dw_activity.setSort("decode A") < 0 then messageBox("Error", "uo_emission::uof_activity_retrieve(); setSort() failed.", exclamation!) return -1 end if if this.dw_activity.sort() < 0 then messageBDAT*box("Error", "uo_emission::uof_activity_retrieve(); sort() failed.", exclamation!) return -1 end if if this.dw_activity.rowsDiscard(1, ll_discardCount, primary!) < 0 then messageBox("Error", "uo_emission::uof_activity_retrieve(); rowsDiscard() failed.", exclamation!) return -1 end if end if //sort the buffer with highest priority at the top if this.dw_activity.setSort("priority D, decode A, value_amt D") < 0 then messageBox("Error", "uo_emission::uof_activityDAT*d_retrieve(); setSort() failed.", exclamation!) return -1 end if if this.dw_activity.sort() < 0 then messageBox("Error", "uo_emission::uof_activity_retrieve(); sort() failed.", exclamation!) return -1 end if li_num_rows = this.dw_activity.rowCount() end if //speciation prioritization //openWithParm(w_data_viewer, this.dw_activity) IF li_num_rows = -1 THEN RETURN (-1) ELSEIF li_num_rows = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THENDAT*f FileWrite( pi_log_file, & " No activity record for " + & ps_metric_code + " of " + ps_material_code + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) END IF RETURN 0 ELSE // We've got rows //DEBUG LINE //this.dw_activity.saveAs("dw_deDAT*hbug\act_" + is_curSourceID + "_" + is_curDeviceID + "_" + is_curProcessID + "_" + is_curPollutant + ".txt", text!, true) IF IsNull(w_emiss.is_input_ref_code) THEN IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = this.dw_activity.GetItemString(1,"material_code") Return 1 // Normal Return END IF // Now we know there's more than one row //DAT*j Filter out material codes in favor of exact matches, if possible REJ 07MAY96 IF this.dw_activity.DataObject = 'd_activity_retrieve' THEN ls_mat_filter = "material_code = '" + ps_material_code + "'" this.dw_activity.SetFilter(ls_mat_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") DAT*l ps_material_code = this.dw_activity.GetItemString(1,"material_code") Return 1 // Normal Return ELSEIF li_num_rows = 0 THEN ls_mat_filter = "" END IF END IF // Check reference code against output reference code IF ls_mat_filter = "" THEN ls_filter = "reference_code = '" + ps_reference_code + "'" ELSE ls_filter = ls_mat_filter + " AND reference_code = '" + ps_reference_code + "'" END IF this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter(DAT*n) li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = this.dw_activity.GetItemString(1,"material_code") Return 1 // Normal Return ELSEIF li_num_rows > 1 THEN // If first two data_code priorities are the same, then cannot choose, // unless material codes are different. Different material codes shouldDAT*p only occur // for speciation select ("PM", "PM,FLTRBLE", etc.) ls_decode = this.dw_activity.GetItemString(1, "decode") ls_material = this.dw_activity.GetItemString(1, "material_code") IF ls_decode = this.dw_activity.GetItemString(2, "decode") AND & ls_material = this.dw_activity.GetItemString(2, "material_code") THEN IF ls_decode = w_emiss.is_ro_code_map THEN ls_decode = "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" DAT*r END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " of " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:DAT*tss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + ps_reference_code + & " Data Code: " + ls_decode) END IF RETURN 0 ELSE // First record with unique data code and material_code is o.k. // If data_code is not unique, filter to make sure material code is unique for that // data_code IF ls_decode = this.dw_activity.GetItemString(2, "decode") THEN ls_filter = ls_filter + " AND material_code = '" + ls_materialDAT*v + "' AND decode = '" +& ls_decode + "'" this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = ls_material Return 1 // Normal Return ELSE IF ls_decode = w_emiss.is_ro_code_map THEN ls_decode DAT*x= "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " of " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time,DAT*z "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + ps_reference_code + & " Data Code: " + ls_decode) END IF RETURN 0 END IF ELSE pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = ls_materDAT*|ial Return 1 // Normal Return END IF END IF ELSE // No rows have output reference code // Clear filter and check data code only this.dw_activity.SetFilter(ls_mat_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() // If first two data_code priorities are the same, then cannot choose, // unless material codes are different. Different material codes should only occur // for speciation select ("PM", "PM,FLTRBLE", etc.) DAT*~ls_decode = this.dw_activity.GetItemString(1, "decode") ls_material = this.dw_activity.GetItemString(1, "material_code") STRING ls_test_decode, ls_test_mat ls_test_decode = this.dw_activity.GetItemString(2, "decode") ls_test_mat = this.dw_activity.GetItemString(2, "material_code") IF ls_decode = this.dw_activity.GetItemString(2, "decode") AND & ls_material = this.dw_activity.GetItemString(2, "material_code") THEN IF ls_decode = w_emiss.is_ro_code_map THEN DAT* ls_decode = "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " of " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, DAT*yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, " Data Code: " + ls_decode) END IF RETURN 0 ELSE // First record with unique data code and material_code is o.k. // If data_code is not unique, filter to make sure material code is unique for that // data_code IF ls_decode = this.dw_activity.GetItemString(2, "decode") THEN ls_filter = ls_filter + " AND material_DAT*code = '" + ls_material + "' AND decode = '" +& ls_decode + "'" this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = ls_material Return 1 // Normal Return ELSE IF ls_decode = w_emiss.is_ro_code_map TDAT*HEN ls_decode = "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " of " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & StriDAT*ng( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + ps_reference_code + & " Data Code: " + ls_decode) END IF RETURN 0 END IF ELSE pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_mDAT*aterial_code = ls_material Return 1 // Normal Return END IF END IF END IF ELSE // input reference code was specified // Check reference code against input reference code ls_filter = "reference_code = '" + w_emiss.is_input_ref_code + "'" this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = thisDAT*.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = this.dw_activity.GetItemString(1,"material_code") Return 1 // Normal Return ELSEIF li_num_rows > 1 THEN // For emission factor method, // Filter out '@' material codes in favor of exact matches, if possible REJ 07MAY96 IF this.dw_activity.DataObject = 'd_activity_retrieve' THEN ls_mat_filter = ls_filter + " AND material_code = '" + ps_material_code + "'" this.dw_activity.SetFilter(ls_mat_filter) DAT* this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") Return 1 // Normal Return ELSEIF li_num_rows = 0 THEN ls_mat_filter = ls_filter this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() END IF END IF ls_maDAT*t_filter = ls_filter // If first two data_code priorities are the same, then cannot choose, // unless material codes are different. Different material codes should only occur // for speciation select ("PM", "PM,FLTRBLE", etc.) ls_decode = this.dw_activity.GetItemString(1, "decode") ls_material = this.dw_activity.GetItemString(1, "material_code") IF ls_decode = this.dw_activity.GetItemString(2, "decode") AND & ls_material = this.dw_activity.GetItemString(2, "materialDAT*_code") THEN IF ls_decode = w_emiss.is_ro_code_map THEN ls_decode = "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " of " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " DAT* Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + w_emiss.is_input_ref_code + & " Data Code: " + ls_decode) END IF RETURN 0 ELSE // First record with unique data code and material_code is o.k. // If data_code is not unique, filter to make sure material coDAT*de is unique for that // data_code IF ls_decode = this.dw_activity.GetItemString(2, "decode") THEN ls_mat_filter = ls_mat_filter + " AND material_code = '" + ls_material + "' AND decode = '" +& ls_decode + "'" this.dw_activity.SetFilter(ls_filter) this.dw_activity.Filter() li_num_rows = this.dw_activity.RowCount() IF li_num_rows = 1 THEN pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GDAT*etItemString(1,"value_unit_code") ps_material_code = ls_material Return 1 // Normal Return ELSE IF ls_decode = w_emiss.is_ro_code_map THEN ls_decode = "RO" ELSEIF ls_decode = w_emiss.is_null_code_map THEN ls_decode = "NULL" END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " More than one activity record for " + & ps_metric_code + " oDAT*f " + ls_material + " at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + w_emiss.is_input_ref_code + & " Data Code: " + ls_decode) END IF RETURN 0 END IF DAT* ELSE pdb_value_amt = this.dw_activity.GetItemNumber(1,"value_amt") ps_activity_unit = this.dw_activity.GetItemString(1,"value_unit_code") ps_material_code = ls_material Return 1 // Normal Return END IF END IF ELSE // None with specified reference code IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, & " No activity records for " + & ps_metric_code + " of " + ps_material_code + DAT*" at stream " + String(pl_stream_rid)) FileWrite( pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " End Date: " + String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) FileWrite( pi_log_file, & " Reference Code: " + w_emiss.is_input_ref_code) END IF RETURN 0 END IF END IF END IF Return -1 // Shouldn't get to bottom end function public function integerDAT* uof_process_info (decimal pd_process_rid, boolean pb_control_process_flag, integer pi_log_file);// int uof_process_info(DECIMAL pd_process_rid // STRING ps_source_name // STRING ps_source_id // STRING ps_device_name // STRING ps_device_id // STRING ps_process_name // STRING ps_process_id // INTEGER pi_log_file) // /DAT*/ This function retrieves the process information and // displays the status in w_emiss_status window. // // Returns: 1 Success // 0 Record not found // // History // // WHEN WHO WHAT // --------- --- ---------------------------------------------- // 26AUG94 MAS CREATED // 07MAR96 REJ Moved source name FileWrite to uof_source, uof_process_name will // no longer return source name // 21MAY98 MDY Modified to write the current county andDAT* source info to the status window // 12FEB99 MDY Modified to call uof_get_process_info() instead of uof_get_process_name() // There was alot of redundant SQL happening, and the new function does the // work of two or three other functions that were being called. //Declare local variable(s) //STRING ls_source_name //STRING ls_source_id //STRING ls_device_name //STRING ls_device_id //STRING ls_process_name //STRING ls_process_id INTEDAT*GER li_ret_status // Put current process information (source, device, and process) // in emission log file for identification. //li_ret_status = uof_process_name( pd_process_rid, ls_source_name, & // ls_source_id, ls_device_name, ls_device_id, & // ls_process_name, ls_process_id, pi_log_file, sqlca ) //MDY 2/99 //this replaces old uof_process_name() and loads values into //instance variables so they can be accessed by functions instead //oDAT*f being passed around all over the place as parameters li_ret_status = uof_get_process_info(pd_process_rid) IF li_ret_status = 1 THEN // Put information in log file //added code from old uof_process_name() MDY 2/99 //this just logs the source begin message IF w_emiss.is_start_level = "Process" THEN IF w_emiss.uo_tl.uof_source_name(il_curSourceRid, pi_log_file, sqlca) = -1 THEN uof_sql_error( "uof_process_info()", pi_log_file, sqlca ) Return( -1 ) END IF DAT* END IF //end code addition MDY 2/99 IF pd_process_rid <> w_emiss.il_orig_process_rid OR pb_control_process_flag = FALSE THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " " ) IF Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " BEGINNING emission estimation for" ) END IF FileWrite( pi_log_file, " Device ID/Name: " + & is_curDeviceID + "/" + is_curDeviceName ) DAT* FileWrite( pi_log_file, " Process ID/Name: " + & is_curProcessID + "/" + is_curProcessName ) FileWrite( pi_log_file, " " ) END IF END IF ELSEIF li_ret_status = 0 THEN // Process or Device name was not found. // Default to process_rid and keep going. //added code from old uof_process_name() MDY 2/99 IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Source/Device/Process record" + & " not foDAT*und for process_rid " + String( pd_process_rid ), & Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Source/Device/Process record " + & "not found for process_rid " + String( pd_process_rid ) ) END IF //think we should just return here as an error condition return 0 //end code addition MDY 2/99 IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " " ) DAT* FileWrite( pi_log_file, "Beginning emission estimation for " + & "process " + String( pd_process_rid ) ) END IF ELSE // SQL Error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "SQL Error occurred on process_rid " + & String( pd_process_rid ) ) END IF Return( 0 ) END IF // Update background processing status screen //** 5/21/98 MDY Modified to write the current county and source infDAT*o to the status window IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_county.text = is_curCountyName w_emiss_status.sle_source.text = is_curSourceID + " / " + is_curSourceName w_emiss_status.sle_device.text = is_curDeviceID + " / " + is_curDeviceName w_emiss_status.sle_process.text = is_curProcessID + " / " + is_curProcessName END IF Return (1) end function public function integer uof_calc_mass_balance (decimal pd_process_rid, string ps_scc_ams_code, string ps_rDAT*eference_code, datetime pd_start_date_time, datetime pd_end_date_time, integer pi_num_metrics, integer pi_num_metric_groups, decimal pd_record_group_no[], decimal pd_sequence_no[], string ps_item_type[], string ps_operator_type[], string ps_numer_material_code[], string ps_denom_material_code[], string ps_metric_code[], string ps_in_throughput_material, string ps_pollutant, ref double pdb_est_emission, ref string ps_emission_unit_code, integer pi_log_file, ref transaction pt_trans_object, ref tranDAT*saction pt_emiss_object, ref transaction pt_rid_object, ref long pl_next_process_rid, boolean pb_scc_at_str, integer pi_curr_priority);// INTEGER uof_calc_mass_balance( DECIMAL pd_process_rid, STRING ps_scc_ams_code, // STRING ps_reference_code, DATETIME pd_start_date_time, DATETIME pd_end_date_time, // INTEGER pi_num_metrics, INTEGER pi_num_metric_groups, DECIMAL pd_record_group_no[], // DECIMAL pd_sequence_no[], STRING ps_item_type[], STRING ps_operator_type[], // DAT*STRING ps_numer_material_code[], STRING ps_denom_material_code[], // STRING ps_metric_code[], STRING ps_in_throughput_material, // STRING ps_pollutant, DECIMAL VAR pdb_est_emission, // STRING VAR ps_emission_unit_code, INTEGER pi_log_file, TRANSACTION VAR pt_trans_object, // TRANSACTION VAR pt_emiss_object, TRANSACTION VAR pt_rid_object , // LONG VAR pl_next_process_rid) // // Returns: 1 Success // 0 Error or all required data not found // DAT* -1 SQL Error // // Compute estimated emission using MASS BALACE method // Estimated_emissions = (1-transfer efficiency)*(density * vol.flow)*(mass fraction) // // NOTES: // 1) Method metric records sequence order MUST be M,[M...],E. // 2) If constants are used, the E method metric record must have a // specific denom_material_code (NOT @) so that at most ONE // emission factor record is retrieved. // // Modification History // WHO WHEN WHAT // === ==== ====DAT* // MAS 07/23/94 created // PER 08/17/94 Modified error messages. // REJ 02/26/96 Modified log messages. // REJ 02/28/96 // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables UOST_MASS_BAL lst_mass_eq[] UOST_INPUT_MATERIAL lst_input_mDAT*aterial[] UOST_DENSITY lst_density[] UOST_XFER_EFF lst_xfer_eff[] UOST_MASS_FRACTION lst_mass_fraction[] BOOLEAN lb_transfer_eff_found, lb_density_found, lb_flow_found, lb_factor_found, & lb_ready_to_calculate, lb_last_device INTEGER li_ret_status, li_metric_loop, li_index, li_num_input_materials, & li_eq_entry_count, li_input_ub STRING ls_profile_code, ls_metric_code, ls_null_value, ls_act_unit, ls_group, & ls_priority DECIMAL ld_null_value, ld_curr_group, DAT*ld_act_value DATETIME ld_today, ld_input_creation_date_time LONG ll_next_process_rid STRING ls_numer_unit, ls_denom_unit, ls_density_numer_unit LONG ll_char_pos, ll_length DOUBLE ldb_mass_flow_value, ldb_downstrmdis_value, ldb_fugitive_discharge, ldb_null // Set ld_today to today's date/time (for inserts) ld_today = DateTime( Today(), Now() ) // Set NULL values (for passing arguments for inserts) SetNull( ls_null_value) SetNull( ld_null_value ) SetNull( ldb_null)DAT* SetNull(ls_metric_code) ls_density_numer_unit = "" // Initialize default values lb_flow_found = FALSE lb_density_found = FALSE lb_transfer_eff_found = FALSE lb_factor_found = FALSE lb_last_device = FALSE INTEGER li_ub = 200 lst_mass_eq[200].throughput_amt = 0 lst_input_material[200].amt = 0 lst_density[200].amt = 0 lst_xfer_eff[200].value_amt = 0 lst_mass_fraction[200].amt = 0 // Loop through the method_metric records li_metric_loop = 1 li_num_input_materials = 0 lb_ready_to_cDAT*alculate = FALSE DO WHILE TRUE // Check to see if we have tried all the method_metric records IF li_metric_loop > pi_num_metrics THEN IF lb_flow_found THEN // 15DEC94 added a case where one method metric exists (M - MASS FLOW) lb_ready_to_calculate = TRUE ld_curr_group++ ELSE // can not successfully calculate emission Return( 0 ) END IF END IF IF not lb_ready_to_calculate THEN // 15DEC94 // Save the current gDAT*roup number IF ld_curr_group <> pd_record_group_no[li_metric_loop] THEN ld_curr_group = pd_record_group_no[li_metric_loop] IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Method metric group: " + string(ld_curr_group)) END IF END IF // Determine method metric record type IF ps_item_type[li_metric_loop] = 'E' THEN // Emission Factor record IF li_num_input_materials > 0 THEN FOR li_indeDAT*x = 1 TO li_num_input_materials lst_mass_fraction[li_index].amt = 0 lst_mass_fraction[li_index].found = FALSE li_ret_status = uof_get_spec_profile(& lst_input_material[li_index].code,& ls_profile_code,pi_log_file, & pt_trans_object) lst_mass_fraction[li_index].material_code = & lst_input_material[li_index].code IF li_ret_staDAT*tus = -1 THEN //SQL ERROR return (-1) ELSEIF li_ret_status = 0 THEN // no profile record found // put default values for missing record lst_mass_fraction[li_index].amt = 0 lst_mass_fraction[li_index].found = FALSE CONTINUE ELSE // initialize array cell li_ret_status = uof_get_mass_fractions(& ls_profile_code, ps_pollutantDAT*,& lst_mass_fraction[li_index].amt, pi_log_file, & pt_trans_object) IF li_ret_status = -1 THEN // sql error return (-1) ELSEIF li_ret_status = 0 THEN // no mass fraction record found for this profile code lst_mass_fraction[li_index].amt = 0 lst_mass_fraction[li_index].found = FALSE CONTINUE ELSEIF li_ret_staDAT*tus = 1 THEN // successful lst_mass_fraction[li_index].amt = & lst_mass_fraction[li_index].amt/100.0 lst_mass_fraction[li_index].found = TRUE END IF END IF NEXT // for num_input_materials lb_ready_to_calculate = TRUE ELSE IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " No input flow defined. MUDAT*ST HAVE either " +& "VOL FLOW or MASS FLOW before FRACTION.") END IF END IF // if li_num_input_materials li_metric_loop++ ELSEIF ps_item_type[li_metric_loop] = 'M' THEN // Metric record CHOOSE CASE ps_metric_code[li_metric_loop] CASE 'VOL FLOW' , 'MASS FLOW' // Initialize array cell li_input_ub = li_ub li_ret_status = uof_get_throughput_materials(pd_process_rid,& ps_pollutant, & DAT* ps_metric_code[li_metric_loop], & pd_start_date_time, pd_end_date_time, & lst_input_material[], & li_num_input_materials,& li_input_ub, & pi_log_file, & pt_trans_object) IF li_ret_status = -1 then // SQL error ROLLBACK USING pt_trans_object; Return (-1) ELSEIF liDAT*_ret_status = 0 then // no record found, try next group IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " No input of " + & ps_metric_code[li_metric_loop] + & " to process " + String(pd_process_rid) ) END IF DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP DAT* CONTINUE ELSE // successfully retrieved input material(s) IF li_input_ub > li_ub THEN li_ub = li_input_ub lst_mass_eq[li_ub].throughput_amt = 0 lst_input_material[li_ub].amt = 0 lst_density[li_ub].amt = 0 lst_xfer_eff[li_ub].value_amt = 0 END IF lb_flow_found = TRUE END IF li_metric_loop++ CASE 'DENSITY' IF li_num_input_materials > 0 THEN FOR li_index= 1 TO li_num_inputDAT*_materials li_ret_status = uof_activity_data( & ps_metric_code[li_metric_loop], & lst_input_material[li_index].code, & pd_process_rid, pd_start_date_time, & pd_end_date_time, 'I', & lst_density[li_index].amt, & lst_density[li_index].unit, & 'MASS BALANCE', ps_reference_code,pi_log_file, & pt_trans_object ) lst_denDAT*sity[li_index].material_code = & lst_input_material[li_index].code IF li_ret_status = -1 then // SQL error ROLLBACK USING pt_trans_object; Return (-1) ELSEIF li_ret_status = 0 then // record not found, try next group IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Density not found for "+& DAT* "material code: " + & lst_input_material[li_index].code) END IF // put default values for missing record IF lst_input_material[li_index].metric_code = 'VOL FLOW' THEN lst_density[li_index].amt = -1 ELSE lst_density[li_index].amt = 1 END IF lst_density[li_index].found = FALSE DAT* SetNull(lst_density[li_index].unit) ELSE // Success lst_density[li_index].found = TRUE lb_density_found = TRUE END IF NEXT // for li_num_input_materials END IF li_metric_loop++ CASE 'TRANSFER EFF' IF li_num_input_materials > 0 THEN li_ret_status = uof_pm(ps_pollutant, pt_trans_object,& pi_log_fiDAT*le) IF li_ret_status = -1 THEN // SQL ERROR ROLLBACK USING pt_trans_object; RETURN (-1) ELSEIF li_ret_status = 0 THEN // xfer_eff = 0 FOR li_index = 1 TO li_num_input_materials lst_xfer_eff[li_index].material_code = & lst_input_material[li_index].code lst_xfer_eff[li_index].value_amt = 1 SetNull(lst_xfer_eff[li_index].unit) DAT* lst_xfer_eff[li_index].found = TRUE NEXT ELSE FOR li_index= 1 TO li_num_input_materials li_ret_status = uof_activity_data( & ps_metric_code[li_metric_loop], & lst_input_material[li_index].code, & pd_process_rid, pd_start_date_time, & pd_end_date_time, ls_null_value, & lst_xfer_eff[li_index].valuDAT*e_amt, & lst_xfer_eff[li_index].unit, & 'MASS BALANCE', ps_reference_code,pi_log_file, & pt_trans_object ) lst_xfer_eff[li_index].material_code = & lst_input_material[li_index].code IF li_ret_status = -1 then // SQL error ROLLBACK USING pt_trans_object; Return (-1) ELDAT*SEIF li_ret_status = 0 then // record not found REJ 28FEB96 - check TRAN EFF GRP lst_xfer_eff[li_index].found = uof_choose_group_activities(& pd_process_rid, lst_input_material[li_index].code, & 'TRAN EFF GRP', lst_xfer_eff[li_index].value_amt, & lst_xfer_eff[li_index].unit, pd_start_date_time, & pd_end_date_time, pi_log_file, pt_trans_object) IF lst_xfer_eff[li_index].found = FALSE then // rDAT*ecord not found IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Transfer efficiency not " + & "found. Default = 100%") END IF // put default values for missing record lst_xfer_eff[li_index].value_amt = 1 SetNull(lst_xfer_eff[li_index].unit) ELSE // SuccessfuDAT*l IF lst_xfer_eff[li_index].unit = 'WT/WT' THEN lst_xfer_eff[li_index].value_amt = 1-lst_xfer_eff[li_index].value_amt ELSE lst_xfer_eff[li_index].value_amt = 1-lst_xfer_eff[li_index].value_amt/100.0 END IF lb_transfer_eff_found = TRUE END IF ELSE // Successful // Transfer efficiency term is (1-xfer_eff) // So the value to be multiplied is already calculated DAT* IF lst_xfer_eff[li_index].unit = 'WT/WT' THEN lst_xfer_eff[li_index].value_amt = 1-lst_xfer_eff[li_index].value_amt ELSE lst_xfer_eff[li_index].value_amt = 1-lst_xfer_eff[li_index].value_amt/100.0 END IF lst_xfer_eff[li_index].found = TRUE lb_transfer_eff_found = TRUE END IF NEXT // for li_num_input_materialsDAT* END IF END IF li_metric_loop++ END CHOOSE END IF // if 'E' END IF // calculate the emissions and write them. // IF lb_ready_to_calculate THEN IF ld_curr_group <> pd_record_group_no[li_metric_loop] THEN // calculate the emissions and write to the database FOR li_index = 1 TO li_num_input_materials IF lst_input_material[li_index].metric_code = 'VOL FLOW' THEN // IF lst_density[li_index].amt = -1 THEN DAT* IF NOT lb_density_found THEN // density required. but not found IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Required density not found "+& "for material code: " + & lst_input_material[li_index].code ) FileWrite( pi_log_file, & " Continuing with next possible material") END IDAT*F CONTINUE ELSE // density exits ls_metric_code = 'MASS FLOW' IF IsNull(lst_input_material[li_index].unit) THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " Unit is blank for the density "+& "of material code: " + & lst_input_material[li_index].code ) DAT* FileWrite( pi_log_file, & " Will not convert units") END IF ELSE // see if unit coversion is required // ex. Vol(Gal) * density(LB/FT3) requires // unit conversion ll_length = Len(lst_density[li_index].unit) ll_char_pos = POS(lst_density[li_index].unit, "/") ls_numer_unit = Left(lst_density[li_index].unitDAT*, & ll_char_pos - 1) ls_density_numer_unit = ls_numer_unit ls_denom_unit = Right(lst_density[li_index].unit,& ll_length - ll_char_pos) // ld_act_value is an original input value // ld_act_value is only used to print out to the log ld_act_value = Dec(String(lst_input_material[li_index].amt)) ls_act_unit = lst_input_maDAT*terial[li_index].unit IF lst_input_material[li_index].unit <> & ls_denom_unit THEN li_ret_status = uof_unit_convert(& lst_input_material[li_index].unit,& ls_denom_unit, ld_null_value, & lst_input_material[li_index].amt, 'DOUBLE', & pi_log_file, pt_trans_object) // after conversion, unit should rDAT*eflect the converted // value 13DEC94 MAS lst_input_material[li_index].unit = ls_numer_unit ELSE lst_input_material[li_index].unit = ls_numer_unit END IF pdb_est_emission = lst_input_material[li_index].amt * & lst_density[li_index].amt IF pi_log_file <> -1 AND Dec(wDAT*_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Vol Flow "+& "of material = " + & lst_input_material[li_index].code + " " +& String(Round(ld_act_value,2 )) +" " +& ls_act_unit) // 13DEC94 MAS used to be lst_input_material[].unit FileWrite(pi_log_file, " Density = " + & DAT* String(Round(lst_density[li_index].amt,2)) + " " + & lst_density[li_index].unit) // 13DEC94 MAS unit is added END IF END IF // IsNull() END IF // li_density <> -1 ELSEIF lst_input_material[li_index].metric_code = & 'MASS FLOW' THEN // REJ 26FEB96 Must use w_emiss.is_user_unit, since records are // written to activity table in w_emiss.is_user_unit units DAT* IF lst_input_material[li_index].unit <> w_emiss.is_user_unit THEN li_ret_status = uof_unit_convert(& lst_input_material[li_index].unit,& w_emiss.is_user_unit, ld_null_value, & lst_input_material[li_index].amt, 'DOUBLE', & pi_log_file, pt_trans_object) IF li_ret_status = 1 THEN pdb_est_emission = lst_input_material[li_index].amt DAT* lst_input_material[li_index].unit = w_emiss.is_user_unit ELSE // conversion to w_emiss.is_user_unit unsuccessful // try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP CONTINUE END IF ELSE // input is in w_emiss.is_user_unit pdb_est_emission = lst_input_material[li_index].amt END IF IFDAT* pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Mass Flow "+& "of material = " + & lst_input_material[li_index].code + " " + & String(Round(Dec(String(lst_input_material[li_index].amt)),2)) + " " +& lst_input_material[li_index].unit) END IF END IF IF li_metric_loop <= pi_num_metrics THEN IF lst_xfer_eff[li_index].found THEN DAT* pdb_est_emission = pdb_est_emission * & lst_xfer_eff[li_index].value_amt IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " TRANSFER EFF = "+ " "+ & String(Round(((1-lst_xfer_eff[li_index].value_amt)*100), 2)) + " " +& lst_xfer_eff[li_index].unit) END IF END IF IF lst_mass_fraction[li_index].foundDAT* THEN pdb_est_emission = pdb_est_emission * & lst_mass_fraction[li_index].amt IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Mass fraction = "+" "+ & String(Round(lst_mass_fraction[li_index].amt,2))) END IF ELSE // no mass fraction found IF ps_pollutant <> lst_input_material[li_index].code THEN DAT*  pdb_est_emission = -1 IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Mass fraction not found for " + & ps_pollutant + " - no estimation calculated") END IF END IF END IF END IF IF (pdb_est_emission >= 0) THEN /* and lst_mass_fraction[li_index].found REJ 28FEB96 */ IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THENDAT*  FileWrite(pi_log_file, " ***** Result *****") FileWrite(pi_log_file," Emittant material = " + & ps_pollutant) END IF // ready to write - conver to user prefered unit IF (ls_numer_unit <> "") and & (w_emiss.is_user_unit <> ls_numer_unit) THEN li_ret_status = uof_unit_convert( ls_numer_unit,& w_emiss.is_user_unit, ld_null_value, pdb_est_emission, 'DOUBLEDAT*', pi_log_file,& pt_trans_object) END IF IF li_ret_status <> 1 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " Converting unit to"+& "user selected unit failed ") END IF return (0) END IF // apply default parameters to the emissions 30DEC94 MAS ld_input_creation_date_time = DateTime(Today(DAT*),Now()) IF ld_curr_group < 10 THEN ls_group = "0" + string(ld_curr_group) ELSE ls_group = string(ld_curr_group) END IF ls_priority = string(pi_curr_priority) li_ret_status = uof_default_parameters(pd_process_rid,pdb_est_emission,& ps_pollutant,pd_start_date_time, pd_end_date_time,& pi_log_file,pt_trans_object,ld_input_creation_date_time,ps_reference_code,& DAT* ldb_mass_flow_value,& ldb_downstrmdis_value, ldb_fugitive_discharge,TRUE,'BC') IF li_ret_status <> 1 THEN ROLLBACK USING pt_trans_object; Return(0) END IF // Insert record into rap_activities with emission // estimation information. // no down stream device then it is a discharge IF w_emiss.uo_tl.uof_downstream_process(pd_process_rid, sqlca,& ll_next_process_riDAT*d ) <> 1 then // uof_sql_error( "uof_activity_data()", pi_log_file, pt_trans_object ) IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " Multiple output streams. "+& "Partitioning on output streams NOT supported.") END IF return (-1) END IF IF ll_next_process_rid = 0 THEN ls_numer_unit = ls_density_numer_unit DAT* lb_last_device = TRUE // Add total fugitive emission to downstream discharge value ldb_downstrmdis_value = gd_total_fug_emission + & ldb_downstrmdis_value li_ret_status = & uof_activity_replace(ldb_downstrmdis_value,ld_today,& pd_process_rid, 'DOWNSTRMDIS',& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_objectDAT*,& pi_log_file,'BC',ps_reference_code,& w_emiss.is_user_unit,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN // sql error ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; RETURN (0) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWritDAT*e(pi_log_file, " DOWNSTREAM DISCHARGE EMISSION = " + & STRING(Round(Dec(string(ldb_downstrmdis_value)),4)) + " " + & w_emiss.is_user_unit) IF Dec(w_emiss.em_log_detail.text) < 2 THEN FileWrite( pi_log_file, " from MASS BALANCE method") END IF END IF ls_metric_code = 'DISCHARGE' ELSE // from the conference call, 07DEC94 DAT* // decision was made to have metric of output to be MASS FLOW // for all uncontrolled emissions 13DEC94 ls_numer_unit = ls_density_numer_unit li_ret_status = & uof_activity_replace(ldb_fugitive_discharge,ld_today,& pd_process_rid, 'DOWNSTRMDIS',& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file,'BC',ps_reference_code,& DAT* w_emiss.is_user_unit,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN // sql error ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; RETURN (0) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " DOWNSTREAM DISCHARGE EMISSION = " + & DAT*  STRING(Round(Dec(string(ldb_fugitive_discharge)),4)) + " " + & w_emiss.is_user_unit) IF Dec(w_emiss.em_log_detail.text) < 2 THEN FileWrite( pi_log_file, " from MASS BALANCE method") END IF END IF ls_metric_code = 'MASS FLOW' END IF IF IsNull(ls_numer_unit) OR ls_numer_unit = "" THEN ls_numer_unit = lst_input_material[li_indeDAT*"x].unit END IF li_ret_status = & uof_activity_replace(ldb_mass_flow_value,ld_today,& pd_process_rid, ls_metric_code,& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file,'BC',ps_reference_code,& w_emiss.is_user_unit,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN DAT*$ // sql error ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; RETURN (-1) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " " + ls_metric_code + " EMISSION = " + & STRING(Round(Dec(String(ldb_mass_flow_value)),4)) + " " + & w_emiss.is_user_unit) IF Dec(w_emiss.em_log_detaiDAT*&l.text) < 2 THEN FileWrite( pi_log_file, " from MASS BALANCE method") END IF END IF IF ldb_fugitive_discharge > 0 THEN // keep track of total fugitive discharge gd_total_fug_emission = gd_total_fug_emission + ldb_fugitive_discharge // write a value for either connected stream or discharge stream // metric for fugitive emission is DISCHARGE li_ret_status = uof_activity_replace(ldb_fugDAT*(itive_discharge,ld_today,& pd_process_rid, 'DISCHARGE',& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file, 'BC',& ps_reference_code,& w_emiss.is_user_unit,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN // Error inserting record ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_tDAT**rans_object; Return( 0 ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " FUGITIVE EMISSION = " +& String(Round(Dec(string(ldb_fugitive_discharge)),4)) + " " + & w_emiss.is_user_unit) IF Dec(w_emiss.em_log_detail.text) < 2 THEN FileWrite( pi_log_file, " from MASS BALANCE method") END IF DAT*, END IF END IF // 15FEB95 MAS w_emiss.il_uncontrolled_process_rid = pd_process_rid // Estimation successfully stored in database IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Emission estimation " + & "successful " + & ", Method MASS BALANCE" + + & ", Throughput material " + & DAT*. lst_input_material[li_index].code + & ", Emittant material " + & ps_pollutant + " " + & uof_activity_get_value(pdb_est_emission) + " " + & lst_input_material[li_index].unit, Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file," Estimation successfully " + & DAT*0 "completed using MASS BALANCE method." ) END IF COMMIT USING pt_emiss_object; RETURN (1) ELSE // pdb_est_emission = 0 IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Estimation failed " + & "using MASS BALANCE method." ) // FileWrite(pi_log_file," Emittant material is " + & // pDAT*2s_pollutant) // FileWrite(pi_log_file," Estimated emission = " + & // uof_activity_get_value(pdb_est_emission) + " " + & // lst_input_material[li_index].unit) END IF END IF // pdb_est_emission calculated NEXT // for num_input_materials IF li_num_input_materials = 0 THEN // NO INPUT FOUND IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN DAT*4 FileWrite(pi_log_file, " No input flow defined." ) FileWrite(pi_log_file, " MUST HAVE either VOL FLOW or MASS FLOW" ) END IF ELSE FOR li_index = 1 TO li_num_input_materials lst_density[li_index].found = FALSE lst_xfer_eff[li_index].found = FALSE lst_mass_fraction[li_index].found = FALSE NEXT li_num_input_materials = 0 END IF // Reset control values lb_flow_fouDAT*6nd = FALSE lb_density_found = FALSE lb_transfer_eff_found = FALSE lb_factor_found = FALSE lb_ready_to_calculate = FALSE ELSE // for mass balance method no other item type is supported END IF LOOP // do while true end function public function integer uof_priority_list (string ps_source_code, string ps_device_code, string ps_process_code, string ps_scc_ams_code, string ps_pollutant, integer pi_num_modes, string ps_modes[], ref decimal pd_protocol_riDAT*8d[], ref integer pi_priority_no[], ref string ps_mode_type[], ref string ps_method_code[], ref string ps_throughput_material_code[], ref integer pi_rows_returned, integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_priority_list( STRING ps_source_code, // STRING ps_device_code, // STRING ps_process_code, // STRING ps_scc_ams_code, // STRING ps_pollutant, // DAT*: INTEGER pi_num_modes, // STRING ps_modes[], // DECIMAL VAR pd_protocol_rid[], // DECIMAL VAR pd_priority_no[], // STRING VAR ps_mode_type[], // STRING VAR ps_method_code[], // STRING VAR ps_throughput_material_code[], // INTEGER VAR pi_rows_returned, // INTEGEDAT*<R pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function retrieves the emission calculation methods for // a given process (in priority order). // // Returns: 1 Success // 0 Record not found // -1 SQL Error // // Modification History // Who When What // --- ------- ----------------------------------------------- // PER 16MAY94 Added support for pollutant. // PER 09JUN94 Modified cursor to manually check for pattDAT*>ern // matches on scc/ams code. // PER 16AUG94 Reformatted log file messages. // REJ 30JUN96 Changed protocol table cursor to datawindow to avoid multiple selects of // same rows // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local varDAT*@iables BOOLEAN lb_save_record INTEGER li_pos, li_row DECIMAL ld_rid INTEGER li_priority_no STRING ls_method_code STRING ls_mode_type STRING ls_throughput_material_code STRING ls_source_code STRING ls_device_code STRING ls_process_code STRING ls_emittant_material_code STRING ls_scc_ams_code STRING ls_sub_type INTEGER li_prot_ub = 50 // Declare cursor to retrieve possible calculation protocols // 30JUN96 REJ Change this to datawindow so that retrieve is only performed onceDAT*B //DECLARE priority_list CURSOR FOR // SELECT rid, // priority_no, // method_code, // mode_type, // throughput_material_code, // source_code, // device_code, // process_code, // emittant_material_code, // scc_ams_code, // sub_type // FROM rap_calculation_protocols // WHERE throughput_material_code IS NOT NULL // ORDER BY priority_no // USING pt_trans_object; // REJ 30JUN96 load DAT*Ddatawindow, if it hasn't been loaded yet IF NOT ib_protocol_retrieved THEN this.dw_calc_priority.SetTransObject(pt_trans_object) ii_num_protocols = this.dw_calc_priority.Retrieve() IF ii_num_protocols < 0 THEN // SQL Error uof_sql_error( "uof_priority_list()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) ELSE ib_protocol_retrieved = TRUE END IF END IF // Retrieve possible emission calculation methods for this process // in priorityDAT*F order. pi_rows_returned = 0 //OPEN priority_list; IF ii_num_protocols = 0 THEN // Error-no calculation protocol records found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No calculation protocol " + & "records found", Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " No calculation protocol records" + & " found" ) END IF ROLLBACK USING pt_trans_object; Return( DAT*H0 ) END IF //IF pt_trans_object.sqlcode <> 0 THEN // // Error opening cursor // uof_sql_error( "uof_priority_list()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // CLOSE priority_list; // Return( -1 ) //END IF // Retrieve the first record //FETCH priority_list INTO // :ld_rid, // :ld_priority_no, // :ls_method_code, // :ls_mode_type, // :ls_throughput_material_code, // :ls_source_code, // :ls_device_code, // :ls_process_code, //DAT*J :ls_emittant_material_code, // :ls_scc_ams_code, // :ls_sub_type; //IF pt_trans_object.sqlcode = 100 THEN // // Error-no calculation protocol records found // IF NOT w_emiss.cbx_background.checked THEN // MessageBox( "Emission Estimator", "No calculation protocol " + & // "records found", Exclamation!, OK! ) // END IF // IF pi_log_file <> -1 THEN // FileWrite( pi_log_file, " No calculation protocol records" + & // " found"DAT*L ) // END IF // ROLLBACK USING pt_trans_object; // CLOSE priority_list; // Return( 0 ) //ELSEIF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uof_sql_error( "uof_priority_list()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // CLOSE priority_list; // Return( -1 ) //END IF // Loop through emission calculation protocol records //DO WHILE pt_trans_object.sqlcode = 0 FOR li_row = 1 TO ii_num_protocols ld_rid = this.dw_calc_priority.GetItDAT*NemNumber(li_row,"rid") li_priority_no = this.dw_calc_priority.GetItemNumber(li_row,"priority_no") ls_method_code = this.dw_calc_priority.GetItemString(li_row,"method_code") ls_mode_type = this.dw_calc_priority.GetItemString(li_row,"mode_type") ls_throughput_material_code = this.dw_calc_priority.GetItemString(li_row,"throughput_material_code") ls_source_code = this.dw_calc_priority.GetItemString(li_row,"source_code") ls_device_code = this.dw_calc_priority.GetItemString(li_roDAT*Pw,"device_code") ls_process_code = this.dw_calc_priority.GetItemString(li_row,"process_code") ls_emittant_material_code = this.dw_calc_priority.GetItemString(li_row,"emittant_material_code") ls_scc_ams_code = this.dw_calc_priority.GetItemString(li_row,"scc_ams_code") ls_sub_type = this.dw_calc_priority.GetItemString(li_row,"sub_type") // Determine if this protocol record fits our requirements. // '@' fields in the database signify that any STRING matches. // '%' fieldDAT*Rs in the database signify that any CHARACTER matches. // If ls_sub_type = 'C' then try source/device/process/pollutant // match. If ls_sub_type = 'S' then try scc_ams match. lb_save_record = FALSE IF ls_sub_type = 'S' THEN // Try an exact match on scc_ams_code IF ls_scc_ams_code = ps_scc_ams_code THEN lb_save_record = TRUE // Try a pattern match on scc_ams_code. // First, the string lengths must match ELSEIF Len( ls_scc_ams_code ) = Len( ps_sDAT*Tcc_ams_code ) THEN // Lengths match--loop through characters and try pattern li_pos = 1 DO WHILE li_pos <= Len( ls_scc_ams_code ) IF ( ( Mid( ls_scc_ams_code, li_pos, 1 ) <> & Mid( ps_scc_ams_code, li_pos, 1 ) ) & AND ( Mid( ls_scc_ams_code, li_pos, 1 ) <> '%' ) ) THEN // Characters don't match EXIT ELSE // Keep going li_pos++ DAT*V END IF LOOP IF li_pos > Len( ls_scc_ams_code ) THEN // We have a match for scc or ams code lb_save_record = TRUE END IF END IF ELSEIF ( ( ls_sub_type = 'C' ) & AND ( ( ls_source_code = ps_source_code ) & OR ( ls_source_code = '@' ) ) & AND ( ( ls_device_code = ps_device_code ) & OR ( ls_device_code = '@' ) ) & AND ( ( ls_process_code = ps_process_code ) & DAT*X OR ( ls_process_code = '@' ) ) & AND ( ( ls_emittant_material_code = ps_pollutant ) & OR ( ls_emittant_material_code = '@' ) ) ) THEN // We have a match for source/device/process/pollutant lb_save_record = TRUE END IF // Store the information in the array for passback if marked // for save IF lb_save_record THEN pi_rows_returned++ pd_protocol_rid[pi_rows_returned] = ld_rid pi_priority_no[pi_rows_returned] = liDAT*Z_priority_no ps_method_code[pi_rows_returned] = ls_method_code IF pi_rows_returned = li_prot_ub THEN uof_increment_array_int (pi_priority_no[], li_prot_ub, 100) pd_protocol_rid[li_prot_ub] = 0 ps_method_code[li_prot_ub] = 'END' END IF IF IsNull(ls_mode_type) THEN ps_mode_type[pi_rows_returned] = '@' ELSE ps_mode_type[pi_rows_returned] = ls_mode_type END IF IF IsNull(ls_throughput_material_code) THEN ps_throughput_material_code[pi_rows_returDAT*\ned] = '@' ELSE ps_throughput_material_code[pi_rows_returned] = ls_throughput_material_code END IF // REJ 08APR96 // ps_mode_type[pi_rows_returned] = ls_mode_type // ps_throughput_material_code[pi_rows_returned] = & // ls_throughput_material_code END IF // Retrieve the next record // FETCH priority_list INTO // :ld_rid, // :ld_priority_no, // :ls_method_code, // :ls_mode_type, // DAT*^ :ls_throughput_material_code, // :ls_source_code, // :ls_device_code, // :ls_process_code, // :ls_emittant_material_code, // :ls_scc_ams_code, // :ls_sub_type; // IF pt_trans_object.sqlcode = 100 THEN // // No more records to retrieve // EXIT // ELSEIF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uof_sql_error( "uof_priority_list()", pi_log_file, pt_trans_object ) // ROLLBACK USING pt_trans_object; // CLOSEDAT*` priority_list; // Return( -1 ) // END IF NEXT //LOOP // end priority loop // Close priority list cursor //CLOSE priority_list; IF pi_rows_returned = 0 THEN // No appropriate calculation protocols found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No calculation protocols found" + & " for source: " + ps_source_code + " device: " + & ps_device_code + " process: " + ps_process_code + & DAT*b " pollutant: " + ps_pollutant + " OR scc_ams: " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & "No calculation protocols found for source: " + & ps_source_code ) FileWrite( pi_log_file, & " device: " + & ps_device_code ) FileWrite( pi_log_file, & " DAT*d process: " + & ps_process_code ) FileWrite( pi_log_file, & " pollutant: " + & ps_pollutant ) FileWrite( pi_log_file, & " OR SCC/AMS: " + & ps_scc_ams_code ) END IF ROLLBACK USING pt_trans_object; Return( 0 ) ELSE // Normal return COMMIT USING pt_trans_object; Return( 1 ) END IF // end uof_priDAT*fority_list() end function public subroutine uof_increment_array (ref string ps_array[], long pl_increment);INTEGER li_bound li_bound = UpperBound(ps_array) ps_array[li_bound + pl_increment] = 'End' end subroutine public function integer uof_get_profile_code (string ps_scc_ams_code, ref string ps_profile_code[], ref integer pi_num_profile_codes, ref string ps_gen_spec_thruputs, ref string ps_spec_filter[], decimal pd_source_process, long pl_target_process, ref datetime pd_start_date, ref DAT*hdatetime pd_end_date, integer pi_log_file, ref transaction pt_trans_object);// int function uof_get_profile_code(STRING ps_scc_ams_code // STRING var ps_profile_code[], // INTEGER var pi_num_profile_codes, // INTEGER pi_log_file, // TRANSACTION pt_trans_object) // Return: 1 success // 0 failure // -1 SQL error // // RetriDAT*jeves profile codes for the scc/ams code passed in. // // Modification History // When Who What // ------- --- ------------------------------------------------- // 16AUG94 PER Added error messages. // Added pi_log_file and pt_trans_object. // 12MAR96 REJ Added check for duplicate throughput materials // 31MAY96 REJ Modified check for duplicates to see controls associated with profiles BOOLEAN lb_found STRING ls_sql, ls_throughput[], ls_multiple[], ls_dup_mat[],DAT*l ls_ctl1[], ls_ctl2[], & ls_controlled, ls_cntl_co_type, ls_proc_cd1, ls_proc_cd2, ls_dist_thruputs[10] INTEGER li_i, li_j, li_k, li_cnt, li_multiple[], li_pos, li_length, li_pos_comma, li_count, & li_num, li_ret_status, li_dist_thruputs IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // 11SEP96 - Problem with controlled profile matching REJ SetNull(ls_proc_cd1) SetNull(ls_proc_cd2) pi_num_profile_codes = 0 li_i = UpperBouDAT*nnd(ps_profile_code) ls_throughput[li_i] = 'End' ls_ctl1[li_i] = 'End' ls_ctl2[li_i] = 'End' DECLARE profile_cur DYNAMIC CURSOR FOR SQLSA; ls_sql = "Select DISTINCT rap_scc_ams_speciation_codes.profile_code, throughput_material_code, " +& "control_1_device_code, control_2_device_code " + & "FROM rap_scc_ams_speciation_codes, rap_emission_factors " + & " where rap_scc_ams_speciation_codes.scc_ams_code = " + ps_scc_ams_code + & " AND rap_scc_ams_speciation_codes.profile_code = rap_emDAT*pission_factors.profile_code " + & " AND SUBSTR(throughput_material_code,1) in " + ps_gen_spec_thruputs PREPARE SQLSA FROM :ls_sql USING pt_trans_object; OPEN DYNAMIC profile_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_profile_code()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE profile_cur; Return( -1 ) END IF FETCH profile_cur INTO :ps_profile_code[1], :ls_throughput[1], :ls_ctl1[1], :ls_ctl2[1];DAT*r IF pt_trans_object.sqlcode = 100 THEN // No profile codes found IF( NOT w_emiss.cbx_background.checked ) THEN MessageBox( "Emission Estimator", " No generic profile codes found for" + & " SCC/AMS code: " + ps_scc_ams_code, & Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " No generic profile codes found " + & "to match throughpDAT*tut materials: " + ps_gen_spec_thruputs) END IF ROLLBACK USING pt_trans_object; CLOSE profile_cur; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_get_profile_code()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE profile_cur; Return( -1 ) ELSE pi_num_profile_codes = 1 IF IsNull(ls_ctl1[pi_num_profile_codes]) THEN ls_ctl1[pi_num_profile_codes] = '' END IF IF IsNull(ls_ctl2[pi_num_profileDAT*v_codes]) THEN ls_ctl2[pi_num_profile_codes] = '' END IF ps_spec_filter[1] = "factor_type = 'P' AND " END IF DO WHILE pt_trans_object.sqlcode = 0 FETCH profile_cur INTO :ps_profile_code[pi_num_profile_codes + 1], :ls_throughput[pi_num_profile_codes + 1], :ls_ctl1[pi_num_profile_codes + 1], :ls_ctl2[pi_num_profile_codes + 1]; ps_spec_filter[pi_num_profile_codes + 1] = "factor_type = 'P' AND " IF pt_trans_object.sqlcode = 100 THEN // No more records DAT*x EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL error uof_sql_error( "uof_get_profile_code()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE profile_cur; Return( -1 ) ELSE pi_num_profile_codes++ IF IsNull(ls_ctl1[pi_num_profile_codes]) THEN ls_ctl1[pi_num_profile_codes] = '' END IF IF IsNull(ls_ctl2[pi_num_profile_codes]) THEN ls_ctl2[pi_num_profile_codes] = '' END IF IF pi_num_profile_codes >= DAT*zli_i THEN uof_increment_array(ps_profile_code,50) uof_increment_array(ls_throughput,50) uof_increment_array(ls_ctl1,50) uof_increment_array(ls_ctl2,50) uof_increment_array(ps_spec_filter,50) li_i = UpperBound(ps_profile_code) END IF END IF LOOP // Check for duplicate profile codes for a given throughput // AND control configuration REJ 31MAY96 li_multiple[pi_num_profile_codes] = 0 ls_multiple[pi_num_profile_codes] = 'End' ls_dup_mat[pi_num_profile_codes] = DAT*|'End' FOR li_i = 1 TO pi_num_profile_codes // Initial array of distinct throughput materials for control lookup REJ 25JUL96 lb_found = FALSE FOR li_k = 1 TO li_dist_thruputs IF ls_dist_thruputs[li_k] = ls_throughput[li_i] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN li_dist_thruputs++ ls_dist_thruputs[li_dist_thruputs] = ls_throughput[li_i] END IF // check for duplicate profile codes li_k = li_i + 1 IF li_multiple[li_i] <> 1 THEN lb_founDAT*~d = FALSE FOR li_j = li_k TO pi_num_profile_codes // VOC = TOG for this purpose REJ 12MAR96 // Also remove identical profiles from final list REJ 22JUL96 IF (ls_throughput[li_i] = ls_throughput[li_j] OR & ( (ls_throughput[li_i] = 'TOG' OR ls_throughput[li_i] = 'VOC') AND & (ls_throughput[li_j] = 'TOG' OR ls_throughput[li_j] = 'VOC') ) ) AND & ( (ls_ctl1[li_i] = ls_ctl1[li_j]) OR & (IsNull(ls_ctl1[li_i]) AND IsNull(ls_ctl1[li_j]) ) ) & AND ((ls_ctl2[liDAT*_i] = ls_ctl2[li_j]) OR & (IsNull(ls_ctl2[li_i]) AND IsNull(ls_ctl2[li_j]) ) ) THEN lb_found = TRUE li_multiple[li_i] = 1 li_multiple[li_j] = 1 ELSEIF (ps_profile_code[li_i] = ps_profile_code[li_j]) THEN li_multiple[li_j] = 2 END IF NEXT // Note in log that duplicate profiles were found, and make list of throughput materials // that may not be usable IF lb_found THEN IF ls_ctl1[li_i] = '' AND ls_ctl2[li_i] = '' THEN IF pi_log_file <> -1 ANDDAT* Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file," Multiple generic uncontrolled speciation profiles" +& " found for material " + ls_throughput[li_i]) FileWrite(pi_log_file," and SCC " + ps_scc_ams_code + ". These will not be used.") END IF ELSEIF ls_ctl2[li_i] = '' THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file," Multiple generic controlled speciation profiles" +& " found for mateDAT*rial " + ls_throughput[li_i] + ",") FileWrite(pi_log_file," primary control " + ls_ctl1[li_i] + ",") FileWrite(pi_log_file," and SCC " + ps_scc_ams_code + ". These will not be used.") END IF ELSE IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file," Multiple generic controlled speciation profiles" +& " found for material " + ls_throughput[li_i] + ",") FileWrite(pi_log_file," primary control " + ls_ctl1[lDAT*i_i] + ", secondary control " + ls_ctl2[li_i] + ",") FileWrite(pi_log_file," and SCC " + ps_scc_ams_code + ". These will not be used.") END IF END IF lb_found = FALSE FOR li_k = 1 TO li_count IF ls_multiple[li_k] = ls_throughput[li_i] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN li_count++ ls_multiple[li_count] = ls_throughput[li_i] END IF // Also list controls for duplicate profiles not used END IF DAT*END IF NEXT // Make sure non-usable throughput materials don't have a profile we would like to use! FOR li_i = 1 TO li_count FOR li_j = 1 TO pi_num_profile_codes IF li_multiple[li_j] <> 1 AND ls_multiple[li_i] = ls_throughput[li_j] THEN ls_multiple[li_i] = 'REMOVE' END IF NEXT NEXT FOR li_i = 1 TO li_count IF ls_multiple[li_i] <> 'REMOVE' THEN li_cnt++ ls_dup_mat[li_cnt] = ls_multiple[li_i] END IF NEXT IF li_cnt > 0 THEN FOR li_i = 1 TO li_cnt // Take DAT*material out of ps_gen_spec_thruputs CHOOSE CASE ls_dup_mat[li_i] CASE 'TOG', 'VOC' li_pos = POS(ps_gen_spec_thruputs, "'TOG'") li_pos_comma = POS(ps_gen_spec_thruputs, "','") + 1 IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos) + MID(ps_gen_spec_thruputs, li_pos + 4) ELSEIF li_pos_comma > li_pos THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos - 1) + MID(ps_gen_spec_thruputs, li_pos +DAT* 6) ELSE ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos - 2) + MID(ps_gen_spec_thruputs, li_pos + 5) END IF END IF li_pos = POS(ps_gen_spec_thruputs, "'VOC'") li_pos_comma = POS(ps_gen_spec_thruputs, "','") + 1 IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos) + MID(ps_gen_spec_thruputs, li_pos + 4) ELSEIF li_pos_comma > li_pos THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_DAT*thruputs, li_pos - 1) + MID(ps_gen_spec_thruputs, li_pos + 6) ELSE ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos - 2) + MID(ps_gen_spec_thruputs, li_pos + 5) END IF END IF CASE ELSE li_pos = POS(ps_gen_spec_thruputs, "'" + ls_dup_mat[li_i] + "'") li_pos_comma = POS(ps_gen_spec_thruputs, "','") + 1 li_length = LEN(ls_dup_mat[li_i]) IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, lDAT*i_pos) + MID(ps_gen_spec_thruputs, li_pos + li_length + 1) ELSEIF li_pos_comma > li_pos THEN ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos - 1) + MID(ps_gen_spec_thruputs, li_pos + li_length + 3) ELSE ps_gen_spec_thruputs = LEFT(ps_gen_spec_thruputs, li_pos - 2) + MID(ps_gen_spec_thruputs, li_pos + li_length + 2) END IF END IF END CHOOSE NEXT END IF // Check non-duplicate profiles for control configuration match li_num = 4 STRING ls_temp_sDAT*pec_filter FOR li_j = 1 TO li_dist_thruputs //if ls_controlled <> "uncontrolled" then li_ret_status = uof_calc_ef_set_cont_filter (li_num, pd_source_process, & pl_target_process, ls_dist_thruputs[li_j], pd_start_date, pd_end_date, & ls_cntl_co_type, ls_controlled, ls_temp_spec_filter, & ls_proc_cd1, ls_proc_cd2, pi_log_file, pt_trans_object) //end if IF ls_proc_cd1 = "NOT FOUND" THEN ls_proc_cd1 = '' IF ls_proc_cd2 = "NOT FOUND" THEN ls_proc_cd2 = '' lb_found = FDAT*ALSE // Look for uncontrolled profile, if found, do not use any controlled profiles REJ 13MAR97 FOR li_i = 1 TO pi_num_profile_codes IF ls_ctl1[li_i] = '' AND li_multiple[li_i] <> 1 AND & ls_throughput[li_i] = ls_dist_thruputs[li_j] THEN lb_found = TRUE END IF NEXT FOR li_i = 1 TO pi_num_profile_codes IF li_multiple[li_i] <> 1 AND & ls_throughput[li_i] = ls_dist_thruputs[li_j] AND ls_ctl1[li_i] <> '' THEN IF lb_found THEN // if uncontrolled profile exists forDAT* this throughput li_multiple[li_i] = 2 ELSEIF ls_proc_cd1 <> ls_ctl1[li_i] OR ls_proc_cd2 <> ls_ctl2[li_i] OR & li_ret_status <> 1 THEN li_multiple[li_i] = 2 ELSE // 13MAR97 // lb_found = TRUE ps_spec_filter[li_i] = ls_temp_spec_filter END IF END IF NEXT // This code could tell the estimator not to use unconrolled speciation profiles when // a controlled profile is found. This is not consistent with the current estimator // protocol REJ 02NOV96DAT* // IF lb_found THEN // FOR li_i = 1 TO pi_num_profile_codes // IF ls_throughput[li_i] = ls_dist_thruputs[li_j] AND ls_ctl1[li_i] = '' AND & // ls_ctl2[li_i] = '' THEN // li_multiple[li_i] = 2 // END IF // NEXT // END IF NEXT // And remove profiles not to be used from profile_code list li_count = pi_num_profile_codes pi_num_profile_codes = 0 FOR li_i = 1 TO li_count IF li_multiple[li_i] = 0 THEN pi_num_profile_codes++ IF li_i > pi_num_profile_codes THEN ls_DAT*throughput[pi_num_profile_codes] = ls_throughput[li_i] ps_profile_code[pi_num_profile_codes] = ps_profile_code[li_i] ps_spec_filter[pi_num_profile_codes] = ps_spec_filter[li_i] END IF END IF NEXT //Move profile codes for "additive" profiles to the front of the list //MDY 10/99 string ls_tempThru, ls_tempCode, ls_tempFilter integer li_front = 1 for li_i = 1 to pi_num_profile_codes //if there is a value_type associated with this throughput, then //it is an "additive" specDAT*iate material if f_speciation_value_type(ls_throughput[li_i]) <> "" then //swap data at current index with data at current "front" if li_i > li_front then //grab data at current index ls_tempThru = ls_throughput[li_i] ls_tempCode = ps_profile_code[li_i] ls_tempFilter = ps_spec_filter[li_i] //copy "front" data to current index location ls_throughput[li_i] = ls_throughput[li_front] ps_profile_code[li_i] = ps_profile_code[li_front] ps_spec_filter[li_i] = psDAT*_spec_filter[li_front] //copy temp data to current front location ls_throughput[li_front] = ls_tempThru ps_profile_code[li_front] = ls_tempCode ps_spec_filter[li_front] = ls_tempFilter end if //increment front li_front ++ end if next //set instance variable to indicate first standard (non-additive) profile //MDY 10/99 ii_firstStandardProfile = li_front // Normal program return CLOSE profile_cur; COMMIT USING pt_trans_object; Return( 1 ) // end uDAT*of_get_profile_code() end function public function integer uof_pollutant_list (long pl_process_rid, string ps_scc_ams_code, string ps_material_code, integer pi_log_file, ref string ps_poll_list[], ref string ps_poll_method[], ref integer pi_num_pollutants, ref boolean pb_mass_balance, datetime pd_start_date_time, datetime pd_end_date_time, ref string ps_profile_codes[], ref integer pi_num_profiles, ref string ps_spec_filter[], ref long pl_target_process);// INTEGER uof_pollutant_list( ) // DAT* // Returns: 1 Success *OR* // Input pollutants and/or factors not found. // -1 SQL Error // // Set up an array of pollutants with factors available // // Modification History // When Who What // ------- --- ----------------------------------------------- // 31MAR95 MAS CREATED // 05JUN95 SJS Code is "hard-coded" to work only with TOG and PM profiles - // must be modified to handle the more generic case!!! // 22JUN95 MAS modified to handle the more DAT*generic case // 17JAN95 REJ changed to create select statement based on emission methods selected // 04MAR96 REJ added code to check speciation throughput activity records and to skip // generic profiles that conflict with source-specific speciation // 18MAY98 MDY added union to emission factor select to get county specific emission // factors and updated generic select to get state factors // 22FEB02 MDY added unions to emission factor select to get source specific emission // DAT* factors and state specific emission factors and updated generic select // to no longer get state factors, since they have their own select, now // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables INTEGER li_method_count, li_item, li_count, li_comDAT*ponent_count, li_bc_cnt, li_i, li_j, li_k INTEGER li_jumps, li_in_cnt, li_pos, li_length, li_pos_comma, li_ret_status, li_count_spec, & li_pm_like, li_pm10_like, li_ub_spec_poll, li_ub_input STRING ls_code, ls_profile_code, ls_last_profile_code, ls_spec2, ls_spec_input STRING ls_name, ls_bc_pollutants[], ls_input_pollutants[], ls_comp_pollutants[] STRING ls_speciate_pollutants[], ls_spec_poll_source[], ls_thruput[] BOOLEAN lb_scc_ams_null, lb_emis_factor, lb_speciate, lb_dual_profiles, lDAT*b_found, lb_pm10, & lb_pm10_like, lb_pm, lb_pm_like STRING ls_sql_statement, ls_emis1, ls_spec1, ls_gen_spec_thruputs, ls_spec_thruputs integer li_n string ls_null[] //reset instance array for used speciate pollutants ii_usedSpecThruputs = 0 is_usedSpecThruputs = ls_null // Initialize local variables // uof_pollutant isn't called unless scc_ams_code is not null REJ 17JAN95 lb_scc_ams_null = IsNull(ps_scc_ams_code) // Check methods for emission estimation REJ 17JAN96 FOR liDAT*_method_count = 1 to w_emiss.ii_num_methods IF w_emiss.is_method_types[li_method_count] = 'F' THEN lb_emis_factor = TRUE ELSEIF w_emiss.is_method_types[li_method_count] = 'P' THEN lb_speciate = TRUE ELSEIF w_emiss.is_method_types[li_method_count] = 'BC' THEN pb_mass_balance = TRUE END IF NEXT // Initialize unbounded arrays ls_speciate_pollutants[100] = 'End' ls_spec_poll_source[100] = 'End' li_ub_spec_poll = 100 // Put "emission factor" pollutants first on list IF lb_DAT*emis_factor THEN // Create select for // generic, state, county, source and process specific emission factors ls_sql_statement = "SELECT distinct (emittant_material_code) " +& "FROM rap_emission_factors " +& "WHERE (SUBSTR(factor_type,1) = 'G' " +& "AND scc_ams_code = '" + ps_scc_ams_code + "') UNION " +& "SELECT distinct (emittant_material_code) " +& "FROM rap_emission_factors " +& "WHERE(SUBSTR(factor_type,1) = 'S' " +& "AND process_ridDAT* = " + String(pl_process_rid) + ") UNION " +& "SELECT distinct (emittant_material_code) " +& "FROM rap_emission_factors " + & "WHERE(SUBSTR(factor_type,1) = 'Q' " +& "AND scc_ams_code = '" + ps_scc_ams_code + "' " +& "AND process_rid = " + String(il_curStateRid) + ") UNION " +& "SELECT distinct (emittant_material_code) " +& "FROM rap_emission_factors " + & "WHERE(SUBSTR(factor_type,1) = 'R' " +& "AND scc_ams_code = '" + ps_scc_ams_code + "' " +DAT*& "AND process_rid = " + String(il_curCountyRid) + ") UNION " +& "SELECT distinct (emittant_material_code) " +& "FROM rap_emission_factors " + & "WHERE(SUBSTR(factor_type,1) = 'M' " +& "AND scc_ams_code = '" + ps_scc_ams_code + "' " +& "AND process_rid = " + String(il_curSourceRid) + ") " DECLARE emittant_cur DYNAMIC CURSOR FOR SQLSA; PREPARE SQLSA FROM :ls_sql_statement; OPEN DYNAMIC emittant_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sqlDAT*_error( "uof_pollutant_list() .. Open emittant_cur for emission factor method", & pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; Return( -1 ) END IF // Retrieve first record FETCH emittant_cur INTO :ps_poll_list[1]; IF sqlca.sqlcode = 100 THEN // No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Emission" + & "factors not found for SCC/AMS code: " + & DAT* ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " No emission " + & "factors found for SCC/AMS code: " + ps_scc_ams_code ) END IF ROLLBACK USING sqlca; ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list() .. fetch emittant_cur", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; ReturDAT*n( -1 ) ELSE pi_num_pollutants = 1 ps_poll_method[pi_num_pollutants] = 'E' IF ps_poll_list[pi_num_pollutants] = 'VOC' OR ps_poll_list[pi_num_pollutants] = 'TOG' & OR ps_poll_list[pi_num_pollutants] = 'PM' OR ps_poll_list[pi_num_pollutants] = 'PM10' & OR LEFT(ps_poll_list[pi_num_pollutants],3) = 'PM,' & OR LEFT(ps_poll_list[pi_num_pollutants],5) = 'PM10,' & OR ps_poll_list[pi_num_pollutants] = 'EXHC' & OR ps_poll_list[pi_num_pollutants] = 'EVHC' & OR ps_poll_lisDAT*t[pi_num_pollutants] = 'EXPM' & OR ps_poll_list[pi_num_pollutants] = 'BW10' & OR ps_poll_list[pi_num_pollutants] = 'TW10' THEN li_count++ IF li_count >= li_ub_spec_poll THEN uof_increment_array_str(ls_speciate_pollutants,li_ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_speciate_pollutants[li_count] = ps_poll_list[pi_num_pollutants] ls_spec_poll_source[li_count] = 'E' END IF // Loop through the rest of the pollutant(emission facDAT*tors) DO WHILE sqlca.sqlcode = 0 // Retrieve the next record FETCH emittant_cur INTO :ps_poll_list[ pi_num_pollutants + 1 ]; IF sqlca.sqlcode = 100 THEN // No more records to retrieve EXIT ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; Return( -1 ) ELSE pi_num_pollutants++ IF pi_num_pollutants DAT*>= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_increment_array(ps_poll_method,50) END IF ps_poll_method[pi_num_pollutants] = 'E' IF ps_poll_list[pi_num_pollutants] = 'VOC' OR ps_poll_list[pi_num_pollutants] = 'TOG' & OR ps_poll_list[pi_num_pollutants] = 'PM' OR ps_poll_list[pi_num_pollutants] = 'PM10' & OR LEFT(ps_poll_list[pi_num_pollutants],3) = 'PM,' & OR LEFT(ps_poll_list[pi_num_pollutants],5) = 'PM10,' & OR ps_poll_DAT*list[pi_num_pollutants] = 'EXHC' & OR ps_poll_list[pi_num_pollutants] = 'EVHC' & OR ps_poll_list[pi_num_pollutants] = 'EXPM' & OR ps_poll_list[pi_num_pollutants] = 'BW10' & OR ps_poll_list[pi_num_pollutants] = 'TW10' THEN li_count++ IF li_count >= li_ub_spec_poll THEN uof_increment_array_str(ls_speciate_pollutants, li_ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_speciate_pollutants[li_count] = ps_poll_list[piDAT*_num_pollutants] ls_spec_poll_source[li_count] = 'E' END IF END IF LOOP // end materials loop END IF CLOSE emittant_cur; END IF IF pb_mass_balance OR lb_speciate THEN // look up inflow materials li_in_cnt = 0 ls_input_pollutants[50] = 'End' li_ub_input = 50 DECLARE inflow_cur CURSOR FOR SELECT material_code FROM rap_activities, rap_streams WHERE SUBSTR(metric_code,1) in ('MASS FLOW','VOL FLOW') AND rap_activities.ref_rid = rap_streams.rid DAT* AND rap_streams.to_process_rid = :pl_process_rid AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND SUBSTR(material_code,1) IS NOT NULL AND value_amt IS NOT NULL AND value_unit_code IS NOT NULL AND value_type IS NULL; OPEN inflow_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", & pi_log_file, SQLCA) CLOSE inflow_cur; Return( -1 ) END IF // DAT*retrieve values DO FETCH inflow_cur INTO :ls_input_pollutants[li_in_cnt + 1 ]; lb_found = FALSE FOR li_i = 1 TO li_in_cnt IF ls_input_pollutants[li_in_cnt + 1] = ls_input_pollutants[li_i] THEN lb_found = TRUE END IF NEXT IF NOT lb_found THEN li_in_cnt++ IF li_in_cnt >= li_ub_input THEN uof_increment_array_str(ls_input_pollutants, li_ub_input, 50) END IF IF ls_input_pollutants[li_in_cnt] = 'VOC' OR ls_input_pollutants[li_in_cnt] = 'TOG' &DAT* OR ls_input_pollutants[li_in_cnt] = 'PM' OR ls_input_pollutants[li_in_cnt] = 'PM10' & OR LEFT(ls_input_pollutants[li_in_cnt],3) = 'PM,' & OR LEFT(ls_input_pollutants[li_in_cnt],5) = 'PM10,' & OR ls_input_pollutants[li_in_cnt] = 'EXHC' & OR ls_input_pollutants[li_in_cnt] = 'EVHC' & OR ls_input_pollutants[li_in_cnt] = 'EXPM' & OR ls_input_pollutants[li_in_cnt] = 'BW10' & OR ls_input_pollutants[li_in_cnt] = 'TW10' THEN lb_found = FALSE FOR li_i = 1 TDAT*O li_count IF ls_input_pollutants[li_in_cnt] = ls_speciate_pollutants[li_i] THEN lb_found = TRUE ls_spec_poll_source[li_i] = '' END IF IF (LEFT(ls_input_pollutants[li_in_cnt],3) = 'PM,' AND ls_speciate_pollutants[li_i] = 'PM') OR & (LEFT(ls_input_pollutants[li_in_cnt],5) = 'PM10,' AND ls_speciate_pollutants[li_i] = 'PM10') THEN ls_spec_poll_source[li_i] = '' END IF NEXT IF NOT lb_found THEN li_count++ IF li_count >= li_ub_spDAT*ec_poll THEN uof_increment_array_str(ls_speciate_pollutants, li_ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_speciate_pollutants[li_count] = ls_input_pollutants[li_in_cnt] ls_spec_poll_source[li_count] = '' END IF END IF END IF LOOP WHILE sqlca.sqlcode = 0 li_in_cnt -- IF SQLCA.sqlcode <> 100 THEN // SQL error uof_sql_error( "uof_pollutant_list()", & pi_log_file, SQLCA) CLOSE inflow_cuDAT*r; Return( -1 ) ELSE IF li_in_cnt = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " No input flows found for " + & "speciation or mass balance at process.") END IF CLOSE inflow_cur; IF NOT (lb_emis_factor OR lb_speciate) THEN Return(1) END IF END IF CLOSE inflow_cur; END IF END IF IF lb_speciate THEN // look up output flow materials DECLARE outDAT*flow_cur CURSOR FOR SELECT DISTINCT material_code FROM rap_activities, rap_streams WHERE SUBSTR(metric_code,1) in ('MASS FLOW','DISCHARGE') AND rap_activities.ref_rid = rap_streams.rid AND rap_streams.from_process_rid = :pl_process_rid AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND (SUBSTR(material_code,1) in ('PM','PM10','TOG','VOC','EXHC','EVHC','EXPM','BW10','TW10') OR SUBSTR(material_code,1,3) = 'PM,' OR SUBSTR(mateDAT*rial_code,1,5) = 'PM10,') AND value_amt IS NOT NULL AND value_unit_code IS NOT NULL AND value_type IS NULL; OPEN outflow_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, SQLCA) CLOSE outflow_cur; Return( -1 ) END IF // retrieve values DO FETCH outflow_cur INTO :ls_speciate_pollutants[li_count + 1 ]; lb_found = FALSE FOR li_i = 1 TO li_count IF ls_speciate_pollutants[li_count +DAT* 1] = ls_speciate_pollutants[li_i] THEN lb_found = TRUE ls_spec_poll_source[li_i] = '' END IF IF (LEFT(ls_speciate_pollutants[li_count + 1],3) = 'PM,' AND ls_speciate_pollutants[li_i] = 'PM') OR & (LEFT(ls_speciate_pollutants[li_count + 1],5) = 'PM10,' AND ls_speciate_pollutants[li_i] = 'PM10') THEN ls_spec_poll_source[li_i] = '' END IF NEXT IF NOT lb_found THEN li_count++ IF li_count >= li_ub_spec_poll THEN uof_increment_array_str(ls_speciate_poDAT*llutants, li_ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_spec_poll_source[li_count] = '' END IF LOOP WHILE sqlca.sqlcode = 0 IF SQLCA.sqlcode <> 100 THEN // SQL error uof_sql_error( "uof_pollutant_list()", & pi_log_file, SQLCA) CLOSE outflow_cur; Return( -1 ) ELSE IF li_count = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " No input or outDAT*put flows found for " + & "speciation at process.") END IF CLOSE outflow_cur; IF NOT (lb_emis_factor or pb_mass_balance) THEN Return(1) END IF END IF CLOSE outflow_cur; END IF // REJ 14MAY96 - Check for PM and PM10 materials that can use PM/PM10 profiles lb_found = FALSE FOR li_i = 1 TO li_count IF ls_speciate_pollutants[li_i] = 'PM' THEN lb_pm = TRUE END IF IF LEFT(ls_speciate_pollutants[li_i],3) = 'PM,' THEN DAT* lb_pm_like = TRUE IF ls_spec_poll_source[li_i] = 'E' THEN li_pm_like = li_i ELSE li_pm_like = 0 END IF END IF IF ls_speciate_pollutants[li_i] = 'PM10' THEN lb_pm10 = TRUE END IF IF LEFT(ls_speciate_pollutants[li_i],5) = 'PM10,' THEN lb_pm10_like = TRUE IF ls_spec_poll_source[li_i] = 'E' THEN li_pm10_like = li_i ELSE li_pm10_like = 0 END IF END IF NEXT IF NOT lb_pm AND lb_pm_like THEN li_count++ IF li_count >= li_ubDAT*_spec_poll THEN uof_increment_array_str(ls_speciate_pollutants, li_ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_speciate_pollutants[li_count] = 'PM' IF li_pm_like > 0 THEN ls_spec_poll_source[li_count] = ls_speciate_pollutants[li_pm_like] ELSE ls_spec_poll_source[li_count] = '' END IF END IF IF NOT lb_pm10 AND lb_pm10_like THEN li_count++ IF li_count >= li_ub_spec_poll THEN uof_increment_array_str(ls_speciate_pollutants, li_DAT*ub_spec_poll, 50) ls_spec_poll_source[li_ub_spec_poll] = 'End' END IF ls_speciate_pollutants[li_count] = 'PM10' IF li_pm10_like > 0 THEN ls_spec_poll_source[li_count] = ls_speciate_pollutants[li_pm10_like] ELSE ls_spec_poll_source[li_count] = '' END IF END IF // Note available throughput materials for speciation profiles IF li_count > 0 THEN ls_spec_input = " AND (factor_type = 'S' OR throughput_material_code in ('" ls_spec2 = "('" FOR li_i = 1 TO li_cDAT*ount IF li_i = li_count THEN ls_spec2 = ls_spec2 + ls_speciate_pollutants[li_i] + "')" ls_spec_input = ls_spec_input + ls_speciate_pollutants[li_i] + "'))" ELSE ls_spec2 = ls_spec2 + ls_speciate_pollutants[li_i] + "','" ls_spec_input = ls_spec_input + ls_speciate_pollutants[li_i] + "','" END IF NEXT ELSE lb_speciate = FALSE // speciation selects are not used without input or // output flows, or emission factor estimates END IF END IF // SpeciaDAT*tion Outflows IF lb_speciate THEN // throughputs are available ls_thruput[20] = 'End' DECLARE specific_spec_cur CURSOR FOR SELECT DISTINCT throughput_material_code FROM rap_emission_factors WHERE process_rid = :pl_process_rid AND (SUBSTR(factor_type,1) = 'F') AND (SUBSTR(throughput_material_code,1) in ('VOC','TOG','PM','PM10','EXHC','EVHC','EXPM','BW10','TW10') OR SUBSTR(throughput_material_code,1,3) = 'PM,' OR SUBSTR(throughput_material_code,1,5) = 'PM10,')DAT*; OPEN specific_spec_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, SQLCA) CLOSE specific_spec_cur; Return( -1 ) END IF // retrieve values li_count_spec = 0 DO FETCH specific_spec_cur INTO :ls_thruput[li_count_spec + 1]; li_count_spec++ IF li_count_spec >= UpperBound(ls_thruput) THEN uof_increment_array(ls_thruput,20) END IF LOOP WHILE sqlca.sqlcode = 0 IF sqlca.sqlcode <> 100 THEN DAT* uof_sql_error( "uof_pollutant_list()", pi_log_file, sqlca ) CLOSE specific_spec_cur; ROLLBACK USING sqlca; Return( -1 ) END IF CLOSE specific_spec_cur; li_count_spec -- ls_gen_spec_thruputs = ls_spec2 FOR li_i = 1 TO li_count_spec // Limit Generic Factors to throughputs not described by specific factors // TOG = VOC in this respect IF li_i = li_count_spec THEN ls_spec_thruputs = ls_spec_thruputs + " " + ls_thruput[li_i] ELSE ls_spec_thruputs = DAT*ls_spec_thruputs + " " + ls_thruput[li_i] + "," END IF CHOOSE CASE ls_thruput[li_i] CASE 'TOG', 'VOC' li_pos = POS(ls_gen_spec_thruputs, "'TOG'") li_pos_comma = POS(ls_gen_spec_thruputs, "','") + 1 IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos) + MID(ls_gen_spec_thruputs, li_pos + 4) ELSEIF li_pos_comma > li_pos THEN ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos - 1) + MID(ls_gen_DAT*spec_thruputs, li_pos + 6) ELSE ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos - 2) + MID(ls_gen_spec_thruputs, li_pos + 5) END IF END IF li_pos = POS(ls_gen_spec_thruputs, "'VOC'") li_pos_comma = POS(ls_gen_spec_thruputs, "','") + 1 IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos) + MID(ls_gen_spec_thruputs, li_pos + 4) ELSEIF li_pos_comma > li_pos THEN ls_gen_spec_thrupDAT*uts = LEFT(ls_gen_spec_thruputs, li_pos - 1) + MID(ls_gen_spec_thruputs, li_pos + 6) ELSE ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos - 2) + MID(ls_gen_spec_thruputs, li_pos + 5) END IF END IF CASE ELSE li_pos = POS(ls_gen_spec_thruputs, "'" + ls_thruput[li_i] + "'") li_pos_comma = POS(ls_gen_spec_thruputs, "','") + 1 li_length = LEN(ls_thruput[li_i]) IF li_pos > 0 THEN IF li_pos_comma = 1 THEN ls_gen_spec_thruputs = LEFT(DAT*ls_gen_spec_thruputs, li_pos) + MID(ls_gen_spec_thruputs, li_pos + li_length + 1) ELSEIF li_pos_comma > li_pos THEN ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos - 1) + MID(ls_gen_spec_thruputs, li_pos + li_length + 3) ELSE ls_gen_spec_thruputs = LEFT(ls_gen_spec_thruputs, li_pos - 2) + MID(ls_gen_spec_thruputs, li_pos + li_length + 2) END IF END IF END CHOOSE NEXT IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN IF li_coDAT*unt_spec > 1 THEN FileWrite(pi_log_file, " Source Specific Profiles found for throughputs: " + & ls_spec_thruputs) ELSEIF li_count_spec = 1 THEN FileWrite(pi_log_file, " Source Specific Profile found for throughput: " + & ls_spec_thruputs) ELSE FileWrite(pi_log_file, " Source Specific Profile not found.") END IF END IF // Retrieve Generic factors and check for duplicate profiles for a single throughput // UNLESS there are NO throughput materials aDAT*vailable that don't have a source specific // profile REJ 04AUG96 IF ls_gen_spec_thruputs = "()" THEN li_ret_status = 1 pi_num_profiles = 0 ELSE li_ret_status = uof_get_profile_code (ps_scc_ams_code, ps_profile_codes[], & pi_num_profiles, ls_gen_spec_thruputs, ps_spec_filter[], pl_process_rid, & pl_target_process, pd_start_date_time, pd_end_date_time, pi_log_file, SQLCA) END IF IF li_ret_status = -1 THEN RETURN (-1) // If source specific profile only ELSEIF pi_DAT*num_profiles = 0 AND li_count_spec > 0 THEN pi_num_profiles = 1 SetNull(ps_profile_codes[1]) END IF IF pi_num_profiles = 0 THEN // no applicable speciation profiles lb_speciate = FALSE END IF END IF // IF lb_speciate // IF speciation profiles are present for thruputs and emission factors, then add // speciation pollutants IF lb_speciate THEN IF lb_emis_factor THEN // Create speciation select // generic speciation factors ls_spec1 = " SELECT distinct emittantDAT*_material_code, throughput_material_code" + & " FROM rap_emission_factors, rap_scc_ams_speciation_codes" + & " WHERE SUBSTR(factor_type,1) = 'P'" + & " AND rap_emission_factors.profile_code = " + & " rap_scc_ams_speciation_codes.profile_code " + & " AND rap_scc_ams_speciation_codes.scc_ams_code = '" + ps_scc_ams_code + "'" + & " AND SUBSTR(throughput_material_code,1) in " + ls_gen_spec_thruputs // Add source specific profiles to be used ls_sqlDAT*_statement = ls_spec1 + " UNION " + & " SELECT distinct emittant_material_code, throughput_material_code FROM rap_emission_factors " + & "WHERE SUBSTR(factor_type,1) = 'F' " + " AND SUBSTR(throughput_material_code,1) in " + ls_spec2 + & " AND process_rid = " + String(pl_process_rid) ELSE // Create speciation select // generic speciation factors ls_spec1 = " SELECT distinct (emittant_material_code)" + & " FROM rap_emission_factors, rap_scc_ams_speciation_codesDAT*" + & " WHERE SUBSTR(factor_type,1) = 'P'" + & " AND rap_emission_factors.profile_code = " + & " rap_scc_ams_speciation_codes.profile_code " + & " AND rap_scc_ams_speciation_codes.scc_ams_code = '" + ps_scc_ams_code + "'" + & " AND SUBSTR(throughput_material_code,1) in " + ls_gen_spec_thruputs // Add source specific profiles to be used ls_sql_statement = ls_spec1 + " UNION " + & " SELECT distinct (emittant_material_code) FROM rap_emission_factors "DAT* + & "WHERE SUBSTR(factor_type,1) = 'F' " + " AND SUBSTR(throughput_material_code,1) in " + ls_spec2 + & " AND process_rid = " + String(pl_process_rid) END IF PREPARE SQLSA FROM :ls_sql_statement; OPEN DYNAMIC emittant_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; Return( -1 ) END IF // Retrieve first record IF lb_emis_factor THEN FETCH emittanDAT*t_cur INTO :ps_poll_list[pi_num_pollutants + 1], :ls_spec_thruputs; ELSE FETCH emittant_cur INTO :ps_poll_list[1]; END IF IF sqlca.sqlcode = 100 THEN //No default materials found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Inputs and/or " + & "factors not found for SCC/AMS code: " + & ps_scc_ams_code, Exclamation!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_dDAT* etail.text) > 2 THEN FileWrite( pi_log_file, " Input flows and/or " + & "speciation factors not found for SCC/AMS code: " + ps_scc_ams_code ) END IF ROLLBACK USING sqlca; ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; Return( -1 ) ELSE IF lb_emis_factor THEN lb_found = FALSE FOR li_k = 1 TO pi_num_pollutants IF ps_polDAT* l_list[pi_num_pollutants + 1] = ps_poll_list[li_k] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN pi_num_pollutants++ IF pi_num_pollutants >= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_increment_array(ps_poll_method,50) END IF li_k = pi_num_pollutants END IF FOR li_i = 1 TO li_count IF ls_speciate_pollutants[li_i] = ls_spec_thruputs THEN IF ls_spec_poll_source[li_i] = 'E'DAT*  THEN ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_thruputs + "," ELSEIF ls_spec_poll_source[li_i] = '' THEN ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_thruputs + "," ELSE ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_poll_source[li_i] + "," END IF //add speciation throughput to used list for li_n = 1 to ii_usedSpecThruputs if is_usedSpecThruputs[li_n] = ls_spec_thruputs then exit DAT*  next if li_n > ii_usedSpecThruputs then ii_usedSpecThruputs ++ is_usedSpecThruputs[ii_usedSpecThruputs] = ls_spec_thruputs end if EXIT END IF NEXT ELSE pi_num_pollutants = 1 ps_poll_method[1] = 'S' END IF // Loop through the rest of the pollutant(emission factors) DO WHILE sqlca.sqlcode = 0 // Retrieve the next record IF lb_emis_factor THEN FETCH emittant_cur INTO :ps_poll_list[pi_num_pollutaDAT* nts + 1], :ls_spec_thruputs; ELSE FETCH emittant_cur INTO :ps_poll_list[pi_num_pollutants + 1]; END IF IF sqlca.sqlcode = 100 THEN // No more records to retrieve EXIT ELSEIF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, sqlca ) ROLLBACK USING sqlca; CLOSE emittant_cur; Return( -1 ) ELSE IF lb_emis_factor THEN lb_found = FALSE FOR li_k = 1 TO pDAT* i_num_pollutants IF ps_poll_list[pi_num_pollutants + 1] = ps_poll_list[li_k] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN pi_num_pollutants++ IF pi_num_pollutants >= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_increment_array(ps_poll_method,50) END IF li_k = pi_num_pollutants END IF FOR li_i = 1 TO li_count IF ls_speciate_pollutants[li_i] = ls_specDAT* _thruputs THEN IF ls_spec_poll_source[li_i] = 'E' THEN ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_thruputs + "," ELSEIF ls_spec_poll_source[li_i] = '' THEN ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_thruputs + "," ELSE ps_poll_method[li_k] = ps_poll_method[li_k] + 'S,' + ls_spec_poll_source[li_i] + "," END IF //add speciation throughput to used list for li_n = 1 to ii_usedSpecThrDAT* uputs if is_usedSpecThruputs[li_n] = ls_spec_thruputs then exit next if li_n > ii_usedSpecThruputs then ii_usedSpecThruputs ++ is_usedSpecThruputs[ii_usedSpecThruputs] = ls_spec_thruputs end if EXIT END IF NEXT ELSE pi_num_pollutants++ IF pi_num_pollutants >= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_increment_array(ps_poll_method,50) END IF ps_DAT* poll_method[pi_num_pollutants] = 'S' END IF END IF LOOP // end materials loop END IF CLOSE emittant_cur; END IF IF pb_mass_balance THEN // look up product profiles ls_bc_pollutants[50] = 'End' ls_comp_pollutants[50] = 'End' DECLARE split_cur DYNAMIC CURSOR FOR SQLSA; FOR li_i = 1 TO li_in_cnt ls_sql_statement = "SELECT rap_speciation_split_factors.material_code, " + & "rap_speciation_profiles.code " + & " FROM rap_speciation_profiles, rap_speciatiDAT* on_split_factors " + & " WHERE rap_speciation_profiles.material_code = '" + ls_input_pollutants[li_i] + "'" + & " AND rap_speciation_split_factors.profile_code = rap_speciation_profiles.code" + & " AND rap_speciation_profiles.profile_type = 'P'" PREPARE SQLSA FROM :ls_sql_statement; OPEN DYNAMIC split_cur; IF sqlca.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uof_pollutant_list()", pi_log_file, SQLCA) CLOSE split_cur; Return( -1 ) END IF DAT*  // retrieve values li_component_count = 0 lb_dual_profiles = FALSE DO IF li_component_count = 0 THEN FETCH split_cur INTO :ls_comp_pollutants[li_component_count + 1], & :ls_profile_code; ls_last_profile_code = ls_profile_code ELSE FETCH split_cur INTO :ls_comp_pollutants[li_component_count + 1], & :ls_last_profile_code; END IF IF SQLCA.sqlcode = 0 AND ls_last_profile_code <> ls_profile_code THEN lb_dual_profiles = TRUE EXIT END IFDAT*  li_component_count++ IF li_component_count >= UpperBound(ls_comp_pollutants) THEN uof_increment_array(ls_comp_pollutants,50) END IF LOOP WHILE sqlca.sqlcode = 0 IF SQLCA.sqlcode <> 100 THEN // SQL error uof_sql_error( "uof_pollutant_list()", pi_log_file, SQLCA) CLOSE split_cur; Return( -1 ) END IF CLOSE split_cur; IF lb_dual_profiles THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite(pi_log_file, " DAT*  Mass Balance: More than one product profile" + & " available for " + ls_input_pollutants[li_i]) CONTINUE END IF END IF li_component_count -- IF li_component_count = 0 THEN // material has no components, pass through li_bc_cnt++ IF li_bc_cnt >= UpperBound(ls_bc_pollutants) THEN uof_increment_array(ls_bc_pollutants,50) END IF ls_bc_pollutants[li_bc_cnt] = ls_input_pollutants[li_i] CLOSE split_cur; ELSE // material has components FOR DAT* li_j = 1 TO li_component_count li_bc_cnt++ IF li_bc_cnt >= UpperBound(ls_bc_pollutants) THEN uof_increment_array(ls_bc_pollutants,50) END IF ls_bc_pollutants[li_bc_cnt] = ls_comp_pollutants[li_j] NEXT // component material END IF NEXT // inflow material // eliminate duplicate materials in mass balance list, // and combine with factor produced list li_component_count = li_bc_cnt li_jumps = 0 FOR li_i = 1 TO li_component_count lb_found = FALSE DAT*  FOR li_j = 1 TO (li_i - 1) IF ls_bc_pollutants[li_i] = ls_bc_pollutants[li_j] THEN lb_found = TRUE li_bc_cnt -- EXIT END IF NEXT IF NOT lb_found THEN IF lb_speciate OR lb_emis_factor THEN FOR li_k = 1 TO pi_num_pollutants IF ls_bc_pollutants[li_i] = ps_poll_list[li_k] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN // If this pollutant doesn't match any others on the list pi_num_pollutants++ IF pDAT* i_num_pollutants >= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_increment_array(ps_poll_method,50) END IF ps_poll_list[pi_num_pollutants] = ls_bc_pollutants[li_i] li_k = pi_num_pollutants END IF ps_poll_method[li_k] = 'B' + ps_poll_method[li_k] ELSE // Mass Balance only method selected pi_num_pollutants++ IF pi_num_pollutants >= UpperBound(ps_poll_list) THEN uof_increment_array(ps_poll_list,50) uof_DAT* increment_array(ps_poll_method,50) END IF ps_poll_list[pi_num_pollutants] = ls_bc_pollutants[li_i] ps_poll_method[pi_num_pollutants] = 'B' END IF END IF NEXT END IF // Mass Balance only Return (1) end function public function integer uof_build_poll_list (decimal pd_process_rid, ref string ps_pollutants[], ref integer pi_num_pollutants, string ps_scc_ams_code, ref string ps_poll_method[], string ps_material_code, ref datetime pd_start_date_time, ref datetime pd_endDAT*" _date_time, integer pi_log_file, ref string ps_profile_codes[], ref integer pi_num_profiles, ref string ps_spec_filter[], ref long pl_target_process);// uof_build_poll_list // // code was taken from uof_emissions_main, and expanded to fill out array with 'F' if // a pollutant the user has asked for has no factors for the methods requested for this // process. // // // BOOLEAN lb_found, lb_mass_balance INTEGER li_ret_status, li_i, li_j STRING ls_factor_pollutants[] // user identified DAT*$ pollutants with factors STRING ls_factor_methods[], ls_gen_spec_thruputs STRING ls_holder, ls_hold2 // temporary string variables INTEGER li_num_factor_pollutants // counter for the array INTEGER li_possible_calc // Check if any possible calcs before going on IF pi_num_pollutants = 0 THEN IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_material.text = "Building Emittant List . . . " END IF // Try emission_factors table first (or input flows if mass balance is choseDAT*& n) li_ret_status = uof_pollutant_list(pd_process_rid,ps_scc_ams_code,& ps_material_code,pi_log_file,ps_pollutants[], ps_poll_method[], pi_num_pollutants, lb_mass_balance, & pd_start_date_time, pd_end_date_time, ps_profile_codes[], pi_num_profiles, & ps_spec_filter[], pl_target_process) IF li_ret_status = -1 THEN Return(-1) ELSE IF pi_num_pollutants = 0 THEN // if pi_num_pollutants = 0 THEN NO pollutants can be calculated! REJ 01MAR96 // li_ret_status = uof_uncont_poll_listDAT*( (pi_num_pollutants, & // ps_pollutants[], ps_scc_ams_code, pi_log_file, sqlca) // IF li_ret_status <> 1 THEN Return (0) // END IF END IF END IF ELSE // if user selected pollutants, identify those without factors with an 'F' in // the "estimation failure array" IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_material.text = "Screening Emittant List . . . " END IF // REJ 17JUl96 - Screening pollutant list seems to be a good ideaDAT** , even if only // one pollutant is chosen, based on test run of Wisconsin's Adams county // area sources (PCBS only). If emission estimation algorithm is improved, // this could change. // IF pi_num_pollutants > 2 THEN // identify pollutants with factors ls_factor_pollutants[100] = 'End' ls_factor_methods[100] = 'End' // Try emission_factors table first (or input flows if mass balance is chosen) li_ret_status = uof_pollutant_list(pd_process_rid,ps_scc_ams_code,& ps_materiDAT*, al_code,pi_log_file,ls_factor_pollutants[], ls_factor_methods[], li_num_factor_pollutants, & lb_mass_balance, pd_start_date_time, pd_end_date_time, ps_profile_codes[], & pi_num_profiles, ps_spec_filter[], pl_target_process) IF li_ret_status = -1 THEN Return(-1) ELSEIF li_num_factor_pollutants = 0 THEN Return (0) // if pi_num_pollutants = 0 THEN NO pollutants can be calculated! REJ 01MAR96 // li_ret_status = uof_uncont_poll_list(li_num_factor_pollutants, & //DAT*.  ls_factor_pollutants[], ps_scc_ams_code, pi_log_file, sqlca) // IF li_ret_status <> 1 THEN // Return (0) // END IF END IF FOR li_i = 1 TO pi_num_pollutants lb_found = FALSE FOR li_j = 1 TO li_num_factor_pollutants IF ls_factor_pollutants[li_j] = ps_pollutants[li_i] THEN lb_found = TRUE EXIT END IF NEXT IF NOT lb_found THEN ps_poll_method[li_i] = 'M' ELSE li_possible_calc++ ps_poll_method[li_i] = ls_factor_methodsDAT*0 [li_j] END IF NEXT IF li_possible_calc = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " Either factors or activity data are missing for " + & "all chosen pollutants ") END IF RETURN 0 END IF // ELSE // FOR li_i = 1 to w_emiss.ii_num_methods // IF w_emiss.is_method_types[li_i] = 'P' THEN // ls_gen_spec_thruputs = "('PM','PM10','VOC','TOG')" // li_ret_status = uof_get_profile_code (ps_sDAT*2 cc_ams_code, ps_profile_codes[], pi_num_profiles, & // ls_gen_spec_thruputs, pi_log_file, SQLCA) // IF li_ret_status = -1 THEN // RETURN (-1) // // If source specific profile only // ELSEIF pi_num_profiles = 0 THEN // pi_num_profiles = 1 // SetNull(ps_profile_codes[1]) // END IF // END IF // NEXT // // END IF // if pi_num_pollutants > 2 END IF // if pi_num_pollutants = 0 //moves speciate pollutants to the front of the list FOR li_i = 1 TO pi_num_pDAT*4 ollutants IF ps_pollutants[li_i] = 'VOC' OR ps_pollutants[li_i] = 'TOG' & OR ps_pollutants[li_i] = 'PM' OR ps_pollutants[li_i] = 'PM10' & OR LEFT(ps_pollutants[li_i],3) = 'PM,' & OR LEFT(ps_pollutants[li_i],5) = 'PM10,' & OR ps_pollutants[li_i] = 'EXHC' & OR ps_pollutants[li_i] = 'EVHC' & OR ps_pollutants[li_i] = 'EXPM' & OR ps_pollutants[li_i] = 'BW10' & OR ps_pollutants[li_i] = 'TW10' THEN ls_holder = ps_pollutants[li_i] ls_hold2 = ps_poll_method[li_i] FOR li_DAT*6 j = 1 TO (li_i - 1) ps_pollutants[li_i + 1 - li_j] = ps_pollutants[li_i - li_j] ps_poll_method[li_i + 1 - li_j] = ps_poll_method[li_i - li_j] NEXT ps_pollutants[1] = ls_holder ps_poll_method[1] = ls_hold2 END IF NEXT Return 1 end function public subroutine uof_increment_array_int (ref integer pi_array[], ref integer pi_ub, integer pi_increment);pi_ub = pi_ub + pi_increment pi_array[pi_ub] = 0 RETURN end subroutine public function integer uof_get_throughput_materialDAT*8 s (decimal pd_process_rid, string ps_pollutant, string ps_metric_code, datetime pd_start_date_time, datetime pd_end_date_time, ref uost_input_material pst_input_material[], ref integer pi_count, ref integer pi_ub, integer pi_log_file, transaction pt_trans_object);// int function uof_get_throughput_materials // (DECIMAL pd_process_rid // STRING ps_pollutant // STRING DAT*: ps_metric_code // DATETIME pd_start_date_time // DATETIME pd_end_date_time // UOST_INPUT_MATERIAL pst_input_material[], // INTEGER pi_count, // INTEGER pi_log_file, // TRANSACTION pt_trans_object) // // Return: 1 Success // 0DAT*<  Failure // -1 SQL error // // Modification History // When Who What // ------- --- -------------------------------------------------- // 16AUG94 PER Added error messages. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variable(s) INTEGER li_index DECLARE mat_cur CURSOR FOR SELECT material_code, value_amt, value_unit_code, metric_code FROM raDAT*> p_activities, rap_streams WHERE SUBSTR(metric_code,1) = :ps_metric_code AND rap_activities.ref_rid = rap_streams.rid AND rap_streams.to_process_rid = :pd_process_rid AND start_date_time = :pd_start_date_time AND end_date_time = :pd_end_date_time AND SUBSTR(material_code,1) IS NOT NULL AND value_amt IS NOT NULL AND value_unit_code IS NOT NULL USING pt_trans_object; OPEN mat_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uof_sql_error( "uDAT*@ of_get_throughput_materials()", & pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) END IF li_index = 0 // retrieve values DO FETCH mat_cur INTO :pst_input_material[li_index+1].code, :pst_input_material[li_index+1].amt, :pst_input_material[li_index+1].unit, :pst_input_material[li_index+1].metric_code; li_index++ IF li_index >= pi_ub THEN pst_input_material[pi_ub + 100].DAT*B amt = 0 pi_ub = pi_ub + 100 END IF LOOP WHILE pt_trans_object.sqlcode = 0 pi_count = li_index - 1 IF pt_trans_object.sqlcode <> 100 THEN // SQL error uof_sql_error( "uof_get_throughput_materials()", & pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; CLOSE mat_cur; Return( -1 ) ELSE IF pi_count = 0 THEN // No records found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", & DAT*D  "No activity record found for" + & " Metric: " + ps_metric_code + & " Process: " + String( pd_process_rid ) + & " Start date: " + String( pd_start_date_time, & "mmm d, yyyy h:mm:ss AM/PM" ) + & " End date: " + String( pd_end_date_time, & "mmm d, yyyy h:mm:ss AM/PM" ), & Information!, OK! ) END IF IF pi_log_fiDAT*F le <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, & " No activity record found for metric: " + & ps_metric_code ) FileWrite( pi_log_file, & " start date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) + & " end date: " + & String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) END IF ROLLDAT*H BACK USING pt_trans_object; CLOSE mat_cur; Return( 0 ) ELSE // At least one record found COMMIT USING pt_trans_object; CLOSE mat_cur; Return( 1 ) END IF END IF // end uof_get_throughput_materials() end function public subroutine uof_increment_array_dec (ref decimal pd_array[], ref integer pi_ub, integer pi_increment);pi_ub = pi_ub + pi_increment pd_array[pi_ub] = 0 RETURN end subroutine public subroutine uof_increment_array_str (ref sDAT*J tring ps_array[], ref integer pi_ub, integer pi_increment);pi_ub = pi_ub + pi_increment ps_array[pi_ub] = 'End' RETURN end subroutine public function integer uof_get_input_activity_value (decimal pd_process_rid, string ps_pollutant, string ps_reference_code, datetime pd_start_date_time, datetime pd_end_date_time, ref double pdb_input_values, ref string ps_input_units, ref integer pi_num_inputs, ref datetime pd_creation_date_time, integer pi_log_file, ref transaction pt_trans_obj, ref string DAT*L ps_method_type, ref string ps_data_code);// int function uof_get_input_activity_value(DECIMAL pd_process_rid, // STRING ps_metric_code, // STRING ps_pollutant, // STRING ps_reference_code, // DATETIME pd_start_date_time, // DATETIME pd_end_date_time, // DAT*N  DOUBLE pdb_input_values[], // STRING ps_input_units[], // INTEGER pi_num_inputs, // INTEGER pi_log_file, // TRANSACTION pt_trans_obj) // // Return: 1 Success // 0 Failure (No records found) // -1 SQL error // // // Retrieves the input activity valueDAT*P  to a process. // If multiple input streams, then assume that the values are the same. // // Modification History // When Who What // ------- --- ------------------------------------------------ // 16AUG94 PER Added error messages. // Added pi_log_file. // 21FEB96 REJ Changed select to join for performance // 04JUN96 REJ Added reference_type and order by to SELECT and reverted to cursor code. // This function is only meant to "carry through" emissions created byDAT*R  the emission estimator // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // local variable INTEGER li_status // Retrieve input activity value amount and unit DECLARE activity_cur CURSOR FOR select value_amt, value_unit_code, data_code, creationDAT*T _date_time, method_type from rap_activities, rap_streams where rap_activities.ref_rid = rap_streams.rid AND rap_streams.to_process_rid = :pd_process_rid and rap_streams.from_process_rid = :w_emiss.il_prev_process_rid //09DEC94 MAS-only one stream between processes // and metric_code = :ps_metric_code and SUBSTR(metric_code,1) = 'MASS FLOW' // MAS 28AUG94 // or metric_code = 'VOL FLOW') // not possible to the input of controlled device and mDAT*V etric_level_type = 'STR' and value_type is NULL and SUBSTR(material_code,1) = :ps_pollutant and reference_code = :ps_reference_code and start_date_time = :pd_start_date_time and end_date_time = :pd_end_date_time and (method_type = :ps_method_type OR SUBSTR(method_type,1,1) = :ps_method_type) and reference_type = 'EE' // REJ 03JUN96 and value_amt is not null and value_unit_code is not null ORDER BY creation_date_time DESC using pt_trans_obj; DAT*X OPEN activity_cur; IF pt_trans_obj.sqlcode <> 0 then ROLLBACK USING pt_trans_obj; CLOSE activity_cur; ELSE FETCH activity_cur INTO :pdb_input_values, :ps_input_units, :ps_data_code, :pd_creation_date_time, :ps_method_type; END IF IF pt_trans_obj.sqlcode = 100 OR & (pt_trans_obj.sqlcode = -1 AND & pt_trans_obj.sqlerrtext = 'Procedure has not been executed or has no results') THEN // no input record found ROLLBACK USING pt_trans_DAT*Z obj; CLOSE activity_cur; // Activity record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No activity record found for" + & " Metric: " + /* VOL FLOW or */ "MASS FLOW" + & " Material: " + ps_pollutant + & " Reference Code: " + ps_reference_code + & " Start date: " + String( pd_start_date_time, & "mmm d, yyyy h:mm:ss ADAT*\ M/PM" ) + & " End date: " + String( pd_end_date_time, & "mmm d, yyyy h:mm:ss AM/PM" ), & Information!, OK! ) END IF IF pd_process_rid <> w_emiss.il_orig_process_rid THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, & " No activity record found for Metric: " + & /* "VOL FLOW or */ "MASS FLOW") FileWrite( piDAT*^ _log_file, & " Reference Code: " + ps_reference_code + " Material: " + & ps_pollutant ) FileWrite(pi_log_file, & " Start Date: " + & String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM") + & " End Date: " + & String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) END IF END IF Return( 0 ) ELSEIF pt_trans_obj.sqlcode <> 0 THEN // SQL Error DAT*`  // ROLLBACK using pt_trans_obj; // Could use this instead of cursor: // IF pt_trans_obj.sqlcode = -185 OR ( (pt_trans_obj.sqlcode = -1) and & // (pt_trans_obj.sqlerrtext = "Select returned more than one row") ) THEN // More than one row // IF pi_log_file <> -1 THEN // FileWrite( pi_log_file, & // " More than one activity record found with reference_type = 'EE' for Metric: " + & // /* "VOL FLOW or */ "MASS FLOW") // FileWrite( pi_log_fDAT*b ile, & // " Reference Code: " + ps_reference_code + " Material: " + & // ps_pollutant ) // FileWrite(pi_log_file, & // " Start Date: " + & // String( pd_start_date_time, "mmm d, yyyy h:mm:ss AM/PM") + & // " End Date: " + & // String( pd_end_date_time, "mmm d, yyyy h:mm:ss AM/PM" ) ) // FileWrite(pi_log_file, " Change the reference_type for the record that is not from DAT*d the emission estimator.") // END IF // Return(0) // END IF uof_sql_error( "uof_get_input_activity_value()", pi_log_file, pt_trans_obj ) Return( -1 ) ELSE // input activity data found COMMIT using pt_trans_obj; CLOSE activity_cur; Return( 1 ) END IF end function public subroutine uof_log_activity_value (ref string ps_factor_material, ref string ps_activity_material, ref double pdb_activity_value, ref string ps_activity_unit, ref string ps_control, ref strDAT*f ing ps_factor_type, ref string ps_cd1_code, ref string ps_cd2_code, ref decimal pd_emission_factor, ref string ps_activity_unit_code, ref string ps_emission_unit_code, ref integer pi_log_file);IF pi_log_file <> -1 AND ps_factor_material <> ps_activity_material THEN FileWrite( pi_log_file, " Activity Record For " + & ps_activity_material + " used in place of " +& "material " + ps_factor_material) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 1 THEN FileWriteDAT*h ( pi_log_file, " Activity Record Found: " + & String(Round(pdb_activity_value,6)) + " " + ps_activity_unit + " " + & ps_activity_material) END IF // We now have the emission factor and the activity value, // so we can compute the emission estimation IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 1 THEN IF ps_control = 'controlled' THEN FileWrite( pi_log_file, " Controlled " + ps_factor_type + & " factor found for First control: " + ps_cd1_code + &DAT*j  ", Second control: " + ps_cd2_code) FileWrite(pi_log_file, " " + String(Round(pd_emission_factor,10)) + & " " + ps_emission_unit_code + " / " + & ps_activity_unit_code + " " + & ps_activity_material) ELSE FileWrite( pi_log_file, " Uncontrolled " + ps_factor_type + & " factor found: " + String(pd_emission_factor) + & " " + ps_emission_unit_code + " / " + & ps_activity_unit_code + " " + & ps_activity_material) END IF END IF end subrDAT*l outine public function integer uof_get_seasonal_adj_factor (long al_processrid); //loads the instance variable in_curSeasonalAdjFactor with the appropriate seasonal //adjustment factor (if any) for the current process. If no SAF is found, //in_curSeasonalAdjFactor is set to -1 long ll_rc string ls_season //see if process has a SEASON activity record SELECT rap_activities.value INTO :ls_season FROM rap_activities WHERE ( rap_activities.ref_rid = :al_processRDAT*n id ) AND ( rap_activities.metric_code = 'SEASON' ) AND ( rap_activities.metric_level_type = 'PRO' ) USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 then return 0 end if //lookup the correct user supplied seasonal adjustment factor for the current //geographic location, scc code, and season SELECT rap_season_adj_factor.saf INTO :in_curSeasonalAdjFactor FROM rap_season_adj_factor WHERE ( rap_seasoDAT*p n_adj_factor.geographic_state_rid = :il_curStateRid ) AND ( rap_season_adj_factor.geographic_county_rid = :il_curCountyRid ) AND ( rap_season_adj_factor.scc_ams_code = :is_curSccCode ) AND ( rap_season_adj_factor.season = :ls_season ) AND ( rap_season_adj_factor.factor_type = 'U' ) USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 then //lookup the correct generic seasonal adjustment factor for the curDAT*r rent //geographic location, scc code, and season SELECT rap_season_adj_factor.saf INTO :in_curSeasonalAdjFactor FROM rap_season_adj_factor WHERE ( rap_season_adj_factor.geographic_state_rid = :il_curStateRid ) AND ( rap_season_adj_factor.geographic_county_rid = :il_curCountyRid ) AND ( rap_season_adj_factor.scc_ams_code = :is_curSccCode ) AND ( rap_season_adj_factor.season = :ls_season ) AND ( rap_season_adj_factorDAT*t .factor_type = 'G' ) USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 then in_curSeasonalAdjFactor = -1 return 0 end if end if //log that the seasonal adj factor was found if w_emiss.ii_log_file <> -1 and dec(w_emiss.em_log_detail.text) > 2 then fileWrite(w_emiss.ii_log_file, " Seasonal Adjustment factor found for process: " + is_curProcessID) fileWrite(w_emiss.ii_log_file, " Season Code: " + ls_season + " Value: " +DAT*v  string(in_curSeasonalAdjFactor) + "~r~n") end if return 1 end function public function integer uof_calc_emission_factor (decimal pd_process_rid, string ps_scc_ams_code, string ps_reference_code, datetime pd_start_date_time, datetime pd_end_date_time, integer pi_num_metrics, integer pi_num_metric_groups, decimal pd_record_group_no[], decimal pd_sequence_no[], string ps_item_type[], string ps_operator_type[], string ps_input_output_flag[], string ps_numer_material_code[], string ps_denom_maDAT*x terial_code[], string ps_metric_code[], string ps_in_throughput_material, string ps_pollutant, ref double pdb_est_emission, ref string ps_emission_unit_code, integer pi_log_file, ref transaction pt_trans_object, ref transaction pt_emiss_object, transaction pt_rid_object, ref long pl_next_process_rid, string ps_profile_code, string ps_spec_filter, datetime pd_today, string ps_method_type, ref boolean pb_scc_at_str, string ps_method, integer pi_curr_priority, date pd_cutoff_date);// INTEGER uof_calcDAT*z _emission_factor( PARAMETERS NOT LISTED HERE ) // // Returns: 1 Success // 0 Error or all required data not found // -1 SQL Error // // Compute estimated emissions using the equation: // Estimated_emissions = activity_value * [constant...] * emission_factor // // NOTES: // 1) Method metric records sequence order MUST be E,[C...,]M. // 2) If constants are used, the E method metric record must have a // specific denom_material_code (NOT @) so that at most ONE // emission factDAT*| or record is retrieved. // // Modification History // When Who What // ------- --- ------------------------------------------------ // 13FEB96 REJ Only look for factors if downstream processes and control codes are // successfully found // 19FEB96 REJ Changed call to uof_control_device_code() to allow control // device groups to use device codes corresponding to EPA CNTL CO codes // associated with the control process // Reorganized code to check any speciDAT*~ fic factors against all method groups // before dropping to generic factors. Reformatted log file messages. // Had to remove some of the header information because // the source code has become too big for the editor. // 20FEB99 MDY Modified emission factor prioritization logic to filter pre-prioritized // factors in priority order during calculation attempts // Set the pointer to the regular arrow for background estimation // runs (so the user can clicDAT* k on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables BOOLEAN lb_successful_calc, lb_use_constant, lb_init_flag, lb_last_device STRING ls_activity_unit, ls_numer_unit_code, ls_denom_unit_code, ls_curr_material, ls_curr_unit STRING ls_unit, ls_factor_material, ls_method_type, ls_quality_type STRING ls_CD1_code, ls_CD2_code, ls_metric, ls_priority, ls_filtDAT* er STRING ls_factor_type, ls_emiss_factor_status, ls_for_factors, ls_control INTEGER li_ret_status, li_num_factors, li_metric_loop, li_emiss_loop, li_ss_factor_num INTEGER li_g_factor_num, li_num_factor_rows, li_factor_row DECIMAL ld_curr_group, ld_constant, ld_null, ld_last_group DATETIME ld_today LONG ll_next_process_rid, ll_i, ll_j, ll_factorPriority, ll_prevFactorPriority, ll_factorRowPointer DOUBLE ldb_mass_flow_value, ldb_downstrmdis_value, ldb_fugitive_discharge, ldb_null, & DAT*  ldb_activity_value ld_today = pd_today lb_last_device = FALSE SetNull(ls_emiss_factor_status) SetNull(ls_factor_type) SetNull(ldb_null) SetNull(ld_null) // Retrieve all appropriate emission factors li_ret_status = uof_emiss_factor(ps_pollutant, ps_scc_ams_code, '@', & ps_profile_code, pd_process_rid, li_num_factors, li_ss_factor_num, & li_g_factor_num, pi_log_file, pt_trans_object, ps_method, pd_cutoff_date) IF li_num_factors < 1 THEN IF pi_log_file <> -1 ANDDAT*  Dec(w_emiss.em_log_detail.text) > 2 THEN IF ps_method = 'SPECIATION' THEN IF IsNull(ps_profile_code) THEN FileWrite( pi_log_file, " No Factors Found from Source Specific profile~r~n" + & " ... continuing with next emittant") ELSE FileWrite( pi_log_file, " No Factors Found for profile " + ps_profile_code + " ... continuing with next profile") END IF ELSEIF ps_method = 'EMIS FACT' THEN FileWrite( pi_log_file, " No Factors Found ... coDAT* ntinuing with next emittant") END IF END IF Return(0) END IF IF ps_method = 'SPECIATION' THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " Factors Found for profile " + ps_profile_code ) END IF END IF STRING ls_throughput_material_code[], ls_throughput_unit_code[], & ls_emission_unit_code[], ls_quality_rating[] DECIMAL ld_emission_factor[] ls_throughput_material_code[li_num_factors] = 'End' ls_throughput_unit_codDAT* e[li_num_factors] = 'End' ls_emission_unit_code[li_num_factors] = 'End' ls_quality_rating[li_num_factors] = 'End' ld_emission_factor[li_num_factors] = 0 // set up control device codes ls_CD1_code = is_controlCode[1] ls_CD2_code = is_controlCode[2] if ls_CD1_code = "" then ls_CD1_code = "NOT FOUND" if ls_CD2_code = "" then ls_CD2_code = "NOT FOUND" //outer loop to filter out emission factors one priority level at a time //before entering the metric loop ll_factorPriority = -1 ll_fDAT* actorRowPointer = 0 do while true // turn off any filter on the emission factors this.dw_emis_fact.SetFilter("") this.dw_emis_fact.Filter() //if no more factors to process, exit if ll_factorRowPointer >= this.dw_emis_fact.rowCount() then exit //find the next factor priority number in the buffer do ll_factorRowPointer ++ if ll_factorRowPointer > this.dw_emis_fact.rowCount() then exit ll_prevFactorPriority = ll_factorPriority ll_factorPriority = this.dw_emis_factDAT* .getItemNumber(ll_factorRowPointer, "factor_priority") if ll_factorPriority < 0 then return -1 loop until ll_prevFactorPriority <> ll_factorPriority choose case ll_factorPriority case 42 ls_factor_type = "SPECIFIC" ls_control = "uncontrolled" ls_for_factors = " For Process Specific Uncontrolled Factors with Control Efficiency" case 41 ls_factor_type = "SPECIFIC" ls_control = "controlled" ls_for_factors = " For Process Specific Controlled FactorDAT* s" case 40 ls_factor_type = "SPECIFIC" ls_control = "uncontrolled" ls_for_factors = " For Process Specific Uncontrolled Factors" case 37 ls_factor_type = "SOURCE" ls_control = "uncontrolled" ls_for_factors = " For Source Specific Uncontrolled Factors with Control Efficiency" case 36 ls_factor_type = "SOURCE" ls_control = "controlled" ls_for_factors = " For Source Specific Controlled Factors" case 35 ls_factor_type = "SOURCE" DAT*  ls_control = "uncontrolled" ls_for_factors = " For Source Specific Uncontrolled Factors" case 32 ls_factor_type = "COUNTY" ls_control = "uncontrolled" ls_for_factors = " For County Specific Uncontrolled Factors with Control Efficiency" case 31 ls_factor_type = "COUNTY" ls_control = "controlled" ls_for_factors = " For County Specific Controlled Factors" case 30 ls_factor_type = "COUNTY" ls_control = "uncontrolled" ls_for_factDAT* ors = " For County Specific Uncontrolled Factors" case 22 ls_factor_type = "STATE" ls_control = "uncontrolled" ls_for_factors = " For State Specific Uncontrolled Factors with Control Efficiency" case 21 ls_factor_type = "STATE" ls_control = "controlled" ls_for_factors = " For State Specific Controlled Factors" case 20 ls_factor_type = "STATE" ls_control = "uncontrolled" ls_for_factors = " For State Specific Uncontrolled FactoDAT* rs" case 12 ls_factor_type = "GENERIC" ls_control = "uncontrolled" ls_for_factors = " For Generic Uncontrolled Factors with Control Efficiency" case 11 ls_factor_type = "GENERIC" ls_control = "controlled" ls_for_factors = " For Generic Controlled Factors" case 10 ls_factor_type = "GENERIC" ls_control = "uncontrolled" ls_for_factors = " For Generic Uncontrolled Factors" case else IF pi_log_file <> -1 THEN FileWrite( pi_DAT* log_file, "Data Error: unknown factor type for " + & "process " + String( pd_process_rid ) +" ") END IF return -1 end choose ls_filter = "factor_priority = " + string(ll_factorPriority) IF ls_control = "controlled" and ps_method = "SPECIATION" and POS(ps_spec_filter,"control_code_1") > 0 THEN ls_filter = ps_spec_filter END IF // filter factors for current priority this.dw_emis_fact.SetFilter(ls_filter) this.dw_emis_fact.Filter() li_num_factor_rows DAT* = this.dw_emis_fact.RowCount() IF li_num_factor_rows = 0 THEN // Matching emission factor record(s) not found // Try next type IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite(pi_log_file, " No " + ls_factor_type + " " + & ls_control + " factors used.") END IF CONTINUE ELSEIF li_num_factor_rows = -1 THEN // SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SQL ERROR: counting factors for " + & "proceDAT* ss " + String( pd_process_rid ) +" ") END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSE IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, ls_for_factors) END IF END IF // Loop through the method_metric records li_metric_loop = 1 DO WHILE TRUE // Check to see if we have tried all the method_metric records IF li_metric_loop > pi_num_metrics THEN EXIT // Save the current group number ld_last_group = ld_curDAT* r_group ld_curr_group = pd_record_group_no[li_metric_loop] IF pi_log_file <> -1 AND ld_curr_group <> ld_last_group & AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " Record Group: " + string(Int(ld_curr_group))) END IF // Determine method metric record type IF ps_item_type[li_metric_loop] = 'E' THEN // Emission Factor record IF ps_numer_material_code[li_metric_loop] <> ps_pollutant AND & ps_numer_material_code[li_metric_loop] <> '@' THEN DAT*  // This metric group does not apply to this pollutant. // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSE lb_use_constant = FALSE //refresh flag // IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN // FileWrite(pi_log_file, " Searching for " + ls_control + & // " factor") // END IF li_num_factors = 0 FOR li_factor_roDAT* w = 1 TO li_num_factor_rows IF ld_curr_group = 1 OR li_metric_loop = 1 THEN ls_throughput_material_code[li_factor_row] = & this.dw_emis_fact.GetItemString(li_factor_row, & "throughput_material_code") END IF //added check for EXHC MDY 10/99 IF li_num_factor_rows = 1 AND ls_throughput_material_code[li_factor_row] = 'VOC' AND & (ps_pollutant = 'TOG' OR ps_pollutant = 'EXHC') THEN ld_last_group = ld_curr_group if ps_pollutant = 'TOG' thDAT* en DO UNTIL (ps_denom_material_code[li_metric_loop] = 'VOC' AND ps_numer_material_code[li_metric_loop] = 'TOG') li_metric_loop++ // Check to see if we have tried all the method_metric records IF li_metric_loop > pi_num_metrics THEN EXIT LOOP else DO UNTIL (ps_denom_material_code[li_metric_loop] = 'VOC' AND ps_numer_material_code[li_metric_loop] = 'EXHC') li_metric_loop++ // Check to see if we have tried all the method_metric recorDAT* ds IF li_metric_loop > pi_num_metrics THEN EXIT LOOP end if ld_curr_group = pd_record_group_no[li_metric_loop] IF pi_log_file <> -1 AND ld_curr_group <> ld_last_group & AND Dec(w_emiss.em_log_detail.text) > 2 THEN if ps_pollutant = 'TOG' then FileWrite( pi_log_file, " VOC to TOG Record Group: " + string(Int(ld_curr_group))) else FileWrite( pi_log_file, " VOC to EXHC Record Group: " + string(Int(ld_curr_group))) DAT*  end if END IF END IF // Check to see if we have tried all the method_metric records IF li_metric_loop > pi_num_metrics THEN EXIT IF ps_denom_material_code[li_metric_loop] = '@' THEN is_denom_material = ls_throughput_material_code[1] ELSE is_denom_material = ps_denom_material_code[li_metric_loop] END IF IF ps_denom_material_code[li_metric_loop] = '@' OR & ps_denom_material_code[li_metric_loop] = ls_throughput_material_code[lDAT* i_factor_row] THEN li_num_factors++ ls_throughput_unit_code[li_num_factors] = this.dw_emis_fact.GetItemString(li_factor_row, & "throughput_unit_code") ld_emission_factor[li_num_factors] = & this.dw_emis_fact.GetItemDecimal(li_factor_row, "emission_factor") ls_emission_unit_code[li_num_factors] = & this.dw_emis_fact.GetItemString(li_factor_row, "unit_code") ls_quality_rating[li_num_factors] = & this.dw_emis_fact.GetItemString(li_factor_row, DAT* "quality_type") END IF NEXT //li_factor_row // Check to see if we have tried all the method_metric records IF li_metric_loop > pi_num_metrics THEN EXIT IF li_num_factors = 0 then // No factors match throughput material, try next record group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSE IF li_num_factors > 1 THEN li_ret_status = uof_compareDAT* _factors (li_num_factors, & ls_throughput_unit_code[], ls_throughput_material_code[], pi_log_file, & pt_trans_object) IF li_ret_status = -1 THEN Return( -1 ) ELSEIF li_ret_status = 0 AND & pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " More than one " + ls_control + & + " " + ls_factor_type + " factor found for " + ps_pollutant) FileWrite( pi_log_file, " with the same throuDAT* ghput material.") ROLLBACK USING pt_trans_object; Return( 0 ) END IF END IF ls_emiss_factor_status = "FOUND" END IF // num_factors = 0 END IF // pollutant applicable // IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN // FileWrite(pi_log_file, " Emission Factors Found") // END IF ELSEIF ps_item_type[li_metric_loop] = 'C' THEN // Constant record // Make sure there is only ONE active emission factor record IF li_num_facDAT* tors > 1 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Denominator material code for " + & "method_metric record type E," ) FileWrite( pi_log_file, " group number " + & String( pd_record_group_no[li_metric_loop] ) + & ", resulted in more than one possible emission factor" ) END IF // Do not try next group, per JEG e-mail 23FEDAT* B96 EXIT // // Try next group // DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group // li_metric_loop++ // LOOP // SetNull(ls_emiss_factor_status) // CONTINUE END IF // MAS 20APR95 IF pd_record_group_no[li_metric_loop] = ld_curr_group THEN IF ps_numer_material_code[li_metric_loop] = '@' THEN ps_numer_material_code[li_metric_loop] = is_denom_material END IF END IF DAT*  // Retrieve the constant li_ret_status = uof_constant(pd_process_rid,ps_scc_ams_code,& ps_numer_material_code[li_metric_loop], ps_denom_material_code[li_metric_loop], pd_cutoff_date, & ls_numer_unit_code, ls_denom_unit_code, ld_constant, pi_log_file, pt_trans_object ) IF ps_denom_material_code[li_metric_loop] = '@' THEN is_denom_material = ps_pollutant ELSE is_denom_material = ps_denom_material_code[li_metric_loop] END IFDAT*  IF li_ret_status = 0 THEN // Constant record not found // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF IF lb_use_constant THEN // This is the second (or thirDAT* d...) constant. // Convert ld_constant from ls_numer_unit_code to // ls_curr_unit if necessary. IF ls_numer_unit_code <> ls_curr_unit THEN li_ret_status = uof_unit_convert( ls_numer_unit_code, & ls_curr_unit, ld_constant, ldb_null, 'DECIMAL', pi_log_file, pt_trans_object ) IF li_ret_status = 0 THEN IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " No unit cDAT* onversion information " + & "found to convert " + ls_numer_unit_code + " constant") FileWrite( pi_log_file, " to be compatible with " + ls_curr_unit +& " constant.") END IF // No unit conversion record found. // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_statusDAT* ) CONTINUE ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF // We now have the interim emission and second (third...) constant. // Compute new INTERIM emission value. IF ps_operator_type[li_metric_loop] = '*' THEN pdb_est_emission = pdb_est_emission * ld_constant ELSEIF ps_oDAT* perator_type[li_metric_loop] = '/' THEN pdb_est_emission = pdb_est_emission / ld_constant ELSE // ERROR--Unknown operator_type IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "Unknown operator type " + & ps_operator_type[li_metric_loop] + " in group " + String( ld_curr_group ) ) END IF // Try next group DO WHILE pd_record_group_no[li_metDAT* ric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE END IF // Save current material and units for future use ls_curr_material = ps_denom_material_code[li_metric_loop] is_denom_material = ls_curr_material ls_curr_unit = ls_denom_unit_code ELSE // This is the first constant. // Convert ld_constant from ls_numer_unit_code to // lDAT* s_throughput_unit_code if necessary. IF ls_numer_unit_code <> ls_throughput_unit_code[1] THEN li_ret_status = uof_unit_convert( ls_numer_unit_code, ls_throughput_unit_code[1], & ld_constant, ldb_null, 'DECIMAL', pi_log_file, pt_trans_object ) IF li_ret_status = 0 THEN // No unit conversion record found. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " No unit conversioDAT* n information " + & "found to convert " + ls_numer_unit_code + " constant") FileWrite( pi_log_file, " to be compatible with " + ls_throughput_unit_code[1] +& " based factor.") END IF // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSEIFDAT*  li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF // We now have the emission factor and first constant. // Compute INTERIM emission value IF ps_operator_type[li_metric_loop] = '*' THEN pdb_est_emission = ld_emission_factor[1] * ld_constant ELSEIF ps_operator_type[li_metric_loop] = '/' THEN pdb_esDAT* t_emission = ld_emission_factor[1] / ld_constant ELSE // ERROR--Unknown operator_type IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "Unknown operator type " + ps_operator_type[li_metric_loop] + & " in group " + String( ld_curr_group ) ) END IF // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group liDAT* _metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE END IF // Save current material and units and // set use constant flag for future use ls_curr_material = ps_denom_material_code[li_metric_loop] is_denom_material = ls_curr_material ls_curr_unit = ls_denom_unit_code lb_use_constant = TRUE END IF ELSEIF ps_item_type[li_metric_loop] = 'M' THEN // Metric record IF NODAT* T lb_use_constant THEN // No interim constant records were used in this calculation. // Try to find activity records for materials that match // our available emission factors. lb_successful_calc = FALSE // 20APR95 IF pd_record_group_no[li_metric_loop] = ld_curr_group THEN IF ps_numer_material_code[li_metric_loop] = '@' THEN ps_numer_material_code[li_metric_loop] = is_denom_material END IF END IFDAT*  FOR li_emiss_loop = 1 TO li_num_factors IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(pi_log_file, " Starting search for activity data") END IF // REJ 14MAY96 throughput material code is passed as reference to uof_activity_data // activity data returned may have different material code ("@", "PM,TOTAL", etc.) ls_factor_material = ls_throughput_material_code[li_emiss_loop] li_ret_status = uof_activity_data(DAT*  & ps_metric_code[li_metric_loop], ls_throughput_material_code[li_emiss_loop], & pd_process_rid, pd_start_date_time, pd_end_date_time, & ps_input_output_flag[li_metric_loop], ldb_activity_value, & ls_activity_unit, ps_method, ps_reference_code, pi_log_file, pt_trans_object ) IF li_ret_status = 1 THEN // Activity record found // Convert ldb_activity_value from ls_activity_unit to // lDAT* s_throughput_unit_code[li_emiss_loop] if necessary. IF ls_activity_unit <> & ls_throughput_unit_code[li_emiss_loop] THEN li_ret_status = uof_unit_convert( ls_activity_unit, & ls_throughput_unit_code[li_emiss_loop], ld_null, & ldb_activity_value, 'DOUBLE', pi_log_file, pt_trans_object ) IF li_ret_status = 0 THEN // No unit conversDAT* ion record found. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " No unit conversion information " + & "found to convert " + ls_activity_unit + " activity") FileWrite( pi_log_file, " to be compatible with " + & ls_throughput_unit_code[li_emiss_loop] + " based factor.") END IF // Try next emission factor. CONTINUDAT* E ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) ELSEIF li_ret_status = 1 THEN ls_curr_unit = ls_emission_unit_code[li_emiss_loop] ls_activity_unit = ls_throughput_unit_code[li_emiss_loop] END IF END IF uof_log_activity_value (ls_factor_material, ls_throughput_mateDAT* rial_code[li_emiss_loop], & ldb_activity_value, ls_activity_unit, ls_control, ls_factor_type, ls_cd1_code, & ls_cd2_code, ld_emission_factor[li_emiss_loop], ls_throughput_unit_code[li_emiss_loop], & ls_emission_unit_code[li_emiss_loop], pi_log_file) // We now have the emission factor and the activity value, // so we can compute the emission estimation IF ps_operator_type[li_metric_loop] = '*' THEN pdb_est_emissiDAT* on = ld_emission_factor[li_emiss_loop] * ldb_activity_value ELSEIF ps_operator_type[li_metric_loop] = '/' THEN pdb_est_emission = ld_emission_factor[li_emiss_loop] / ldb_activity_value ELSE // ERROR--Unknown operator_type IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "Unknown operator type " + & ps_operator_type[li_metrDAT* ic_loop] + " on emission factor record" ) END IF // Try next emission factor CONTINUE END IF ls_curr_unit = ls_throughput_unit_code[li_emiss_loop] ls_unit = ls_emission_unit_code[li_emiss_loop] ls_quality_type = ls_quality_rating[li_emiss_loop] lb_successful_calc = TRUE EXIT ELSEIF li_ret_status = -1 THEN // SQL Error retrieviDAT* ng record ROLLBACK USING pt_trans_object; Return( -1 ) END IF NEXT // end emiss loop ELSE // Interim constant records were used in this calculation. // Find the activity record for the material that matches our current equation. lb_successful_calc = FALSE li_ret_status = uof_activity_data( & ps_metric_code[li_metric_loop], & ls_curr_maDAT* terial, & pd_process_rid, pd_start_date_time, & pd_end_date_time, & ps_input_output_flag[li_metric_loop],& ldb_activity_value, & ls_activity_unit, ps_method, ps_reference_code,& pi_log_file, & pt_trans_object ) IF li_ret_status = 1 THEN // Activity record found DAT*  // Convert ldb_activity_value from ls_activity_unit to ls_curr_unit if necessary. IF ls_activity_unit <> ls_curr_unit THEN li_ret_status = uof_unit_convert( ls_activity_unit, & ls_curr_unit, ld_null, & ldb_activity_value, 'DOUBLE', & pi_log_file, pt_trans_object ) IF li_ret_status = 0 THEN // No unit conversion record found. DAT*  IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " No unit conversion information " + & "found to convert " + ls_activity_unit + " activity") FileWrite( pi_log_file, " to be compatible with " + & ls_curr_unit + " constant.") END IF // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group DAT*  li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF uof_log_activity_value (ls_factor_material, ls_throughput_material_code[1], & ldb_activity_value, ls_activity_unit, ls_control, ls_factor_type, ls_cd1_DAT* code, & ls_cd2_code, ld_emission_factor[1], ls_activity_unit, ls_emission_unit_code[1], pi_log_file) // We now have the interim calculation and the // activity value, so we can compute the emission estimation. IF ps_operator_type[li_metric_loop] = '*' THEN pdb_est_emission = pdb_est_emission * ldb_activity_value ELSEIF ps_operator_type[li_metric_loop] = '/' THEN pdb_est_emission = pdb_est_emission / ldb_actDAT* ivity_value ELSE // ERROR--Unknown operator_type IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "Unknown operator type " + & ps_operator_type[li_metric_loop] + & " on emission factor record" ) END IF // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group DAT*  li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE END IF // Emission estimation units are from emission factor // ps_emission_unit_code = ls_emission_unit_code[1] ls_unit = ls_emission_unit_code[1] ls_quality_type = ls_quality_rating[1] lb_successful_calc = TRUE ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK DAT* USING pt_trans_object; Return( -1 ) END IF END IF // 23MAR95 convert value into user prefered unit ps_emission_unit_code = w_emiss.is_user_unit IF (ls_unit <> "") and (ps_emission_unit_code <> ls_unit) THEN li_ret_status = uof_unit_convert( ls_unit,& w_emiss.is_user_unit, ld_constant, pdb_est_emission, 'DOUBLE', pi_log_file,& pt_trans_object) IF li_ret_status = 0 THEN // No unit conversion record DAT* found. IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) < 3 AND & lb_successful_calc THEN FileWrite( pi_log_file, " No unit conversion information " + & "found to convert " + ls_unit + " emission estimate") FileWrite( pi_log_file, " to " + w_emiss.is_user_unit) END IF END IF END IF IF li_ret_status = 0 THEN // No unit conversion record found, or no activity record found. DAT*  // Try next group DO WHILE pd_record_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSEIF li_ret_status = -1 THEN // SQL Error retrieving record ROLLBACK USING pt_trans_object; Return( -1 ) END IF IF NOT lb_successful_calc THEN // Could not successfully complete calculation // Try next group DO WHILE pd_recoDAT* rd_group_no[li_metric_loop] = ld_curr_group li_metric_loop++ LOOP SetNull(ls_emiss_factor_status) CONTINUE ELSE ls_priority = string(pi_curr_priority) // We have a valid emission estimate // Assign method_type based on quality rating of factor used REJ 03OCT96 IF ls_factor_type = "SPECIFIC" THEN // Source-Specific IF ls_quality_type = 'L' OR ls_quality_type = 'M' OR ls_quality_type = 'S' DAT* OR & ls_quality_type = 'U' THEN ls_method_type = ps_method_type + ls_quality_type ELSE ls_method_type = ps_method_type + 'N' END IF // Generic ELSEIF ls_quality_type = 'A' OR ls_quality_type = 'B' OR ls_quality_type = 'C' OR & ls_quality_type = 'D' OR ls_quality_type = 'E' OR ls_quality_type = 'F' THEN ls_method_type = ps_method_type + ls_quality_type ELSE ls_method_type = ps_method_type END IF // Pass method type for factor used - thDAT* is is used by control_emission_main to avoid using // control efficiencies together with controlled emission factors // Controlled speciation factors do NOT decrease amount of emission estimate to // account for controls REJ 03OCT96 IF ls_control = "controlled" AND ps_method <> 'SPECIATION' then //MDY 2/99 changed dw_composite_ef to contain process rids for //processes handled by controlled emission factors for ll_i = 1 to 2 if il_controlRid[ll_i] = 0 then exDAT* it ll_j = w_emiss.dw_composite_ef.InsertRow(0) w_emiss.dw_composite_ef.SetItem(ll_j, 'process_rid', il_controlRid[ll_i]) w_emiss.dw_composite_ef.SetItem(ll_j, 'material_code', ps_pollutant) w_emiss.dw_composite_ef.SetItem(ll_j, 'method_type', ls_method_type) next END IF // check if controlled e.f. // Insert record into rap_activities with emission estimation information. // see if downstream device exists li_ret_status = w_emisDAT* s.uo_tl.uof_downstream_process(& pd_process_rid, & pt_trans_object, ll_next_process_rid) // 15FEB95 MAS // to handle the case of estimating emissions multiple times // when more input processes(devices) are connected to an uncontrolled process. w_emiss.il_uncontrolled_process_rid = pd_process_rid IF li_ret_status = -1 THEN // SQL error Return (-1) END IF li_ret_status = uof_default_paramDAT* eters(pd_process_rid,pdb_est_emission,& ps_pollutant,pd_start_date_time, pd_end_date_time,& pi_log_file,pt_trans_object,DateTime(Today(),Now()),& ps_reference_code,ldb_mass_flow_value,& ldb_downstrmdis_value, ldb_fugitive_discharge,TRUE,ls_method_type) IF li_ret_status <> 1 THEN ROLLBACK USING pt_trans_object; Return(0) END IF IF pi_log_file <> -1 THEN END IF IFDAT*  ll_next_process_rid = 0 THEN lb_last_device = TRUE // first parm. pdb_est_emission -> ldb_downstrmdis_value 28DEC94 // write the downstrm discharge value // Add total fugitive emissions ldb_downstrmdis_value = ldb_downstrmdis_value + & gd_total_fug_emission IF uof_activity_replace(ldb_downstrmdis_value,ld_today,& pd_process_rid, 'DOWNSTRMDIS',& ps_poDAT* llutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file, ls_method_type,& ps_reference_code,& ps_emission_unit_code,pb_scc_at_str,lb_last_device,& ls_priority) = -1 THEN // Error inserting record ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; Return( 0 ) END IF ls_metric = 'DISCHARGE' EDAT* LSE // It is always MASS FLOW 14DEC94 IF uof_activity_replace(ldb_fugitive_discharge,ld_today,& pd_process_rid, 'DOWNSTRMDIS',& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file, ls_method_type,& ps_reference_code,& ps_emission_unit_code,pb_scc_at_str,lb_last_device,& ls_priority) = -1 THEN // Error inserting record DAT*  ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; Return( 0 ) END IF ls_metric = 'MASS FLOW' END IF // write a value for either connected stream or discharge stream li_ret_status = uof_activity_replace(ldb_mass_flow_value,ld_today,& pd_process_rid, ls_metric,& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& DAT*  pi_log_file, ls_method_type,& ps_reference_code,& ps_emission_unit_code,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN // Error inserting record ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; Return( 0 ) END IF IF pi_log_file <> -1 THEN IF Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " DAT*  " + ls_control + " " + ls_metric + & " EMISSION = " + STRING(Round(ldb_mass_flow_value,4)) + " " + & ps_emission_unit_code + " from " + ps_method + " method") ELSE FileWrite( pi_log_file, " " + ls_control + " " + ls_metric + & " EMISSION = " + STRING(Round(ldb_mass_flow_value,4)) + " " + & ps_emission_unit_code) END IF END IF IF ldb_fugitive_discharge > 0 THEN DAT*  // keep track of fugitive emissions gd_total_fug_emission = gd_total_fug_emission + ldb_fugitive_discharge // write a value for either connected stream or discharge stream // metric for fugitive emission is DISCHARGE li_ret_status = uof_activity_replace(ldb_fugitive_discharge,ld_today,& pd_process_rid, 'DISCHARGE',& ps_pollutant,pd_start_date_time, pd_end_date_time,& pt_emiss_object,& pi_log_file, ls_mDAT* ethod_type,& ps_reference_code,& ps_emission_unit_code,pb_scc_at_str,lb_last_device,& ls_priority) IF li_ret_status = -1 THEN // Error inserting record ROLLBACK USING pt_emiss_object; ROLLBACK USING pt_trans_object; Return( 0 ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " FUGITIVE EMISSION = " +& StriDAT* ng(Round(ldb_fugitive_discharge,4)) + " " + & ps_emission_unit_code ) IF Dec(w_emiss.em_log_detail.text) < 3 THEN FileWrite( pi_log_file, " from " + ps_method + " method") END IF END IF END IF // Emission estimation completed successfully. // Commit and return to calling program. COMMIT USING pt_emiss_object; // GO to next downstream device. DAT*  Return( 1 ) END IF // lb_successful_calc END IF // ps_item_type // Move to next method metric row li_metric_loop++ LOOP // end metric loop loop //factor prioritization loop // Could not successfully calculate emission Return( 0 ) // end uof_calc_emission_factor() end function public function integer uof_emiss_factor (string ps_emittant_material_code, string ps_scc_ams_code, string ps_in_throughput_material, string ps_profile_code, decimal pd_process_riDAT* d, ref integer pi_num_factors, ref integer pi_ss_factor_num, ref integer pi_g_factor_num, integer pi_log_file, ref transaction pt_trans_object, string ps_method, date pd_cutoff_date); // INTEGER uof_emiss_factor( STRING ps_emittant_material_code, // STRING ps_scc_ams_code, // STRING ps_profile_code, // DECIMAL pd_process_rid, // INTEGER VAR pi_num_factors, // DAT*  INTEGER VAR pi_ss_factor_num, // INTEGER VAR pi_g_factor_num, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object, // STRING ps_method ) // // This function retrieves the emission factors for a given // pollutant. It retrieves all the possible matches (source-specific, generic) // into the uof_emissions.dw_emis_fact for comparision to the method metrics. DAT* // // Returns: 1 Success // 0 No records found // -1 SQL Error // // Modification History // Who When What // --- --------- ----------------------------------------------- // REJ 16FEB96 Creation // MDY 01APR97 Modified to accomodate state emission factors // MDY 13MAY98 Modified to accomodate county emission factors // MDY 13MAY98 Modified to accomodate seasonal adjustment factors // MDY 14MAY98 Modified to support cutoff date and epa date comparison DAT* function // MDY 08DEC98 Modified to support factor type prioritization and // controlled vs. uncontrolled factor prioritization // MDY 02JAN02 Modified to support true state and source specific factors // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF DAT* // Declare local variables LONG ll_i STRING ls_test STRING ls_generic_factor_type, ls_specific_factor_type string ls_state_factor_type //*****************************************> MDY string ls_county_factor_type //*****************************************> MDY string ls_source_factor_type //*****************************************> MDY STRING ls_retrieval_arguments STRING ls_in_throughput_material // Initialize local variables (throughput material is metric specific, won't DAT* match on // throughput until later // if IsNull(ps_in_throughput_material) then ls_in_throughput_material = '@' //else // ls_in_throughput_material = ps_in_throughput_material //end if IF ps_method = 'EMIS FACTOR' THEN ls_generic_factor_type = 'G' ls_state_factor_type = 'Q' //added for state level factors ****> MDY ls_county_factor_type = 'R' //added for county level factors ***> MDY ls_source_factor_type = 'M' //added for source level factors ***> MDY ls_speDAT*" cific_factor_type = 'S' //(process specific) ELSE //speciation factor types ls_generic_factor_type = 'P' ls_specific_factor_type = 'F' //(process-specific) END IF this.dw_emis_fact.SetTransObject(pt_trans_object) // Make sure filter is clear this.dw_emis_fact.SetFilter("") this.dw_emis_fact.Filter() //Retrieve emission factors //*** Modified dw_emis_fact SQL and retrieval arguments to accomodate the //*** state, county and source factor types ***********************DAT*$ **************> MDY pi_num_factors = this.dw_emis_fact.Retrieve(ps_emittant_material_code, & ls_in_throughput_material, ls_specific_factor_type, pd_process_rid, & ls_generic_factor_type, ps_scc_ams_code, ps_profile_code, & ls_state_factor_type, ls_county_factor_type, ls_source_factor_type, & il_curStateRid, il_curCountyRid, il_curSourceRid, & pd_cutoff_date) //*** Added trap logic here to avoid logic problems below ***************> MDY IF pi_num_factors = 0 THEN retDAT*& urn (0) //return if no factors were found ELSEIF pi_num_factors < 0 then uof_sql_error ("uof_emiss_factor() .. Retrieving emission factors", & pi_log_file, pt_trans_object) return (-1) END IF //***********************************************************************>MDY // BEGIN FACTOR PRIORITIZATION: MDY 12/8/98 //** Debug lines for MDY ** //this.dw_emis_fact.print(false) //this.dw_emis_fact.saveAs("ef_" + is_curSourceID + "_" + is_curDeviceID + "_" + is_curProcessID + "_" + isDAT*( _curPollutant + ".txt", text!, true) if pi_num_factors > 1 then this.uof_log_factors(4) //run the routine to weed out factors with old dates where //factors with newer dates are available and factors that need //to be eliminated by factor type prioritization if uof_discard_factors_by_date_and_type() < 0 then messageBox("Error", "uo_emission::uof_emiss_factor(); call to uof_discard_factors_by_date_and_type() failed.", exclamation!) return -1 end if end if //this.dw_DAT** emis_fact.saveAs("ef_" + is_curSourceID + "_" + is_curDeviceID + "_" + is_curProcessID + "_" + is_curPollutant + "_d.txt", text!, true) //run the routine to weed out factors based on prioritization //by controlled/uncontrolled and type if uof_discard_factors_by_priority() < 0 then messageBox("Error", "uo_emission::uof_emiss_factor(); call to uof_discard_factors_by_priority() failed.", exclamation!) return -1 end if //this.dw_emis_fact.saveAs("ef_" + is_curSourceID + "_" + is_curDevDAT*, iceID + "_" + is_curProcessID + "_" + is_curPollutant + "_p.txt", text!, true) this.uof_log_factors(2) //adjust pi_num_factors to reflect new row count //in the case that some factors were eliminated in uof_discard_factors_by_...() functions pi_num_factors = dw_emis_fact.rowCount() // END FACTOR PRIORITIZATION: MDY //***********************************************************************>MDY // New code block MDY string ls_factorType long ll_row long ll_rc doDAT*. uble ln_factorAmt //MDY 12/8/98 //Loop through emission factor buffer and change factor types for //state and county factors to to the generic factor type to //"fool" the rest of the program for ll_row = 1 to pi_num_factors ls_factorType = trim(upper(this.dw_emis_fact.getItemString(ll_row, "factor_type"))) if ls_factorType = "" then messageBox("Error", "uo_emission::uof_emiss_factor(); getItemString() failed.", exclamation!) return -1 end if if ls_factorType = "Q" or ls_DAT*0 factorType = "R" or ls_factorType = "M" then //set the state or county or source factor type to "G" to "fool" the rest of the program ll_rc = this.dw_emis_fact.setItem(ll_row, "factor_type", "G" ) if ll_rc < 0 then messageBox("Error", "uo_emission::uof_emiss_factor(); setItem() failed.", exclamation!) return -1 end if end if next //MDY 12/8/98 //MDY 05/13/98 //loop through the buffer and multiply remaining factors by seasonal adjustment factor if in_curSeasonDAT*2 alAdjFactor >= 0 then for ll_row = 1 to pi_num_factors //get the factor ln_factorAmt = this.dw_emis_fact.getItemNumber(ll_row, "amt") if ln_factorAmt < 0 then messageBox("Error", "uo_emission::uof_emiss_factor(); getItemNumber() failed.", exclamation!) return -1 end if //multiply the factor by the SAF ln_factorAmt *= in_curSeasonalAdjFactor //store the adjusted factor ll_rc = this.dw_emis_fact.setItem(ll_row, "amt", ln_factorAmt) if ll_rc < 0 then DAT*4  messageBox("Error", "uo_emission::uof_emiss_factor(); setItem() failed.", exclamation!) return -1 end if next end if //MDY 05/13/98 // Count source specific and generic emission factors here pi_ss_factor_num = 0 pi_g_factor_num = 0 IF pi_num_factors > 0 THEN ll_i = 1 DO UNTIL ll_i > pi_num_factors ls_test = this.dw_emis_fact.GetItemString(ll_i, "factor_type") IF ls_test = ls_specific_factor_type THEN pi_ss_factor_num ++ ELSE pi_g_factor_num ++ DAT*6 END IF ll_i ++ LOOP return(1) ELSEIF pi_num_factors = 0 THEN return (0) ELSE uof_sql_error ("uof_emiss_factor() .. Retrieving emission factors", & pi_log_file, pt_trans_object) return (-1) END IF // end uof_emiss_factor() end function public function integer uof_constant (decimal pd_process_rid, string ps_scc_ams_code, string ps_emittant_material_code, string ps_throughput_material_code, date pd_cutoff_date, ref string ps_emission_unit_code, ref string ps_throughputDAT*8 _unit_code, ref decimal pd_constant, integer pi_log_file, ref transaction pt_trans_object);// INTEGER uof_constant( DECIMAL pd_process_rid, // STRING ps_scc_ams_code, // STRING ps_emittant_material_code, // STRING ps_throughput_material_code, // DATE pd_cutoff_date, // STRING VAR ps_emission_unit_code, // STRING VAR ps_throughput_unit_code, // DAT*:  DECIMAL VAR pd_constant, // INTEGER pi_log_file, // TRANSACTION VAR pt_trans_object ) // // This function retrieves the constant for a given // input/output material combination. // // Returns: 1 Success // 0 No records found // -1 SQL Error // // Modification History // When Who What // ------- --- ------------------------------------------------- // 15AUG94 PER Reformatted error message. //DAT*<  06JUN98 MDY Added cutoff date paramteter to SQL to select only // constants <= cutoff date // Set the pointer to the regular arrow for background estimation // runs (so the user can click on the Cancel button), otherwise // set to the hourglass. IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables DECIMAL ld_exponent // Retrieve constant with units for this input/output // material combinatioDAT*> n SELECT amt, exponent_amt, throughput_unit_code, unit_code INTO :pd_constant, :ld_exponent, :ps_throughput_unit_code, :ps_emission_unit_code FROM rap_emission_factors WHERE (SUBSTR(emittant_material_code,1) = :ps_emittant_material_code OR '@' = :ps_emittant_material_code) AND (SUBSTR(throughput_material_code,1) = :ps_throughput_material_code OR '@' = :ps_throughput_material_code) AND process_rid = :pd_process_rid ADAT*@ ND SUBSTR(factor_type,1) = 'A' and epa_date <= :pd_cutoff_date and SUBSTR(throughput_material_code,1) is NOT NULL USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Constant not found for" + & " emittant material " + ps_emittant_material_code + & " throughput material " + ps_throughput_material_code, & InfDAT*B ormation!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, & " Specific constant not found for emittant material: " + & ps_emittant_material_code ) FileWrite( pi_log_file, & " throughput material: " + & ps_throughput_material_code ) END IF ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error DAT*D  IF pt_trans_object.sqlerrtext = "Select returned more than one row" THEN IF pi_log_file <> -1 THEN FileWrite( pi_log_file, & " Found more than one specific constant.") Return (-1) END IF END IF uof_sql_error( "uof_constant()", pi_log_file, pt_trans_object ) Return( -1 ) ELSE // Record retrieved successfully IF NOT IsNull( ld_exponent ) THEN pd_constant = pd_constant * 10^ld_exponent END IF IF pi_log_file DAT*F <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, & " Specific constant found for emittant material: " + & ps_emittant_material_code ) FileWrite( pi_log_file, & " throughput material: " + & ps_throughput_material_code ) END IF Return (1) END IF // Generic Constant SELECT amt, exponent_amt, throughput_unit_code,DAT*H  unit_code INTO :pd_constant, :ld_exponent, :ps_throughput_unit_code, :ps_emission_unit_code FROM rap_emission_factors WHERE (SUBSTR(emittant_material_code,1) = :ps_emittant_material_code OR '@' = :ps_emittant_material_code) AND (SUBSTR(throughput_material_code,1) = :ps_throughput_material_code OR '@' = :ps_throughput_material_code) AND factor_type = 'C' and epa_date <= :pd_cutoff_date and SUBSTR(throughput_material_code,1) is NDAT*J OT NULL USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "Constant not found for" + & " emittant material " + ps_emittant_material_code + & " throughput material " + ps_throughput_material_code, & Information!, OK! ) END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite(DAT*L  pi_log_file, & " Generic constant not found for emittant material: " + & ps_emittant_material_code ) FileWrite( pi_log_file, & " throughput material: " + & ps_throughput_material_code ) END IF Return (0) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error IF pt_trans_object.sqlerrtext = "Select returned more than one row" THEN IF pi_log_file <> -1 TDAT*N HEN FileWrite( pi_log_file, & " Found more than one generic constant.") Return (-1) END IF END IF uof_sql_error( "uof_constant()", pi_log_file, pt_trans_object ) Return( -1 ) ELSE // Record retrieved successfully IF NOT IsNull( ld_exponent ) THEN pd_constant = pd_constant * 10^ld_exponent END IF IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, & DAT*P " Generic constant found for emittant material: " + & ps_emittant_material_code ) FileWrite( pi_log_file, & " throughput material: " + & ps_throughput_material_code ) END IF Return (1) END IF // end uof_constant() end function public function integer uof_discard_factors_by_priority (); //prioritize emission and sort emission factors and discard any //controlled factorsDAT*R  that don't match the control device //configuration //MDY long ll_rowCount long ll_rc, ll_rt long ll_i long ll_uncontrolledCount long ll_controlledCount long ll_discardCount boolean lb_controlsRetrieved boolean lb_controlEfficiencies string ls_controlEfficiencies string ls_control[2] //factor specific data integer li_factorPriority[] string ls_factorType[] boolean lb_factorControlled[] boolean lb_factorDiscard[] boolean lb_factorIgnore[] //initialize ll_uncontrolledCouDAT*T nt = 0 ll_controlledCount = 0 ll_discardCount = 0 lb_controlsRetrieved = FALSE lb_controlEfficiencies = FALSE ll_rowCount = dw_emis_fact.rowCount() //Used for testing. MKC 01/26/04 //ll_rt = dw_emis_fact.saveas("C:\RAPIDS20\Import\import012604\DWEMIS.TXT",Text!,TRUE) //loop through the factors and grab the factor type, determine //if the factor is controlled or not for ll_i = 1 to ll_rowCount //initialize factor specific data li_factorPriority[ll_i] = 0 ls_factorType[ll_i] =DAT*V  "" lb_factorControlled[ll_i] = FALSE lb_factorDiscard[ll_i] = FALSE lb_factorIgnore[ll_i] = FALSE //grab the current row's factor type ls_factorType[ll_i] = trim(upper(dw_emis_fact.getItemString(ll_i, "factor_type"))) if isNull(ls_factorType[ll_i]) then ls_factorType[ll_i] = "" //determine the relative priority of this row's factor //larger numbers mean higher priority choose case ls_factorType[ll_i] case "G" //generic factor li_factorPriority[ll_i] = 10 case "PDAT*X " //generic speciate factor li_factorPriority[ll_i] = 10 case "Q" //state specific factor li_factorPriority[ll_i] = 20 case "R" //county specific factor li_factorPriority[ll_i] = 30 case "M" //source specific factor li_factorPriority[ll_i] = 35 case "S" //process specific factor li_factorPriority[ll_i] = 40 case "F" //process specific speciate factor li_factorPriority[ll_i] = 40 case else //factor type can't be prioritized here DAT*Z  lb_factorIgnore[ll_i] = TRUE continue end choose //grab the current row's control codes ls_control[1] = trim(upper(dw_emis_fact.getItemString(ll_i, "control_1_device_code"))) if isNull(ls_control[1]) then ls_control[1] = "" ls_control[2] = trim(upper(dw_emis_fact.getItemString(ll_i, "control_2_device_code"))) if isNull(ls_control[2]) then ls_control[2] = "" //if this row's factor is a controlled factor, then see if it matches the current //process's control configuDAT*\ ration if (ls_control[1] <> "" or ls_control[2] <> "") then //controlled factor //obtain current downstream control equipment information //the ib_controlsRetrieved flag is used to ensure that uof_get_controls() is //called at most one time for any process, and is always set to false //for each process in uof_emissions_main() if not ib_controlsRetrieved or (ib_controlsByPollutant and not lb_controlsRetrieved) then ll_rc = this.uof_get_controls() if ll_rc DAT*^ < 0 then messageBox("RAPIDS", "uof_discard_factors_by_priority(); " +& "call to uof_get_controls() failed.", exclamation!) return -1 end if ib_controlsRetrieved = TRUE //instance lb_controlsRetrieved = TRUE //local end if //see if this row's factor matches current downstream control equipment if (ls_control[1] = is_controlCode[1] and ls_control[2] = is_controlCode[2]) or & (ls_control[1] = is_controlCode[2] and ls_control[2]DAT*`  = is_controlCode[1]) then //valid controlled factor ll_controlledCount ++ lb_factorControlled[ll_i] = TRUE //if the control equipment in the emission factor record is not in the same //order as the actual control equipment, then change the order so that //existing estimator code will still work if ls_control[1] = is_controlCode[2] and ls_control[2] = is_controlCode[1] then if dw_emis_fact.setItem(ll_i, "control_1_device_code", ls_control[2]) < 0 thDAT*b en messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setItem() failed.", exclamation!) return -1 end if if dw_emis_fact.setItem(ll_i, "control_2_device_code", ls_control[1]) < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setItem() failed.", exclamation!) return -1 end if end if else //invalid controlled factor (doesn't match downstream control equipment) lb_factorDiscard[ll_iDAT*d ] = TRUE continue end if else //uncontrolled factor ll_uncontrolledCount ++ end if next //if we are keeping both controlled and uncontrolled factors, //we need to see if control efficiencies can be used //for uncontrolled factors for the current pollutant if ll_uncontrolledCount > 0 and ll_controlledCount > 0 then ll_rc = uof_check_control_efficiencies() if ll_rc < 0 then return -1 elseif ll_rc > 0 then lb_controlEfficiencies = TRDAT*f UE end if ls_controlEfficiencies = upper(string(lb_controlEfficiencies)) else ls_controlEfficiencies = "N/A" end if //do the final prioritization adjustments, and prepare any rows that //need to be discarded for ll_i = 1 to ll_rowCount //if factor flagged for ignore, don't do anything if lb_factorIgnore[ll_i] then continue //if factor flagged for discard then set the factor type to "_" //(this value can be sorted to the top of the buffer for a batch discarDAT*h d) if lb_factorDiscard[ll_i] then if this.dw_emis_fact.setItem(ll_i, "factor_type", "_") < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setItem() failed.", exclamation!) return -1 end if ll_discardCount ++ continue end if //modify priority based on controlled vs. uncontrolled w/control efficiencies if lb_factorControlled[ll_i] then //if factor is controlled, increase the priority by 1 li_factorPriority[ll_i] += 1 DAT*j  elseif lb_controlEfficiencies then //if factor is uncontrolled and control efficiencies can be used, //increase the priority by 2 li_factorPriority[ll_i] += 2 end if //set the factor priority in the buffer so factors can be sorted by priority if this.dw_emis_fact.setItem(ll_i, "factor_priority", li_factorPriority[ll_i]) < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setItem() failed.", exclamation!) return -1 end if next //log theDAT*l  active control(s) if we have kept any controlled factors if ll_controlledCount > 0 and w_emiss.ii_log_file <> -1 and dec(w_emiss.em_log_detail.text) >= 4 then fileWrite(w_emiss.ii_log_file, " Control 1: " + is_controlCode[1] +& " Control 2: " + is_controlCode[2] +& " Control Efficiencies: " + ls_controlEfficiencies) end if //now discard the unwanted rows if ll_discardCount > 0 then //first, sort the rows to be discaDAT*n rded to the top of the buffer if this.dw_emis_fact.setSort("factor_type A") < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setSort() failed.", exclamation!) return -1 end if if this.dw_emis_fact.sort() < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); sort() failed.", exclamation!) return -1 end if //now, discard the flagged rows if this.dw_emis_fact.rowsDiscard(1, ll_discardCount, primary!) < 0 then messageDAT*p Box("Error", "uo_emission::uof_discard_factors_by_priority(); rowsDiscard() failed.", exclamation!) return -1 end if //log the discard(s) if w_emiss.ii_log_file <> -1 and dec(w_emiss.em_log_detail.text) >= 4 then fileWrite(w_emiss.ii_log_file, " Discarded " + string(ll_discardCount) +& " factor(s) for " + is_curPollutant +& " during CONTROL prioritization.") end if end if //sort the remaining factors with highest priority at the toDAT*r p if this.dw_emis_fact.setSort("factor_priority D, quality_type A") < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); setSort() failed.", exclamation!) return -1 end if if this.dw_emis_fact.sort() < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_priority(); sort() failed.", exclamation!) return -1 end if return ll_discardCount end function public function boolean uof_compare_factors (long al_row1, long al_row2, string as_exclude[DAT*t ]); //uo_emission::uof_compare_factors() /* Compare rows of dw_emis_fact (emission factor buffer) and return comparison result. Any field names to exclude from the comparison are given in as_exclude[] Compare on the following fields: scc_Ams_Code unit_Code throughput_Material_Code throughput_Unit_Code factor_Type profile_Code control_1_Device_Code control_2_Device_Code epa_date MDY 12/4/98 */ string ls_sccAmsCode[2] string ls_unitCode[2] string ls_throDAT*v ughputMaterialCode[2] string ls_throughputUnitCode[2] string ls_factorType[2] string ls_profileCode[2] string ls_control1DeviceCode[2] string ls_control2DeviceCode[2] string ls_measCode[2] datetime ld_epaDate[2] boolean lb_epaDate = TRUE boolean lb_sccAmsCode = TRUE boolean lb_unitCode = TRUE boolean lb_throughputMaterialCode = TRUE boolean lb_throughputUnitCode = TRUE boolean lb_factorType = TRUE boolean lb_profileCode = TRUE boolean lb_control1DeviceCode = TRUE boolean lb_controlDAT*x 2DeviceCode = TRUE boolean lb_control1Match = TRUE boolean lb_control2Match = TRUE integer li_i long ll_rc long ll_rowCount //check for rows in buffer ll_rowCount = this.dw_emis_fact.rowCount() if ll_rowCount < 1 then return FALSE //check for valid input row numbers if al_row1 < 1 or al_row1 > ll_rowCount or & al_row2 < 1 or al_row2 > ll_rowCount then messageBox("Error", "uo_emission::uof_compare_factors(); " +& "input row value(s) out of range.", exclamation!) return FDAT*z ALSE end if //set flags for exclude fields for li_i = 1 to upperBound(as_exclude) choose case trim(lower(as_exclude[li_i])) case "epa_date" lb_epaDate = FALSE case "scc_ams_code" lb_sccAmsCode = FALSE case "unit_code" lb_unitCode = FALSE case "throughput_material_code" lb_throughputMaterialCode = FALSE case "throughput_unit_code" lb_throughputUnitCode = FALSE case "factor_type" lb_factorType = FALSE case "profile_code" lb_profileCode = FALSE DAT*|  case "control_1_device_code" lb_control1DeviceCode = FALSE case "control_2_device_code" lb_control2DeviceCode = FALSE end choose next //compare epa_date fields if lb_epaDate then ld_epaDate[1] = this.dw_emis_fact.getItemDateTime(al_row1, "epa_date") ld_epaDate[2] = this.dw_emis_fact.getItemDateTime(al_row2, "epa_date") if isNull(ld_epaDate[1]) or isNull(ld_epaDate[2]) then messageBox("Error", "uo_emission::uof_compare_factors(); " +& "DATA Error: column 'epa_datDAT*~ e' can't be NULL in table " +& "'rap_emission_factors'", exclamation!) return FALSE end if end if //compare scc_ams_code fields if lb_sccAmsCode then ls_sccAmsCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "scc_ams_code"))) ls_sccAmsCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "scc_ams_code"))) if isNull(ls_sccAmsCode[1]) then ls_sccAmsCode[1] = "" if isNull(ls_sccAmsCode[2]) then ls_sccAmsCode[2] = "" if ls_sccAmsCode[1] <> ls_sccAmsCode[2DAT* ] then return FALSE end if //compare throughput_material_code fields if lb_throughputMaterialCode then ls_throughputMaterialCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "throughput_material_code"))) ls_throughputMaterialCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "throughput_material_code"))) if isNull(ls_throughputMaterialCode[1]) then ls_throughputMaterialCode[1] = "" if isNull(ls_throughputMaterialCode[2]) then ls_throughputMaterialCode[2] = "" DAT* if ls_throughputMaterialCode[1] <> ls_throughputMaterialCode[2] then return FALSE end if //compare factor_type fields if lb_factorType then ls_factorType[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "factor_type"))) ls_factorType[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "factor_type"))) if isNull(ls_factorType[1]) then ls_factorType[1] = "" if isNull(ls_factorType[2]) then ls_factorType[2] = "" if ls_factorType[1] <> ls_factorType[2] then return FALSE enDAT* d if //compare profile_code fields if lb_profileCode then ls_profileCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "profile_code"))) ls_profileCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "profile_code"))) if isNull(ls_profileCode[1]) then ls_profileCode[1] = "" if isNull(ls_profileCode[2]) then ls_profileCode[2] = "" if ls_profileCode[1] <> ls_profileCode[2] then return FALSE end if //compare control_1_device_code fields if lb_control1DeviceCode DAT* then ls_control1DeviceCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "control_1_device_code"))) ls_control1DeviceCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "control_1_device_code"))) if isNull(ls_control1DeviceCode[1]) then ls_control1DeviceCode[1] = "" if isNull(ls_control1DeviceCode[2]) then ls_control1DeviceCode[2] = "" if ls_control1DeviceCode[1] <> ls_control1DeviceCode[2] then lb_control1Match = FALSE end if //compare control_2_device_code fielDAT* ds if lb_control2DeviceCode then ls_control2DeviceCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "control_2_device_code"))) ls_control2DeviceCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "control_2_device_code"))) if isNull(ls_control2DeviceCode[1]) then ls_control2DeviceCode[1] = "" if isNull(ls_control2DeviceCode[2]) then ls_control2DeviceCode[2] = "" if ls_control2DeviceCode[1] <> ls_control2DeviceCode[2] then lb_control2Match = FALSE end if //if coDAT* ntrol 1 and control 2 are the same for both factors, but in reversed order //then treat them as a match if not lb_control1Match and not lb_control2Match then if ls_control1DeviceCode[1] = ls_control2DeviceCode[2] and & ls_control2DeviceCode[1] = ls_control1DeviceCode[2] then //controls match, keep going else return FALSE end if elseif not lb_control1Match or not lb_control2Match then //either control 1 or control 2 doesn't match return FALSE end DAT* if //compare unit_code fields if lb_unitCode then ls_unitCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "unit_code"))) ls_unitCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "unit_code"))) if isNull(ls_unitCode[1]) then ls_unitCode[1] = "" if isNull(ls_unitCode[2]) then ls_unitCode[2] = "" if ls_unitCode[1] <> ls_unitCode[2] then //if unit codes don't match, still have to check measurement codes for the units SELECT rap_units.meas_code INTO DAT* :ls_measCode[1] FROM rap_units WHERE rap_units.code = :ls_unitCode[1] USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 or ll_rc = 100 then return FALSE SELECT rap_units.meas_code INTO :ls_measCode[2] FROM rap_units WHERE rap_units.code = :ls_unitCode[2] USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 or ll_rc = 100 then return FALSE if ls_measCode[1] <> ls_measCode[2] then return FALSE end if end if //compDAT* are throughput_unit_code fields if lb_throughputUnitCode then ls_throughputUnitCode[1] = trim(upper(this.dw_emis_fact.getItemString(al_row1, "throughput_unit_code"))) ls_throughputUnitCode[2] = trim(upper(this.dw_emis_fact.getItemString(al_row2, "throughput_unit_code"))) if isNull(ls_throughputUnitCode[1]) then ls_throughputUnitCode[1] = "" if isNull(ls_throughputUnitCode[2]) then ls_throughputUnitCode[2] = "" if ls_throughputUnitCode[1] <> ls_throughputUnitCode[2] then //if throughpDAT* ut unit codes don't match, still have to check measurement codes for the units SELECT rap_units.meas_code INTO :ls_measCode[1] FROM rap_units WHERE rap_units.code = :ls_throughputUnitCode[1] USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 or ll_rc = 100 then return FALSE SELECT rap_units.meas_code INTO :ls_measCode[2] FROM rap_units WHERE rap_units.code = :ls_throughputUnitCode[2] USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if DAT* ll_rc < 0 or ll_rc = 100 then return FALSE if ls_measCode[1] <> ls_measCode[2] then return FALSE end if end if //If we made it to here, the factors match return TRUE end function public function integer uof_log_factors (integer ai_loglevel); //writes the currently selected emission factors to the log file //MDY long ll_row long ll_rc long ll_generic = 0 long ll_genericControlled = 0 long ll_state = 0 long ll_stateControlled = 0 long ll_county = 0 long ll_couDAT* ntyControlled = 0 long ll_source = 0 long ll_sourceControlled = 0 long ll_process = 0 long ll_processControlled = 0 long ll_genericSpeciate = 0 long ll_processSpeciate = 0 long ll_unknown = 0 long ll_total = 0 string ls_factorType string ls_controlCode //loop through the emission factor buffer for ll_row = 1 to dw_emis_fact.rowCount() //get the factor type ls_factorType = trim(upper(this.dw_emis_fact.getItemString(ll_row, "factor_type"))) if ls_factorType = "" then mesDAT* sageBox("Error", "uo_emission::uof_log_factors(); getItemString() failed.", exclamation!) return -1 end if //get the first control code ls_controlCode = trim(upper(this.dw_emis_fact.getItemString(ll_row, "control_1_device_code"))) if ls_controlCode = "" then messageBox("Error", "uo_emission::uof_log_factors(); getItemString() failed.", exclamation!) return -1 end if //count the current factor if isNull(ls_controlCode) then //uncontrolled factor choose case ls_fDAT* actorType case "G" ll_generic ++ case "Q" ll_state ++ case "R" ll_county ++ case "M" ll_source ++ case "S" ll_process ++ case "P" ll_genericSpeciate ++ case "F" ll_processSpeciate ++ case else ll_unknown ++ end choose else //controlled factor choose case ls_factorType case "G" ll_genericControlled ++ case "Q" ll_stateControlled ++ case "R" ll_countyControlled ++ case "M" ll_sourceDAT* Controlled ++ case "S" ll_processControlled ++ case "P" ll_genericSpeciate ++ case "F" ll_processSpeciate ++ case else ll_unknown ++ end choose end if ll_total ++ next if w_emiss.ii_log_file <> -1 and dec(w_emiss.em_log_detail.text) >= ai_logLevel then if ll_total > 0 then fileWrite(w_emiss.ii_log_file, " Factor(s) Found:") else fileWrite(w_emiss.ii_log_file, " No Factors Found.") return 0 end if if lDAT* l_generic > 0 or ll_genericControlled > 0 then fileWrite(w_emiss.ii_log_file, " Generic/Uncontrolled: " + string(ll_generic) +& " Generic/Controlled: " + string(ll_genericControlled)) end if if ll_state > 0 or ll_stateControlled > 0 then fileWrite(w_emiss.ii_log_file, " State/Uncontrolled: " + string(ll_state) +& " State/Controlled: " + string(ll_stateControlled)) end if if ll_county > 0 or ll_countyControlled > 0 then DAT*  fileWrite(w_emiss.ii_log_file, " County/Uncontrolled: " + string(ll_county) +& " County/Controlled: " + string(ll_countyControlled)) end if if ll_source > 0 or ll_sourceControlled > 0 then fileWrite(w_emiss.ii_log_file, " Source/Uncontrolled: " + string(ll_source) +& " Source/Controlled: " + string(ll_sourceControlled)) end if if ll_process > 0 or ll_processControlled > 0 then fileWrite(w_emiss.ii_log_file, " DAT*  Process/Uncontrolled: " + string(ll_process) +& " Process/Controlled: " + string(ll_processControlled)) end if if ll_genericSpeciate > 0 then fileWrite(w_emiss.ii_log_file, " Generic/Speciate: " + string(ll_genericSpeciate)) end if if ll_processSpeciate > 0 then fileWrite(w_emiss.ii_log_file, " Process/Speciate: " + string(ll_processSpeciate)) end if if ll_unknown > 0 then fileWrite(w_emiss.ii_log_file, " Unknown Type(s)DAT* : " + string(ll_unknown)) end if end if return 1 end function public function integer uof_discard_factors_by_date_and_type (); //uo_emission::uof_discard_factors_by_date_and_type() /* Compare rows of dw_emis_fact (emission factor buffer) and discard duplicate factors based on factor type and factor date. Compare on the following fields: scc_Ams_Code unit_Code throughput_Material_Code throughput_Unit_Code factor_Type profile_Code control_1_Device_Code contrDAT* ol_2_Device_Code epa_Date If any two records match, then discard the one with the lowest priority factor type. MDY 12/8/98 */ string ls_factorType[2] datetime ld_epaDate[2] integer li_priority[2] long ll_rc long ll_rowCount long ll_i, ll_k long ll_dateDiscardCount long ll_typeDiscardCount long ll_discardCount long ll_discardRow boolean lb_rowDiscard[] string ls_excludeCompare[] ls_excludeCompare[1] = "factor_type" ls_excludeCompare[2] = "epa_date" ll_dateDiscardCDAT* ount = 0 ll_typeDiscardCount = 0 ll_discardCount = 0 ll_rowCount = this.dw_emis_fact.rowCount() if ll_rowCount <= 1 then return 0 //initialize the discard flag array lb_rowDiscard[ll_rowCount] = FALSE //loop through the emission factors for ll_i = 1 to ll_rowCount - 1 if lb_rowDiscard[ll_i] then continue //row already flagged //grab the first factor's type ls_factorType[1] = trim(upper(this.dw_emis_fact.getItemString(ll_i, "factor_type"))) if isNull(ls_factorType[1]) tDAT* hen ls_factorType[1] = "" //grab the first factor's epa_date //ld_epaDate[1] = dw_emis_fact.object.epa_date[ll_i] ld_epaDate[1] = this.dw_emis_fact.getItemDateTime(ll_i, "epa_date") if isNull(ld_epaDate[1]) then messageBox("Error", "uo_emission::uof_discard_factors_by_date_and_time(); " +& "DATA Error: column 'epa_date' can't be NULL in table " +& "'rap_emission_factors'", exclamation!) return -1 end if //prioritize the factor type by assigning values //larger DAT* numbers mean higher priority choose case ls_factorType[1] case "G" //generic factor li_priority[1] = 10 case "P" //generic speciate factor li_priority[1] = 10 case "Q" //state specific factor li_priority[1] = 20 case "R" //county specific factor li_priority[1] = 30 case "M" //source specific factor li_priority[1] = 35 case "S" //process specific factor li_priority[1] = 40 case "F" //process specific speciate factor li_pDAT* riority[1] = 40 case else //factor type can't be prioritized here continue end choose //inner loop to compare outer loop row to all following rows for ll_k = (ll_i + 1) to ll_rowCount if lb_rowDiscard[ll_k] then continue //row already flagged //grab the second factor's type ls_factorType[2] = trim(upper(this.dw_emis_fact.getItemString(ll_k, "factor_type"))) if isNull(ls_factorType[2]) then ls_factorType[2] = "" //grab the second factor's epa_date DAT* ld_epaDate[2] = this.dw_emis_fact.getItemDateTime(ll_k, "epa_date") if isNull(ld_epaDate[2]) then messageBox("Error", "uo_emission::uof_discard_factors_by_date(); " +& "DATA Error: column 'epa_date' can't be NULL in table " +& "'rap_emission_factors'", exclamation!) return -1 end if //if the factor types and dates match, //then no prioritization can be done here if (ls_factorType[1] = ls_factorType[2] and ld_epaDate[1] = ld_epaDate[2]) then continue eDAT*p nd if //prioritize the factor type by assigning values //larger numbers mean higher priority choose case ls_factorType[2] case "G" //generic factor li_priority[2] = 10 case "P" //generic speciate factor li_priority[2] = 10 case "Q" //state specific factor li_priority[2] = 20 case "R" //county specific factor li_priority[2] = 30 case "M" //source specific factor li_priority[2] = 35 case "S" //process specifiDAT* te_time ='2005-01-31 15:29:39.233000' and end_date_time ='2005-01-31 15:29:39.233000' and ( method_type =' ' OR SUBSTR ( method_type , 1 , 1 ) =' ' ) and reference_type ='EE' and value_amt is not null and value_unit_code is not null ORDER BY creation_date_time DESC jm"%YVV`YSAYSASELECT rap_activities.value DAT* FROM rap_activities WHERE ( rap_activities.ref_rid =0 ) AND ( rap_activities.metric_code ='SEASON' ) AND ( rap_activities.metric_level_type ='PRO' ) PQZ ZSAZZSAf_sqlcheckSELECT rap_season_adj_factor.saf FROM rap_season_adj_factor WHERE ( rap_season_adj_factor.geographic_state_rid =0 ) AND ( rap_season_adj_factor.geographic_county_rid =0 ) AND ( rap_season_adj_factor.scc_ams_code =' ' ) DAT* AND ( rap_season_adj_factor.season =' ' ) AND ( rap_season_adj_factor.factor_type ='U' ) pqx\C[SA\\SASELECT rap_season_adj_factor.saf FROM rap_season_adj_factor WHERE ( rap_season_adj_factor.geographic_state_rid =0 ) AND ( rap_season_adj_factor.geographic_county_rid =0 ) AND ( rap_season_adj_factor.scc_ams_code =' ' ) AND ( rap_season_adj_factor.season =' ' ) AND ( rap_season_adDAT* j_factor.factor_type ='G' ) pq2^\SA|^D^SASELECT amt , exponent_amt , throughput_unit_code , unit_code FROM rap_emission_factors WHERE ( SUBSTR ( emittant_material_code , 1 ) =' ' OR '@' =' ' ) AND ( SUBSTR ( throughput_material_code , 1 ) =' ' OR '@' =' ' ) AND process_rid =0 AND SUBSTR ( factor_type , 1 ) ='A' and epa_date <= '2005-01-31' and SUBSTR ( throughput_material_codeDAT*8  , 1 ) is NOT NULL ,`^SAp`8`SASELECT amt , exponent_amt , throughput_unit_code , unit_code FROM rap_emission_factors WHERE ( SUBSTR ( emittant_material_code , 1 ) =' ' OR '@' =' ' ) AND ( SUBSTR ( throughput_material_code , 1 ) =' ' OR '@' =' ' ) AND factor_type ='C' and epa_date <= '2005-01-31' and SUBSTR ( throughput_material_code , 1 ) is NOT NULL DAT* g@ @TAg@g@g@X@X@+c@c@8@@D`@`@Nj@j@\k@k@hl@l@|m@m@@@@@@@@@^@^@g@q@q@p@F@F@| RnTp@PT dt  D  @v@v@@ H8 uo_topleveluserobjectuserobjectswindowobjectborderstylestructuremailrecipientenvironmentmailfiledescriptionmailmessDAT* agedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject ;uo_emissiontransaction XXXHR Xw_emiss L< 8Q8Q8QDAT* HRpointerSelect to_process_rid from rap_streams where from_process_rid =0 and to_process_rid is not null ?@SAX SASelect Count ( *) from rap_streams where to_process_rid =0 9:SA SASelect count ( *) From rap_group_membersDAT*  Where child_ref_rid =0 >?HSASA>?HTA8@TAf_db_errorSELECT rap_sources.name , rap_sources.id FROM rap_sources WHERE rap_sources.rid =0 QRTATAw_emiss_statusDAT*  |$SELECT rid FROM rap_geographic_locations WHERE parent_rid =0 ;<dcounty_curnTASELECT name FROM rap_geographic_locations WHERE rid =0 56D TAdeHTATATA $;<4statDAT* e_cur" XP>TTA56 TA8TAA TAP TA-SELECT rap_devices.rid FROM rap_devices WHERE rap_devices.source_rid =0 FG1 device_cur TA t8 DAT* TAsqlcaSELECT COUNT ( *) FROM rap_connections WHERE to_device_rid =0 <= z TAst TA-SELECT rap_processes.rid FROM rap_processes WHERE rap_processes.device_rid =0 LM4 process_cur H > TA: TA- $SELECT rid ,DAT*  type FROM rap_sources WHERE geographic_county_rid =0 @A source_cur < * TA56 TA TAf_sqlcheckP TA TA56 TA TADAT* message8@h8`  X \         @ D    d jn t DH       4 :> DPTd      P T DAT*         8 <     4 : > D       & * 0        P T       2 uo_toplevel  0 pl_source_ridpt_src_trans_objectpi_log_filetf_lpl_source_listpi_num_sourceuof_sDAT* ource_listpl_src_process_ridpt_trans_objectpl_target_processuof_downstream_processpl_process_riduof_orig_processpt_proc_trans_objuof_process_grppl_device_ridpt_proc_trans_objectuof_device_grppd_start_datepd_end_dateps_referenceps_ini_fileps_ini_sectionpi_num_calc_prots_lps_calc_protspi_num_modesteps_modespi_num_pollutants_mps_pollutantsuof_source _lte_muof_deviceuof_source_namepl_state_rid_lteDAT* _muof_statepl_nation_rid_lte_muof_nationf_pl_arraypi_ubpi_incrementuof_incr_unb_arraypt_dev_trans_object_lpl_device_listpi_num_devicepi_dev_ubuof_device_list_lpl_process_listpi_num_processpi_pro_ubuof_process_listpl_county_rid_lte_muof_countyarg_tranobjuof_disconnect8        DAT*        +destructor+constructor+create+destroy8 LXdL(4@LXdp|+x DAT* *D8SILRCtransaction.IRL[]RIqILRCtransaction.RL)ILRCtransaction. 1?KXd*sIWWLSSSIIS[]IS[]IS[]pi1?KXd*sDAT*  *ILRICtransaction.1??K*sLXdIWWLSRIIS[]IS[]IS[]1?zK*sQRL[]RIICC*#1DAT*HILRCtransaction.IRL[]RIRI *XLhw1?K*sIWWRLSRIIS[]IS[]IS[]QCtransaction.LQ\  @x  (p  x _initsrcuserobjectuo_topleveluserobjectswindowobjectborderDAT* p@@UA>p@p@p@@@\@\@'[@[@3c@c@@U@U@Q`@`@[j@j@ik@k@ul@l@m@m@a@@a@@a@@q@@a^@^@@@`@@a@@a%@@0@@A:@@F@@AR@@[S@S@Ad8@8@0g@@X@X@a@@@@@@8n@n@C@@L@@g@q@q@a@@` @@`D@DAT* @Mn@pTn@co@o@Qg@@ F@F@ < e=pp g@ /g@)`@v@v@antjwnt o@`d@d@qp@yasmwasp@n w_emisswindowmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectDAT*  Dstatictextfontcharsetfontpitchfontfamilyalignmentfillpatternborderstyleeditmasktextcasemaskdatatyperia u_class_ss_clientuserobjectsu_class_source_group CcheckboxcommandbuttonddatawindowdwobjectlistboxC duo_topleveltransaction DAT* xԑ xԑ xԑsinglelineeditxԑdropdownlistbox groupboxu_dddwu_dw_unit_codedatastored_units_dddw_on_qccheckeru_pollutant_ee 4QDAT* ˵4QEmission EstimatorEMISS.ICO ˵ 4Q>˵˵ 4QMS Sans SerifEmission Factor Cutoff Datemmm dd, yyyyjan 01, 1900~dec 31, 2100eP?? 8List Level SelectionDAT* s in Log FileFiles...View...ArialLog Detail##1~48TF??d_composite_efRule EffectivenessRule PenetrationPeak Season Ozone Daily EmissionsPeak Season CO Daily EmissionsL GZk GZkUse All Modes@ Run Calculation in BackgroundDAT*  Stop At First Successful Estimate1~9<??Use Priorities 1 ThroughUse All Methodsʑ CalculateExitʑn@??JAN 1, 1900~DEC 31, 21003??Yearly ʑDAT*   ʑ End DateStart DateIntervalLog FileOptionsCalculation MethodModeCalculation Periodd_ref_codes_table_dddw  pointergs_inifilesqlca-SELECT name FROM rap_calculation_methods meth_cur@.  UAuo_emissionn@| DAT* UAu UAgd_process_ridSELECT mode_type FROM rap_processes WHERE rid =0 /06  UAt < UA-SELECT type , name FROM rap_modes mode_cur UA UA\UAu_poDAT* llutantstr_emission_parmmessagegl_source_ridSELECT device_rid FROM rap_processes WHERE rid =0 01UA<UASELECT source_rid FROM rap_devices WHERE rid =0 ./0xUAUASELECT geographic_county_rid FROM rap_sources WHERE rid =0 9:`$DAT* UAdUASELECT parent_rid FROM rap_geographic_locations WHERE rid =0 ;<UATUA;<UA UAu_ds_baseSELECT name FROM rap_geographic_locations WHERE rid =0 56JUADAT* PUAdragobjectw_select_file_modef_display_filew_emiss_statustT| 4\0XLx(0t4 ` h    ( 0 T    DAT*  h     8 |    6 < t x      $ \ `  < @    `d    T X    JP   2 w_emiss ;'@ wf_initializewf_dbconnectwf_dbdisconnectpt_trans_objectwDAT* f_load_calc_methods_listwf_select_all_methodswf_deselect_all_methodswf_load_pollutants_listwf_load_modes_listwf_select_all_modeswf_deselect_all_modespi_num_pollutantsncps_pollutantspi_log_filewf_get_pollutantspi_num_calc_prots@_lps_calc_protspi_num_modes@_rps_modes_mwf_get_user_inputswf_set_ridpl_county_ridwf_get_county_namestart_date_strend_date_strcutoff_date_strwf_checkdatesde    +oDAT* pen+close+create+destroy+clicked+constructor+row+dwo+itemfocuschanged@h ,P I3=IRCtransaction.3=3=3=IRIRS[]ICtransaction.ho,L@ZthIIRIRS[]RIRS[]RIRS[]3=IICtransaction.SLISSSLQ lDAT* q6LLCdwobject._mlq6 (4@,\ xH _initsrcwindoww_emissmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectstatictextst_cutoff_datefontcharsetfontpitchfontfamilyalignmentfillpatternborderstyleeditmaskem_cutoff_datetextDAT* casemaskdatatypeu_class_ss_clientuo_ssuserobjectsu_class_ss_client`cb_debugu_class_ss_client`pb_printu_class_ss_client`st_data_levelu_class_ss_client`st_4u_class_ss_client`st_result_countu_class_ss_client`st_3u_class_ss_client`st_filter_countu_class_ss_client`st_source_countu_class_ss_client`st_2u_class_ss_client`st_1u_class_ss_client`cb_source_selectoru_class_source_groupcheckboxcbx_log_listcommandbuttoncb_browsecb_viewst_log_detailem_log_detaildatawindowdw_composite_efdDAT* wobjectlistboxlb_optioncbx_modesuo_topleveluo_tluo_toplevel`uo_emistransactioncbx_backgroundlb_modescbx_stopem_priorityst_prioritycbx_all_methlb_calc_methodssinglelineeditsle_log_filecb_okcb_cancelem_endem_startdropdownlistboxddlb_intervalst_endst_startst_intervalcbx_log_filegroupboxgb_log_filegb_optiongb_calc_methgb_modegb_intervalu_dddwdw_input_ref_codedw_ref_codeu_dw_unit_codedw_unit_codedatastoreu_pollutant_eeuo_pollutantu_pollutant_ee`dw_material_groupDAT* u_pollutant_ee`cb_remove_allu_pollutant_ee`cb_add_allu_pollutant_ee`st_2u_pollutant_ee`dw_materialu_pollutant_ee`st_1u_pollutant_ee`gb_1pointeruo_emissionu_pollutantstr_emission_parmmessageu_ds_basedragobjectw_select_file_modew_emiss_status@ @%@0@<@I@Z@d@r @~ @DAT*  @@!` !@@ @@@A@s@"@@d@v@@ @@@@;(@84@!@@IX@!a@n<@Pl sel m@mates,escsDAT*  ! ,8 Z | <$)@)@&@8,8(86 @/AQ!@@KZ"@blSv#@<,$/@DAT* g %@) !T"8 # BREAT*$lu 1%M:&@J&<X'_(7h)<t*M grou'@7+,-./e(DAT* (@0<1 )7@2*@ +@3(4OI5f6789:-@-0=@2@83@ 4@ -7@R8@ &9@$9<@ DAT*  ! " # $ % & ' (  )! *" +#.0123589; <:>?@ABCDAT* DFGHIJLMNOPRSTUVXY[^ _] ` ] a] b] c] d] e]f v*. DAT* G9004( 1!--/-/-. G9004y%7A2##--:@5 (!--7A2##--G900.DAT*  --7A2##E;-##/-/-G900G900KG7%%. . . --Q%Q%Q%QDAT* %Q%Wy- 'Wy- 'Z{- (]5* +!     p:F@@81}(9}@$P8X08_3@3$C@C81<Y(@(8z'@88g3@3$C@DAT* C81<Y(@(8z'@8|$,.68080380)@)8@8$,.68080380)@)8@8$80/) 81<h1/)<81<1P$X8`0l$|9}DAT* $9}$9})8$801 4#H$l%'4)- 305X@hBFILMN$Q6TZd3 ld_start_dateld_end_dategs_inifilesqlcaP  ".@-/@= ii_log_filePib_abortQddlb_interval0BLtextHYearlyJan 1, Dec 31, em_startpAJDAT* Hcalculation periodstart_datemmm dd, yyyyem_endct@IHend_dateem_cutoff_date+HJan 01, 2100wf_load_calc_methods_listzwf_load_modes_list~(em_priorityD9AH9cbx_stopb8@checkedtcbx_modes49tlb_modes7?enabledwf_select_all_modesem_log_details13H1 ( @ P |        < P X l DAT* |          :F@@8/j,/8$0,/,840,/,/X$18`08f,/p$(@(8z',/x$z&:)@:@@811  ( D `fd sqlca/@=0 transaction=ODBCConnectstring='DSDAT* N=Rapids Database'LOGINError   , X p x 6:F@@8,/1 d sqlca/@= ^!:F@@8- -$1$($800T$-)l81$)8- -$1d:8088DAT* z%:)@:@@8-1-$1$$800$-)8-1-$1$6) 8- -($1d$-0$18$@$800H$-)P8-1--X$1`$h$800p$-DAT*" )x8-1$19)8-1,F!# $&%6'T)*.03467 9>;~<>ABDFGLNBOHd* pt_trans_objectls_namemeth_cur< =  8 > uo_tl5;uo_emis !wf_load_calc_methods()ii_log_fileGPuof_sql_error4\lb_calc_methodstDAT*$ <Dresetwc5Emission EstimatorError: No calculation protocols foundt5; !GP4\t<Dadditem.5; !GP4\5; !GP4\t<Dsetstate:  ( T l             ( 0 8 @ H P X ` h p x  DAT*&  :F@@81}:$),84$9)H801  ^ d li_itemP lb_calc_methods<Dtotalitems? <Dsetstate:< , 4 H :F@@81}:$),84$9)H801DAT*(   ^ d li_itemP lb_calc_methods<Dtotalitems? <Dsetstate:< , 4 H 1d pt_trans_object = */:F@@81}1}80Q13 vQ1,/x - -$1,$DAT** <$8D0h$-)81$)8- $-$1d8080:)@:@@8-1-$1$$8D0$-)8-1-$1V$6) 88(l}0$9)D8DAT*, - `-L$1dVR-T$1R\$d$8D0l$-)t8-1--|$1$$8D0$-)8-18$9)8-1,>P`d)v*,.2678,:F<z=>@BCHJK(NLO`RlSDAT*. ~VWXZ[]_<`BbReVffhjkpqstdl pt_trans_objectls_namels_typels_default_modeli_mode_ctrli_indexgd_process_ridsqlcamode_cur =  ( 8DM1~\/@=b > uo_tl$5;uo_emis4!wf_load_modes_list()ii_log_fileYPuofDAT*0 _sql_error4plb_modess_o7?resette5Emission EstimatorError: No modes foundan$5;4!YP4p7?additem.NORMAL7?setstate:8$5;4!YP4p$5;4!YP4p7?:8  , < h              0 D L T \ d DAT*2 l t |       :F@@81}:$)(80$9)D801  ^ d li_itemL lb_modesobj7?totalitems?7?setstatetr:8 ( 0 D :F@@81}:$)DAT*4 (80$9)D801  ^ d li_itemL lb_modes7?totalitems?7?setstate:8 ( 0 D 1dP pi_num_pollutantsps_pollutants pi_log_filept_trans_object(P(-4@ = DAT*6  z$($::F@@8T:F@@88$H$/)d81<,/1<8l0A@A88n8z%A@A81$$/)81<,/1<88z%A@A88l0A@A81<T$11DAT*8 )l8$)8-1<d$-< 8016:T!&)X*^+r-/367*8>;dd pi_log_filepi_num_calc_protsps_calc_prots pi_num_modesps_modes pi_num_pollutantsps_pollutants sqlca4X4&-@XDAT*: M-dv-/@=p cbx_background6>checked uo_tl05;uo_emis@!uof_get_calc_prots6P Ending emission estimation. Reading user-selected calculation protocols failed.05;@!uof_get_modes:Reading user-selected mode(s) failed. !rEnding emission estimation.is_user_unit-jdw_unit_codeorDN[getitemstringns\uo_pollutanttO^uf_get_emittants2DAT*< is_poll_calc_failsU ( 8 H d    < T l     n:F@@8,5$ 18H$6P$8X`,6x,68Q1Q18\$$8DAT*> $ $8$,$DL$T$\$1"xl$$:W@)8$t1 $1$@$1d$1H8088!z%,$(@(8z(:)@:@@88084DAT*@ 8Lz%:)@:@@81d$1t$$80)81$1:$$1d8088!z%$(@(8z(:)@:@@81:$1:$$80) 81$1DAT*B p$$,$1d80848!z%P$(@(8z(:)@:@@81pX$1p`$h$80)p81x$1$X$1d>8088!z%$(@(8z(:)@:@@81DAT*D $1$$80)81$1$$1dt8088!z%$(@(8z(:)@:@@81$1$$,$80)481<$T$p$1)8$$$DAT*F $801$)98$1 $$$$801 $) 98($1h 0$8$@$H$8X01P$)d98l$1 t$|$$$801$)98$1 $$$$80DAT*H 1$)98$$$180/)T8\$1V d$l$t$|$801$)98$$$180/)8$$$11:@$$$1:@)088$P$`8h0l$$80DAT*J $$8h0$$$680$$1)81 0Fh !:#X$p%'()-2(3T4d7t9x;=>@ABDDEHHIJKLMQSU(V4XBY\[\]^_$`*d:fRh^ijkxlnopq"rZs`wpy{|~$*:XDAT*L Z`p t  h \  V N da pi_log_filept_trans_objectstr_parmmessagecase21gl_source_ridgd_process_ridls_str =$ i-5@j5 =6@K1~Z  ^@il_start_ridRis_start_level(Slevel@(SSODAT*N URCERil_source_ridhZPROCESSRil_process_rid\COUNTYRridil_county_ridYSTATE_eRil_state_rid1XNATIONRil_nation_rid4WRRuo_sstyd,cb_source_selectort+#triggerevent ib_abortQ\il_device_rid[\\Emission EstimatorProcess record not found for rid=\Process not selected. PleaDAT*P se select process. uo_tll5;uo_emis|!wf_set_rid()uof_sql_error4[hZ[Device record not found [l5;|!4hZYhZSource record not found hZl5;|!4YXYCounty record not found Yl5;|!4X4WXState record not found Xl5;|!4d,icDAT*R lass_groupD,$ids_sourcecriteria\ insertrow0xd,D,$\ object@4Wnation_rid__set_attribute_itemXd,D,$\ @Xstate_rid$Yd,D,$\ @Ycounty_ridhZd,D,$\ @hZsource_rid[d,D,$\ @[source_sub1_ridd,D,$ids_groupdata d,D,$data_levelDAT*T d,D,$setitemL\d,D,$\ @\source_sub2_ridd,D,$ d,D,$d,D,$Ld,D,$\ d,D,$ids_resultset  rowscopy$d,st_source_count@( text1X1d,st_filter_countt'X0d,st_result_count%Xd,st_data_level#X@ d,D,$of_getsourcesql  8 DAT*V H P ` x            $ , D L T \ l         , d t               $ , P X ` h p x          DAT*X      $ , 4 < T p                 ( 0 8 @ H P d l t |                 ( < D T \ d l t |     DAT*Z             0 8 P ` l             *,/6  d$ pl_county_ridls_namesqlca</@= ,:F@@8#8080:)@:@DAT*\ @8<$)P81#808X0:)@:@@8t$)|81#d8080:)@:@@8$)816@86@8#@#818080:)@:@@8$)811  ( \ xDAT*^ 8T!d"%&)d4 start_date_strend_date_strcutoff_date_str<  $ @ Emission EstimatorStart Date is Invalidem_start1AJsetfocusDEnd Date is Invalidem_endl@IDCutoff Date is Invalidl@IDStart Date must be earlier than End Date 1AJD< P t |     )DAT*` 81<8@8,$,/)@81<@8,51,5H$ 8hd sqlca::message(/@=5@jP wf_initializewii_log_file Pwf_set_rid4 , @ H $1<$$4$<$)P8X$/@/8DAT*b `1},51,5h$  N nd ls_log_close::message( 5@jp@ ii_log_filePuo_tl5;uo_emis,!Puof_end_log9DPP $ 4 < P X ` h *'(* 8*@P*Xp*x**DAT*d ***  *(<*DT*\t*|***** $*,D*L\*dx*******$<DAT*f *DX*`t*|*****(*0H*P`h$p$x$$$$$$$$$$$$$$$$$$$$$DAT*h  $($0$8$@$H$P$X$`$h$p$x$$$$ &|,BXn 4J`v&<Rh~ !"#$%&'.(Dd  st_cutoff_date*em_cutoff_date(+(uo_ssH,Hcbx_log_list`-.DAT*j `.cb_browse.00cb_view/11st_log_detail022em_log_detail@133dw_composite_ef255lb_optiont388cbx_modes04909uo_tl L5;L;cbx_background d6>d>lb_modes7??cbx_stop18@@em_priority9AAst_priority:BBcbx_all_meth;CClb_calc_methods<DDsle_log_file4=F4Fcb_okT>GTGcbDAT*l _cancell?HlHem_end@IIem_startAJJddlb_intervalBLLst_endCMMst_startDNNst_intervalEOOcbx_log_filee r,FP,Pgb_log_fileLGRLRgb_optionhHShSgb_calc_methITTgb_modeJUUgb_intervalKVVdw_input_ref_codeLXXdw_ref_codeMYYdw_unit_code N[[uo_pollutant 8O^8^controlXDAT*n c@*(+H,`-..0/102132538049L5;d6>7?8@9A:B;C<D4=FT>Gl?H@IAJBLCMDNEO,FPLGRhHSITJUKVLXMYN[8O^  8 @P Xp x        (< DT \tDAT*p  |      $ ,D L\ dx       $< DX `t |     ( 0H P` h p x        DAT*r                ( 0 8 @ H P X ` h p x    &$0$@$X$l$|$$$$$$$$($<$P$d$|$$DAT*t $$$$$ $$0$D$\$p$$$$$$$$ $*8FT b p ~  &4BP^lz !"#$%&'d (0 st_cutoff_date*em_cutoff_date DAT*v +uo_ss*8,cbx_log_list*H-.cb_browse`.0cb_viewt/1st_log_detail002em_log_detail113dw_composite_ef25lb_option38cbx_modes49uo_tl5;cbx_background6>lb_modes7?cbx_stop08@em_priorityD9Ast_priorityX:Bcbx_all_meth l;Clb_calc_methods<Dsle_log_file=Fcb_ok>Gcb_cancel?Hem_end@Iem_start$AJddlb_intervalBLst_endCMst_staDAT*x rt$DNst_interval8EOcbx_log_fileLFPgb_log_filedGRgb_optionxHSgb_calc_methITgb_modeJUgb_intervalKVdw_input_ref_codeLXdw_ref_codeMYdw_unit_codeN[uo_pollutantO^ 0 @ X l |        ( < P d |          0 D \ p  DAT*z         &wxyz{|}~     F&2 ? wf_initializewf_dbconnectwf_dbdisconnectwf_load_calc_methods_listwf_select_all_methodswf_deselect_all_methodswf_load_pollutants_listwf_load_modes_listwf_select_all_modeswf_deselect_all_modeswf_get_pollutantswf_get_user_inputswf_set_ridwf_get_county_namewf_checkdates+open+close+createDAT*| +destroy|#3Mc{     !'.62  widthheighttitlebartitlecontrolmenuminboxmaxboxresizablewindowstatebackcoloricoDAT*~ nst_cutoff_dateem_cutoff_dateuo_sscbx_log_listcb_browsecb_viewst_log_detailem_log_detaildw_composite_eflb_optioncbx_modesuo_tlcbx_backgroundlb_modescbx_stopem_priorityst_prioritycbx_all_methlb_calc_methodssle_log_filecb_okcb_cancelem_endem_startddlb_intervalst_endst_startst_intervalcbx_log_filegb_log_filegb_optiongb_calc_methgb_modegb_intervaldw_input_ref_codedw_ref_codedw_unit_codeuo_pollutantii_log_fileib_abortil_start_ridis_start_levelil_orig_process_rDAT*idil_discharge_proc_ridil_prev_process_ridil_nation_ridil_state_ridil_county_ridil_source_ridil_device_ridil_process_ridii_start_rid_ubii_cnty_rid_ubis_state_nameis_headerid_estimator_time_stampil_total_fug_emissions>il_uncontrolled_process_ridis_data_typeis_priorityis_group_numis_method_typeis_method_typesD@ ii_num_methodsis_user_unitis_input_ref_codeis_ref_headeris_input_ref1is_input_ref2is_input_ref3is_input_ref4is_ro_code_mapis_null_code_mDAT* @G@M@U^@js@}@@@nd@ordebj@commfo@arseh@famiEr@5@` @  "@8dDAT* ( )8}1<X11),8b984"6850@899,TXb~ !"d+ ps_msg_titlels_unit_codeli_valid<  "X accepttextgetitemstringSorry! Unit of Measure is required , DAT* $#* j4<$D8L0d$, )|8$80)811$1)88)81<R8088z%@81@$*)T8< * N n FRd ll_rcldwc_dddwsqlDAT*b,@8 d! file_namew_file_display( @  2  f_display_fileeven/S2  DAT* p@ @TA"p@p@p@q@@a#\@\@q.[@[@a:c@c@qGU@U@qX`@`@qbj@j@qpk@k@a|l@l@m@m@@@@@@@@@^@^@ @@@@'@@1@@<S@S@qE@@qQ@@p\@@af@@qr@@`mal.d@d@q9F@F@qAp@`Agb)Iv@v@I*Q w_emiss_statuswindowmenuwindowtypewindowstatewiDAT* ndowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject@ POsinglelineeditfontcharsetfontpitchfontfamilytextcaseborderstylestatictextalignmentfillpatterncommandbuttonEmission Estimator Status[] XUMS Sans SerifCounty:Material:Process (ID / Name):Device (ID / Name):Source (ID / Name):ArialCanceldragDAT* objectpointerw_emissmessage2 w_emiss_status  " +create+destroy+clicked QL x _initsrcwindoww_emiss_statusmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectsinglelineeditsle_countyfontcharsetfontpitchfontfamilytextcaseborderstylestDAT* atictextst_1alignmentfillpatternsle_materialsle_processsle_devicesle_sourcest_materialst_processst_devicest_sourcecommandbuttoncb_canceldragobjectpointerw_emissmessage\ @'@-,@7@C@P@a@%k@y @ @% @ @} @-DAT* @$@X@1@1@@@n%@,.@:@!EJ@T@!`m<y,   @ if$@M@DAT* @ @  !"#$&wW 5*;-##. ;-##;-##;-##;-##DAT* . . . . %- *,*4L*Th*p******,*4DL$T$\$d$l$t$DAT* |$$$$$ |,BXn d  sle_county*st_1$+$sle_material<,<sle_process\-\sle_devicex.xsle_source/ st_material0!!st_process1""st_device2##st_source3$$cb_cancel 4& &control<c@*$+DAT* <,\-x./ 0!1"2#3$ 4& , 4L Th p      , 4D L T \ d l t |      $$$<$P$d$x$$$$$$DAT* *8FT b p ~ d X sle_county*st_1+sle_material,,sle_processD-sle_deviceX.sle_sourcel/ st_material0!st_process1"st_device2#st_source3$cb_cancel4& $ < P d x      2  +create+destroy(2 DAT*  xywidthheighttitlebartitlecontrolmenuwindowtypebackcolorsle_countyst_1sle_materialsle_processsle_devicesle_sourcest_materialst_processst_devicest_sourcecb_cancel  "( 4 ?I T Y f r } DAT*  ! " # $ &] o    1  @@@      ! " #DAT*  $ &2  2 ~ xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorautohscrolldisplayonlyborderstylee @ %X "+2<GPDAT* Zfr] oe@%X  E@ @@ @@2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextalignmentfocusrectDAT* angle,` P H")3>GQ[chr] o`PH @ DAT* @2  2 u xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorautohscrolldisplayonlyborderstylee  %X")3>GQ]i] oDAT* e %X E@ @@ @@2  2 u xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorautohscrolldisplayonlyborderstylee  %XDAT* ")3>GQ]i] oe%X E@ @@ @@2  2 u DAT*  xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorautohscrolldisplayonlyborderstylee 0 %X")3>GQ]i] oe0%X E@DAT*  @@ @@2  2 u xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorautohscrolldisplayonlyborderstylee  %X")3>GDAT* @Q]i] oe%X E@ @@ @@2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextalignmentDAT* focusrectangle,` ( H")3>G@Q[chr] o`(H @ DAT* @2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextalignmentfocusrectangle,  .P")3>GQ[cDAT*hr] o.P @ @2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextalignmentfocusrectangle, 8DAT* p@)b?TA p@p@p@q@@a#\@\@a.[@[@:c@c@aGU@U@qX`@`@qbj@j@apk@k@q|l@l@m@m@@@@@@@@@^@^@ @@@@&@@0@@;@@@F@@P@@A\@@hn@n@@s@@@v@v@!@d@d@ w_file_displaywindowmenuwindowtypewindowstatewindowobjecttoolbaralignmDAT* entstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject@ fcommandbuttonfontcharsetfontpitchfontfamilystatictextalignmentfillpatternborderstyledatawindowdwobjectFile Display@ d?&PrintMS Sans SerifFile Name: d_file_displayE&xitc:\whateverArialmessagedragobjectf_print_file2 w_file_dDAT* isplay L +open+create+destroysizetypenewwidthnewheight+resize+clicked5 LQ (1LUII  x _initsrcwindoww_file_displaymenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectcommandbuttoncb_printfontcharsetfontpitchfontfamilystatictextsDAT* t_namealignmentfillpatternborderstyledatawindowdw_displayfiledwobjectcb_exitst_filenamemessagedragobject @'@-,@7@C@P@a@%k@y @ @% @$ $@\ d@@$$@@@$DAT* |@ @@@@"@R-Jp 5es@!?@K@W @!bq<@zidME@@  wW /*-DAT* . y%-. $$,,$6D$L$T$)h8118p01801801801>801dDAT* 8080)@)88z&806@8@8,1, $,dt !"#$%&(':(N)`*d,-/d3 ll_resultls_msgmessagecase28::messaged @!!)@!@ st_filename. textdw_displayDAT* file4,. importfile&\Invalid argumentInvalid inputCould not open the fileCould not close the fileError reading the fileNot a .TXT file0 Unknown errorFile Display Error $ , D L T h   *,*4L*Td*l*$$$$$ |,BDAT* Xnd cb_printme*st_name$+$dw_displayfile<,<cb_exit\-\st_filenamet. t controlc@*$+<,\-t.  , 4L Td l       L$$$<$L$`$*8d h( DAT*  cb_printme*st_name+dw_displayfile,,cb_exitD-st_filenameT.  $ < L ` h$($}0$)H8P$\$<<Y)t8|$$<<Y)8$$<<Y}$$<<R}1<4$},N1\,$DAT* "#&4dN sizetypenewwidthnewheightli_changeli_dwwidthli_stwidth::message $.9D@! dw_displayfile,width ,workspacewidtha8,xXworkspaceheight`d,y resize, st_filename. . DAT*  ( 0 H P \ t |          &.&.2 ' +open+create+destroy+resizeP2 xywidthheighttitlebartitlebackcolorcontrolmenuminboxmaxboxresizablewindowtypecb_printst_namedw_displayfilecb_exitst_filenameT DAT* N "|(2>ELVa j r   ] oN |  1 DAT* p@)b?TA-p@p@p@@@\@\@([@[@4c@c@AU@U@R`@`@\j@j@jk@k@vl@l@m@m@@@@@@@@@^@^@@@@@@@&@@1@@q=@@K@@ZS@S@c0g@@uX@X@a@@@@@@A@@@@n@n@ @@!///Lo@ 0q@q@!<ntGdBF@F@JDAT* YErdd@d@ov@v@QogJewga( w_growthwindowmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject Xradiobuttonfontcharsetfontpitchfontfamilyborderstylecommandbuttonsinglelineedittextcaseu_class_ss_clientuserobjectsu_class_source_group// L!DAT* statictextalignmentfillpatterngroupboxdatawindowdwobjectEmission Estimates GrowthEMISS.ICO P+ u_ds_base AppendMS Sans SerifOverwriteView...ArialBrowse...s TUPDATE data for current Source Selection, Projected Year and Output Reference Code:DELETE data for current Source Selection, Projected Year and Output Reference Code:Close&CalculateReady0OutDAT* put Activity Count:Input Activity Count:Log FileStatusGrowth Factor Count:Growth Parametersd_growth_parametersOutput Data Generationtransactionsqlcapointerf_get_sequencef_sqlcheckdragobjectmessagef_display_file$X2 w_growth %8 of_setdataof_retrieveinputof_retrievefactorsof_retrieveoutputof_calculateas_statusof_setstatusof_openlogfileof_closelogfileas_messageai_linesbeforeai_liDAT* nesafterai_timestampof_writelogmessage+create+destroy+open+close+closequery+clicked+modified+constructorrowdwodata+itemchanged IyVQSQrdeISIIIfISLore"D&LLCdwobject.S  Xl x _initsrcwindoww_growthmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmaDAT* ilmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectradiobuttonrb_appendfontcharsetfontpitchfontfamilyborderstylerb_overwritecommandbuttoncb_viewsinglelineeditsle_log_file_nametextcasecb_browseu_class_ss_clientuo_ssuserobjectsu_class_ss_client`cb_debugu_class_ss_client`pb_printu_class_ss_client`st_data_levelu_class_ss_client`st_4u_class_ss_client`st_result_countu_class_ss_client`st_3u_class_ss_client`st_filter_countu_class_ss_client`st_source_countDAT* u_class_ss_client`st_2u_class_ss_client`st_1u_class_ss_client`cb_source_selectoru_class_source_groupstatictextst_merge_mode_talignmentfillpatternst_overwrite_mode_trb_delete_moderb_merge_modecb_closecb_calculatest_statusst_factor_countst_output_countst_output_activity_count_tst_input_count_tst_input_countgroupboxgb_log_filegb_statusst_factor_count_tgb_growth_parametersdatawindowdw_growth_parametersdwobjectgb_merge_modeu_ds_basetransactionpointerdragobjectmessageDAT* @!@&@1@=@J@[@e@s @ @ @ cb_ co@dbut w@e_di t@ typam@om swi@ w_fy @ typwa@-@12@8@'8DAT* 4es@!BJ@Y !k@t<~@idME@h_ h   p@1 NOHp@p@jSTp@p@XYp@p@]@^p@@p@arrage@put_al@<DAT* %9$H8V_<l6Hv,,P@  !$" en@riab"#up87!@@$deitemN#@is_nX$@ue_id&@l)Er@w*8@DAT*   " # $ % & ' ( )  *! +" ,#/23456789:;?@ACE b ]*---;-##-4( 1!. . . . ---DAT* -. . . . . . . . . . . . = %= %. . = %By%= %     A$)$8DAT* #8,08:0:)@@8\$x$)81$18J8}$f8,080:)@@8 $)8$8)0881}1T\$18dJt8}|$H8,080:)@@8$)8$8dDAT* )81}1$18)8$8$($"D8,0800:)@@8\$)d8l$8)t8|8$01$18)8$8$$"@8,080:)@@8$) 8$8DAT* )8$8$01,$4$8<08J8|z%:)@@8$)8$8)88$08$01$$$$8$"8,08 0:)@@8($)08L8$0d8$01rl$tDAT* $|$r$$6$$6$80$ 808$@8H0`$,%)x8$,%)8$,%)8$)8$)8$)81101H$PXDAT* $(@(8p$x$(@(8$$(@(81 N t<Vf8!H"#$%&'4*D+~,-./004@5b789:;?@XABCDEGHIHNrOPRSTV>WZXv[\]^_ `Dc|d sqlca%@G uo_ss/DAT*  of_hasdata3Data RequiredPlease select Source Criteria./ cb_source_selectord+#setfocusii_baseyearMdw_growth_parameters@Cbase_yeargetitemnumber MPlease select Base Year.@C@Csetcolumn H$Mii_projectedyear@O@Cprojected_year @OPlease select Projected Year.@C@CH$@Ois_inputreferencecodeB@Cinput_referencegetitemsDAT* tringttBBPlease select Input Data Reference Code.@C@CH$Bis_outputreferencecodelC@Coutput_referencedesCCPlease select Output Data Reference Code.ec@C@CH$CCBData ConflictThe Output Data Reference Code must be different than the Input Data Reference Code.@C@CH$BCsle_log_file_name<-text-DAT* Please enter Log File name.-is_logfilepathname8Wis_logfilenameTX-8W8W-TX-ids_activityTFdataobjectd_growth_activity_selectids_factorUFd_growth_factor_selectids_output+VFd_growth_output_selectTFsettransobjecthUFh+VFhTFreset,UF+VFil_inputactivitycountQDAT* il_outputactivitycountSil_growthfactorcount$Rst_input_count8;<Qst_output_count`89Sst_factor_count78R $ \ x          0 8 T \ t |          ( \ d l t |         DAT*   $ , 4           ( 0 L d l t |            8 @ ` x             0 H P X p x      :F@@8DAT* $(@(88z&@8@8$$(@(88,z&@8@8<$T$l)8<188z%8z%111)8806:)@@81J1J8 8-z%8z%111)H88DAT* 06:)@@81hp$55$6$$$$$$$$$$$0$8$@$\$d$l$$) 8 $1808z%111)8806:)@@81DAT* $188z%($(@(8z(80z&H$z&8Pz%111)d88l06:)@@81|$  n*h: J*l+,-./0,3458d? ll_rcldt_startdatetimeldt_enddatetimels_messagetextP  DAT*  0 ( ii_baseyearM/01/01M/12/31uo_ss@3/ iclass_group\D,$ids_activity\TFof_modobjectsqltw_growth::of_retrieveInput(); call to uo_ss.iclass_group.of_modObjectSQL() failed.ERROR: of_writelogmessageErrorNo source group criteria data was added to ids_activity SQL.il_inputactivitycountPQ\TFis_inputreferencecodexB3/ D,$il_nationarray3/ D,$iDAT* l_statearray3/ D,$il_countyarray3/ D,$il_sourcearray 3/ D,$il_sourcesub1arrayH 3/ D,$il_sourcesub2arrayt retrieve$PQw_growth::of_retrieveInput(); retrieve() failed.PQNo activity data found matching: Base Year = M Reference Code = exBNo Input Data: No Input DataPQ $ < T l   H hDAT*  p             0 8 @ \ d l      ( H d |  :F@@8$,$D$`$!t$$!$$!$$!$($!1H\$d$l$DAT* t$6|$6$$)8$1808z%111)8806:)@@81$ ($08$6@H$6PX$}`h$}p$ Vn!"#2$R%r&DAT* (d ls_messagetext x  il_stateridEil_stateridlastFil_countyrid4Gil_countyridlast@LHis_scccodehIis_scccodelast|Jis_materialcodeKis_materialcodelastLii_baseyearMii_baseyearlastNii_projectedyearOii_projectedyearlast8Pil_growthfactorcount0Rids_factorPUFE4GhIKMOretrieve 0RDAT* w_growth::of_retrieveFactors(); retrieve() failed.ERROR: of_writelogmessageErrorFELH4G|JhILKNMPO0R , D ` t       ( H \ d l t |          ( 0 8 @ H P X ` h p , :F@DAT* @8$(@(88$z&@8@8,$(@(884z&@8@8D$\$p)8<188z%8z%111)88 06:)@@81J1J885z%8z%111DAT* )P88 06:)@@81px$55$6$$$$$$$$$$ $8$@$H$d$l$t$$) 8 $1808z%111)88 06:)@@DAT* 81$ n*h:!J+l,-./2d? ll_rcldt_startdatetimeldt_enddatetimels_messagetextP  0  ii_projectedyearO/01/01O/12/31uo_ss;/ iclass_groupastL,$ids_outputdVFof_modobjectsqlxw_growth::of_retrieveOutput(); call to uo_ss.iclDAT* ass_group.of_modObjectSQL() failed.ERROR: of_writelogmessageErrorNo source group criteria data was added to ids_output SQL. il_outputactivitycountXSdVFis_outputreferencecodeC;/ L,$il_nationarray;/ L,$il_statearray;/ L,$il_countyarray;/ L,$il_sourcearray(;/ L,$il_sourcesub1arrayP ;/ L,$il_sourcesub2arrays| retrievesXSw_gDAT* rowth::of_retrieveOutput(); retrieve() failed.XS , D \ p   P p x              8 @ H d l t       $(@(88$z&@8 ,$(@(884z&@88;0111DAT* )l88t0)880)88$(@(8z')88$(@(8z')88@$z%)H88P$z%)8$80111)8B80111)8$:F@@880)08P)lDAT* 8<t$1@81(|$1()81$$(@(88$(@(8z'8z&)8D@D$$1:F@@88 0)08P)l8<t$1n@81$$(DAT*" @(88$(@(8z'8z&)8D@D$$1$#80)8 $1~80)@8T$)h81p$1x$)8:@$1:@)8<1808z%111)8806:)@@DAT*$ 8@81$1$18 0)88@$"H$PX$(@(8:F@@88`0)x880111)81$)8"D@D$$F1$8J8DAT*& $$8,J88LT$8\)t8$8)8$8J8$8J8 $8)8 $8 )8 $8()88X)t8<|$1d @81" $1DAT*(  $)81 " $1" 88z%$z&8z&$z&8z&,$(@(8z(84z&L$(@(8z(8Tz&h$(@(8z(8pz&$(@(8z(8z%111)8806:)@@8$1 $$$6DAT** ~@~81R(@(81$18 J 8L5  8 08z%111)\ 8806:)@@8@81LLd 9}d $8l | $(@(8z'8 z&8 z& $(@(8z(8 z&8 z&(@(8z(8 z&8 z&DAT*  $z&8 z&8 z& $z&8 z&8 z& z&8 z&8 z& z&8 z&8 z&z&8 z& $1 $)( 8)8 818@ 08z%111)t 8806:)@@8@811| $8L1) 8 $8 L18 0)DAT*. p@ @TA$p@p@$p@q!@@q&\@\@q1[@[@=c@c@aJU@U@a[`@`@!ej@j@ask@k@l@l@m@m@@@@@@@@@^@^@ @@@@&@@0@@;@@F@@P@@a\@@Ah@@`qS@S@z8@8@@@@@ u lv@v@qje'_d@d@a` w_set_max_choiceswindowmenDAT*0 uwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject xcommandbuttonfontcharsetfontpitchfontfamilystatictextalignmentfillpatternborderstyleeditmasktextcasemaskdatatype4 5multilineedit@ ۳groupboxSDAT*2 et Maximum Values p܁MS Sans Serif&Ok&CancelMaximum Source Selections:Maximum County Selections:###1~999Hʑ????Set the maximum number of Counties and/or Sources that may be picked from the level selector window.p@LArialge_envgs_inifilemessagedragobject,DAT*4 2 w_set_max_choices  2 +open+create+destroy+clicked+modified LQ x _initsrcwindoww_set_max_choicesmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectcommandbuttoncb_2fontcharsetfontpitchfontfamilycb_1statictDAT*6 extst_2alignmentfillpatternborderstylest_1editmaskem_2textcasemaskdatatypeem_1multilineeditmle_1groupboxgb_1messagedragobject4 ce@ppen*te@@/@mess:@F@S@,do @Writn.@t۸| @ @P @ @8Z %@)@@11@@DAT*8 messje@1@%) @1@)4!1&@1s_g!6@@@Lpp@!X]<@fnintwikse@getwtct@w_sywash_h@_outycof@bjec  !@tern#it@ DAT*: "$&wW 2*--. . G900G900#@2((%% ,$5 Ik0$DAT*< : @?@?858@k]: @@8}D,L$5XIkh$: @?@?85p@k]: @@8}$, 680801@8(@(8$, 680801@8(@(8,"1,"$xT d$ ge_envgs_inifileDAT*> ::message<D  @"@'x x @width(@y@ @height`@em_1x/"textLevelMaxCountiesem_2.MaxSources   0 8D L Xh p     . *(*0@*HX*`DAT*@ p*x***$$$$$$$$ |,BXn d  cb_2,*cb_1k + st_2@8,8st_1kP-Pem_2h.hem_1"/""mle_1Ma0$$gb_11&&controlc@DAT*B * +8,P-h./"0$1& ( 0@ HX `p x            v$ $0$@$P$`$p$$*8FT bd @ cb_2,*cb_1+st_2(DAT*D ,st_1@8-em_2H.em_1X/"mle_1h0$gb_1x1&  0 @ P ` p  &&2  +open+create+destroy<2 r xywidthheighttitlebartitlecontrolmenuwindowtypebackcolorcb_2cb_1st_2st_1em_2em_1mle_1gb_1T  DAT*F "(4?I N S X ] b "g $m &] o  ,1  @@DAT*H @      " $ &&  x, 68080 $0$6@8, 680880H$P$6@8@8,"1,"DAT*J X$Jd gs_inifile::message( @"@'`( LevelMaxCountiesem_1/"text(MaxSourcesem_2C.( 0 H P X ""2  +clicked2 ] xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextdefault  DAT*L l2"+2<GTPbU] ol2 @T @b"J@8,"01>,"$DAT*N d ::message"@'  ""2  +clicked2 \ xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcancel  l("+2<GTPfUDAT*P ] ol( @T @f"2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle  HDAT*R ")3>TGQ[cnh ] oH @T n@ 2  2 w xywidthheightDAT*textsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle d H")3>TGQ[ch] odH @DAT*V p@)b?TAp@p@p@q"@@a'\@\@a2[@[@a>c@c@aKU@U@a\`@`@qfj@j@tk@k@l@l@m@m@q@@q@@@@@@^@^@a@@p@@*@@4@@?@@M@@WS@S@q`@@afou(v@v@(0d@d@; w_select_file_modewindowmenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenviDAT*X ronmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobject .commandbuttonfontcharsetfontpitchfontfamilymultilineeditalignmenttextcaseborderstyle8ŐSelect File Mode@ pݳCancelMS Sans SerifAppend&OverwriteArial &messagedragobjectl2 DAT*Z  w_select_file_mode ( +open+create+destroy+clicked LQ x _initsrcwindoww_select_file_modemenuwindowtypewindowstatewindowobjecttoolbaralignmentstructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectcommandbuttoncb_cancelfontcharsetfontpitchfontfamilycb_appendcb_overwritemultilineeditmle_messagealignmenttextcaseborderstyDAT*\ lemessagedragobject daf_ret@etriotrie+f_@ulat0at@f_op;of@seloGri@gmesT_s@ncee+@te+ope@lose} ry@V` @] @cord l_@rdsi _r@dsupa@at@@@efceco@/ _n@narr@/ '_sDAT*^ arra1>af@ i!LX@bte@!k@w<@@ wW .*---@2((~$$8,,4$DAT*` z'8<z&8Pz&,d1r,h$Jd message::message(@@p mle_message-textFile '' already exists. Overwrite or Append? $ 4 h *0*8P*Xl*t$$$$ |DAT*b ,BXd h cb_cancele*cb_appendle$+$cb_overwrite @,@mle_message`-`control|c@*$+@,`- 0 8P Xl t     >$($@$T$*d \ cb_cancele*cb_append_a+cb_overwriteDAT*d 0,mle_messageH- ( @ T &&2  +open+create+destroy<2 j xywidthheighttitlebartitlebackcolorwindowtypecb_cancelcb_appendcb_overwritemle_message 2  doS"SI(2= asDAT*f G Q aw^ ] o2  1  @@@    & DAT*h  xX1I+@8,>1L,$$d ::message@  ""2  +clicked2 h xywidthheighttabordertextcanceltextsizeweightfacenamefontcharsetfontfamilyfontpitch i_ 0ls IDAT*j l`tyl_"ou'ce.ub7t>ouGcoSou^] o0I`  @"X1I+@8,>1DAT*L,$$d ::message@  ""2  +clicked2 i xywidthheighttabordertextdefaulttextsizeweightfacenamefontcharsetfontfamilyfontpitch% 0 I` "'/8DAT*n forward global type w_set_max_choices from window end type type cb_2 from commandbutton within w_set_max_choices end type type cb_1 from commandbutton within w_set_max_choices end type type st_2 from statictext within w_set_max_choices end type type st_1 from statictext within w_set_max_choices end type type em_2 from editmask within w_set_max_choices end type type em_1 from editmask within w_set_max_choices end type type mle_1 from multilineedit within w_set_max_choices end type DAT* type gb_1 from groupbox within w_set_max_choices end type end forward global type w_set_max_choices from window integer x = 672 integer y = 264 integer width = 1449 integer height = 912 boolean titlebar = true string title = "Set Maximum Values" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 cb_2 cb_2 cb_1 cb_1 st_2 st_2 st_1 st_1 em_2 em_2 em_1 em_1 mle_1 mle_1 gb_1 gb_1 end type global w_set_max_choices w_set_max_choices event opDAT*r c factor li_priority[2] = 40 case "F" //process specific speciate factor li_priority[2] = 40 case else //factor type can't be prioritized here continue end choose //if neither factor types nor dates match, //then check for one factor that is higher in priority //for both type and date if (li_priority[1] < li_priority[2] and ld_epaDate[1] > ld_epaDate[2]) or & (li_priority[1] > li_priority[2] and ld_epaDate[1] < ld_epaDate[2]) then continueDAT*t  //no prioritization can be done here end if //compare two factors for rows ll_i and ll_k if not uof_compare_factors(ll_i, ll_k, ls_excludeCompare) then continue end if //If we made it to here, the factors match (except for date and/or type) //decide which of the two rows needs to be discarded if li_priority[1] < li_priority[2] or ld_epaDate[1] < ld_epaDate[2] then //first row needs to be flagged for discard ll_discardRow = ll_i //since we arDAT*v e discarding the outer loop row, no more inner loop //comparisons are necessary, break out of the inner loop by //setting ll_k higher than row count ll_k = ll_rowCount + 1 else //second row needs to be flagged for discard ll_discardRow = ll_k end if //set row discard array variable, keeps track of which rows //have been flagged for discard lb_rowDiscard[ll_discardRow] = TRUE //determine which type of discard we did, type or date /DAT*x /(if the factor is being discarded on the basis of //both type and date, then it will be counted as a TYPE discard) if li_priority[1] <> li_priority[2] then ll_typeDiscardCount ++ else ll_dateDiscardCount ++ end if //increment the rows discarded counter and ll_discardCount ++ next //ll_k next //ll_i //now discard the flagged rows if ll_discardCount > 0 then //flag the rows to be discarded by setting the factor type to "_" in the buffer //this vDAT*z alue can be sorted to the top of the buffer to facilitate //a block discard for ll_i = 1 to ll_rowCount if lb_rowDiscard[ll_i] then if this.dw_emis_fact.setItem(ll_i, "factor_type", "_") < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_date_and_type(); setItem() failed.", exclamation!) return -1 end if end if next //sort the rows to be discarded to the top of the buffer if this.dw_emis_fact.setSort("factor_type A") < 0 then DAT*|  messageBox("Error", "uo_emission::uof_discard_factors_by_date_and_type(); setSort() failed.", exclamation!) return -1 end if if this.dw_emis_fact.sort() < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_date_and_type(); sort() failed.", exclamation!) return -1 end if //discard the flagged rows if this.dw_emis_fact.rowsDiscard(1, ll_discardCount, primary!) < 0 then messageBox("Error", "uo_emission::uof_discard_factors_by_date_and_type(); rowsDiscard() faiDAT*~ led.", exclamation!) return -1 end if //log date discard(s) if ll_dateDiscardCount > 0 then if w_emiss.ii_log_file <> -1 and dec(w_emiss.em_log_detail.text) >= 4 then fileWrite(w_emiss.ii_log_file, " Discarded " + string(ll_dateDiscardCount) +& " factor(s) for " + is_curPollutant +& " during DATE prioritization.") end if end if //log type discard(s) if ll_typeDiscardCount > 0 then if w_emiss.ii_log_file <> -1 and dec(w_emiDAT* ss.em_log_detail.text) >= 4 then fileWrite(w_emiss.ii_log_file, " Discarded " + string(ll_typeDiscardCount) +& " factor(s) for " + is_curPollutant +& " during TYPE prioritization.") end if end if end if return ll_discardCount end function public function integer uof_get_process_info (long al_processrid); //loads object instance variables with state, county, source, //device and process rids, names and IDs for the current process //DAT* MDY long ll_rc SELECT v_rap_ss_scc.nation_rid, v_rap_ss_scc.nation_name, v_rap_ss_scc.state_rid, v_rap_ss_scc.state_name, v_rap_ss_scc.county_rid, v_rap_ss_scc.county_name, v_rap_ss_scc.source_rid, v_rap_ss_scc.source_id, v_rap_ss_scc.source_name, v_rap_ss_scc.sic_code, v_rap_ss_scc.source_sub1_rid as device_rid, v_rap_ss_scc.source_sub1_id, DAT*  v_rap_ss_scc.source_sub1_name, v_rap_ss_scc.source_sub2_rid as process_rid, v_rap_ss_scc.source_sub2_id, v_rap_ss_scc.source_sub2_name, v_rap_ss_scc.scc_code INTO :il_curNationRid, :is_curNationName, :il_curStateRid, :is_curStateName, :il_curCountyRid, :is_curCountyName, :il_curSourceRid, :is_curSourceID, :is_curSourceName, :is_curSicDAT* Code, :il_curDeviceRid, :is_curDeviceID, :is_curDeviceName, :il_curProcessRid, :is_curProcessID, :is_curProcessName, :is_curSccCode FROM v_rap_ss_scc WHERE v_rap_ss_scc.source_sub2_rid = :al_processRid USING SQLCA; if isNull(is_curNationName) then is_curNationName = "" if isNull(is_curStateName) then is_curStateName = "" if isNull(is_curCountyName) then is_curCountyName = "" if DAT* isNull(is_curSourceID) then is_curSourceID = "" if isNull(is_curSourceName) then is_curSourceName = "" if isNull(is_curSicCode) then is_curSicCode = "" if isNull(is_curDeviceID) then is_curDeviceID = "" if isNull(is_curDeviceName) then is_curDeviceName = "" if isNull(is_curProcessID) then is_curProcessID = "" if isNull(is_curProcessName) then is_curProcessName = "" if isNull(is_curSccCode) then is_curSccCode = "" ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then returDAT* n -1 elseif ll_rc = 100 then return 0 else return 1 end if end function public function integer uof_get_controls (); //Loads instance arrays with process rids, control (device) codes //for up to two downstream control processes from the current process. //Returns: 0, no controls; >0, number of control(s) found; -1, error //MDY 11/98 long ll_rc long ll_count long ll_i long ll_upstreamProcessRid long ll_controlRid string ls_controlCode string ls_controlCodeType string lsDAT* _controlCodeMetric double ld_null integer li_controlCount //initialize setNull(ld_null) ls_controlCodeType = "" il_controlRid = {0, 0} is_controlCode = {"", ""} //loop while control processes exist downstream ll_upstreamProcessRid = il_curProcessRid li_controlCount = 0 do while true //check to see that we have only one connected downstream processes SELECT count(*) INTO :ll_count FROM rap_streams WHERE ( rap_streams.from_process_rid = :ll_upstreamPDAT* rocessRid ) AND ( rap_streams.to_process_rid is not null ) USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 or ll_count <> 1 then //no connected downstream process found or multiple connected //downstream processes found for current upstream process exit //get out of the loop end if //capture the downstream control code and process rid SELECT rap_processes.rid, rap_device_codes.code DAT*  INTO :ll_controlRid, :ls_controlCode FROM rap_streams, rap_processes, rap_devices, rap_device_codes WHERE ( rap_streams.to_process_rid = rap_processes.rid ) and ( rap_processes.device_rid = rap_devices.rid ) and ( rap_device_codes.code = rap_devices.code ) and ( ( rap_streams.from_process_rid = :ll_upstreamProcessRid ) AND ( rap_device_codes.metric_map_code = 'CONTROL' ) ) DAT*  USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 then //no downstream control process found for current upstream process exit //get out of the loop end if //resolve the generic "CONTROL" device code if possible //there may be a process level activity with an AFS control code if ls_controlCode = "CONTROL" and li_controlCount < 1 then ll_count = 0 // see if there are process level control definitions SELEDAT* CT count(*) INTO :ll_count FROM rap_activities WHERE ( rap_activities.ref_rid = :ll_controlRid ) AND (rap_activities.metric_code = 'EPA CNTL CO' OR rap_activities.metric_code = 'CNTL CO GRP') USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 or ll_count = 0 then // no process level control information exists for this process // "CONTROL" will be used as the control code DAT*@ib_controlsByPollutant = FALSE else // controls will have to be checked for every pollutant ib_controlsByPollutant = TRUE end if end if //if there are process level activities with AFS control codes if ib_controlsByPollutant then // some code in this if block was taken from uof_control_device_code() ls_controlCodeType = "1ST" ls_controlCodeMetric = "EPA CNTL CO" //search for up to two process level control definitions //for each pDAT*ic_county_rid" OP ="=" EXP2 ="" ) ) ARG(NAME = "pl_rid" TYPE = number) qs "rno"tyesDAT* PDW0800pdwPlZ[````- F$ nnaaDAT*  @HO`$DAT*  " value_amt_t$1<  $ 0%  MS Sans SerifMS Sans Serif$2$-8$700$ 536870912$DAT* 8388608$ 9$8$452$658% ! Value Amount Value Amount"#0`/% &(*-value_unit_code_t$'677$)k489%+,VaDAT* lue Unit CodeValue Unit Code".0`:$0 1358reference_code_t$21175$4x%549%67Reference CodeReference Code"90`O/;< @BDFHJMt_1<=  DAT* %>?ArialArial$A 67108864$C{1733$E4$G856$I-206%KLDecodeDecode"N0`:P< @QDFSUXt_2$RDAT* 1947$TX402%VWMaterial CodeMaterial Code"Y0@@T\j][^`bd(hg value_amt$_ 9$a@DAT* 64$c658&ef [general] [general]"i0v\k[l`np(tsvalue_unit_code$m677$ok489&qr [general] [general]"u0jwDAT* [x`zp(}| reference_code$y1175${x%549"~0v[< @`p decode${1733$-206DAT* "0[< @`p material_code$1947$X402"0@DAT*  \ j v DAT* DgengPI\Dapl(virid) :as_null:as_ro:al_stream_rid:as_metric_code:as_material_code:as_material_code:ad_start_date_time:ad_end_date_time<al_stream_ridas_metric_codeas_material_codead_start_date_timead_end_date_timeas_roas_nullmaterial_coderap_activities.material_codeDAT*  value_amtrap_activities.value_amt\value_unit_coderap_activities.value_unit_codejreference_coderap_activities.reference_codevdecodedecodeSELECT rap_activities.material_code, rap_activities.value_amt, rap_activities.value_unit_code, rap_activities.reference_code, (if rap_activities.data_code is null then  else if rap_activities.data_code = 'RO' then  else rap_activities.dataDAT* _code endif endif) AS decode FROM rap_activities WHERE ( ( rap_activities.ref_rid =  ) AND SUBSTR(rap_activities.metric_code,1) =  ) AND ((SUBSTR(rap_activities.material_code,1) =  ) OR ( <> 'VOC' AND SUBSTR(rap_activities.material_code,1) = '@')) AND ( rap_activities.start_date_time =  ) AND ( rap_activities.end_date_time =  ) AND rap_activities.value_type is NULL ORDER BY decode\DAT* en;// Center the window this.x = pixelsToUnits((ge_env.screenwidth / 2) - (unitsToPixels(this.width,XUnitsToPixels!) /2), XPixelsToUnits!) this.y = pixelsToUnits((ge_env.screenheight / 2) - (unitsToPixels(this.height,YUnitsToPixels!) /2), YPixelsToUnits!) //Obtain Max Number of Counties,Sources from INI file, default to 20 em_1.text = String(ProfileInt(gs_iniFile,"Level","MaxCounties",20)) em_2.text = String(ProfileInt(gs_iniFile,"Level","MaxSources",20)) end event on w_set_max_choiceDAT* s.create this.cb_2=create cb_2 this.cb_1=create cb_1 this.st_2=create st_2 this.st_1=create st_1 this.em_2=create em_2 this.em_1=create em_1 this.mle_1=create mle_1 this.gb_1=create gb_1 this.Control[]={this.cb_2,& this.cb_1,& this.st_2,& this.st_1,& this.em_2,& this.em_1,& this.mle_1,& this.gb_1} end on on w_set_max_choices.destroy destroy(this.cb_2) destroy(this.cb_1) destroy(this.st_2) destroy(this.st_1) destroy(this.em_2) destroy(this.em_1) destroy(this.mle_1) destrDAT* oy(this.gb_1) end on type cb_2 from commandbutton within w_set_max_choices integer x = 750 integer y = 664 integer width = 279 integer height = 108 integer taborder = 50 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" string text = "&Ok" boolean default = true end type event clicked;//Set Max Number of Counties,Sources in INI file SetProfileString(gs_iniFile, "Level", "MaxCounties", em_DAT* 1.text) SetProfileString(gs_iniFile, "Level", "MaxSources", em_2.text) close(parent) end event type cb_1 from commandbutton within w_set_max_choices integer x = 398 integer y = 664 integer width = 279 integer height = 108 integer taborder = 40 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" string text = "&Cancel" boolean cancel = true end type on clicked;close(parent) end on typDAT* e st_2 from statictext within w_set_max_choices integer x = 169 integer y = 480 integer width = 759 integer height = 72 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Maximum Source Selections:" boolean focusrectangle = false end type type st_1 from statictext within w_set_max_choices integer x = 17DAT* 4 integer y = 356 integer width = 759 integer height = 72 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Maximum County Selections:" boolean focusrectangle = false end type type em_2 from editmask within w_set_max_choices integer x = 937 integer y = 468 integer width = 311 integer height = 88 intDAT* eger taborder = 30 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 alignment alignment = right! borderstyle borderstyle = stylelowered! string mask = "###" boolean spin = true double increment = 1 string minmax = "1~~999" end type on modified;IF this.text = "" then this.text = "1" END IF end on type em_1 from editmask within w_set_max_choices integer x = 9DAT* 37 integer y = 344 integer width = 311 integer height = 88 integer taborder = 20 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 alignment alignment = right! borderstyle borderstyle = stylelowered! string mask = "###" boolean spin = true double increment = 1 string minmax = "1~~999" end type on modified;IF this.text = "" then this.text = "1" END IF end on DAT* type mle_1 from multilineedit within w_set_max_choices integer x = 142 integer y = 52 integer width = 1193 integer height = 204 integer taborder = 10 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long backcolor = 67108864 string text = "Set the maximum number of Counties and/or Sources that may be picked from the level selector window." boolean border = false boolean displayonly = true eDAT* @)8) 8 $8 8 0) 8 $8 3@3$@$@8) 8 9}1 # $:@ $ $) 81R:@), 8<1>84 08z%111)l 8806:)@@8@81t DAT* | $) 8 $1@81 $ $8 ) 8 $ $8  3@8) 8 $ $8  3@8) 8 $ $8  $6) 8( $0 $8L1)8 8@ $H $8 L18 0)@)8)P 8XDAT* global type f_speciation_value_type from function_object end type forward prototypes global function string f_speciation_value_type (string as_throughput_material) end prototypes global function string f_speciation_value_type (string as_throughput_material);//MDY 9/99 //Returns a value_type code for speciation materials that //contain toxics that can also be calculated from other //speciation materials, where the toxic values should be //addative. E.G. EXHC and EVHC contain some cDAT* ommon toxics. //Both profiles should be calculated for those toxics. We are //using the value_type field to indicate what the speciate material //is so that both records may be stored. long ll_rc string lsValueType = "" string lsValueTypeName //value type records for speciation materials that should be //addative must be named as "SPECIATED FROM " lsValueTypeName = trim("SPECIATED FROM " + as_throughput_material) select rap_value_types.type into :lsValueType from rDAT*ap_value_types where rap_value_types.name = :lsValueTypeName using sqlca; ll_rc = f_sqlCheck(sqlca) if ll_rc < 0 or ll_rc = 100 then return "" else return lsValueType end if end function DAT*  $` $8 8 0)h 8p $x $8 3@3$@$@8) 8 $  $(@(818 0111) 88 0) 8 $) 8<1`8 84 z%8z%111)T 8806:)@@8,%DAT* @81,%,% 81,%@818\ (@(8z')x 88 (@(8z') 88 (@(8z') 88 (@(8z') 88 0111) 88 0)81B !"#0$j%&'()-B/R0l12DAT* 34567;(=`ABGHI J0KHL^PnRVWZ[.\J]b_~`abc*dhefijklmru,zd{~|}&F~ N z " : P ` |  " : 8 d z 8HZ,v $.>h0x>v " \x0DAT* 6L\`f !"#J&|(*d< ll_rcll_rowll_outputrowcountll_outputridll_activityrefridls_searchstringln_activityvalueln_growthfactorln_newvalueld_outputstartdateld_outputenddatelb_mergeupdatels_metriccodels_datacodels_valueunitcodels_messagetextll_factorsusedll_recordsdeletedll_recordsinsertedll_recordsupdatedsqlca'4FDAT* V g w      $co6%@G x ii_projectedyearO/01/01O/12/31BEGINNING GROWTH CALCULATIONSof_writelogmessageYInput ParametersY-----------------YBase Year: DAT* TYPE = datetime) ARG(NAME = "adt_endDateTime" TYPE = datetime) ARG(NAME = "as_referenceCode" TYPE = string) ARG(NAME = "al_nationArray" TYPE = numberlist) ARG(NAME = "al_stateArray" TYPE = numberlist) ARG(NAME = "al_countyArray" TYPE = numberlist) ARG(NAME = "al_sourceArray" TYPE = numberlist) ARG(NAME = "al_sourceSub1Array" TYPE = numberlist) ARG(NAME = "al_sourceSub2Array" TYPE = numberlist) "no"yesDAT*DAT* "as_materialCode" TYPE = string) ARG(NAME = "as_baseYear" TYPE = number) ARG(NAME = "as_projectedYear" TYPE = number) DAT*Oal_stateArray" TYPE = numberlist) ARG(NAME = "al_countyArray" TYPE = numberlist) ARG(NAME = "al_sourceArray" TYPE = numberlist) ARG(NAME = "al_sourceSub1Array" TYPE = numberlist) ARG(NAME = "al_sourceSub2Array" TYPE = numberlist) "no"yesDAT* mt, rap_emission_factors.emittant_material_code, rap_emission_factors.unit_code, rap_emission_factors.throughput_unit_code, rap_emission_factors.throughput_material_code, rap_emission_factors.quality_type, rap_emission_factors.scc_ams_code, rap_emission_factors.profile_code, rap_emission_factors.process_rid, rap_emission_factors.epa_date, 0 as factor_priority FROM rap_emission_factors WHERE (rap_emission_factors.emittant_material_code =  ) AND ( (rap_emission_facDAT* ols.sub_type1PBSELECT( VERSION(400) TABLE(NAME="rap_calculation_protocols" ) COLUMN(NAME="rap_calculation_protocols.rid") COLUMN(NAME="rap_calculation_protocols.priority_no") COLUMN(NAME="rap_calculation_protocols.method_code") COLUMN(NAME="rap_calculation_protocols.mode_type") COLUMN(NAME="rap_calculation_protocols.throughput_material_code") COLUMN(NAME="rap_calculation_protocols.source_code") COLUMN(NAME="rap_calculation_protocols.device_code") COLUMN(NAME="rap_calculatioDAT*, :F@@866@68}1<808z%@896@81808*0@8/@/891=@=8}1<}#16@8}1R/@/8}@8DAT* tors.factor_type =  AND rap_emission_factors.process_rid = ) OR ( ( rap_emission_factors.factor_type =  OR (rap_emission_factors.factor_type =  AND rap_emission_factors.process_rid = ) OR (rap_emission_factors.factor_type =  AND rap_emission_factors.process_rid = ) OR (rap_emission_factors.factor_type =  AND rap_emission_factors.process_rid = ) ) AND ( rap_emission_factors.scc_ams_code =  OR ( (rap_DAT* emission_factors.profile_code is not NULL) AND (rap_emission_factors.profile_code = ) ) ) ) ) AND (rap_emission_factors.throughput_material_code is not NULL) AND (rap_emission_factors.throughput_material_code =  OR  = '@') AND (rap_emission_factors.epa_date <= ) \"1"1"DAT*1"1"0"0"0DAT**~"y1"{1"}1"1"0"0"0DAT* n_protocols.process_code") COLUMN(NAME="rap_calculation_protocols.emittant_material_code") COLUMN(NAME="rap_calculation_protocols.scc_ams_code") COLUMN(NAME="rap_calculation_protocols.sub_type")WHERE( EXP1 ="rap_calculation_protocols.throughput_material_code" OP ="is not" EXP2 ="NULL" ) ) ORDER(NAME="rap_calculation_protocols.priority_no" ASC=yes ) \')+-/13"(DAT*1"*1",1".1"00"20"40DAT*"1"1"1"1"0"0"0DAT*ttransactioneven//@Max Coes,S0IN@le :St@(gs_HLe@, "MT",@1.tehof@trintle@evelrc@ em_ c@(par ev@ @% @  8 z%,`,811d"806DAT* g@r@TA/g@g@q#X@X@a/c@c@<@@aH@@aQ^@^@am@@ay@@q@@@@a@@atlF@F@aq@q@qe_oarov@v@qly8h u_pollutant_eeu_pollutantuserobjectswindowobjectborderstyledwobjectpowerobjectd_exp_mat_groupfontcharsetfontpitchfontfamilyMS Sans SerifRemove AllAdd AllalignmentfillpatternEmittantsd_exp_materialsMaterial GroupsDAT* Standard user object contains d_units_dddw_on_qccheckerforward global type u_dw_unit_code from u_dddw end type end forward global type u_dw_unit_code from u_dddw int Width=1079 int Height=104 string DataObject="d_units_dddw_on_qcchecker" boolean Border=false BorderStyle BorderStyle=StyleBox! boolean LiveScroll=false end type global u_dw_unit_code u_dw_unit_code type variables datastore ids_neiUnits end variables forward prototypes public function boolean uf_check_required (sDAT* tring ps_msg_title) public function long of_setneiunitslist () end prototypes public function boolean uf_check_required (string ps_msg_title);// Function: uf_check_required // // Purpose: To validate that unit code is selected // // Scope: public // // Parameter: // ps_msg_title (string/value) - contains the title for the messagebox. // // Return: boolean - TRUE denotes validation passed; FALSE if validation // failed. // // Log: // Date Who What // -------- ----- -----------DAT* ------------------ // 3/24/95 SWJ Initial version // 3/23/96 REJ u_dw_unit_code is allow edit, so unit code must pass validation from // accept_text string ls_unit_code integer li_valid li_valid = This.AcceptText() IF li_valid <> -1 THEN ls_unit_code = This.GetItemString(1, 1) else return FALSE end if if IsNull(ls_unit_code) or ls_unit_code = '' then MessageBox(ps_msg_title, 'Sorry! Unit of Measure is required') return FALSE else return TRUE end if end function DAT*  public function long of_setneiunitslist (); long ll_rc dataWindowChild ldwc_dddw //set up the nei units datstore if not isValid(ids_neiUnits) then ids_neiUnits = create datastore end if ids_neiUnits.dataObject = "d_dddw_nei_units_list" ids_neiUnits.SetTransObject(SQLCA) ll_rc = ids_neiUnits.Retrieve('MASS') if ll_rc < 0 then return ll_rc elseif ll_rc = 0 then ids_neiUnits.insertRow(0) end if //grab the child datawindow if this.getChild("code", ldwc_dddw) < 0 then messDAT* ageBox('Unit of Measure', "Application Error:~nUnit Code - " + & "Not a DataWindowChild.~nContact your technical support.") return -1 end if //share data from nei units datastore to dddw ll_rc = ids_neiUnits.shareData(ldwc_dddw) return ll_rc end function on itemfocuschanged;call u_dddw::itemfocuschanged;is_child_name = 'code' is_validation_table = 'rap_units' is_msg_name = 'Column - Unit of Measure' is_msg_text = 'Sorry! Not a valid unit code' end on event constructor;DDAT* ataWindowChild dwc // Retrieve data for unit of measure dddw // Get the handle of the child datawindow if This.GetChild("code", dwc) = -1 then MessageBox('Unit of Measure', "Application Error:~nUnit Code - " + & "Not a DataWindowChild.~nContact your technical support.") return end if dwc.SetTransObject(SQLCA) dwc.Retrieve('MASS') This.SetTransObject(SQLCA) This.InsertRow(0) end event event destructor;if isValid(ids_neiUnits) then destroy ids_neiUnits end if end eventDAT* DAT*  @ʑM@ʑ `pointertransactionsqlca,select distinct emittant_material_code from rap_emission_factors order by emittant_material_code emit_cursorfTAf_db_errormessagesDAT* TATA@h t     2 u_pollutant_ee " +create+destroy+clicked QL x _initsrcu_pollutantu_pollutant_eeuserobjectswindowobjectborderstyleu_pollutant`dw_material_groupdw_material_groupdwobjectpowerobjectu_pollutant`cb_remove_allcDAT* b_remove_allfontcharsetfontpitchfontfamilyu_pollutant`cb_add_allcb_add_allu_pollutant`st_2st_2alignmentfillpatternu_pollutant`dw_materialdw_materialu_pollutant`st_1st_1u_pollutant`gb_1gb_1pointertransactionmessageX qq@j@k@T,@m@a8a@@E@@Q^@oj_q@ @@@@iss!DAT* ac@e = er@ lonr 1088 t= "Simumbe ied/or ha@y be! om@ lev- r ow."E bo = fQ easplab ued tyg!x} @@!/@     DAT*     5* +!y% --. y%. %8d  create8dDAT*   destroy2  +create+destroy(2  ] oe` @@h1    @        33DAT* L%1$2  2  ] o.t d @ ]@  "2  2  ] oIL2 DAT*@   @"2  2  ] oIL( @   @$:F@@8$)$8@$1)X81B`$DAT*  +commandlinew_emiss( @ f80j0jPjl j|!j(6DRd( sqlcasqldasqlsaerrormessaged@@@ @ !@0 appnamerapids_etransactionq!dynamicdescriptionarea@8dynamicstagingareaqXeDAT* rrorittmessage 0Pl|$,,,, ,! d( sqlcasqldasqlsaerrormessaged@@@ @! !@ 2  +open+create+destroy<2  o  DAT* o   #xDAT* ca<  @\p ids_neiunits''datastore('d_dddw_nei_units_list'settransobjectl'MASSretrievela'insertrowcodegetchildqloUnit of MeasureApplication Error: Unit Code - Not a DataWindowChild. Contact your technical support.r'sharedata+uH  4< D d |    DAT*"   @ T 18(800L8T0l8t080, 1, $:Tnd0 +row+dwoancestorreturnvalue::messageP $& @ ( itemfocuschangedis_child_namecodeis_validation_table5"rap_unitsis_msg_nameDAT*$ ^ Column - Unit of Measureis_msg_textla!Sorry! Not a valid unit codeode( L l   "8)81<8 0808Pz%@8, v1, $, )880)8, )81)8, 1, $. \ d dwc::messageDAT*& sqlca<  @  @8 codegetchildo Unit of MeasureApplication Error: Unit Code - Not a DataWindowChild. Contact your technical support.asettransobjectMASSretrieve u}^insertrowm(       T$  $, :1H, ($ d ::messageDAT*(  @ 0 ids_neiunits''  ( %'1L%OP'-/10.2 X uf_check_requiredof_setneiunitslist+itemfocuschanged+constructor+destructord7-?L2 K widthheightdataobjectborderborderstylelivescrollids_neiunits 7luDAT** h_rOll rt'ex3ss>] o7h @ O  'DAT*D4x1V%Lc'DAT*. }9!<#P$|)+-./36769N;X<ACEKdH filenamels_lineli_fnli_num_charsll_cntlb_donell_prtli_rc ^@ ^@ ,^@3;^@BB File PrintUnable to open file: Unable to open printer.2  f_print_file2  DAT*8 DAT*2 D ` | d9 dw_argumentpl_maxselpl_sel_countll_clickedrowP 6+H getrowisselected)selectrow8@,@, $ 8 @ -1)8-)(811"h1Y-8008>-DAT*4 (@(8z'8Jz&@810-)l8#-9)8-1R&-)8-1)81 :X h v >Zv !"dU dw_argumentpl_maxselpl_selcountl_oldrowl_newrowl_startrowl_endrowll_i ^@DAT*6 ^@* 3^@<G^@P0 getselectedrowgetrow Cannot SelectMaximum of rows may be selectedisselectedA)`selectrow@tsetrowQsetcolumnG ( l    "80)$8d , constructortriggerevent $ "80) 8DAT*d ( destructortriggerevent  2 1 controlclickshiftclick+create+destroyPGn [@:(2  M+,D,@OdxWdDAT*:  a`SA@bbSASELECT rap_units.meas_code FROM rap_units WHERE rap_units.code =' ' @CbbSAcbSA@C@cbSA|cDcSA@CcbSADAT*< ccSA@C0dbSAld4dSASELECT v_rap_ss_scc.nation_rid , v_rap_ss_scc.nation_name , v_rap_ss_scc.state_rid , v_rap_ss_scc.state_name , v_rap_ss_scc.county_rid , v_rap_ss_scc.county_name , v_rap_ss_scc.source_rid , v_rap_ss_scc.source_id , v_rap_ss_scc.source_name , v_rap_ss_scc.sic_code , v_rap_ss_scc.source_sub1_rid as device_rid , v_rap_ss_scc.DAT*> source_sub1_id , v_rap_ss_scc.source_sub1_name , v_rap_ss_scc.source_sub2_rid as process_rid , v_rap_ss_scc.source_sub2_id , v_rap_ss_scc.source_sub2_name , v_rap_ss_scc.scc_code FROM v_rap_ss_scc WHERE v_rap_ss_scc.source_sub2_rid =0 -.fdSAgfSASELECT count ( *) FROM rap_streams WHERE ( rap_streams.from_process_rid =0 ) AND ( rap_streams.to_process_rid is nDAT*@ ot null ) IJgpgSA,hgSASELECT rap_processes.rid , rap_device_codes.code FROM rap_streams , rap_processes , rap_devices , rap_device_codes WHERE ( rap_streams.to_process_rid =rap_processes.rid ) and ( rap_processes.device_rid =rap_devices.rid ) and ( rap_device_codes.code =rap_devices.code ) and ( ( rap_streams.from_process_rid =0 ) AND ( rap_device_codes.metric_map_code ='CONTROL' ) ) 3DAT*B 4ihhSAjiSASELECT count ( *) FROM rap_activities WHERE ( rap_activities.ref_rid =0 ) AND ( rap_activities.metric_code ='EPA CNTL CO' OR rap_activities.metric_code ='CNTL CO GRP' ) FGjPjSA8kkSASELECT rap_device_codes.code FROM rap_activities , rap_device_codes WHERE rap_activities.vDAT*D alue =rap_device_codes.afs_control_code AND rap_activities.value <> '099' AND ref_rid =0 AND SUBSTR ( metric_code , 1 ) =' ' AND SUBSTR ( material_code , 1 ) =' ' AND start_date_time <= '2005-01-31 15:29:39.795000' AND ( end_date_time >= '2005-01-31 15:29:39.795000' OR end_date_time is null ) AND rap_activities.value_type =' ' 0HdmtkSAhm0mSAselect value_amt from rap_activiDAT*F ties , rap_streams where ref_rid =rap_streams.rid and from_process_rid =0 and metric_code ='CNTL EFFIC' and start_date_time <= '2005-01-31 15:29:39.811000' and ( end_date_time >= '2005-01-31 15:29:39.811000' or end_date_time is null ) and material_code =' ' and value_amt is not null and value_unit_code is not null hi!omSALooSAselect value_amt from rap_activities , rap_streamsDAT*H  where ref_rid =rap_streams.rid and from_process_rid =0 and metric_code ='CNTL EFFIC' and start_date_time <= '2005-01-31 15:29:39.827000' and ( end_date_time >= '2005-01-31 15:29:39.827000' or end_date_time is null ) and material_code ='@' and value_amt is not null and value_unit_code is not null hipoSA,qpSAdatastoremessage @hpDAT*J    TX    4 8 p vz   " (6 <  X \                  F L            X DAT*L  h          T X     NTd      * 0     $ NT    , 0        fl    T X    0DAT*N P     D H    <X     < @    P T     ! ! @!D! |! ! #"# %$<& && '  ' '' ' ' (( L( P( (( ( ( z** * * , DAT*P , , , -- . . .. (/ ,/ d/ j/n/ t/x/ ~// // // /1 11 1 2 33 4 4 55 06 46 l6p6 6 6 88 8 8 :: ,; 0; h;l; ; ; <<@< x< |< < << = T= X= = DAT*R = = =  > > |>> > > > > ? D? |? ? ? ? ?? 0@ 4@ l@p@ @ @ pBB B B CC  D &D*D 0D>D DDHD NDRD XD\D bDE EE F F PF TF F FF FF F&G0GDG |G G G GDAT*T   H H$H \H H H H H I I,I dI I I I I J JJ $J(J .J2J 8JKKL @L DL |L LL LL LL LNO O XO \O O OO OQ Q8Q pQ tQ Q Q Q  R $R \R `R R R R RRDAT*V   S XS \S S S S SS SS SS SS SUUU U V Y`YY Y Y ZZ Z [ x\\ \ \ 2^D^ |^ ^ ` 8` p` x` a b @b DAT*X Hb bb c c @cDc |c c cc c c 0d4d ld pd ff g 8g gg ,h 0h ii j j jk 8k  pt_trans_objectuof_abort_transps_activity_valuepi_log_fileuof_DAT*Z activity_valueps_scc_ams_codeps_source_codeps_device_codeps_process_codeuof_source_device_processps_calling_funcuof_sql_erroruof_get_ridpi_num_calc_protsddancps_calc_protsuof_get_calc_protsps_test_protpi_num_protssncps_calc_protuof_use_calc_protuof_begin_loguof_end_logpi_num_modesurf_ps_modesuof_get_modesps_test_modef_uof_use_mode_typepi_num_pollutantsncps_pollutantspd_process_riduof_get_pollutantsps_input_materialps_proDAT*\ file_codeuof_get_spec_profileps_pollutantuof_pmps_emittantpd_weight_percuof_get_mass_fractionsuof_speciation_scc_amspd_protocol_ridpi_num_metricspi_num_metric_groups_lpd_record_group_no_lpd_sequence_no_lps_item_type_lps_operator_type_lps_numer_material_code_lps_denom_material_code@_lps_metric_code_lps_input_output_flaguof_metricspd_start_date_timepd_end_date_timeps_reference_codeps_ini_DAT*^ fileps_ini_sectionpl_next_process_rid_lf__muof_emissions_mainncuof_uncont_poll_listuof_create_trans_objectpl_process_ridncps_scc_ams_codespi_num_scc_amsuof_get_scc_at_streamf_ps_profilepi_num_profilespt_trans_objanuof_speciation_pollutant_listps_cntl_co_typeuof_control_device_codeps_ref_codeyn_luof_log_inputspi_num_factorsruncps_throughput_unit_codencps_throughput_materialuDAT*` of_compare_factorspdb_valueuof_activity_get_valuepd_rev_dateps_method_typeps_input_unitpb_scc_at_strpb_last_deviceps_data_codeuof_activity_replacepd_creation_date_timeps_metric_level_typepd_ref_ridps_user_idps_confidential_flagps_material_codeps_reference_typeps_value_typeps_value_unit_codeuof_activity_insertpdb_fug_emisspdb_cont_emisspd_start_datepd_end_dateps_unitpt_rid_objectpb_cont_at_origpd_emiss_start_date_timepb_from_last_deviceuof_default_calc_successps_activiDAT*b ty_unit_codepd_activity_valuepdb_activity_valueps_data_typeuof_unit_convertpdb_emissionpd_input_creation_date_timepdb_mass_flow_valuepdb_downstrmdis_valuepdb_fugitive_dischargepb_org_processuof_default_parameterspdb_efficiencyuof_choose_group_activitiespb_init_flagpdb_value_amtuof_activity_updatencuof_cont_poll_list ncpb_calc_successpd_todayuof_control_emission_mainps_throughput_material_codeps_activity_unitps_methoduof_activity_datapl_stream_riduof_acDAT*d tivity_retrievepb_control_process_flaguof_process_infoturteteteteteteteps_in_throughput_materialpdb_est_emissionps_emission_unit_codept_emiss_objectpi_curr_priorityuof_calc_mass_balancete_m_mpi_priority_noe_mps_mode_typeE _mps_method_code _mpi_rows_returneduof_priority_listlteps_arraypl_incrementuof_increment_arrayncpi_num_profileDAT*f _codesps_gen_spec_thruputsncps_spec_filterpd_source_processpl_target_processuof_get_profile_code_lps_poll_list_lps_poll_methodpb_mass_balanceIteps_profile_codesteuof_pollutant_listncnc_l_luof_build_poll_listtepi_arraypi_ubpi_incrementuof_increment_array_inttepst_input_materialpi_countuof_get_throughput_materialstepd_arrayuof_increment_array_dec DAT*h teuof_increment_array_strpdb_input_valuesps_input_unitspi_num_inputsuof_get_input_activity_valueps_factor_materialps_activity_materialps_controlps_factor_typeps_cd1_codeps_cd2_codepd_emission_factoruof_log_activity_valueal_processriduof_get_seasonal_adj_factortetetetetetetetepd_cutoff_dateuof_calc_emission_factorps_emittant_material_codepi_ss_factor_numpi_g_factor_numuof_emiss_factorpdDAT*j _constantuof_constantuof_discard_factors_by_priorityal_row1al_row2ܥteas_excludeai_logleveluof_log_factorsuof_discard_factors_by_date_and_typeuof_get_process_infouof_get_controlsuof_check_control_efficienciespi_loop_numps_filteruof_calc_ef_set_cont_filteras_tablef_cleartable                 DAT*l         > >                         > >    DAT*n     +constructor+destructor+create+destroy8,Hh`lx$X\ | T ` l x     , 8 T p    ,        , L   DAT*p $0<HT`lxD,8DP\ht(4@LXdp| $0<HT`lxDAT*r  IRCtransaction.(:MSIYix:ISRSRSRSIRCtransaction.:ISICtransaction.h@:LIRCtransaction. :IRIRS[]IRCtransaction.*D8ISIS[]:IIh:}DAT*t :}Y:IRIRS[]SIRCtransaction.M(::ISRSICtransaction.m_:ISCtransaction.I:s:ISSRMICtransaction.Y:IMRSIRCtransaction.DAT*v 8,THth:IMRIRIRM[]RM[]RS[]RS[]RS[]RS[]RS[]RS[]IRCtransaction. /;:J`}lxIWWMSSSIRLIS[]IS[]IS[]Y:IRIRS[]SICtransaction.:IIRCtransaction.DAT*x :ILRS[]RICtransaction.I0$;:KXIS[]IICtransaction.RS[]RIx_ :KIMRSRSSWWICtransaction.:ISIIS[]:IIS[]S[]ICtransaction.?SRD?`_DAT*z  :l{IDWLSSWWRCtransaction.ISSSBBS?  l/AO:IWSSMWSDSSWSSSSSSIRCtransaction.valv_:DAT*| lIMDDWWSSIRCtransaction.SBWRBBSS/AT:ISSRMRDSIRCtransaction.r_ :lILDSWWICtransaction.WSRDRDRDBSt_  DAT*~ :BLSSRDRSWWICtransaction.- ` : _:KlIBWLWWRDSSSSICtransaction.SS\ l:IMRIRS[]SSICtransaction.|  :v JDAT*  lIMS[]ISWWICtransaction.RDRDRBRLWS  A  :ISRSMWWSRDRSSSIRCtransaction.:    :IRDRSSRSLWWSRICtransaction.( :IMBIY DAT* T ` 8l Tx t    _  : J IMSSWWIIM[]M[]S[]S[]S[]S[]S[]SSRDRSIRCtransaction.RCtransaction.RCtransaction.RLBIixY_} , D 8 ` T | p   :ISDAT* SSSSIS[]RM[]RI[]RS[]RS[]RS[]RIIRCtransaction.  QRS[]L/Y:   8 , G Y :ISRS[]RIRSRS[]MLRWRWIRCtransaction.Y:     ;8 Y ILSSIRS[]RS[]RIRBWWRS[]RIRS[]RL Y  DAT*  : ;8 , Y IMRS[]RISRS[]SRWRWIRS[]RIRS[]RLX L a g QRI[]RIICan_   a :IMSSWWRCuost_input_material.[]RIRIICtransaction.d") a g QRM[]RII_el a g QRS[]RIIl_r_ DAT* (9H:KlIMSSWWRDRSRIRWIRCtransaction.RSRSndsA  :QRSRSRDRSRSRSRSRSRMRSRSRImeIL"Y $08<THTt`lxDAT*  _  : J:8  l   IMSSWWIIM[]M[]S[]S[]S[]S[]S[]S[]SSRDRSIRCtransaction.RCtransaction.Ctransaction.RLSSWSRBSIYY ::  ISSSSMRIRIRIIRCtransaction.SYYDAT*    :IMSSSYRSRSRMIRCtransaction.I19PDBLLS[][G Y _ :IRIMRLSWWRSRSRSRSRSICtransaction.ISLQ$@LxLDAT* \ 0Dp(,<  X   p    \  H    t `    x _initsrcuserobjectuo_emissionuserobjectswindowobjectborderstylestructuremailrecipientenvironmentDAT* mailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectdatawindowdw_calc_prioritydwobjectdw_activitydw_emis_factuost_mass_baluost_input_materialuost_densityuost_xfer_effuost_mass_fractiontransactionw_emisspointerw_emiss_statusuo_toplevelu_class_source_groupu_class_ss_clientdynamicstagingareadatastoremessage@(@4@A@DAT* M@W@e@q@ @ @ @t.Se _C@edRo @sel_x(@el_c) @ELSEumSeleli@Row,pl_coul_t + IFEND "rn 6 fion CharArQ !d@p@x@!@<@DAT* @id @ME!@w_sy%w@ash_&h@ C?pe CJ!>y%>y%>y%DAT* C      !"#$%&'()*+,-./0123456789:;<=>?@AB -p,$($D:F@@8^:F@@8---1 &@D^dDAT* jpd pt_trans_objectw_emiss( @0 cbx_background6>checked  ( 0 ,$($::F@@8T:F@@86%@%8M30 ,@$H$#8P08c8}z%z&:)@:@@81< 8z%A@A8M 6:TvDAT* !"' d7 ps_activity_valuepi_log_filew_emissld_valueP &@.> ( cbx_background6>checked 6> Emission EstimatorError converting activity value: Error converting activity value:  ( 0@ H &,$($::F@@8T:F@@8-DAT* -0$1d0,8$@$#8H08[z%:)@:@@81<8[z%A@A81-,|$$#8H08z%:)@:@@81<8z%A@A81-,$$#>8H08z%:)@:@@81<x8z%DAT* A@A81-:,$$#8H08z%:)@:@@81<&8z%A@A81-$18 0-)L8116:TX\!`"d$r&'*+./,1:2X569:<=@>ARDxEGHKLO&P6RTTxUWdj ps_scc_ams_DAT* codeps_source_codeps_device_codeps_process_codepi_log_filept_trans_objectw_emiss  ' 6 FR b@Th cbx_background6>checked 6> Emission EstimatorSCC/AMS record not found for 6> No source code for SCC/AMS code 6> No device code for SCC/AMS code @6> No process code for SDAT* CC/AMS code Auof_source_device_process()uof_sql_error4< ( 0 8 @ |       L " ,$($::F@@8T:F@@880z%?81< 8>L$(@(8z'8Tz&z&A@A8\$6A@A816:!T%z&DAT* )- d< ps_calling_funcpi_log_filept_trans_objectw_emissP $ 4@d cbx_background6>checked SQL Error in SQL Error mis  in r  ( L \ |,$($::F@@8T:F@@8@$6:cTeldD pi_log_filept_trans_DAT* objectw_emissll_last_ridll_next_ridd $@,80 cbx_background6>checked  ( L,$($::F@@8T:F@@81}1},@$)T8,\$)l81<,t$)8--DAT* $1n80-)8-1--< 6|-1<08088z%:)@:@@81<80A@A81F-16: T#f$&(*+ -/41X2^6n7x9;TVWYZ,[0\6dp pi_num_calc_protsps_calc_prots pi_log_filept_trans_objectDAT* w_emissli_itemls_codels_name((-4@ P@X` h $P cbx_background6>checked lb_calc_methods0<Dtotalitems?H0<Dstate<d0<Dtext=|uof_get_calc_prots()uof_sql_error4Emission EstimatorYou must select at least one calculation methodNo calculation methods selectedDAT*  ( @ T \ l t     ,$($::F@@8T:F@@81}t<=1j16:T!dL ps_test_protpi_num_protsps_calc_prot w_emissli_item0d 0"-<@DAT* D0 cbx_background6>checked  ( ,$($::F@@8T:F@@81}t1<l}1<800 1<1<"8S0 1< 801<X6A@A8h1j1  6:DAT* T !"% '4(T*X-h.ld6 pi_log_filew_emissls_log_beginli_icase28d@ ). cbx_background6>checked RAPIDS Emission Estimator Log File======================================================================USER SELECTION ( ,$($::F@@8T:F@@DAT* 81}t1<}1<8001<1<"8L01<83@3$80)@)8z'8z&@$80)@)8z(1<801<6A@A81j1  6:T !"DAT* $%(*+-01d4 pi_log_filew_emissls_log_endli_icase28d@ ', cbx_background6>checked Emission Estimator Complete======================================================================Execution End Date/Time: mmm dd, yyyy h:mm:ss am/pmEnd of RAPIDS Emission Estimator Log File ( L,$($:DAT* :F@@8T:F@@81}1},<$)P8,X$)h81<,p$)8-8-$1n80-)8-1--< 6|-1<08088z%:)@:@@81<80A@ADAT* 81F-16:Tf!#%& (*4,X-^1n2x468:;=>,?0@6dh pi_num_modesps_modes> pi_log_filept_trans_objectw_emissli_itemls_typels_name  -,8 H@PX ` P cbx_background6>checked DAT* lb_modes:07?totalitems?D07?state<`07?text=xuof_get_modes()uof_sql_error4Emission EstimatorYou must select at least one modeNo modes selected ( < P X h p     ,$($::F@@8T:F@@81}t<=80"1j1DAT* 6:T!dH ps_test_modepi_num_modesps_modes w_emissli_item,d ,"-8@@2 cbx_background6>checked @ ( Z,$($::F@@8T:F@@8 } #1<8L8rz%A@A8 DAT* - -$1(80-)8- -1-1 - \-$1d4,$$#8088z%z&:)@:@@81< 898Yz%z&A@A8- -1-|$180-)8- -11DAT* }-$1--1<R - -$1d-$180-)8- -1 -1<80A@A811<F88z%A@A880A@A8 -M,D$ -$180DAT* -)8- -1-1 - -$1d, $($#p80880z%:)@:@@81<898Jz%A@A880A@A8- -1r-d$1`80-)l8- -1r1}-t$1R-DAT* -1<R - -|$1dRN-$1D80-)8- -1Nr -1<80A@A880A@A81 !6":,T>bAlBFGIJKLQ(SLUfVZ[^ _` a0cNdrexfghlprtuw2xVy\zl{||DAT* $Fv6p6<L\`r 0@DNRbvd pi_num_pollutantsps_pollutants ps_scc_ams_codepi_log_filept_trans_objectpd_process_ridw_emissli_itemls_codels_namelb_scc_ams_nullmat_curact_cur((-4 DP `> DAT* o@w  > > cbx_background6>checked il_prev_process_rid0VNo pollutants specified. Retrieving defaults from rap_scc_ams_materials.uof_get_pollutants()uof_sql_error46> Emission EstimatorNo pollutants specified and no defaults found for SCC/AMS code: No pollutants specified and no defaults fouDAT* nd for SCC/AMS code: 44Using default pollutantsNo pollutants specified. Using defaults from Input stream(s). 46> no input pollutants foundinput pollutants found-44Using input pollutants  ( D      |           ( d l t DAT* |   ,$($::F@@8T:F@@80$1dj,8$@$#8H08[8pz%z&:)@:@@81<,$$6%@%83!V8z%A@A81$180)811DAT* 6:!T#X$\&j()-.01V2f45679dN ps_input_materialps_profile_codepi_log_filept_trans_objectw_emissd  *6 F@ P cbx_background6>checked 6> Emission EstimatorNo profile code for input material: em_log_detail13textA$ No profile code for input materDAT* ial: uof_get_spec_profile()uof_sql_error@4 ( 0 8 @     ,$($::F@@8T:F@@80$1dz,8$@$#8H08[z%8fz&:)@:@@81<,$$6%@%83!`8z%8fz&A@A8DAT* 1$180)8116:!T)X*\,j./3407`8f9v;<=ABdA ps_pollutantpt_trans_objectpi_log_filew_emissls_coded  %1@9 P cbx_background6>checked 6> Emission EstimatorPolDAT* lutant is not in PM group em_log_detail{13text$ Pollutant uof_pm()uof_sql_error4 ( 0 8 @     R,$($::F@@8T:F@@8 0$1dd,8$@$#8H08[z%8z&z&:)@:@@81<P8[DAT* z%A@A88z%A@A81$180)811$11L$1d"1L $1L16:T!X"\#`%n'(-.1*5P6`8~9:<HIJKLM<dW ps_profile_codeps_emittantpd_weight_percpi_log_fiDAT* lept_trans_objectw_emissx  $ 3? O@P cbx_background6>checked 6> Emission EstimatorNo weight percent found for profile code: material code: material code: zuof_get_mass_fractions()uof_sql_error4 ( 0 8 @     DAT*   ,$($::F@@8T:F@@8M- -0$1dd,8$@$#8H08[8sz%M2(@(8z(:)@:@@81<J8M2(@(8z'A@A8-1-$180-)8-1-16DAT* :TX\ j"#'(+J,P-`/~01245dK pd_process_ridps_scc_ams_codepi_log_filept_trans_objectw_emissd>  '3 C@8 cbx_background6>checked 6> Emission EstimatorSCC/AMS code not found for process SCC/AMS code not found for process uof_speciation_scc_ams()uof_sql_error4 (DAT*  0 8 @   C ,$($::F@@8T:F@@81}1}- M - 0$1880 - )T8- - 1-1-1-1-1-1-1- 1- 1-  - \$1d,d$l$#8t08DAT* 8z%M2(@(8z(:)@:@@8 1<h 88z%M2(@(8z(A@A8- - 1- $1880 - )8- - 11}1}- $1--1<R--1<R--1<R--1<R--1<R--1DAT* <R- -1<R- -1<R-  h - $1d0- $1880 - )8- - 1-1d)8-< 1G-< 80-< 80-< 80-< 80- < 80- < 80-DAT* -<C}- 16 :6T7f8x:<=>?DEFG"H0I>JLKZM~OPTU"XhYnZ~[]^_`abc gk8lPmhnopqrtv(w,yJzn{t|}~2Pnd}@ pd_protocol_ridpi_num_metricspi_num_metric_groupspd_record_group_non pd_sequence_no ps_item_type, ps_operaDAT* tor_typeH ps_numer_material_codeo ps_denom_material_code ps_metric_code ps_input_output_flag pi_log_filept_trans_objectw_emissli_metr_ubmeth_metric_listPl 0@> 'P<-l\-x---- -0DAT* -<H X@`,k > p cbx_background6>checked uof_metrics()uof_sql_error4F6> Emission EstimatorNo method metrics records found for protocol 84F4Fuof_increment_array_dec_END ( 0 T \ d l        #%5%DAT*'1}#$M2 $6655"#)*!<=6 $<=6( ( $3%<=64%<=67580!<=6'!<=,0 $3)8   8!}1<'%1<RX $<%9}` $1<%1BN`"h0v 0HZr,0@DHf V   ( h x |    ! "L $ & ) + ,0 -X . 0 2 4 86 9d ;~ = > ? B"C6DXFzHDAT*IJLNTUVPWrZ\^_`eLhXitqv@xTyZzn|~ 8Z\~0,hl"hFJjR0RV `&()(*J,l./12378*9:<BCDE* FT G` Jd Mh Nr O P R!T$!\(!_\!bp!c!e!g!h!k"l`"o"q"s#u#xL#y^DAT*#zh#$$%%6%%%%''"'6'|''''''>(((H)j))))***++,,(,n,,,,,,D-f- j- t- ------.P... .!/# /$&/d pd_start_date_timepd_end_date_timepd_process_ridps_reference_codeps_ini_fileps_ini_sectionpi_log_filepl_next_process_ridpi_num_calc_protsps_calc_prots pi_num_modesps_modesfo pi_num_pollutantsps_pollutantsDAT*  w_emisslb_calc_successlb_scc_at_strls_source_codels_device_codels_process_codels_emission_unit_codels_input_output_flag ls_method_code ls_throughput_material_code ls_metric_codeg ls_mode_type ls_item_type ls_operator_type ls_numer_material_code ls_denom_material_code li_scc_ams_loopli_ret_statusli_num_protocolsli_prot_loopli_num_metricsli_num_metric_groupslDAT*"i_poll_loopli_profile_loopld_protocol_rid}> li_priority_noldb_est_emissionld_record_group_no> ld_sequence_no> lb_control_process_flagld_orig_process_ridld_input_value> ls_input_unit ls_scc_ams_codes- ldb_cont_emissldb_fug_emissls_spec_scc_ams_codels_profile_codes ls_spec_filter li_num_profile_codesli_input_act_countld_todayli_num_scc_amsli_num_inputsli_input_actll_dischDAT*$arge_proc_ridli_methodls_method_usedls_gen_spec_thruputsls_thruputls_nullli_thruputli_ils_curdevicecodelb_specthruputli_metrics_ubw_emiss_statussqlcacase212ll_spec_target_process_rid<` <l \x  ,> ; M Y hDAT*&t---@ * 9 H -X n---%-- -<(-`H-zl-(DAT*(   >-et<,-odH tilY>-amx>-> >-- - _e' 5 \J-xh- DAT**p^p  # 2. 6AF Wf,t@@ 4X cbx_background6>checked Endib_controlsretrieved_sq4Cib_controlsbypollutantTDidt_startdatetimet+idt_enddDAT*,atetime,6> sle_material,text uof_process_infoVis_curscccodeffA@STREAMuof_get_scc_at_streamEAAA@Auof_get_seasonal_adj_factorc` Error retrieving Seasonal Adjustment factor; Ending emission estimation for process: il_process_rids\RAPIDSProcess Level Estimation not supported for connected processesem_log_detail>13 Ending emission estimation for DAT*.process ii_num_methodsiis_method_typeshFEMIS FACTORPSPECIATIONBCMASS BALANCEis_curcalcmethod.>13 METHOD USED: huof_control_emission_main=SHuo_tll5;uof_downstream_process2|dw_composite_ef25reset/il_uncontrolled_process_ridcA>13p SCC/AMS: AAis_poll_calc_fail0suof_build_poll_list\Ll5;2|il_prev_procDAT*0ess_ridxVAuof_source_device_process3>13 Retrieval Error - Ending emission estimation for l5;2|\>13 ENDING emission estimation for il_discharge_proc_ridrUgd_total_fug_emission*is_curpollutant-6> ib_abortQEmission EstimatorAbort estimation process?***** ESTIMATION RUN ABORTED BY USER *****Q0sM>13 DAT*2 No factors available for emittant: ...Continuing with next emittant. >13 FOR EMITTANT: 6> ,Auof_priority_listX0cbx_stopL8@ >13s ...Continuing with next pollutant. em_priority9A>13 User-specified priority limit exceededuof_use_calc_prot,7>13 Priority: ; MeDAT*4thod: ; method not chosen by user.uof_use_mode_type;>13e Mode Type not chosen by user. uof_metricsA Retrieval Error - ENDING emission estimation for >13 No metrics found for protocol rid is_method_type g>13; Throughput: @0sE>13 ...Continuing with next protocol. Auoit_emiss_tran8 %uoit_rid_tranP $DAT*6id_cutoffdateh u uof_calc_emission_factord 6> Emission estimation successful using priority , Method , Throughput material , Emittant material uof_activity_get_valueJ g>130sS1>13 Either factors or activity unavailable ...Continuing with next protocol. 0sS,ii_usedspecthruputs G0s,is_usedspecthruputs8 H0s0s>13DAT*8 Speciation throughput activity unavailableuof_speciation_scc_ams @ >13SCC/AMS code for process not found in process tableA8 %P $h u d ii_firststandardprofile@ 0@ 0>13s Additive speciation profile(s) have overridden standard profile(s). 6>  g>130sB>13 Input activityDAT*: unavailable for emittant: A8 %P $uof_calc_mass_balanceW6> J Unknown emission estimation type found!0s0s>13sl5;2|xV ( L l          4 < D L X |  L T \      @ d t    DAT*<      ( D ` h p         ( 0 8 @      D L X ` h       ( D X ` h p x    0 8 @ H    H P DAT*> X         0 H ` x    4 < D L T d p x     4 < D L T \       ( 0 8 X ` h p x        $ ,p x   DAT*@         $ , +,$($::F@@8T:F@@81}1<,@$P$6%@%83X!8h8{z%A@A8 $1Z80)81-1  $1dDAT*B,$$#8088,z%z&:)@:@@81<,T$\$6%@%83d!t8t8z%z&A@A81$180)811}$1--1<R X $1d$DAT*D180)8116:T'f(,-/041:2J7Z9~;<@ADDtEzFGIJKLMNRV2X`Zz[~]^_`abehkdq pi_num_pollutantsps_pollutants ps_scc_ams_codepi_log_filept_trans_objectw_emissmat_cur((-4DAT*F DP `@h > cbx_background6>checked em_log_detailsr013textHt Retrieving default emittants from rap_scc_ams_materials.uof_uncont_poll_list()uof_sql_error46> Emission EstimatorNo pollutants specified and no defaults found for SCC/AMS code: 013Hc No emittants specified anDAT*Hd no defaults found for SCC/AMS code: 44 ( @ P X     T \ d      d,$($::F@@8T:F@@8-#Nj<-D,L$6-T,\$6-d,l$6-t,|$6-DAT*J,$6-,$6-,$6-,$6--$180-)81,8N,--$1N80-) 8116:T`n !"#$"%F&j')+-02468>=NdF pi_log_filept_trans_objectDAT*Lw_emisssqlcags_databasegs_rolex $@,@2@>@ cbx_background6>checked transaction0uof_create_trans_object()uof_sql_error4ORACLE4 ( <D L T \ d DAT*Nl t |              ),$($::F@@8T:F@@81} 0$1-1 8$1d1<^8@0A@A88T0A@A8-1 8u0DAT*P1x$11$1z--<=--<=8u"H--< 8u0--1<R $1d-1<1<80A@A88T0A@A811<r8@0A@A88T0A@ADAT*R816:T&f()*.023456<8^9z:<=>BDEF*JHLvNzOQRSUVXZ[.\P^r_xdt pl_process_ridps_scc_ams_codes pi_num_scc_amspt_trans_objectpi_log_filew_emissscc_ams_cur((-4C S_@gd>8 cbx_bacDAT*Tkground6>checked Failure retrieving SCC_AMS code(s) at stream level.8Successful retrieving  ( 0 8 x   !1} ,<% ,$180,)@8,,1-1<1}--<, ,H$1d*DAT*V,r,P$180,)X8,,1r,`$1r--1<R, $,h$1drn,p$1d80,)x8,,1n,1 . V p &Dhn~ "%')*,-:.@/P0`1d3n5DAT*Xr78d ps_profile pi_num_profilespi_log_filept_trans_objps_pollutants pi_num_pollutantsli_profilessqlcapollutant_curX- 0< XI-dv@>H uof_speciation_pollutant_list()uof_sql_error40404DAT*Z0 @ H P X ` h p x 1 ,$($::F@@8T:F@@8 @8-80\M4$1d,<$D$#*8L08_8z%M2(@(8z(:)@:@@81<,$$6%@%83!88z%M2(@(8DAT*\z(A@A81\$1"8$0)L81\-8TL8\0\1M-0`$1dd -6M68h0  55) 8 @ 68001`,$$#8L08-z%8z&M2(@(8DAT*^z(:)@:@@81<,$$6%@%83!P88z%M2(@(8z(A@A81 $180)H8180016:T p$&*,./3*4v78:;<@6AHCLH\L`NdOhPlQpRtTxU|WY[^ _`,a<c@d^hi lPo`DAT*`q~stvwd pd_process_ridps_device_codeps_cntl_co_typeps_pollutantpd_start_date_timepd_end_date_timepi_log_filept_trans_objw_emissls_device_codeldb_null>  & 6 C V gs @  P cbx_background6>checked 2ND6> EDAT*bmission Estimator Could not find control device code for process_rid = em_log_detail13text< Could not find control device code for process_rid = @uof_control_device_code()uof_sql_error4>CONTROL1STCNTL CO GRPuof_choose_group_activitiesPt6>  Could not find control device code for process_rid = 13euof_control_device_code() ..EPA CNTL CO selectiDAT*don04> ( 4 < D    L `        H  k8,$$z%8,z&,z&8?z%8Pz&8mz&,$z&,$#.8,$z%8z&,$$6@8C@C8(@(8z(8z&, $($z&80,@$HDAT*f$6@8C@C8(@(8z'8z&,P$X$z& 8`08b,$$z%,$$& 808 80 8,$$z%8z& z& 8&01<6A@A86A@A8 6A@A86A@A86A@A8 DAT*h6A@A8 6A@A8 6A@A811,H$<,`$ %68h6 8j08v` 8x08 808 z%1<6A@A811< 6A@A8,$$DAT*j$1,$$$1"n,$$ $68`08(,D$L$T$,\$d$l$(@(8z'A@A88t0A@A88j8@8}1<1<Yo@o81<R@84680DAT*l8@8}1<1<Yo@o81<R@8680680)@)8z&A@A8,$$#f80b8,$$$z%8z&A@A8 6A@A811< 80, 8 DAT*n01<d 6A@A8t 11 < 8=z%1< 6A@A8 1 808e08t3@3$80)@)8z'8`z&@$80)@)8z(,$$68 80F 8 80DAT*pF 8F 808,0$8$z%z&1<p  6A@A86A@A86A@A86A@A86A@A86A@A8 6A@A8 112n*. !""#&&8(t*,-./01:2Z3z469:; < =2>DAT*rJ?\@tCDFGIKOQSV~WY]@_b`vabcdef"i4j\kplmnorv6wTzf}j~n   , @ ` d t   0  4 F x , L l p d' ps_ref_codepi_log_filepi_num_pollutantsps_pollutants lb_writingls_log_linels_log_line2ls_log_line3ls_log_line4ls_log_line5ls_log_line6ls_blank_linels_DAT*ttfls_methodls_detail_descll_ill_posls_idls_namels_part_idls_part_namew_emissgs_user_idcase58case169@  @2-LW c p }         DAT*v d $@8 @ : @` Log File Name: is_lognamect User ID: Reference Code: Output Units: is_user_unitls|jis_input_ref_code_bkInput Reference Code: ek Time Period: em_startAJtext Start Date/Time: AJTime Period: AJAJ DAT*x End Date/Time: em_endd@Icbx_stop8@checkedYNLowest Priority: em_priority f9A Stop at 1st Successful Method?: Selected Methods:ii_num_methodsg8iis_method_typesPhFEMIS FACTORPSPECIATIONBCMASS BALANCE uo_sssdi,iclass_grouprw,$il_countyarray,,$il_sourcearray,st_data_level6#Number of Levels selected: ,,$,,DAT*z$Levels: Level IDs:;@@@@@@@@@@@@@@@@@@cbx_log_list-.Level: ,# Level ID: Selected Emittants: ALLSelected Emittants:======================================================================EXECUTION DATAExecution Start Date/Time: mmm dd, yyyyh:mm:ss am/pmem_log_detail131 - Errors/Warnings2 - Basic Documentation3 - Complete DocumentationLog File Detail Level @13$    DAT*|    ( @ H P X       H `           D L T \ d l        0 8 1 80 1}1}N<<%  $180DAT*~)<811<Y}1}<=<=<=<=!1 1)X8  1<R}D1 .\l|( z"#$%'*d pi_num_factorsps_throughput_unit_code ps_throughput_materialDAT* pi_log_filept_trans_objectls_meas_code li_ili_jli_kli_ub0T0-T<-`l |-` Enduof_compare_meas_codesuof_sql_error84+uof_increment_arrayYD < X 2' R1(@(8%@%8M DAT*2(@(8@8R1(@(8@8R1(@(8%@%8i(@(8&R1(@(8@8(@(8 8@8} 1< 1<R1@8 }8 @8}46@86@84@A! 1<!DAT* 1 <T 1 }6@8i1  <Y1 @8i(@(8 8@8} }8 @8} 1 <Y}1<^ 1}v   ^ 6%@%8i @86%@%83 ^M 6%@%8[6%@%8DAT*i3ZM 2(@(8^l8 @8} } 8@8} <1@88,8 "1<! 1<! <1@88,8 " 1<Yo@o8 8  1 <R18.0)@)8DAT*64& N!"%&.'T(/03&4B5V678:;4<V>Z@^ABCEF8GdHIJLOPSd{ pdb_valuelb_scils_valuels_lastls_expli_sig_figli_decimalli_leftli_rightli_eli_lengthli_maxli_ild_test  " * 1<GODAT*X]gns> ; E.t00.000000E+00 *q,$($::F@@8T:F@@8@8)H88P-&8Z #- -X&--h$1dDAT*,p$x$#8088z%(@(8z(:)@:@@81<88z%(@(8z(A@A81-$1-$81<88z%(@(8z(8z&A@A88b0-)81 #$8T$DAT* - -H$8$ - --$1d&5680Gi5,6L180656 6 6806 6)8}1< -1"-1z-DAT*$1z8b0-)8-180L , -  - $18088/z%8Zz&-d$(@(8z(8lz&-p$z&:)@:@@81<8x8z%A@A88-$(@(8z'8lz&-$z&A@A8-1$-1DAT* 6!:.T0p24689:<>@ACEFH JLNQ&S@T^XY\]_6`Tahefhklnpqr"s&t2u6v:w>xByP{T}\~`dhlptx 4 "@djzZn dV pdb_valuepd_reDAT*v_datepl_process_ridps_metric_codeps_pollutantpd_start_date_timepd_end_date_timept_trans_objectpi_log_fileps_method_typeps_reference_codeps_input_unitpb_scc_at_strpb_last_deviceps_data_codew_emissll_stream_ridll_activity_ridli_ret_statusld_activity_valuels_null_valuels_valuegs_user_idls_ref_type  - < I \ m }DAT*    @> ( 6 ?@J  cbx_background6>checked uof_activity_get_valueJ0DISCHARGEDOWNSTRMDIS6> Emission EstimatorCould not find stream_rid for from_process_rid DAT*=  Select returned more than one row More than one stream_rid Multiple output streams not currently supported by emission estimatoruof_activity_replace()uof_sql_error4yis_speciationvaluetype////STRNEEuof_activity_insertL4yCould not update emission estimation record in the activities table Error  : Could not update emission estimate record in the activities tablDAT*e Error    ( H h p x              d p   c,$($::F@@8T:F@@8)<81-1)\88dM-@8nM- -|$1DAT*B-11<pM- 1<1<80A@A81M-!M-!-$1d,$$#8088z%M2(@(8z(:)@:@@81<88z%M2(@(8z(A@A81- $1-DAT*$81<8>8z%M2(@(8z(8[z&A@A880-)81$8$6bM     L-#M     L-<&-$18088#z%8Pz&-X$(@(DAT*8z(8`z&-d$z&:)@:@@81<8l8z%A@A88-$(@(8z'8`z&-$z&A@A8-11*+,6-:9T:t<=ACEGIJNPRST,U2XBZV\Z^^_l`acdfhjlnpruwx6|}4HDAT*"&*.26:>BFJNR^bfjnrvz~ThdX pd_creation_date_timeps_metric_codeps_metric_level_typepd_ref_ridpd_start_date_timeps_user_idpdb_valueps_confidential_flagps_data_codepd_end_date_timeps_material_codeps_method_typeps_reference_codeps_reference_typeps_value_typeps_value_unit_codepi_log_filept_trans_objectw_emissld_stream_ridllDAT*_ridls_valueli_count  - B> M ` k u           )@1> _s?F O cDAT*bx_background6>checked uof_get_rid50uof_activity_get_valueJDDISCHARGEDOWNSTRMDISfMultiple output stream not supported. m6> Emission EstimatorCould not find stream_rid for from_process_rid =  Select returned more than one row More than one stream_rid Multiple output streams not currently supported by emission estimatoruof_activity_insert()uof_sql_error4is_speciationvaluetype/' /DAT*Could not insert emission estimation record into the activities table Error :  Could not insert emission estimate record into the activities table Error   ( < \ |           X d   *,$($::F@@8T:F@@8@83@3$@$DAT*@8 800JM- '-<$18D0M-'-P$19},X$`$#8h08{M2(@(8z'8z&8z&:)@:@@89}J-$1d80 9}J80-)818xM-P(M-(DAT* -*-$1,$$#f8h08{M2(@(8z'8z&8z&z&:)@:@@880-)D8-1 -L$1d0,T$\$#P8h08{M2(@(8z'8z&8dz&z&8zz&:)@:@@8 #1<,$$DAT*6%@%83!88z%z&A@A8^ ^1<,$$,$6%@%834!^88z%z&A@A880- #LL568D0M25,6L18H06566 68J066)d8}1<l-1,,lDAT*$t$#28h08|L1(@(8%@%8i1@8i(@(8z'8z&z&:)@:@@81<,$$6%@%83!&8z%8z&L1(@(8%@%8i1@8i(@(8z(8z&z&A@A8- -$1 ,$r9DAT*}880!9}80- LL5M55 6666-66)  8}1<n ,($0$# 8h08{M2(@(8z'88z&:)@:@@81<T 8{M2(@(8z'A@A88c0A@A8-1DAT* ,$$# 8h08z%8z&)8z(8z&z&8z&:)@:@@8 # 1<,$$6%@%83! 8z%8z&z&8z&)08z(8z&z&8z&A@A8   1<,8$@$6%@%83H! 8z%8z&z&8DAT*z&)X8z(8z&z&8z&A@A8-M -,-`$1>,h$p$# 8h08{M2(@(8z'8z&8z&z&:)@:@@81<8xM2(@(8z'A@A88z%A@A880-)8-1-$1DAT*dp,$$#8h08{M2(@(8z'8z&8dz&z&8z&:)@:@@8 #1<,$ $6%@%83(!88z%A@A88K0A@A8 1<88z%z&A@A85808D0M25,6L18H06566DAT* 68J066)8}1<-1l,$$#t8h08L1(@(8%@%8i1@8i(@(8z'8z&z&:)@:@@81<,$ $6%@%83!V8$L1(@(8%@%8i1@8i(@(8z'8z&DAT*z&A@A8-1-L$1,T$9}880!9}5M55 66806-66)\ 8}1<x,d$l$#8h08{M2(@(8z'88z&:)@:@@81<^8{M2(@(8z'A@DAT*A88c0A@A8-1,t$|$#8h08z%8z&)8z(8z&z&8z&:)@:@@8 #1<,$$6%@%83!8z%A@A88)8z'8z&z&8z&A@A880A@A8 1<,DAT*$$6%@%83!8z%A@A88) 8z'8z&z&8z&A@A880A@A8-1$16:0T3pXYZ]_aehn prt u:vFwd{|:J^bftx|fPZDAT*.^r|>RXhl2~& ,Jfr !#(.X 1l 2 7 8 :2 =T >Z ?j An B H I J\ O P Q R. Y a e f g i k l m q r s u w x } ~  $*:Xv@ftV\lbv<^dtxf\  dDAT* pd_process_ridpdb_fug_emisspdb_cont_emisspd_start_datepd_end_dateps_pollutantps_unitpi_log_filept_rid_objectps_reference_codepb_cont_at_origpd_emiss_start_date_timepb_last_devicepb_from_last_deviceps_method_typeps_data_codew_emisslb_init_flaglb_fug_streamli_ret_statusld_ridld_fug_ridld_value_amtld_new_ridls_metric_codels_null_valueld_todayld_create_date_timell_stream_ridli_countll_rcgs_user_id>  % DAT*4 B N [ co }    @  e(> uo/> ):> G> alR  a ulo iox rDAT*desul@X cbx_background6>checked DOWNSTRMDISMASS FLOWty6> Emission EstimatorDefault Process: No stream for fugitive emission defined DISCHARGEuof_default_calc_success()uof_sql_error46> SQL ERROR finding output stream metric: 46> Output stream metric NOT FOUND. NEW STREAM ACTIVITY WILL BDAT*E CREATED.em_log_detail13textiog NEW STREAM ACTIVITY WILL BE CREATED For Pollutant }13STRNEEuof_activity_insert8LM6> New Emission Value: 13 Pollutant: ; New Emission Value: id_estimator_time_stampauof_activity_updateQ 6>  SQL Failure during activity value updateSQL Failure during activity value update6> DAT*Pollutant: Emission Value: uof_activity_get_valueJ updated.13g Pollutant Emission Value zJ13J6>  Default Process: SQL ERROR finding output stream metric: 46>  NOT FOUND. NEW FUGITIVE STREAM ACTIVITY WILL BE CREATED.13g Pollutant NEW FUGITIVE STREAM ACTIVITY WILL BE CREATED. DAT*NEW FUGITIVE STREAM ACTIVITY WILL BE CREATED For Pollutant LM6> New Fugitive Emission Value: 013 New Fugitive Emission Value: aQ 6> 6> J13g Pollutant Fugitive Emission Value %J13J ( < P X `      D L T DAT*\   $ , 4d l t       ( 0      0 8 @ HX ` h p        (      L T \ d l t |         X+,DAT*$($::F@@8T:F@@8 -.-0$1d,8$@$#8H08[8oz%z&:)@:@@81<,$$6%@%83!88z%A@A88z%8z& z&A@A81-,$1840-)X818`DAT* SMb6RMNd X1 -,/-h$1d,p$x$#8H08[8oz%z&:)@:@@81<,$$6%@%83!88z%z&A@A88 z%8z&z&A@A81-$1840-)81DAT*8`,SMiBRMNk16:)T*X,\0`2n459:4<\?@BCGH IJ N6QHWXY\Z`]d_rabfg8ihlmopuvw(x,}Bd ps_activity_unit_codeps_throughput_unit_codepd_activity_valuepdb_activity_valueps_data_typepi_log_filept_trans_objectw_emissld_factor_amtls_std_unit  DAT*6 H [ ht @>   cbx_background6>checked 6> Emission EstimatorNo unit conversion information found for em_log_detail13textbje No standard unit conversion information found for: From unit: to(standard unit) unit: uof_unit_convert()uof_sql_errorDAT*4GDECIMAL6> 13 No unit conversion information found for From(standard unit): To unit: 4G ( 0 8 @   , X h p x      ,$($::F@@8T:F@@89} #0$18$1d!8@0DAT*)h81 p$1b8x0)81,$ 2$1f9}b1<,$$6%@%83!B8 0A@A818$1d8@0DAT*)h81z,$8$(@(8z'8z&z&8z&8z& z&8z&1,$)8)9811I, $:@) 81<,($0$6%@%838!8H8xz%$(@(8z(A@A888z%A@A8DAT*4$19}8$1d9}88@0)81#68055) 8 }#L46 $19}L($1d9}L8@0)081#1I,8$@$#8DAT*H08[0:)@:@@88085L3Nk]805L]1<,$$6%@%83!80A@A816$18@0)818$1b9} $1dDAT*9}8@0)81# 68055), 8 }# 0;4$1v 9} <$1d 9} 8@0)D81#F 1I,L$T$#B 8H08\0:)@:@@8 8v L3NkDAT* 8 L 1<,$$6%@%83! 80A@A81;$1| 8@0)811<6 1<,$$6%@%83!& 88:z%A@A88V0A@A81|<|$1 8DAT*@0)811<X 1<,$$6%@%83!D 88z%A@A88V0A@A81 1< 1< 80A@A880A@A81 LLdLd LLd LLd5@L]d1<,H$P$6%@%83XDAT*!,h$p$6%@%83x8z%A@A885L];(@(8%@%8i1@8i(@(8z'8z&L1(@(8%@%8i1@8i(@(8z(8z&A@A816 :3T5`IjKLOQR.TRVbWzXYZ[\] `BaRcbdefhDAT*jnuxz{~^(8B<LVh,0| "&*8R^| %'. 0* 1. 42 76 8: => @L Af Br C D F G K N O P UB WF YZ Zr [ \ ] ^ ` e g i l. nH ol r| s t v x& }6 : > L f     " D T DAT*l       jd pl_process_ridpdb_emissionps_pollutantpd_start_date_timepd_end_date_timepi_log_filept_trans_objectpd_input_creation_date_timeps_ref_codepdb_mass_flow_valuepdb_downstrmdis_valuepdb_fugitive_dischargepb_org_processps_method_typew_emissldb_capture_effldb_control_effld_control_eff_termld_ridld_pollutant_ridld_input_valuels_unitls_parent_materialli_countli_num_open_strli_num_connect_strlb_foundlb_input_foundDAT*ld_creation_date_timell_composite_efll_iest_input_cur $ 1 D Ua q      @   > 4> ;> mL> gs[ DAT*cec sevdcks_segs gvil1>H cbx_background6>checked uof_default_parameters()uof_sql_error4Yuof_default_parameters().. open cursors4Yil_uncontrolled_process_ridcem_log_detail13textt No estimation onDAT* input stream.uof_default_parameters()..fetch error4Ydw_composite_efp25process_rid = il_curprocessrid6 AND material_code = ''AND method_type = '1p25rowcount 4find6kp25rowsdiscard13 Using default control efficiency for process 6 Controlled emission factor was applied to upstream process.4YCNTL EFF GRPuof_choose_group_activitiesPDAT*4Y6> Emission EstimatorUsing default control efficiency of 0%WT/WTWT%fI??13f Unknown control efficiency unit.4Y4YCAPT EFF GRPxP4Y6> Using default capture efficiency of 100%f13f Unknown capture efficiency unit.4Y13tDAT* Capture Efficiency found. No output connection found. Calculation Terminated.4Y13t Capture Efficiency found. No fugitive stream found. Multiple open streams. Not supported. Calculation Terminated.?13f13t Pollutant: Control Efficiency = ? WT/WT Capture Efficiency = WT/WT ( 0 8DAT* h p      8 h          ( 0 8       ( 0 8 @         , 4 < D L T       |    @HDAT* P Xh p xH888Gz%8kz&8z&8z&8z&8z&8Jz&8z&8z&888Gz%8kz&8z&8z&8z&8Jz&8z&8z&8~88z%8Cz&8z&8z&8z&8z&8z&8z&-z&8+z&8-88Gz%8kz&8z&DAT*8z&8z&8z&8Jz&8z&8z&,",","=<$18D0)898 11," X= 1 11," =$1d@9$180)8,"9$1DAT*<~ 1d)81d<R} < 1I< 80< 80< 1 =8=6 B=698T 1R1R," = 1R 1R1R," >DAT*$1$1d!80)8,"9,"1 61 >$180)H898P8z%8z&M 2(@(880(z%z&,"$180)T89,"D?DAT*\$18d0)8,"9 ," ?$1dF,"9$180)8,"9@81$1 1  = < ,$1d)81d<RDAT*}  9}1  =  9}  # H M 2(@(8| 8 z%M 2(@(8z(< 1d)$81d<R} 6 ," ?,$14$1d!~ 8<0)p8,"9,DAT*"1 8 1==6  1=B1==61<,$$6%@%83! 8 8z%8z& 1==z&8z&1==z&A@A8 8z%8z& 1==z&8z&R1(@(8z(8z&1==z&A@A8DAT* 9$1$1<,$$6%@%83!8z%8!z&A@A89,"9)|*45 ?z@LOQSFT`UXYZ[^`2a<bZd~ehijklm n(oFpdr~stuvwy|}~PT*DRVZh,:Tx(DAT* 8B` & 0 B z   " D H |  @ d t ~  d x       $(8d( pl_process_ridps_pollutantps_metric_codepdb_efficiencyps_unitpd_start_date_timepd_end_date_timepi_log_filept_trans_objectlb_checkedldb_value_amt ld_pollutant_ridld_parent_ridls_grp_pol ls_unit_code DAT*ls_checked ls_sqlls_sql_startls_sql_endls_sql_childrenls_parent_codell_factor_cntll_check_cntll_match_cntll_ill_match_idxli_ubli_m_ubli_c_ubsqlsagrp_pol_curparent_curw_emiss $ 3 B J ] nz -> DAT*> --- # 0 ; K Zhu-81"@!<> ?>@) CAPT EFF GRPselect material_code, value_amt, value_unit_code from DAT* rap_streams, rap_activities where rap_streams.from_process_rid = ? and rap_activities.ref_rid = rap_streams.rid and rap_streams.to_process_rid is not null and SUBSTR(metric_code,1) = ? and (start_date_time = ? or start_date_time < ?) AND (end_date_time = ? or end_date_time > ? or end_date_time is null) and value_amt is not null and value_unit_code is not nullCNTL EFF GRPCNTL CO GRPselect material_code, rap_device_codes.code from rap_activities, rap_device_codes DAT*where rap_activities.value = rap_device_codes.afs_control_code and rap_activities.value <> '099' and ref_rid = ? and (end_date_time = ? or end_date_time > ? or end_date_time is null) and rap_activities.value_type = ''TRAN EFF GRPuof_choose_group_activities().. open cursoruof_sql_error 04puof_choose_group_activities().. fetch cursor4puof_increment_arrayYEnd4puof_choose_group_activities().. DAT*pollutant rid4pselect code, rap_group_members.parent_ref_rid from rap_group_members, rap_materials where rap_group_members.child_ref_rid in () and rap_materials.rid = rap_group_members.parent_ref_rid uof_choose_group_activities().. prepare parent cursor4puof_choose_group_activities().. open parent cursor4puof_choose_group_activities().. fetch parent cursor4puo_tl5;uof_incr_unb_array;, YDAT*uof_choose_group_actvities().. fetch parent cursor4pem_log_detailMx13text> record for group found: x13 More than one applicable record.<           H  T \        $ , 4 p     DAT* K ,$($::F@@8T:F@@880 4@ @ <$1d,D$L$#$8T08g8z%(@(8z(:)@:@@8 1<z 8g8z%(@(8z(A@A81^ $1^ $8* 1<& 88zDAT*%(@(8z(8z&A@A8N860  )\81M  B d$1d,l$t$#8T08|M2(@(8z'8z&8z&z&8z&8z&z&8z&8z&5(@(8z(8z&8'z&5(@(8z(:)@:@@8 1< 8|M2DAT*(@(8z'A@A8 8z%A@A8 8z%A@A8 85(@(8z'A@A8 8'5(@(8z'A@A810 T$10860  )\81HRZLRV)|8L,   C $18T088zDAT* %8z& $(@(8z(8z& $z&:)@:@@8 1< 88z%A@A8 8 $(@(8z'8z& $z&A@A8 1 L1 !6":/T1h3l5p6~8:<?ABF$G8JzKMNOS&T*VN\^]b^f_janbrdvezf~ijkmop|} DAT*"0V 08DHZz~DX d= pb_init_flagpd_rev_datepl_process_ridpd_start_date_timepd_end_date_timepdb_value_amtps_reference_codeps_pollutantps_metric_codeps_unitpi_log_filept_trans_objps_method_typeps_data_codew_emissld_stream_ridldb_valuels_value_stringls_unitld_creation_datell_activity_ridls_ref_typegs_user_id DAT*$!0 C T b t      @>     G&2@$ cbx_background6>checked DISCHARGEz6>DAT*& Emission EstimatorCould not find stream_rid for from_process_rid =  Select returned more than one row More than one stream_rid Multiple output streams not currently supported by emission estimatoruof_activity_update()uof_sql_errorai4L6> Could not find activity data for Stream: Metric Code: Material Code: Start Date: DAT*( End Date: 4Luof_activity_get_valueJdEEoCould not update control emission record in the activities table. Error : t  record in the activities table.   ( < D L   \ d l t T \ |      n4,$($::F@@8T:F@@81}DAT**M,D$ L$18T0)x81-1 F$1d^,$$#8088z%:)@:@@81<,$$6%@%83!1o@o88< 801o@o88~ DAT*,808 8"08/ z%8Mz&A@A84,X$`$6%@%83h48x0A@A81$18T0)811}$1--1<R TF$1dB$18TDAT*.0)811<,$$6%@%83!X80A@A880A@A81 6!:$T3f46789>@<BVCtFHI&J8KhLzMOPQS4T:\J]Z_x`abcdhln p:q>s\tuvwx{~6Xd pd_pDAT*0rocess_ridpi_num_pollutantsps_pollutants ps_method_typeps_ref_codepi_log_filept_trans_objectw_emissact_curls_method_used8> 8)-D S _k {@E> cbx_background6>checked il_prev_process_rid0Vuof_cont_poll_list()uof_sql_error4i6DAT*2> Emission EstimatorNo input pollutants foundem_log_detail13textUNKNOWNFEMIS FACTORPSPECIATIONBCMASS BALANCE No estimates found for methodw_d13 No estimates found.:4i4i13t Using input pollutants  ( D L x      X ` h  DAT*4      |8,$($::F@@8T:F@@89}9}9}1<M2 66)D8}1<1 61}(f 6,L$T$,l$|<=6D@D$D@D$,DAT*6$$,$!8080:)@:@@81<1<80A@A880A@A880A@A8, 11,9}M2<=665511 ), 8}1<1<848XDAT*8z%M2(@(8z(A@A880A@A81b1<8bb1<bM1B1<=655p$56 9 6)8}1<bb1<1<848Xz%M2(@(8z(A@A880A@A81b1DAT*:<bM2R1R 155<=61=669 5 66)8}1<^,$8R},$GiR1R 155<=61=669 5 66) 8} 9}b1  6 :T`lDAT*<x#$)+,6.F/b34569$:8;Z=|?@ACEIOxQRTVWZ0o4rL{~"h\pR^bfd pd_process_ridps_pollutants pi_num_pollutantsps_reference_codepd_start_date_timepd_end_date_timepi_log_filept_trans_objectpdb_fug_emisspdb_cont_emisspb_calc_successpl_next_process_ridpd_todayps_method_typew_emisslb_successli_ret_statusli_num_inputsli_poDAT*>ll_loopldb_input_values ldb_downstrmdis_valuels_input_units lb_last_deviceld_creation_date_timelb_from_last_devicels_data_codels_method_typew_emiss_statussqlca(@tD> (-4F X k |     DAT*@@ @--L tb-81 8 ( A@6@ cbx_background6>checked uof_cont_poll_listR06> sle_material\,textt6> ib_abort2QEmission EstimatorAbort DAT*Bestimation process? ***** ESTIMATION RUN ABORTED BY USER *****Quof_get_input_activity_valuea  Ending emission estimation for process uoit_rid_trana$uof_default_parametersOxa$uof_default_calc_successMis_start_levelSProcessil_discharge_proc_ridUa$M ( D L T l |     , p         d XDAT*D ,$($::F@@8T:F@@8< 1< 800L8T0 1<,d$t$6%@%83|!6 @$(@(88z&A@A88lM1G1GM ,MM - $180 - )8 DAT*F,111 , G- $1d,$$#8088%z%M2(@(8z(:)@:@@8 1<,<$D$6%@%83L!b 8\8%z%M2(@(8z(A@A8 ,1- x$180 - )8 ,1-DAT*H $11}- $11<R1<R , G- $1d- $180 - )8 ,1- $112)812<R}< 1 , 1<,$$6%@%83!$DAT*J @$(@(88z&A@A88` $48<0\$d8l0 1<,$$6%@%83! @$(@(88z&A@A81}4 6<=55 6 - ) 8 }1<,$$#DAT*L88z%z&8 z&-z&8 z&1=(@(8z(8)z&5860)@)8z(8Pz&5860)@)8z(806:)@:@@8 1< 8[0 - )t81 #8 -6 -66 8|0  )8}1< - 19}LRV*DAT*N8 -6A8L5!N L61^ 1%&'6(:ATBnEGHM6NJOVShTlU~bcdefjkm@oZpxtuxbyrz|}~.Ft*Jf$8\`B   $ 4 8 ~   * : J DAT*PN d ps_metric_codeps_throughput_material_codepd_process_ridpd_start_date_timepd_end_date_timeps_input_output_flagpdb_activity_valueps_activity_unitps_methodps_reference_codepi_log_filept_trans_objectw_emissld_nullldb_value_sumls_convert_to_unitls_no_activityls_data_code_remapli_ret_statusli_countlb_value_foundll_stream_ridsld_to_ridld_from_ridls_stream_ids li_num_streamsils_sql_statementldt_start_date_timeldt_end_date_timelDAT*Ri_ubsqlcadata_cur`  3> B U f {     @>    *8A`P-l> DAT*Tv> - 1   @DG>H cbx_background6>checked Endis_speciationvaluetype4/em_log_detailU13textl Creating cursor of streamsIncuof_activity_data()uof_sql_error$46> Emission EstimatorNo stream found for DAT*Vto_process_rid = U13lt No stream found 44uof_increment_arrayYU13l Setting datawindowSPECIATIONdw_activity"dataobject(d_activity_retrieve_speciate"(d_activity_retrieveU13l Datawindow is Setuof_activity_retrieveU6> No activity record found for Metric Throughput Material DAT*X Stream Start date mmm d, yyyy h:mm:ss AM/PM End date uof_activity_retrieve()4DOUBLEuof_unit_convertN4/1 ( L d t |     < D Lx             4 \ d      t   )  $ DAT*Z),84$8<)H8P$)`8,8hp$8x)88,$z%8z&,$z&8z& @8} 1<88@z%  @8} 1< 1<Yo@o8  <R@88,$z%8z&,DAT*\$z&8z& 1} 1< 8@8} 1<z% 1<Yo@o8z%8z& 1<R@8.8z%z&z&8z&$)88<808,z%@818Z08`8z%:)@@8 DAT*^$6-655,$6,$6)8} 1<$$8!p   < 1} < 8<0 < 8<0 < 8<0 < 9}1D < $$8,)H8 P$8X)h8 p$8x)8DAT*`"=68"<  1<}P8"n  12}P8"  1(}P8"  1}P8"  1}P8"6  1 }P  1}$8 =)81<1:11 1<YDAT*b = 1R < =D  = =f  =1< =1<!==!==!==!  = =  9}$8x80)81<| 1  9}$8x80)81< 1DAT*d 1<R1t $8 ) 81< 8Z08(0:)@@81`$)p81< 8Z08x0:)@@81$1:@)81<t 8Z080:)@@81$8)481< 8Z08(0:)@@81DAT*f<$)D81<J 8Z08x0:)@@81 L$)`8} 1< 1) 1< -1<,x$$6%@%83! -8z%8z&-z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@)8z(A@A8DAT*h1),($ 1<0$188JP8X$18`)p8x$18,)81$$8"8-z%8z&$)8$)8 $)8} 1<$188J8$18`)8DAT*j$18,)81" 1<"8<08<Z8 z%8z&83z%z&8z&L$)T8\$)d8 l$)t8} 1<|$188J8$18`)8$18,)81 1<DAT*l$18x)8$18,)8$18x)8$18,)8!8,$80,$80-1<,$$6%@%83!$-8(z%8z&z&8z&(@(8z(A@A8-8580)@)8z'8DAT*nz&580)@)8z(A@A8-8Uz%8rz&z&A@A81$18x)8h8z%z&8z&z&8z&$)8$)8 $)8} 1<$188J8$18`) 861d,DAT*p $80, $80-1<, $ $6%@%83( !T-8(z%8z&z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@)8z(A@A8-8Uz%8rz&z&A@A818 $188J@ 8DAT*rH $18`)P 861X $)` 8h $)p 8 x $) 8} $18x) 8 $18,) 8# $18x) 8$ $18,) 8 $18x) 8 $18,) 8!", $8DAT*t0, $80-1<, $ $6%@%83 !-8(z%8z&z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@)8z(A@A8-8rz%A@A81 $18x) 8R8z%z&8z&z&8DAT*vz&( $)0 88 $)@ 8 H $)P 8} 1<X $188J` 8h $18`)p 861N,x $80, $80-1<, $ $6%@%83 !>-8(z%8z&z&8z&(@(8z(DAT*xA@A8-8580)@)8z'8z&580)@)8z(A@A8-8Uz%8rz&z&A@A81 $188J 8 $18`) 861)8 , $z%8z& $) 8 $) 8  $) 8} 1<DAT*z  $188J 8 $18`) 8 $18,)( 81) 1<@(0 $8 $8!8z%-z&8z&@ $)H 8P $)X 8 ` $)h 8} 1<X!p $188Jx 8 $18`) 81! 1<DAT*|!6 $) 8 $) 8  $) 8}6 $18x) 8 $18,) 8 $18x) 8 $18,) 8!$, $"80#, $#80-1<, $ $6%@%83 !rDAT*~$-8(z%8z&z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@)8z(A@A8-8U,0 $z%8rz&z&A@A81<(8 $18x)@ 8'8z%z&8z&z&8z&H $)P 8X $)` 8 h $)p 8DAT*} 1<%x $188J 8 $18`) 861', $&80J&, $J&80-1<, $ $6%@%83 !'-8(z%8z&z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@DAT*)8z(A@A8-8U, $z%8rz&z&A@A81<( $188J 8 $18`) 861)-1<, $ $6%@%83 !)-8 z%8z&-z&8z&(@(8z(A@A8-8580)@)8z'8z&580)@DAT*)8z(A@A8-8U,4 $z%A@A811  B^r 2"B$h%|&(,-..B/j0~1234689D:j;~<?BKR`TUVWX[(^V_`cd ef8gPhjijklmnop2q6uPvy~0Df . |    & V 6 d t : DAT*J p T 6d$J^"6VZ&T   lt!$"4&8'l)*+-./J0x1234569:H=AETGdHhIJKNQRS$XJYx\]_bhcdehilpprsw"xVz{|~4br2>NRDAT*8^r $ J r     !D!T!l!|!!!!!"J"""""#\##0$r$$$$$%0%V%j%%%%%%&&8&J&&&j'''''(,( <( @( ((`)))d( pdb_value_amtps_activity_unitps_metric_codeps_material_codepl_stream_ridpd_start_date_timepd_end_date_timeps_reference_codepi_log_filept_trans_objectli_num_rowsli_posli_priorityll_lengDAT*thll_rowll_row2ll_discardcountls_filterls_sqlls_decodels_selectls_rest1ls_restls_charls_dw_syntaxls_errorls_mat_filterls_materialls_materialcode ls_referencecode ls_datacode lb_discardrowimgs_databasew_emisscase99ls_test_decodels_test_mat|  ' 6 GU h DAT*y  -    " f_+ 3 ; etH ECQ _ |k-_r--ac-DAT*@@w  z  < ( dw_activity"settransobject^"setfilteryI="filteraXORACLE"DataWindow.Table.selectdescribe_trjDECODE(data_code,NULL,'is_null_code_mapzr','RO','is_ro_code_mapq',data_code)if rap_activities.data_code is null then :as_null else if rap_activities.data_code = 'RO' then :as_ro else rap_activities.data_code endif endiDAT*fDECODE(data_code,NULL,~'r~',~'RO~',~' q~',data_code)'~'DataWindow.Table.select='"modifyzActivity DataWindow Select unchanged. Contact Technical Support.Erroruo_emission::uof_activity_retrieve(); string ls_decode not found in SQL for dw_activity.8"qrretrieve2"dataobjectdd_activity_retrieve_speciate"material_codegetitemstring:"reference_code:"decode:PMDAT*,TOTALPMPM,FLTRBLEPM10,TOTALPM10PM10,FLTRBLE"prioritysetitemO"_P"P"decode AsetsortXuo_emission::uof_activity_retrieve(); setSort() failed."sort)chuo_emission::uof_activity_retrieve(); sort() failed."rowsdiscarduo_emission::uof_activity_retrieve(); rowsDiscard() failed."priority D, decode A, value_amt DX"ch"rowcount4Tem_log_detailh13DAT*text No activity record for of at stream Start Date: mmm d, yyyy h:mm:ss AM/PM End Date: is_input_ref_codek"value_amtgetitemnumber B"value_unit_code:":"d_activity_retrievematerial_code = '"I="X"4T" B":":reference_code = ' AND reference_code = '"I="X"4DAT*T" B":":":":":":qROrNULLh13 More than one activity record for Reference Code: Data Code: ": AND material_code = '' AND decode = '"I="X"4T" B":qrh13" B":"I=DAT*"X"4T":":":":":":qrh13":"I="X"4T" B":qrh13" B":k"I="X"4T" B":":""I="XDAT*"4T" B":"I="X"4T":":":":qrh13k":"I="X"4T" B":qrh13k" B":h13 No activity records for k , 4 HDAT* P ` p              $ H P h p           ` p    4 < D L ` x  ( 0 P X p x              DAT*  L T \ d l t |                                  ( 8 @ H P X ` h p x           DAT*          ( 0 8 @ H P X ` h p x                     ( 0 8 @ H P X ` h p x            DAT*          0 8 @ H P X ` h p x                 4 "M) 8}1<r,8$8@,P$h$,)81<80,)81DAT*M,$G9"n1<,$$6%@%83!n80A@A8, $$6%@%838,0A@A88Pt$z%8|z&$z&A@A88$z%8|z&$z&A@A880A@A81<,$$#8 088<zDAT*%M2(@(8z(:)@:@@81<V8X8vz%M2(@(8z(A@A811<,$$6%@%83!80A@A888z%M2(@(8z(A@A81<80A@A88M2(@(8z'A@A81,$ DAT*$, $(D$6,X$`x$8z%$z&,$$8z%$z&,$$8z%$z&125 :4;R<=BCD>E`FHJLLOnTUYZ_Vbfcdhjk2lTotuvw*xl{df pd_process_ridpb_control_process_flagpi_log_fileli_ret_statusw_emiDAT*sssqlcaw_emiss_status> /;I@Q@W@8 uof_get_process_infokis_start_level(SProcessuo_tl)H5;il_cursourceridX4uof_source_name8puof_process_info()uof_sql_error4il_orig_process_ridTem_log_detail\13text sq13 BEGINNING emission estimatDAT*ion for Device ID/Name: is_curdeviceide</is_curdevicenamer~= Process ID/Name: is_curprocessid>is_curprocessname?cbx_background6>checkedEmission EstimatorSource/Device/Process record not found for process_rid Source/Device/Process record not found for process_rid 13Beginning emission estimation for process SQL Error occurred on process_rid 6>sle_county*is_curcountynaDAT*mez09sle_sourceL/ is_cursourceidh: / is_cursourcename;sle_device.e<~=sle_process->? 8 P h         t             ( D X ` x          $0:DAT*,$($::F@@8T:F@@843@3$@$@8-@81@8?@8,@89800!9} 9}9}"9}$9}1%@1G1%L1I1%T1I1%h1I1%DAT*p1G&1}(1}#9}90&!r#9}21##BM2&<CF2&<C1<,$$6%@%83!F8M22(@(8z'A@A8 &<=8(1<h'1}'('X'<%1G'<%DAT*9}%'<=$6+-)8}'<%('<=0$6%1<1T%1<'<%81G'<%@9}TT%+66'<%H-)h8}%1<x1T%1<'<%p1G'<%x9}TTDAT*%1<T'<%'<=?3i'<%9}#9}1<,$$6%@%83!88z%A@A8&B &<=8!BA &<=68#A8,A" *@}%M26 &<=655(*-)T 8 }%1<DAT*-1 %1<1<,\$d$6%@%83l!8| &<=z%8z&M2(@(8z(A@A8&<CM2&0 *@ @*}@<%1G@<%1I@<%1I@<%1I!9}&B8A (1DAT*< '1} '(' % &<=6'<%M25580'<%'<%806)   8 }'<%'<=$6%1<2 -1 %1< 1<,$$,$6%@%834! 8D8^z%'<=p$zDAT*&A@A8'<=$8#. '<%1IV '<%1I'<%9}'<%@8 '<%9} 9} &B8AB(1<8%6-)8}%1<l -18%1<n'1} '('j'<DAT*%'<=$6'<%1I'<%@8'<%9} 8'1}'('8% &<=6'<%M255-6'<%'<%806)  8 }'<%'<= $6%1<-DAT*14%1<L'<%(M'<=0$6880'<%H'<%P55-)t 8 }'<=|$91<,$$6%@%83!$88z%A@A8'<%1I'<%@8H'<=$8DAT*'<%5'<=>]<'<%58'<= >3(Nk]9}4'<=@$8'<%H5X'<=P>]'<%`5'<=h>3pNk]'<%9}9}&M2&<C0'1}|'('.'<=DAT*$8#| #z1<,$$6%@%83!r88z%'<=$z&A@A880A@A8.x,8,0'<= $d1<,($0$6%@%838!`8H8jz%'<=$z&A@A880A@A8x;'<=$:DAT*'<=$8@87'<=$:1Yo@o89768'<=$;:Y@83'<=>1(@(8%@%8.'<=$6'<=$8%'<=$6861'<%80)8}'<%76DAT*'<%76'<= >'<=(>d1<,0$8$6%@%83@!x8P8dz%'<=t$z&8|z&M321@8i(@(8z(8|z&.z&A@A88~'<=>i1@8i(@(8z'8|z&'<=$z&A@A8TDAT*'<=$8,T'<=$,$%'<=$6,$61'<%80)8}%1<'<=>'<%,$6&<CM2&.'<=>1<, $$6%@%83!T8,8dzDAT*%'<=D$z&8|z&'<=L>1(@(8%@%8i1@8i(@(8z(8|z&'<=T$z&A@A8&x'<=\$R'<=d>d1<,l$t$6%@%83|!88|z%5'<=>]5di1@8i(@(DAT*8z(8|z&'<=$z&A@A8'<=$R'<=?Nd1<,$$6%@%83!88|z%'<= ?21@8i(@(8z(A@A8x'<= $x1I1<,$ $, $6%@%834 !x8D z%8k DAT*z&A@A8R5 .1<, $ $6%@%83 ! 8 0A@A88 z%A@A8780, $7! %76, $6180) 8}%1<2!1<, $ $6%@%83 !"!8( 8> z%A@A8153@3$@DAT*$@8M23\ !/8l M22(@(8z'!/M22(@(80(@(8%MR1655-556<=>98n 0) 8}%1<"-1, $M6) 81<\#1<, $ $6%@%83 !L#8 8 z%A@A8DAT*161%796$9}=H ?L=NV%L=145M8P 06558n 06,\ $6$06)| 8}%1<d$--11<, $ $6%@%83 !%8 L=1(@(8%@%8i1@8i(@(8z'8|z&, $z&ADAT*@A8, $ $6%@%83 %8 0A@A8,8 0'796%L>145M8P 06558n 06,( $6$06)0 8}%1<&--11<,8 $@ $6%@%83H !'8 L>1(@(8%@%8i1@8iDAT*(@(8z'8|z&,X $z&A@A8,` $h $6%@%83p '8 0A@A8,8,07780",(7'<= $6%L<145M,66558n 06, $6$06) 8}%1<(--11<, $ $6%@%83 DAT*!B*8 ,z%8 z&L<1(@(8%@%8i1@8i(@(8z(8|z&, $z&A@A8, $ $6%@%83 B*8 0A@A8L>5 ,  ?L>NV%L>145M8 06558n 06, $6$06) 8}%1<:+-DAT*-11<, $( $6%@%830 !,8@ L>1(@(8%@%8i1@8i(@(8z'8|z&,` $z&A@A8,h $p $6%@%83x ,8 0A@A8, M, $ $#-8 08 8 z%8 z&8z&'<= $z&8(z&z&DAT*8|z&)T8z(8|z&'<=\$z&:)@:@@81<,d$l$6%@%83t!-88z%A@A8-1.1<,$$6%@%83!.88z%A@A8r(1<0/1<,$$$6%@%83,!,/8<0A@A8DAT*8[0A@A8/'1}P/'('/'<%9}'<%9}'<%9}F/(1}!9} 9}9}"9}#9}0:$%&6':>TABCDEGHI(J4K@MLNrOPQT UV.X:[B\P]X^d_nareghij oFqfrztuw{8~tPdtDAT*2TXdh &LXR F n     . F  * . V x   > R X h     D f jn\ "(*+/$0L1~34568<:H>L?v@ACD(F4I8PBR\SUWX [P^r_vazbcdg>j`ndoprswRxz|`DAT*:xXl`TbBHx J    "!2!l!|!!!!!j"~""""$#L# \# l# |###4$H$N$T$d$ $#P%$%'%(%,%-%6`&8t&9z&:&<&=&@|'A'D'G'H(K,(S(U(V(W(Y(Z4)])^ *bB*dR*g|*p +r+s$+t*+w:+x+{&,|`,,,,---- ..\..... /,/0/^/////DAT*//// 000d` pd_process_ridps_scc_ams_codeps_reference_codepd_start_date_timepd_end_date_timepi_num_metricspi_num_metric_groupspd_record_group_no> pd_sequence_no> ps_item_type ps_operator_type ps_numer_material_code@ ps_denom_material_code ps_metric_code ps_in_throughput_materialps_pollutantpdb_est_emissionps_emission_unit_codepi_log_filept_trans_objectpt_emiDAT*ss_objectpt_rid_objectpl_next_process_ridpb_scc_at_strpi_curr_priorityw_emisslst_mass_eq lst_input_material lst_density lst_xfer_eff lst_mass_fraction$ lb_transfer_eff_foundlb_density_foundlb_flow_foundlb_factor_foundlb_ready_to_calculatelb_last_deviceli_ret_statusli_metric_loopli_indexli_num_input_materialsli_eq_entry_countli_input_ubls_profile_codels_metric_codels_null_valuels_act_unitls_groupls_priorityld_DAT*null_valueld_curr_groupld_act_valueld_todayld_input_creation_date_timell_next_process_ridls_numer_unitls_denom_unitls_density_numer_unitll_char_posll_lengthldb_mass_flow_valueldb_downstrmdis_valueldb_fugitive_dischargeldb_nullli_ubcase169sqlca4P,Ld<>  '