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<>  ' 9 L ]lDAT*>->----4-P@-\ v     Na idpr@,-SL8-ssdX- fp-ur-rer DAT*)$3<Seq      > > >    ! / DAT*= S_i }    @X cbx_backgroundp6>checked throughput_amt1amtHHvalue_amt2\Hem_log_detailx13text Method metric group: EHfoundcodeuof_get_spec_profile8=material_code}DAT*HHuof_get_mass_fractions@?PHHHtx13 No input flow defined. MUST HAVE either VOL FLOW or MASS FLOW before FRACTION.MVOL FLOWMASS FLOWuof_get_throughput_materials^6x13t No input of to process 1HH\DENSITYIHunitMASS BALANCEuof_activity_dataTDAT*x13t Density not found for material code: metric_codexHHTRANSFER EFFuof_pm>\\TTRAN EFF GRP\uof_choose_group_activitiesPXx13t Transfer efficiency not found. Default = 100%\WT/WT\\?DAT*\\?\\?\\?xx13 Required density not found for material code:  Continuing with next possible materialx13 Unit is blank for the density of material code:  Will not convert units/HHDOUBLEuof_unit_convertNDAT*HHx13t Vol Flow of material =  Density = Hxis_user_unitjjHNHjHx13 Mass Flow H\x13 TRANSFER EFF = \?Y@Hx13 MaDAT*ss fraction = Hx13 Mass fraction not found for - no estimation calculatedx13 ***** Result ***** Emittant material = 1jjNx13t Converting unit touser selected unit failed  0BCuof_default_parametersOq uo_tl' 5;uof_downstream_process2 x13 Multiple output DAT*streams. Partitioning on output streams NOT supported.gd_total_fug_emission2 *DOWNSTRMDISjuof_activity_replaceKd x13t DOWNSTREAM DISCHARGE EMISSION = jx13 from MASS BALANCE methodDISCHARGEjKd x13tjx13jKd x13t EMISSION = jx13DAT*2 *2 *jKd x13t FUGITIVE EMISSION = jx13il_uncontrolled_process_rid c6> Emission EstimatorEmission estimation successful , Method MASS BALANCE, Throughput material , Emittant material uof_activity_get_valueJ=x13 Estimation successfully completed using MASS BALANCE method.x13DAT*t Estimation failed using MASS BALANCE method.x13 No input flow defined. MUST HAVE either VOL FLOW or MASS FLOW6 ( @ L T h p       ( 0 8 @ H h p x      T \ d l      DAT*     $ , 4p                    ( 0 H P t |           (8@ H P X` h p       ( 0 8DAT*               ( 0 8 @t                 D L T \ d l t |        $ , 4       DAT*     \       H \ |        ( 0 8 @ H X ` h p                 ( 0 ` h p x      T \ d l t DAT*  $ ,   X Q,$($::F@@8T:F@@8H$#"d$-)|8$)8}$1<80 -)8-1"9} 1}$1<,$$#808#8<z%:)@:@@8 1DAT* < 8J8pz%A@A8-11}x$$<8J8$<8J8}$<8)8$<8)8$<8),84$<8<)H8P$<8X)d8l$<8t)DAT* 8$<8)8$<8)8$<8)89}89}1}<b<1@8<1@8<1@88!Tb^<9}08DAT*8"!8"!8"!8"!09} -- < M-- < }- - < 6- 1d)8-< 1G- < 80,- - < 80H- - < 6t- - < 80- - < 6DAT*RAPIDS Emission User Object (More Functions)forward global type uo_toplevel from userobject end type type uo_emis from uo_emission within uo_toplevel end type end forward global type uo_toplevel from userobject integer width = 2848 integer height = 916 boolean border = true long backcolor = 67108864 long tabtextcolor = 33554432 uo_emis uo_emis end type global uo_toplevel uo_toplevel type variables Transaction itr_county // Transaction itr_state Transaction itr_device // TranDAT*saction itr_source // Transaction itr_nation // w_emiss iw_parent //Declare parent variable for reference end variables forward prototypes public function integer uof_source_list (long pl_source_rid, ref transaction pt_src_trans_object, integer pi_log_file, ref long pl_source_list[], ref integer pi_num_source) public function int uof_downstream_process (long pl_src_process_rid, ref transaction pt_trans_object, ref long pl_target_process) public function int uof_orig_process (long pDAT*l_process_rid, ref transaction pt_trans_object) public function int uof_process_grp (long pl_process_rid, ref transaction pt_proc_trans_obj) public function int uof_device_grp (long pl_device_rid, ref transaction pt_proc_trans_object) public function integer uof_source (datetime pd_start_date, datetime pd_end_date, long pl_source_rid, string ps_reference, string ps_ini_file, string ps_ini_section, integer pi_log_file, integer pi_num_calc_prots, string ps_calc_prots[], integer pi_num_modes, striDAT*ng ps_modes[], integer pi_num_pollutants, string ps_pollutants[]) public function integer uof_device (datetime pd_start_date, datetime pd_end_date, long pl_device_rid, string ps_reference, string ps_ini_file, string ps_ini_section, integer pi_log_file, integer pi_num_calc_prots, string ps_calc_prots[], integer pi_num_modes, string ps_modes[], integer pi_num_pollutants, string ps_pollutants[]) public function integer uof_source_name (long pl_source_rid, ref integer pi_log_file, transaction pt_traDAT*ns_object) public function integer uof_state (datetime pd_start_date, datetime pd_end_date, long pl_state_rid, string ps_reference, ref integer pi_log_file, integer pi_num_calc_prots, string ps_calc_prots[], integer pi_num_modes, string ps_modes[], integer pi_num_pollutants, string ps_pollutants[]) public function integer uof_nation (datetime pd_start_date, datetime pd_end_date, long pl_nation_rid, string ps_reference, ref integer pi_log_file, integer pi_num_calc_prots, string ps_calc_prots[], iDAT*nteger pi_num_modes, string ps_modes[], integer pi_num_pollutants, string ps_pollutants[]) public subroutine uof_incr_unb_array (ref long pl_array[], ref integer pi_ub, integer pi_increment) public function integer uof_device_list (long pl_source_rid, ref transaction pt_dev_trans_object, integer pi_log_file, ref long pl_device_list[], ref integer pi_num_device, ref integer pi_dev_ub) public function integer uof_process_list (long pl_device_rid, ref transaction pt_proc_trans_object, integer pi_lDAT*og_file, ref long pl_process_list[], ref integer pi_num_process, ref integer pi_pro_ub) public function integer uof_county (datetime pd_start_date, datetime pd_end_date, ref long pl_county_rid, string ps_reference, ref integer pi_log_file, integer pi_num_calc_prots, string ps_calc_prots[], integer pi_num_modes, string ps_modes[], integer pi_num_pollutants, string ps_pollutants[]) public subroutine uof_disconnect (transaction arg_tranobj) end prototypes public function integer uof_source_listDAT* (long pl_source_rid, ref transaction pt_src_trans_object, integer pi_log_file, ref long pl_source_list[], ref integer pi_num_source);// Function to retrieve all sources that are associated with the // given source. If the source is not a member of a group, the // function returns the given source in source_list. If the given // source is invalid, the function returns 0. // Argument List: val long pl_source_rid rid of source // ref transaction pt_src_trans_objecDAT* t transaction object // val int pi_log_file log file ptr // ref long pl_source_list[] list of source rids // ref int pi_num_source number of sources // // // // Return: 1 Success // 0 Failure // -1 SQL error ///////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF DAT*" long ll_rid int li_cnt = 1 // For now, just return the source rid we are given pi_num_source = li_cnt pl_source_list[pi_num_source] = pl_source_rid return li_cnt end function public function int uof_downstream_process (long pl_src_process_rid, ref transaction pt_trans_object, ref long pl_target_process);// Function to retrieve the rid of the process immediately // downstream of the source process. The function works only when // there is no more than one immediate downstrDAT*$eam process. // // Argument list: val long pl_source_process_rid // ref transaction pt_trans_object // ref long pl_target_process_rid // // Return: 1 Success // 0 Error: More than one downstream process // -1 SQL Error // If there are no downstream processes, the function returns 1, // but target rid is set to zero. //////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetDAT*&Pointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF int nInd Select to_process_rid into :pl_target_process from rap_streams where from_process_rid = :pl_src_process_rid and to_process_rid is not null // 16NOV94 MAS handle fug_stream using pt_trans_object; if pt_trans_object.sqlcode = 0 then if IsNull(pl_target_process) then pl_target_process = 0 nInd = 1 elseif pt_trans_object.sqlcode = 100 then nInd = 1 pl_target_process = 0 elseif pt_trans_object.sqlcodDAT*(e = -185 then // More than one row nInd = 0 pl_target_process = 0 elseif (pt_trans_object.sqlcode = -1) and & (pt_trans_object.sqlerrtext = "Select returned more than one row") then nInd = 0 pl_target_process = 0 else nInd = -1 pl_target_process = 0 end if return nInd end function public function int uof_orig_process (long pl_process_rid, ref transaction pt_trans_object);// Function determines if the given process is an originating process. // Arguments:DAT** val long pl_process_rid // ref transaction pt_trans_object // // Returns: 1 Process is originating // 0 Process is not originating // -1 SQL Error ///////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF int nCnt int nInd Select Count(*) into :nCnt from rap_streams where to_process_rid = :pl_process_rid using pt_trans_obDAT*,ject; if pt_trans_object.sqlcode = 0 then if nCnt = 0 then nInd = 1 else nInd = 0 end if else nInd = -1 // Sql Error end if return nInd end function public function int uof_process_grp (long pl_process_rid, ref transaction pt_proc_trans_obj);// Function determines if the given process is a member of a group. // Note that a process could BE a group. This function only tells // if a process is a group MEMBER. // Return: 1 The process is a mDAT*.ember of a group // 0 The process is not a member of a group // -1 SQL Error //////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF long ll_Cnt Select count(*) into :ll_Cnt From rap_group_members Where child_ref_rid = :pl_process_rid Using pt_proc_trans_obj; if pt_proc_trans_obj.sqlcode = 0 then if ll_Cnt > 0 then ll_CntDAT*0 = 1 // Process is a group member end if else ll_Cnt = -1 // There was an error end if return ll_Cnt end function public function int uof_device_grp (long pl_device_rid, ref transaction pt_proc_trans_object);// Function determines if the given device is a member of a group. // Note that a device could BE a group. This function only tells // if a device is a group MEMBER. // Return: 1 The device is a member of a group // 0 The device is not a member DAT*2of a group // -1 SQL Error //////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF long ll_Cnt Select count(*) into :ll_Cnt From rap_group_members Where child_ref_rid = :pl_device_rid Using pt_proc_trans_object; if pt_proc_trans_object.sqlcode = 0 then if ll_Cnt > 0 then ll_Cnt = 1 // device is a group member end if else ll_DAT*4Cnt = -1 // There was an error end if return ll_Cnt end function public function integer uof_source (datetime pd_start_date, datetime pd_end_date, long pl_source_rid, string ps_reference, string ps_ini_file, string ps_ini_section, integer pi_log_file, 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 source level emission // estimation. // // argumenDAT*6ts: val datetime pd_start_date // val datetime pd_end_date // val long pl_source_rid // val string ps_reference // val string ps_ini_file // val string ps_ini_section // val integer pi_log_file // val integer pi_num_calc_prots // val string ps_calc_prots[] // val integer pi_num_modes // val string ps_modes[] // DAT*8 val integer pi_num_pollutants // val string ps_pollutants[] // // return: 1 Succesful // 0 Failure // -1 Sql Error // -2 User Aborted Run IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variable(s) integer li_dev_ctr // process counter integer li_num_device // number of devices in the list long ll_device_list[] // DAT*:list of device rids for a source integer li_return_status, li_dev_ub string ls_source_name, ls_source_id // Initialize variables li_dev_ctr = 0 li_num_device = 0 ll_device_list[100] = 0 li_dev_ub = 100 // setup // Write agency id & name to log file REJ 07MAR96 li_return_status = uof_source_name(pl_source_rid, pi_log_file, itr_source) IF li_return_status = -1 THEN Return( -1 ) END IF // main if uof_device_list (pl_source_rid, itr_source, pi_log_file, ll_device_lisDAT*<t[], & li_num_device, li_dev_ub) <> 1 then // retrieving devices for the source failed if NOT w_emiss.cbx_background.checked then MessageBox("Emission Estimator", "No devices found for given source") end if if pi_log_file <> -1 then FileWrite(pi_log_file, "Error: No devices found for given source") FileWrite(pi_log_file, "Ending emission estimation for " + & "source " + String (pl_source_rid) ) FileWrite(pi_log_fileDAT*>, " ") end if li_num_device = 0 end if //\\uo_emis.uof_abort_trans( itr_source) // Don't need this anymore // pass each device in the device list to uof_device to // perform emission estimations for li_dev_ctr = 1 to li_num_device // At some point we may want to filter device groups here // This is not implemented yet, but could be by calling // function uof_device_grp li_return_status = & uof_device(pd_start_date, pd_end_date, & ll_device_list[liDAT*@_dev_ctr], & ps_reference, ps_ini_file, ps_ini_section,pi_log_file,& pi_num_calc_prots, ps_calc_prots[],& pi_num_modes, ps_modes[],pi_num_pollutants,& ps_pollutants[]) if li_return_status <> 1 then if li_return_status = -2 then return (-2) end if // emission estimation at process level failed end if next // if li_num_device > 0 then li_num_device = 1 IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " ======DAT*B================================================================") END IF return(li_num_device) end function public function integer uof_device (datetime pd_start_date, datetime pd_end_date, long pl_device_rid, string ps_reference, string ps_ini_file, string ps_ini_section, integer pi_log_file, 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 device level emDAT*Dission // estimation. // // arguments: val datetime pd_start_date // val datetime pd_end_date // val long pl_device_rid // val string ps_reference // val string ps_ini_file // val string ps_ini_section // val integer pi_log_file // val integer pi_num_calc_prots // val string ps_calc_prots[] // val integer pi_num_modes // DAT*F val string ps_modes[] // // return: 1 Succesful // 0 Failure // -1 sql Error IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variable(s) int li_Ind // Indicator variable long ll_next_process // Downstream process long ll_curr_process // Current process integer li_proc_ctr // process counter integer li_num_process DAT*H // number of processes in the list long ll_process_list[] // list of process ids for a device integer li_pro_ub // upper bound of process list // Initialize variables li_proc_ctr = 0 li_num_process = 0 ll_process_list[50] = 0 li_pro_ub = 50 // main // Write source name to estimator window if at device level estimation IF w_emiss.is_start_level = 'Device' THEN li_Ind = uof_source_name (w_emiss.il_source_rid, pi_log_file, itr_device) IF li_Ind = -1 THEN RETDAT*JURN -1 END IF END IF // main if uof_process_list (pl_device_rid, itr_device, pi_log_file, ll_process_list[], & li_num_process, li_pro_ub) <> 1 then // retrieving processes for the device failed if NOT w_emiss.cbx_background.checked then MessageBox("Emission Estimator", "No process found for device") end if if pi_log_file <> -1 then FileWrite(pi_log_file, "Error: No processes for given device") FileWrite(pi_log_file, "Ending emissiDAT*Lon estimation for " + & "device " + String (pl_device_rid) ) FileWrite(pi_log_file, " ") end if li_num_process = 0 end if // pass each process in the process list to uof_emissions_main for li_proc_ctr = 1 to li_num_process ll_curr_process = ll_process_list[li_proc_ctr] // 15FEB95 multiple inputs to an uncontolled process li_Ind = uof_downstream_process(ll_curr_process, itr_device, ll_next_process) if li_Ind = -1 then f_db_error(itr_deviDAT*Nce, "uof_downstream_process") end if IF (ll_next_process <> w_emiss.il_uncontrolled_process_rid) or & (w_emiss.il_uncontrolled_process_rid = 0 and ll_next_process = 0) THEN // Check to see if the process is an originating process li_Ind = uof_orig_process(ll_curr_process, itr_device) if li_Ind = 1 then w_emiss.il_orig_process_rid = ll_curr_process elseif li_Ind = -1 then MessageBox("Error", "Function uof_orig_process failed") end if w_emDAT*Piss.il_prev_process_rid = 0 // MAS 31AUG94 DO // Loop for each downstream process // Filter out any group processes if uof_process_grp(ll_curr_process, itr_device) = 0 then li_Ind = uo_emis.uof_emissions_main(pd_start_date, pd_end_date, & ll_curr_process, & ps_reference, ps_ini_file, ps_ini_section,pi_log_file, & ll_next_process,pi_num_calc_prots, ps_calc_prots[],& pi_num_modes, ps_modesDAT*R[],& pi_num_pollutants, ps_pollutants[]) if li_Ind = -2 then //mas 03AUG95 //\\ uo_emis.uof_abort_trans( itr_device) // Don't need anymore (REJ 13MAR96) Return (-2) end if w_emiss.il_prev_process_rid = ll_curr_process // We might want to do something here if li_Ind is not zero else li_Ind = uof_downstream_process(ll_curr_process, itr_device, ll_next_process) if li_Ind = 0 then MessageBox("Error", "Process haDAT*Ts more than one downstream~r" & + "process - " + string(ll_curr_process)) if li_Ind = -1 then f_db_error(itr_device, "uof_downstream_process") end if ll_curr_process = ll_next_process LOOP UNTIL ll_curr_process = 0 END IF // next_process not visited yet. next // //\\uo_emis.uof_abort_trans( itr_device) // Don't need anymore if li_num_process > 0 then li_num_process = 1 return(li_num_process) end function public function integer uofDAT*V_source_name (long pl_source_rid, ref integer pi_log_file, transaction pt_trans_object);// Find name of source for log file and status window STRING ls_source_name, ls_source_id SELECT rap_sources.name, rap_sources.id INTO :ls_source_name, :ls_source_id FROM rap_sources WHERE rap_sources.rid = :pl_source_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error-record not found! IF NOT w_emiss.cbx_background.checked THEN MessagDAT*XeBox( "Emission Estimator", "Source record" + & " not found for source_rid " + String( pl_source_rid ), & Exclamation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Source record " + & "not found for source_rid " + String( pl_source_rid ) ) END IF ls_source_name = "" ls_source_id = "" ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_source: name select",DAT*Z pi_log_file, pt_trans_object) Return( -1 ) ELSE // Record retrieved successfully IF IsNull( ls_source_name ) THEN ls_source_name = "" END IF IF IsNull( ls_source_id ) THEN ls_source_id = "" END IF END IF // Update signals IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) // FileWrite( pi_log_file, " BEGINNING emission estimation for" ) FileWrite( pi_log_file, " SOURCE BEGIN - Date/Time: " + & String(Today(), "mmm dd, yyyy") +DAT*\ " " + & String(Now(), "h:mm:ss am/pm") ) FileWrite( pi_log_file, " Source ID/Name: " + ls_source_id + "/" + ls_source_name) END IF IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_source.text = ls_source_id + " / " + ls_source_name w_emiss_status.sle_device.text = "" w_emiss_status.sle_process.text = "" END IF Return 1 end function public function integer uof_state (datetime pd_start_date, datetime pd_end_date, long pl_state_rid, string ps_referencDAT*^e, ref integer pi_log_file, 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_state() // // This function is the main driver for state level emission // estimation. // // arguments: val datetime pd_start_date // val datetime pd_end_date // val long pl_state_rid // val string ps_reference // val integer pi_log_file /DAT*`/ val integer pi_num_calc_prots // val string ps_calc_prots[] // val integer pi_num_modes // val string ps_modes[] // val integer pi_num_pollutants // val string ps_pollutants[] // // return: 1 Succesful // 0 Failure // -1 Sql Error // -2 User aborted run // IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlaDAT*bss! ) END IF // Declare local variables LONG ll_county_rid INTEGER li_loop INTEGER li_num_counties, li_ret_status LONG ll_county_rids[] ll_county_rids[100] = 0 INTEGER li_cnty_ub = 100 // Take out looping back to calculate script - Performance wasn't improved REJ 02DEC96 //IF w_emiss.ii_num_cnty_rids = 0 THEN // Create a transaction object for database access IF NOT isvalid(itr_state) then IF uo_emis.uof_create_trans_object( pi_log_file, itr_state ) <> 1 DAT*dTHEN // Error creating trans object Return( -1 ) END IF END IF // Declare cursor to get all counties in the given state DECLARE county_cur CURSOR FOR SELECT rid FROM rap_geographic_locations WHERE parent_rid = :pl_state_rid USING itr_state; // Get current state name SELECT name INTO :w_emiss.is_state_name FROM rap_geographic_locations WHERE rid = :pl_state_rid USING itr_state; IF itr_state.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_DAT*ferror( "uof_state()", pi_log_file, itr_state ) ROLLBACK USING itr_state; //\\uo_emis.uof_abort_trans( itr_state ) Return( -1 ) END IF // Put current state in log file IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Beginning estimation for state: " + w_emiss.is_state_name ) END IF // Retreive counties OPEN county_cur; IF itr_state.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_state(): open", pi_log_file, itr_stateDAT*h ) ROLLBACK USING itr_state; CLOSE county_cur; //\\uo_emis.uof_abort_trans( itr_state ) Return( -1 ) END IF // Retrive the first record FETCH county_cur INTO :ll_county_rid; IF itr_state.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No counties found for " + & "state: " + w_emiss.is_state_name, Information!, OK! ) END IF IF pi_log_file <> -1 THEN FileWriDAT*jte( pi_log_file, "Error: No counties found for state: " + & w_emiss.is_state_name ) FileWrite( pi_log_file, "Ending emission estimation for state: " + & w_emiss.is_state_name ) FileWrite( pi_log_file, " " ) END IF //\\uo_emis.uof_abort_trans( itr_state ) Return( 0 ) ELSEIF itr_state.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_state(): fetch1", pi_log_file, itr_state ) ROLLBACK USING itr_state; CLOSE counDAT*lty_cur; //\\uo_emis.uof_abort_trans( itr_state ) Return( -1 ) ELSE li_num_counties = 1 END IF DO WHILE itr_state.sqlcode = 0 // Store the current county rid ll_county_rids[ li_num_counties ] = ll_county_rid // Get the next county FETCH county_cur INTO :ll_county_rid; IF itr_state.sqlcode = 100 THEN // No more counties EXIT ELSEIF itr_state.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_state(): fetch2", pi_DAT*nlog_file, itr_state ) ROLLBACK USING itr_state; CLOSE county_cur; //\\uo_emis.uof_abort_trans( itr_state ) Return( -1 ) ELSE li_num_counties++ IF li_num_counties = li_cnty_ub THEN uof_incr_unb_array(ll_county_rids, li_cnty_ub, 50) END IF END IF LOOP // Commit, Close cursor, and destroy trans object COMMIT USING itr_state; IF itr_state.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_state(): commit", pi_log_file, itr_state DAT*p) ROLLBACK USING itr_state; //\\uo_emis.uof_abort_trans( itr_state ) Return( -1 ) END IF CLOSE county_cur; //IF itr_state.sqlcode <> 0 THEN // // SQL Error // uo_emis.uof_sql_error( "uof_state(): close", pi_log_file, itr_state ) // ROLLBACK USING itr_state; // Return( -1 ) //END IF //\\uo_emis.uof_abort_trans( itr_state ) // Take out looping back to calculate script - Performance wasn't improved REJ 02DEC96 //ELSE // IF w_emiss.ib_initial = TRUE THEN // li_nDAT*rum_counties = w_emiss.ii_num_start_rids // ll_county_rids = w_emiss.il_start_rid_array // ELSE // li_num_counties = w_emiss.ii_num_cnty_rids // ll_county_rids = w_emiss.il_county_rid_array // END IF // w_emiss.ii_num_cnty_rids = 0 //END IF // If county array is given // Run the estimator for the counties FOR li_loop = 1 TO li_num_counties // Take out looping back to calculate script - Performance wasn't improved REJ 02DEC96 // IF li_ret_status = 2 THEN // w_emiss.ii_num_cnty_ridsDAT*t++ // w_emiss.il_county_rid_array[w_emiss.ii_num_cnty_rids] = ll_county_rids[li_loop] // CONTINUE // END IF li_ret_status = uof_county( pd_start_date, pd_end_date, ll_county_rids[li_loop], & ps_reference, pi_log_file, pi_num_calc_prots, & ps_calc_prots[], pi_num_modes, ps_modes[], & pi_num_pollutants, ps_pollutants[] ) // Check for user aborted run IF li_ret_status = -2 THEN EXIT // Take out looping back to calculate script - PerfoDAT*vrmance wasn't improved REJ 02DEC96 // ELSEIF li_ret_status = 2 THEN // // county not finished, return to same county next time // w_emiss.il_county_rid_array = ll_county_rids // w_emiss.ii_num_cnty_rids = li_num_counties // EXIT // ELSEIF li_num_counties > 1 THEN // // county finished, but state has more counties // li_ret_status = 2 // CONTINUE ELSE // w_emiss.ib_last = TRUE li_ret_status = 1 END IF NEXT // Take out looping back to calculate script - Performance wasn'DAT*xt improved REJ 02DEC96 //IF li_ret_status = 2 THEN // w_emiss.ib_initial = FALSE // RETURN li_ret_status //END IF // Update log file IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Ending estimation for state: " + w_emiss.is_state_name ) END IF // Normal Return Return(li_ret_status) // end uof_state() end function public function integer uof_nation (datetime pd_start_date, datetime pd_end_date, long pl_nation_rid, string ps_reference, reDAT*zf integer pi_log_file, 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_nation() // // This function is the main driver for nation level emission // estimation. // // arguments: val datetime pd_start_date // val datetime pd_end_date // val long pl_nation_rid // val string ps_reference // val integer pi_log_file // DAT*| val integer pi_num_calc_prots // val string ps_calc_prots[] // val integer pi_num_modes // val string ps_modes[] // val integer pi_num_pollutants // val string ps_pollutants[] // // return: 1 Succesful // 0 Failure // -1 Sql Error IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare localDAT*~ variables LONG ll_state_rid STRING ls_name INTEGER li_loop INTEGER li_num_states LONG ll_state_rids[] ll_state_rids[50] = 0 INTEGER li_state_ub = 50 // Create a transaction object for database access IF NOT isvalid(itr_nation) then IF uo_emis.uof_create_trans_object( iw_parent.ii_log_file, itr_nation ) <> 1 THEN // Error creating trans object Return( -1 ) END IF END IF // Declare cursor to get all states in the given nation DECLARE state_cDAT*ur CURSOR FOR SELECT rid FROM rap_geographic_locations WHERE parent_rid = :pl_nation_rid USING itr_nation; // Get current nation name SELECT name INTO :ls_name FROM rap_geographic_locations WHERE rid = :pl_nation_rid USING itr_nation; IF itr_nation.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_nation()", pi_log_file, itr_nation ) ROLLBACK USING itr_nation; //\\uo_emis.uof_abort_trans( itr_nation ) Return( -1 ) END IF // Put DAT*current nation in log file IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Beginning estimation for nation: " + ls_name ) END IF // Retreive states OPEN state_cur; IF itr_nation.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_nation(): open", pi_log_file, itr_nation ) ROLLBACK USING itr_nation; CLOSE state_cur; //\\ uo_emis.uof_abort_trans( itr_nation ) Return( -1 ) END IF // Retrive the first record FETCH state_cDAT*ur INTO :ll_state_rid; IF itr_nation.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No states found for " + & "nation: " + ls_name, Information!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Error: No states found for nation: " + & ls_name ) FileWrite( pi_log_file, "Ending emission estimation for nation: " + & ls_DAT*name ) FileWrite( pi_log_file, " " ) END IF //\\uo_emis.uof_abort_trans( itr_nation ) Return( 0 ) ELSEIF itr_nation.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_nation(): fetch1", pi_log_file, itr_nation ) ROLLBACK USING itr_nation; CLOSE state_cur; //\\uo_emis.uof_abort_trans( itr_nation ) Return( -1 ) ELSE li_num_states = 1 END IF DO WHILE itr_nation.sqlcode = 0 // Store the current state rid ll_state_rids[ li_num_states ] DAT*= ll_state_rid // Get the next state FETCH state_cur INTO :ll_state_rid; IF itr_nation.sqlcode = 100 THEN // No more states EXIT ELSEIF itr_nation.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_nation(): fetch2", pi_log_file, itr_nation ) ROLLBACK USING itr_nation; CLOSE state_cur; //\\uo_emis.uof_abort_trans( itr_nation ) Return( -1 ) ELSE li_num_states++ IF li_num_states = li_state_ub THEN DAT*uof_incr_unb_array(ll_state_rids, li_state_ub, 10) END IF END IF LOOP // Commit, close cursor, and destroy trans object COMMIT USING itr_nation; IF itr_nation.sqlcode <> 0 THEN // SQL Error uo_emis.uof_sql_error( "uof_nation(): commit", pi_log_file, itr_nation ) ROLLBACK USING itr_nation; //\\uo_emis.uof_abort_trans( itr_nation ) Return( -1 ) END IF CLOSE state_cur; //IF itr_nation.sqlcode <> 0 THEN // // SQL Error // uo_emis.uof_sql_error( "uof_nation(): DAT*close", pi_log_file, itr_nation ) // ROLLBACK USING itr_nation; // Return( -1 ) //END IF //\\uo_emis.uof_abort_trans( itr_nation ) // Run the estimator for the states FOR li_loop = 1 TO li_num_states uof_state( pd_start_date, pd_end_date, ll_state_rids[li_loop], & ps_reference, pi_log_file, pi_num_calc_prots, & ps_calc_prots[], pi_num_modes, ps_modes[], & pi_num_pollutants, ps_pollutants[] ) NEXT // Update log file IF pi_log_file DAT*<> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Ending estimation for nation: " + ls_name ) END IF // Normal Return Return( 1 ) // end uof_nation() end function public subroutine uof_incr_unb_array (ref long pl_array[], ref integer pi_ub, integer pi_increment);//Arguments: pl_array long reference // the array // pi_ub integer reference // the array's upper bound pi_ub = pi_ub + pi_increment pl_array[pi_ub] = 0 Return end subrouDAT*tine public function integer uof_device_list (long pl_source_rid, ref transaction pt_dev_trans_object, integer pi_log_file, ref long pl_device_list[], ref integer pi_num_device, ref integer pi_dev_ub);// Function to retrieve all the originating devices that are // associated with a given source_rid. An originating device is // defined as a device that has no associated to_device_rid in the // rap_connections table. // // Argument List: val long pl_source_rid rid of sourcDAT*e // ref transaction pt_dev_trans_object transaction object // val int pi_log_file log file ptr // ref long pl_device_list[] list of device rids // ref int pi_num_device number of devices // // // // Return: 1 Success // 0 Failure // -1 SQL error ///////////////////////////////////////////////////////////////////// IF w_emiss.cbx_background.checked THEN SetPointDAT*er( Arrow! ) ELSE SetPointer( HourGlass! ) END IF long ll_rid int li_cnt // Declare cursor DECLARE device_cur CURSOR FOR SELECT rap_devices.rid FROM rap_devices WHERE rap_devices.source_rid = :pl_source_rid USING pt_dev_trans_object; // Open the cursor OPEN device_cur; // Retrieve record(s) do while pt_dev_trans_object.sqlcode = 0 li_cnt = -1 // Assume an error FETCH device_cur INTO :ll_rid; if pt_dev_trans_objectDAT*.sqlcode = 0 then // See if device is an originating device SELECT COUNT(*) into :li_cnt FROM rap_connections WHERE to_device_rid = :ll_rid; end if if li_cnt = 0 then pi_num_device ++ IF pi_num_device = pi_dev_ub THEN uof_incr_unb_array( pl_device_list, pi_dev_ub, 50) END IF pl_device_list[pi_num_device] = ll_Rid end if loop // end of retrieving process id(s) if pi_num_device > 0 then li_cnt = 1 // Success else DAT* li_cnt = 0 // Failure end if if pt_dev_trans_object.sqlcode <> 100 then uo_emis.uof_sql_error("uof_device_list()", pi_log_file, & pt_dev_trans_object) li_cnt = -1 end if // close the cursor CLOSE device_cur; return li_cnt end function public function integer uof_process_list (long pl_device_rid, ref transaction pt_proc_trans_object, integer pi_log_file, ref long pl_process_list[], ref integer pi_num_process, ref integer pi_pro_ub);// This function retrieves all DAT*the processes that are // associated with the device of pl_device_id. Any process that is // a member of a group will be filtered from the returned process // list. // // Argument List: val long pl_device_rid rid of device // ref transaction pt_proc_trans_object transaction object // val int pi_log_file log file ptr // ref long pl_process_list[] list of process ids // ref int pi_num_proDAT*cess number of processes // // // // Return: 1 Success // 0 Failure // -1 SQL error // IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare cursor DECLARE process_cur CURSOR FOR SELECT rap_processes.rid FROM rap_processes WHERE rap_processes.device_rid = :pl_device_rid USING pt_proc_trans_object; // Open the cursor OPEN process_cur; if pt_proc_transDAT*_object.sqlcode <> 0 then // error opening the cursor uo_emis.uof_sql_error("uof_process_list()", pi_log_file, & pt_proc_trans_object) return (-1) end if // Retrieve record(s) do while pt_proc_trans_object.sqlcode = 0 FETCH process_cur INTO :pl_process_list[pi_num_process + 1]; if pt_proc_trans_object.sqlcode = 100 then // no more records to retrieve exit // exit the loop elseif pt_proc_trans_object.sDAT*qlcode <> 0 then // error during fetching uo_emis.uof_sql_error("uof_process_list()", pi_log_file, & pt_proc_trans_object) return (-1) else pi_num_process ++ IF pi_num_process >= pi_pro_ub THEN uof_incr_unb_array ( pl_process_list, pi_pro_ub, 50) END IF end if loop // end of retrieving process id(s) // close the cursor CLOSE process_cur; // normal return return (1) end function public function iDAT*nteger uof_county (datetime pd_start_date, datetime pd_end_date, ref long pl_county_rid, string ps_reference, ref integer pi_log_file, 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_county() // // This function is the main driver for county level emission // estimation. // // arguments: val datetime pd_start_date // val datetime pd_end_date // val long DAT* pl_county_rid // val string ps_reference // val integer pi_log_file // val integer pi_num_calc_prots // val string ps_calc_prots[] // val integer pi_num_modes // val string ps_modes[] // val integer pi_num_pollutants // val string ps_pollutants[] // // return: 1 Succesful // 0 Failure // -1 Sql Error // -2 User DAT*aborted run // // Who Date Modification // --- ---- --------------------------- // REJ 19MAR96 Check return status for user abort IF w_emiss.cbx_background.checked THEN SetPointer( Arrow! ) ELSE SetPointer( HourGlass! ) END IF // Declare local variables LONG ll_source_rid STRING ls_name STRING ls_type INTEGER li_loop INTEGER li_num_sources INTEGER li_ret_status LONG ll_source_rids[] STRING ls_source_types[] INTEGER li_src_ub li_src_ub DAT*= MAX(100,w_emiss.ii_start_rid_ub) ll_source_rids[li_src_ub] = 0 ls_source_types[li_src_ub] = 'End' // Create a transaction object for county database access IF NOT isvalid(itr_county) then IF this.uo_emis.uof_create_trans_object( iw_parent.ii_log_file, itr_county ) <> 1 THEN // Error creating trans object messageBox("Error", "uo_toplevel::uof_county(); "+& "invalid transaction object itr_county", exclamation!) return -1 END IF END IF // Declare cursor toDAT* get all sources in the given county DECLARE source_cur CURSOR FOR SELECT rid, type FROM rap_sources WHERE geographic_county_rid = :pl_county_rid USING itr_county; // Get current county name SELECT name INTO :ls_name FROM rap_geographic_locations WHERE rid = :pl_county_rid USING itr_county; IF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emis.uof_sql_error( "uof_county() getting county name", pi_log_file, itr_county ) ROLLBACDAT*K USING itr_county; //\\this.uo_emis.uof_abort_trans( itr_county ) Return( -1 ) END IF // Put current county in log file IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Beginning estimation for county: " + ls_name ) END IF IF w_emiss.cbx_background.checked THEN w_emiss_status.sle_county.text = ls_name END IF // Retreive sources OPEN source_cur; f_sqlcheck(itr_county) IF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emDAT*is.uof_sql_error( "uof_county(): open", pi_log_file, itr_county ) ROLLBACK USING itr_county; //\\this.uo_emis.uof_abort_trans( itr_county ) CLOSE source_cur; return ( -1 ) END IF // Retrive the first record FETCH source_cur INTO :ll_source_rid, :ls_type; IF itr_county.sqlcode = 100 THEN // Record not found IF NOT w_emiss.cbx_background.checked THEN MessageBox( "Emission Estimator", "No sources found for " + & "county: " + ls_name, InfoDAT*rmation!, OK! ) END IF IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Error: No sources found for county: " + & ls_name ) FileWrite( pi_log_file, "Ending emission estimation for county: " + & ls_name ) FileWrite( pi_log_file, " " ) END IF //\\this.uo_emis.uof_abort_trans( itr_county ) CLOSE source_cur; return ( 0 ) ELSEIF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emis.uof_sql_error( "uof_county(DAT*): fetch1", pi_log_file, & itr_county ) ROLLBACK USING itr_county; //\\this.uo_emis.uof_abort_trans( itr_county ) CLOSE source_cur; return ( -1 ) ELSE li_num_sources = 1 END IF DO WHILE itr_county.sqlcode = 0 // Store the current source info ll_source_rids[ li_num_sources ] = ll_source_rid ls_source_types[ li_num_sources ] = ls_type // Get the next source FETCH source_cur INTO :ll_source_rid, :ls_type; IDAT*F itr_county.sqlcode = 100 THEN // No more sources EXIT ELSEIF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emis.uof_sql_error( "uof_county(): fetch2", pi_log_file, & itr_county ) ROLLBACK USING itr_county; //\\this.uo_emis.uof_abort_trans( itr_county ) CLOSE source_cur; return ( -1 ) ELSE li_num_sources++ IF li_num_sources = li_src_ub THEN uof_incr_unb_array(ll_source_rids, li_src_ub, DAT*50) // uo_emis.uof_increment_array(ls_source_types, 50) this.uo_emis.uof_increment_array(ls_source_types, 50) // Take out looping back to calculate script - Performance wasn't improved REJ 02DEC96 // w_emiss.ii_start_rid_ub = li_src_ub // w_emiss.il_start_rid_array[w_emiss.ii_start_rid_ub] = 0 END IF END IF LOOP CLOSE source_cur; // Commit, Close cursor, and destroy trans object COMMIT USING itr_county; IF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emisDAT*.uof_sql_error( "uof_county(): commit", pi_log_file, itr_county ) ROLLBACK USING itr_county; //\\this.uo_emis.uof_abort_trans( itr_county ) return ( -1 ) END IF FOR li_loop = 1 TO li_num_sources // Run the estimator for this source li_ret_status = uof_source( pd_start_date, pd_end_date, ll_source_rids[ li_loop ], & ps_reference, "", "", pi_log_file, pi_num_calc_prots, & ps_calc_prots[], pi_num_modes, ps_modes[], & pi_DAT*num_pollutants, ps_pollutants[] ) // User aborted run REJ 19MAR96 IF li_ret_status = -2 THEN EXIT END IF // Reset Access to Log file to release log records from memory REJ 19FEB96 FileClose(pi_log_file) pi_log_file = FileOpen(w_emiss.is_logname, LineMode!, Write!, LockWrite!, Append!) NEXT //// No more sources //w_emiss.cbx_facility.checked = FALSE //w_emiss.cbx_area.checked = FALSE IF li_ret_status = 1 THEN // Update log file // Get current county name // CreatDAT*e a transaction object for database access IF this.uo_emis.uof_create_trans_object( pi_log_file, itr_county ) <> 1 THEN // Error creating trans object Return( -1 ) END IF SELECT name INTO :ls_name FROM rap_geographic_locations WHERE rid = :pl_county_rid USING itr_county; IF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emis.uof_sql_error( "uof_county() :getting county", pi_log_file, itr_county ) ROLLBACK USING itr_county; //\\ this.uo_emis.uofDAT*_abort_trans( itr_county ) return ( -1 ) END IF // Commit, Close cursor, and destroy trans object COMMIT USING itr_county; IF itr_county.sqlcode <> 0 THEN // SQL Error this.uo_emis.uof_sql_error( "uof_county(): commit", pi_log_file, itr_county ) ROLLBACK USING itr_county; //\\ this.uo_emis.uof_abort_trans( itr_county ) return ( -1 ) END IF //\\ this.uo_emis.uof_abort_trans( itr_county ) IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) DAT* FileWrite( pi_log_file, "Ending estimation for county: " + ls_name ) END IF // Take out looping back to calculate script - Performance wasn't improved REJ 02DEC96 //ELSEIF li_ret_status = 2 THEN // w_emiss.ib_initial = FALSE // RETURN li_ret_status END IF // Normal Return Return(li_ret_status) // end uof_county() end function public subroutine uof_disconnect (transaction arg_tranobj);// uof_disconnect( TRANSACTION VAR arg_tranobj ) // // This function closes a passed transacDAT*tion object // // Returns: none // IF IsValid(arg_tranobj) THEN DISCONNECT USING arg_tranobj; DESTROY arg_tranobj; END IF // end uof_disconnect() end subroutine on destructor;uof_disconnect(itr_county) uof_disconnect(itr_nation) uof_disconnect(itr_state) uof_disconnect(itr_source) uof_disconnect(itr_device) end on on constructor;iw_parent = parent // Create a transaction object: itr_device if this.uo_emis.uof_create_trans_object(iw_parent.ii_log_file, itr_deDAT*vice) <> 1 then // error during device transaction object creation if iw_parent.ii_log_file <> -1 then FileWrite(iw_parent.ii_log_file, "Error creating process transaction object") FileWrite(iw_parent.ii_log_file, "Ending emission estimation for " + & "device " ) // + String (pl_device_rid) ) FileWrite(iw_parent.ii_log_file, " ") end if end if // Create a transaction object: itr_source if this.uo_emis.uof_create_trans_object(iw_parent.ii_log_fDAT*ile, itr_source) <> 1 then // error during device transaction object creation if iw_parent.ii_log_file <> -1 then FileWrite(iw_parent.ii_log_file, "Error creating process transaction object") FileWrite(iw_parent.ii_log_file, "Ending emission estimation for " + & "source " ) // + String (pl_source_rid) ) FileWrite(iw_parent.ii_log_file, " ") end if end if end on on uo_toplevel.create this.uo_emis=create uo_emis this.Control[]={this.uo_emis} DAT* end on on uo_toplevel.destroy destroy(this.uo_emis) end on type uo_emis from uo_emission within uo_toplevel integer x = 55 integer y = 96 long backcolor = 67108864 end type on uo_emis.destroy call uo_emission::destroy end on DAT*- 1<< ,$$$#P808,8Kz%z&8Yz&z&8cz&z&8nz&z&8{z&z&:)@:@@8 1<"  8z%A@A8 8z%A@A8 8z%A@A8 8 z%A@A8 89z%A@A8-1R -1%&'6(:PTQfRSTUVW XDAT*^"a4cPdnghkl0d(XHThzLPT^bx$08BZr (,HRptP d#&),0" 1( 28 4< 5B d0 ps_source_codeps_device_codeps_process_codeps_scc_ams_codeps_pollutantpi_num_modesps_modesd pd_protocol_rid pi_priority_nops_mode_type ps_method_DAT*code ps_throughput_material_code pi_rows_returnedpi_log_filept_trans_objectw_emisslb_save_recordli_posli_rowld_ridli_priority_nols_method_codels_mode_typels_throughput_material_codels_source_codels_device_codels_process_codels_emittant_material_codels_scc_ams_codels_sub_typeli_prot_ubll  & 6 F SDAT*l`-x-----!- =@ET[b> R i x f    z  X  \  2e@DAT* cbx_background6>checked ib_protocol_retrieved0(dw_calc_priorityhP!settransobject^lii_num_protocolsi_p)P!retrieves_m1)uof_priority_list()uof_sql_error40()6> Emission EstimatorNo calculation protocol records found No calculation protocol records found)P!ridgetitemnumber P!priority_no P!method_codegetitemstringP!DAT*mode_typeP!throughput_material_codeP!source_codeP!device_codeP!process_codeP!emittant_material_codeP!scc_ams_codeP!sub_typeS%C@uof_increment_array_int]END6> No calculation protocols found for source: device: process: pollutant: OR scc_ams: No calculation protocols found for source: device: DAT* process: pollutant: OR SCC/AMS:  ( H d |          x          , 4 H P d l          $ >-}-<R 80DAT*d6 ps_arrayT pl_incrementli_bound<- - End>,$($::F@@8T:F@@8@8@81}-} < 800< 800< 800 848z%8z&8z&z&8%DAT*z&8yz&-z&," - %,"\H- $180 - )8- %,"1-1 111%," H- $1dR,$$#808 85z%z&:)@:@@8 1<,T$d$6%@%83l!( 8|8z%-z&A@A8- %DAT*,"1P- $180 - )8- %,"1P1}-<=-< 80-<=4-< 80-1 80- $1--1<R -1<R-1<R-1<R%," H--1<R 80- $1d(- DAT*$180 - )8- %,"1-<=-< 80-<=-< 80-12) 8 12)(812)0812)8812)@8-}P-< 1}-< 800-< 8001DAT*}:-F 9}1}t"< % <= 9}j #""<  <=61<R}<=1<B 9}}f-N  <= <= <=8H <=8L" <=8H <=8L"!"DAT*<=<=<=<=!"!<=<=<=<=!"!  9}< 1}< 1}J -<=-<=J < 1}\ B<=8<=8!P  1<,P$X$6%@%83`!L  8p8z% <=z&A@DAT*A8 8z%8z&A@A8 <=8r  1<,$$6%@%83!n  88z% <=z&88z&A@A8 8:<=z%88z&A@A8 8z%8z&A@A8  1<,P$X$6%@%83`!  88z% <=z&88z&A@A8DAT* 8:<=z%8pz&<=z&88z&A@A8 8z%8z&A@A8 9}1} <= <= 9}  #B<  <=601}f1}- <=1<<= <=!< DAT*80\1}0<=8< <=6&1<B1}B&<=68H&8L&"H-8@8}-8@81R}1<1<-<o@o8-1<R@8z(DAT*V-1<Yo@o8-1<R@8z(-1<Yo@o8-1<R@8z(-8@8}-8@81R}1<D1<-<o@o8-1<R@8z(D-1<Yo@o8-1<R@8z(DAT*D-1<Yo@o8-1<R@8z(>-8<=z%8z&@98}-8@81R}<=}1<>1<h-<o@o8-<<R1R@8z(>-1<Yo@o8-<<R1R@8z(>DAT*-1<Yo@o8-<<R1R@8z( 1}1}t"^! M2< %6-5-5' - )   8}80808V80 9}1}- <=8<=1<! DAT*<=< %! 9}x1}*-Z<=1< <=< %!<=8!V < 1}V<=<="!1<":< 1}V-< '6 j-}1}1}^<=1<DAT*Z-Z -<  <=6--< -<=6--< -<=61}~- <=6B88+( <=6)-<=6*-<=6 <  +<=6-< -+<=6-< -+<=6 +< (6-DAT*+< )6-+< *6+t+}%,"- 16:!T"p$%&'(, 3\5j79:;<@B2DLEjIJM(N.O>PNRlSTUVWXY[\^4aPdjefgi j$lBmfnlo|pqrsuvxyz,{L|l}~HT @Lt , J N V DAT* L p  > n r  ^ BFt >^h@pRV.~DH      dv>BT$ %0'V*b+-/1 28568:;6>:AVNZQ^RjT|UVWXY Z2]Zc^gjlmnp$qLrttuvz~"(dH ps_scc_ams_codeps_profileDAT*_code pi_num_profile_codesps_gen_spec_thruputsps_spec_filter pd_source_processpl_target_processpd_start_datepd_end_datepi_log_filept_trans_objectlb_foundls_sqlls_throughput ls_multiple ls_dup_mat ls_ctl1 ls_ctl2 ls_controlledls_cntl_co_typels_proc_cd1ls_proc_cd2ls_dist_thruputs@@  li_ili_jli_kli_cntli_multiplepli_posli_lengthli_pos_commali_countli_numli_ret_statusDAT*li_dist_thruputsw_emisssqlsaprofile_curcase238ls_temp_spec_filterls_tempthruls_tempcodels_tempfilterli_front(p $8Lp (-4I p^-|>     - -$DAT*-80-LD-X f mnv  -_cdeer-eviit )@1"@!7$H>D tM >aDAT* tim  y ce cbx_background6>checked EndSelect 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 = AND rap_scc_ams_speciation_codes.profile_code = rap_emission_factors.profile_code AND SUBSTR(throughput_material_code,1) in @DAT*uof_get_profile_code()uof_sql_error@46> Emission Estimator No generic profile codes found for SCC/AMS code: em_log_detailE13text\ No generic profile codes found to match throughput materials: 4factor_type = 'P' AND 4uof_increment_arrayY Y Y Y Y TOGVOCE13\e Multiple generic uncontrolled speciation pDAT*rofiles found for material and SCC . These will not be used.E13\e Multiple generic controlled speciation profiles, primary control E13\e, secondary control REMOVE'TOG'',''VOC''uof_calc_ef_set_cont_filter%nNOT FOUNDii_firststandardprofile<0 (      T d l        ( 0 8 @DAT* P X `  P X `  8 ,$($::F@@8T:F@@8D1}`=|.}1},x$,$< %8 /9},$< %8H09},$< %89}+1d DAT*80,1d 80 1d}/ 788z%8z&8 z&z&85z&8z&8z&8?z&8bz&(@(8z(8uz&8z&8z&8~z&8 z&z&8z&8bz&$(@(8z(8uz&8z&8z&8z&8 z&z&8z&8bz&$(@(8z(8uz&8z&8z&8z&8 z&z&8z&8bz&,DAT*$(@(8z(84z&,"7,?,"dI,8$1:8@0,)8,?,"1-1?," I,$1d^,$$#8088z%z&:)@:@@81<,$$6%@%83!T8,8?z%z&A@A8, ,`$18hDAT* 0,)8,?,"1 1}--< 80--<=8--<=8"--<=8"--<=8"--<=1o@o88"--<=1o@o88"--<=8"--<=8"--<=8"--<=8"--<=8"DAT*  + 12)8, < 80+< --<=6,< 80,$1 --1<R?," I,$1d  ,$18 0,)$8,?,"1 --<D 12)@812)H8--< 80--<DAT*=8--<=8"--<=8"--<=8"--<=1o@o88"--<=1o@o88"--<=8"--<=8"--<=8"--<=8"--<=8"  @ + 12)P8, < 80+< --<=6DAT*,< 80?,"-0"D1})12 80!12}A,  ,X$1v 8 0,)`8A,1)1<RA, DL29}1}  )1<R=)<= 29} 2#!n )!12)DAT*h8)<=8)<=8")<=8")<=8")<=1o@o88")<=1o@o88")<=8")<=8")<=8")<=8")<=8"29}1}D)<=+<=xDAT*29},< 8p0)<=1o@o88+<=8!)<=1o@o88+<=8!"@,< 8p0 2# + 12)t8, < 80+< )<=6,< 8p0,|$1v ,$1d|8 0DAT*,)8A,1D1<41<,$$6%@%83!88z%A@A8A,/0"#41A,0B,  ,$18 0,)8B,1+1<RB, \O29}1}4DAT*z+1<R=+<=29},< 8p0+1<R=1o@o88+<=8!+1<R=1o@o88+<=8!"v,< 8p0*2# + 12) 8, < 80,< 8p0,$1,$1dDAT*8 0,)$8B,1H1<81<,,$4$6%@%83<!8L8vz%A@A8B,/-"#81B,29}1}t+<=859}+<=1o@o88469},<=8"}4DAT*1}+<=8`39}+<=1o@o8849},<=8}1}j5#6! \+ 12)8, < 80+< 801<,< +<=6,< 8p03#4! J+ 12)DAT*8, < 80+< 801<,< +<=6,< 8p01<&80%801}%%+<=z%8z&&&+<=z%8z&%%+<=z%8z&&&+<=z%8z&09}0$-1 8DAT* 0C, ,$18 0,)8C,11}-1<RC, tQ-<-1)8,$1,$1d8 0,)8C,,1C,:%61}"*;;8DAT*"z%-<=z&^;;8z%-<=z&8z&D-<=68D8D" :8@8}:8@81R}1<61<t::<o@o8:1<R@8z(6::1<Yo@o8:1<R@8z(6::1<Yo@DAT*$o8:1<R@8z(:8"@8}:8@81R}1< 1< ::<o@o8:1<R@8z( t ::1<Yo@o8:1<R@8z( ::1<Yo@o8:1<R@8z(":8(-<=z%8DAT*&(z&@98}:8@81R}-<=}1<"1<!::<o@o8:<<R1R@8z("d"::1<Yo@o8:<<R1R@8z("::1<Yo@o8:<<R1R@8z(1<,,$DAT*(4$6%@%83<!#1<T#8L;z%A@A8#1<#8;z%A@A8#80A@A8:8#1} 1}P$6  : Gi-  ) 8 }1<x$1$- 1<1<!$ 1}- 1@8- 1DAT**<$09}00/%988Ez%8~z&8z&8z&8z&z&8(z&8*z&:z&798Vz%8^z&8z&8*z&%z&8z&(@(8z(&988Ez%8~z&8z&8z&8z&z&8(z&8*z&:z&798Vz%8 z&8z&8*z&%z&8z&(@(8z(,"7,?,"Q,d $1'8 DAT*,0,)l 8,?,"1/X'--1<R;?," Q|'-1?," $R,t $1d|(,| $ $#'808 8z%z&:)@:@@81<, $ $6%@%83 !r(8 8 z%z&A@A8,0, $1(8 0,) 8,?,"DAT*.10/+29}1})-l)--1<R=-<=h)29}l))2#)--<)12) 812) 8-}1})++<=;+,<=8*-< -<=8( z%;z&8z&:+,<=8p*-< -DAT*0<=8( z%;z&8z&:+-< -<=8( z%,<=z&8z&<1}Z+<, $<+4 $<<=;++P+<< $+D L $T $< ;6+),,1}-1 8\ 0,` $10/,--1<R;?," `R,--1<R?," R,DAT*2h $1d,00,p $1<-8 0,)x 8,?,"10/V029}1}p-----1<R=-<=-29}-f-2#2.--<&.12) 812) 8-}1}R.R0+<=;N0,<=8.-< DAT*4-<=8( z%;z&8z&/,<=8pF/-< -<=8( z%;z&8z&/-< -<=8( z%,<=z&8z&<1}/< $</ $<<=;///< $J0  $ $< ;6R0H.0--<012) 812) DAT*68--< 8\ 0,,?,"-r8(12 80*12 801}@1578 8 z%8" z&8_ z&)<=z&8(z&8 z&8 z&,"7,E," S, $1.28 0,) 8E,"11}19}1<2*1<R#E," \S$#DAT*862*1<R$E," S, $1$#!319}l3*<R3*12)( 8,0 $1L2,8 $1d38 0,)@ 8E,"1E,"1n41<,H $P $6%@%83X !n48h 8 z%)<=z&A@A851<5DAT*:(<4(12) 8(< )<=6E,"51}(55(<v5(12) 8(< *<=6561}1}1}5r829}1}61<Y<6(<=(<=629}66DAT*<2#n80/"71}6-7(<=-<=729}762#7--<j712) 812) 8--< (<=6-}-< 8 -<=z%n8--<(812) 812) 8--< (<=6--< 8 051DAT*>6:0T1n59:;<=8>D?vADEFIMfghjlmn*s:u^wxx|}$TZxr|4b| ( D b " @ h  2 V f v   * 4 B n $NZx"@D N X f 4Xhx| #$%$(4,DAT*@D<L>|@ABHIJKBLtMOQXSvTzUVWXZ\]_8a\blc|defijk(n8rHsTtuwxyz{|"4T`>\z,Jh|,:d:Tx2Lp&*^z  p6^DAT*B  p t   !J!j!~! ! ! ! `" d"""#*#P#h###"###$#%#&#+P$,d$.t$/$0$3$4$:$<$?%Hj%L%O%X2&^&_&`&b&c&d&e 'i'k"'lT'nX'q|'s't'x'yB(|r(~x(((((((((&)X)d)h)l)v))))))*&*F*****:+p+++++++++,,,F,N,,,,,,,--(-8-<-D-P-~-------- .&.DAT*D2.`.~.../B/F///// 00J0N0R0V0`0v00000001 1 N1111122.2@2L2 `2"2#2$2'2(3)3+3,3-23/R30l32333437393:3;.4=j4An4Cx4D4E4F4H4I4J5K5L65M@5NV5Pv5Q5S5Y5Z5[5\5]5^<6_f6`r6a|6c6e6f6g6h6i6j7l7n7o7p7q27rN7tj7u7x7z7{7|7}7~ 8(8P8n8r8d&X pl_process_ridps_scc_ams_codeps_material_codepi_logDAT*F_fileps_poll_listJ ps_poll_method pi_num_pollutantspb_mass_balancepd_start_date_timepd_end_date_timeps_profile_codes pi_num_profilesps_spec_filter pl_target_processw_emissli_method_countli_itemli_countli_component_countli_bc_cntli_ili_jli_kli_jumpsli_in_cntli_posli_lengthli_pos_commali_ret_statusli_count_specli_pm_likeli_pm10_likeli_ub_spec_pollli_ub_inputls_codels_profile_codels_last_profile_codels_spec2ls_spec_inDAT*Hputls_namels_bc_pollutants ls_input_pollutants ls_comp_pollutants ls_speciate_pollutants ls_spec_poll_source ls_thruput lb_scc_ams_nulllb_emis_factorlb_speciatelb_dual_profileslb_foundlb_pm10lb_pm10_likelb_pmlb_pm_likels_sql_statementls_emis1ls_spec1ls_gen_spec_thruputsls_spec_thruputsli_nls_null sqlsaemittant_cursqlcainflow_curoutflow_curspecific_spec_curcase490split_curTDAT*JpTtx ' 8TD-p`-|  -- @&6>GZ dDAT*L ipns|`$  >  ! r* @8 %T@-t`----8-DAT*N '8AIV\g x    -"@!,I>@L> O>!8Q>  /R> ` cbx_DAT*Pbackground6>checked ii_usedspecthruputs0Gis_usedspecthruputsLHii_num_methodshiis_method_typeshFnchP_dhBCEndSELECT distinct (emittant_material_code) FROM rap_emission_factors WHERE (SUBSTR(factor_type,1) = 'G' AND scc_ams_code = '') UNION WHERE(SUBSTR(factor_type,1) = 'S' AND process_rid = ) UNION WHERE(SUBSTR(factor_type,1) = 'Q' ' il_curstaterid2WHERE(SUBSTR(factor_type,1) = 'R' il_curcountyrid3WHERE(SUBSDAT*RTR(factor_type,1) = 'M' il_cursourcerid4) uof_pollutant_list() .. Open emittant_cur for emission factor methoduof_sql_error46> Emission EstimatorEmissionfactors not found for SCC/AMS code: em_log_detail13textz  No emission factors found for SCC/AMS code: uof_pollutant_list() .. fetch emittant_cur4EVOCTOGPMPM10PM,PM10,EXHCEVHCEXPMBW10TW10uof_increment_array_strI`DAT*Tuof_pollutant_list()4uof_increment_arrayY,Y,`4`I`413  No input flows found for speciation or mass balance at process.4`413  No input or output flows found for speciation at process.`` AND (factor_type = 'S' OR throughput_material_code in ('('')'))','DAT*V4Y,4 ,'TOG''VOC''13  Source Specific Profiles found for throughputs: Source Specific Profile found for throughput: Source Specific Profile not found.()uof_get_profile_code-Z SELECT distinct emittant_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_cDAT*Xodes.profile_code AND rap_scc_ams_speciation_codes.scc_ams_code = ' AND SUBSTR(throughput_material_code,1) in UNION SELECT distinct emittant_material_code, throughput_material_code FROM rap_emission_factors WHERE SUBSTR(factor_type,1) = 'F' AND process_rid = SELECT distinct (emittant_material_code) SELECT distinct (emittant_material_code) FROM rap_emission_factors 46> Inputs and/or 13  Input flows and/or specDAT*Ziation factors not found for SCC/AMS code: 4Y,Y,S,0GLH0G0GLH0GS*4Y,Y,0GLH0G0GLH0GY,Y,SELECT rap_speciation_split_factors.material_code, rap_speciation_profiles.code FROM rap_speciation_profiles, rap_speciation_split_factors WHERE rap_speciation_profiles.material_code = ' AND rap_speciation_split_factors.profile_code = rap_speciation_DAT*\profiles.code AND rap_speciation_profiles.profile_type = 'P'*4Y,413  Mass Balance: More than one product profile available for Y,Y,Y,Y,BY,Y, ( D ` x      , 8       `      $ @ H P DAT*^X ` h t |           $ , 4 <        , 4 < d l t |         , 4 < D L T ` h p x           DAT*`    ( 0 8 @ H P X       0-1<,$($V,@$P8X0M66-5-5    )8}1<1 -1< 1,$$P,$801d 80DAT*b1d 80M66-5-5    )  8}1<$1H1<H11}h-P 9}1}<=-<= 9} #-< 80L-< <=6^1<DAT*d1<,$$6%@%83!88Fz%A@A811}--<=8^-<=8b"-<=8f"-<=8i"-<=1o@o88n"-<=1o@o88r"-<=8x"-<=8}"-<=8"-DAT*f<=8"-<=8"-<=6-<=61}1<Y<-1<R<Y -<<Y=6-1<R<Y -<<Y=6-1 6-1 610V$) ,-*6P7l9>?@ A8JHLvMOPQSUDAT*hVWXY$\L^P_d`cz{Ld0 pd_process_ridps_pollutants pi_num_pollutantsps_scc_ams_codeps_poll_method2 ps_material_codepd_start_date_timepd_end_date_timepi_log_fileps_profile_codes pi_num_profilesps_spec_filter pl_target_processlb_foundlb_mass_balanceli_ret_statusli_ili_jls_factor_pollutants ls_factor_methods~  ls_gen_spec_thruDAT*jputsls_holderls_hold2li_num_factor_pollutantsli_possible_calcw_emissw_emiss_status(hXx> (-4F hV-t   --+9>DAT*lXC-xd-   @@h cbx_background6>checked sle_materialrup0,texts_uHBuilding Emittant List . . . uof_pollutant_list[v6> 0,HScreening Emittant List . . . End[vMem_log_detail13H Either factors or activity data are missDAT*ning for all chosen pollutants VOCTOGPMPM10PM,PM10,EXHCEVHCEXPMBW10TW10 ( @ P         H-<<R}--< 1}<d3 pi_arraypi_ubpi_increment<- & (,$($::F@@8T:F@DAT*p@8  M  0$1880 )h8   1 1}- 1<R%x- 1<R%- 1<R%- 1<R%   V  ---1d<R%1I-1d<R} $1 1<Y}DAT* $1d880 )8   1-1<,$$#8088z%z&8z&M2(@(8z(8%z&5830)@)8z(8Mz&5830)@)8z(:)@:@@81<,h$x$6%@%83!8z%A@A885830DAT*tRAPIDS Emission Main Windowforward global type w_emiss from window end type type st_cutoff_date from statictext within w_emiss end type type em_cutoff_date from editmask within w_emiss end type type uo_ss from u_class_ss_client within w_emiss end type type cbx_log_list from checkbox within w_emiss end type type cb_browse from commandbutton within w_emiss end type type cb_view from commandbutton within w_emiss end type type st_log_detail from statictext within w_emiss end type typeDAT*v em_log_detail from editmask within w_emiss end type type dw_composite_ef from datawindow within w_emiss end type type lb_option from listbox within w_emiss end type type cbx_modes from checkbox within w_emiss end type type uo_tl from uo_toplevel within w_emiss end type type cbx_background from checkbox within w_emiss end type type lb_modes from listbox within w_emiss end type type cbx_stop from checkbox within w_emiss end type type em_priority from editmask within w_emiss end typDAT*xe type st_priority from statictext within w_emiss end type type cbx_all_meth from checkbox within w_emiss end type type lb_calc_methods from listbox within w_emiss end type type sle_log_file from singlelineedit within w_emiss end type type cb_ok from commandbutton within w_emiss end type type cb_cancel from commandbutton within w_emiss end type type em_end from editmask within w_emiss end type type em_start from editmask within w_emiss end type type ddlb_interval from dropdownlistDAT*zbox within w_emiss end type type st_end from statictext within w_emiss end type type st_start from statictext within w_emiss end type type st_interval from statictext within w_emiss end type type cbx_log_file from checkbox within w_emiss end type type gb_log_file from groupbox within w_emiss end type type gb_option from groupbox within w_emiss end type type gb_calc_meth from groupbox within w_emiss end type type gb_mode from groupbox within w_emiss end type type gb_interval from DAT*|groupbox within w_emiss end type type dw_input_ref_code from u_dddw within w_emiss end type type dw_ref_code from u_dddw within w_emiss end type type dw_unit_code from u_dw_unit_code within w_emiss end type type uo_pollutant from u_pollutant_ee within w_emiss end type end forward global type w_emiss from window integer width = 2967 integer height = 2020 boolean titlebar = true string title = "Emission Estimator" boolean controlmenu = true boolean minbox = true boolean maxbox = DAT*~true boolean resizable = true windowstate windowstate = maximized! long backcolor = 67108864 string icon = "EMISS.ICO" st_cutoff_date st_cutoff_date em_cutoff_date em_cutoff_date uo_ss uo_ss cbx_log_list cbx_log_list cb_browse cb_browse cb_view cb_view st_log_detail st_log_detail em_log_detail em_log_detail dw_composite_ef dw_composite_ef lb_option lb_option cbx_modes cbx_modes uo_tl uo_tl cbx_background cbx_background lb_modes lb_modes cbx_stop cbx_stop em_priority em_priorityDAT* st_priority st_priority cbx_all_meth cbx_all_meth lb_calc_methods lb_calc_methods sle_log_file sle_log_file cb_ok cb_ok cb_cancel cb_cancel em_end em_end em_start em_start ddlb_interval ddlb_interval st_end st_end st_start st_start st_interval st_interval cbx_log_file cbx_log_file gb_log_file gb_log_file gb_option gb_option gb_calc_meth gb_calc_meth gb_mode gb_mode gb_interval gb_interval dw_input_ref_code dw_input_ref_code dw_ref_code dw_ref_code dw_unit_code dw_unit_code uDAT*o_pollutant uo_pollutant end type global w_emiss w_emiss type variables INTEGER ii_log_file BOOLEAN ib_abort LONG il_start_rid // Initial rid for calculation STRING is_start_level // Source or Process LONG il_orig_process_rid // source process rid LONG il_discharge_proc_rid // downstrmdis LONG il_prev_process_rid // previous process LONG il_nation_rid // for w_emiss_level LONG il_state_rid // for w_emiss_level LONG il_county_rid // for DAT*w_emiss_level LONG il_source_rid // for w_emiss_level LONG il_device_rid // for w_emiss_level LONG il_process_rid // for w_emiss_level INTEGER ii_start_rid_ub, ii_cnty_rid_ub STRING is_state_name STRING is_header // for w_emiss_level DATETIME id_estimator_time_stamp DECIMAL il_total_fug_emissions[] LONG il_uncontrolled_process_rid STRING is_data_type STRING is_priority STRING is_group_num STRING is_method_type STRING is_method_types[10] INTEGER ii_num_methods STRING iDAT*s_user_unit STRING is_input_ref_code STRING is_ref_header // for w_spec_ref_level STRING is_input_ref1 // for w_spec_ref_level STRING is_input_ref2 // for w_spec_ref_level STRING is_input_ref3 // for w_spec_ref_level STRING is_input_ref4 // for w_spec_ref_level STRING is_ro_code_map STRING is_null_code_map STRING is_poll_calc_fail[] // To remember pollutants that won't calculate STRING is_logname // log filename DATE id_cutoffDate end variables forward prototypes public functioDAT*n integer wf_initialize () public function int wf_dbconnect () public function integer wf_dbdisconnect () public function integer wf_load_calc_methods_list (ref transaction pt_trans_object) public function int wf_select_all_methods () public function integer wf_deselect_all_methods () public function int wf_load_pollutants_list (ref transaction pt_trans_object) public function integer wf_load_modes_list (ref transaction pt_trans_object) public function integer wf_select_all_modes () publiDAT*c function integer wf_deselect_all_modes () public function int wf_get_pollutants (ref int pi_num_pollutants, ref string ps_pollutants[], int pi_log_file, transaction pt_trans_object) public function integer wf_get_user_inputs (integer pi_log_file, ref integer pi_num_calc_prots, ref string ps_calc_prots[], ref integer pi_num_modes, ref string ps_modes[], ref integer pi_num_pollutants, ref string ps_pollutants[]) public function integer wf_set_rid (integer pi_log_file, transaction pt_trans_objecDAT*t) public function string wf_get_county_name (long pl_county_rid) public function integer wf_checkdates (string start_date_str, string end_date_str, string cutoff_date_str) end prototypes public function integer wf_initialize ();// int wf_initialize( void ) // Initialize variables // Returns: 1 Success // 0 Failure // // Modification History // When Who What // ------- --- ----------------------------------------------- // ??? MAS Commented out code for procesDAT*s_rid check and // information lookup. Hardcoded to always return // a value of 1. // 11AUG94 PER Changed startup defaults to 1) All modes; and // 2) Stop after first successful estimate. // 13SEP94 PER Changed level and level_id from ddlb to sle. // Added checks for return values from load functions. // Function returns 0 on error again. // 19SEP94 PER Removed wf_load_level_info() call. SetPointer( HourGlass! DAT*) // Declare local variables DATE ld_start_date DATE ld_end_date // Set the log file handle to -1 to indicate that a log file // is NOT currently open. ii_log_file = -1 // This abort flag is used to signal whether the user wants to abort // out of the current background emission estimation procedure. ib_abort = FALSE // Set default calculation period (Previous year) ddlb_interval.text = "Yearly" ld_start_date = date( "Jan 1, " + string( year( today() ) - 1 ) ) ld_end_datDAT*e = date( "Dec 31, " + string( year( today() ) - 1 ) ) em_start.text = ProfileString(gs_iniFile,"calculation period",& "start_date",string(ld_start_date,"mmm dd, yyyy")) em_end.text = ProfileString(gs_iniFile,"calculation period",& "end_date",string(ld_end_date,"mmm dd, yyyy")) //set default cutoff date to a large value em_cutoff_date.text = 'Jan 01, 2100' //em_start.text = string( ld_start_date, "mmm dd, yyyy" ) //em_end.text = string( ld_end_date, "mDAT*mm dd, yyyy" ) // Populate calculation methods list box IF wf_load_calc_methods_list( sqlca ) <> 1 THEN // Error during wf_load_calc_methods_list() Return( 0 ) END IF // Pollutants list box is replaced by uo_pollutant. 3/17/95, SWJ //// Populate pollutants list box //IF wf_load_pollutants_list( sqlca ) <> 1 THEN // // Error during wf_load_pollutants_list() // Return( 0 ) //END IF // Populate modes list box IF wf_load_modes_list( sqlca ) <> 1 THEN // Error during wfDAT*_load_modes_list() Return( 0 ) END IF // Set default calculation protocol priority ending range em_priority.text = '9' // Set default to stop after first successful estimate w_emiss.cbx_stop.checked = TRUE // Set default to all modes w_emiss.cbx_modes.checked = TRUE w_emiss.lb_modes.enabled = FALSE wf_select_all_modes() // Set default log file detail level to 1 em_log_detail.text = '1' // Normal return Return( 1 ) // end wf_initialize() end function public functioDAT*n int wf_dbconnect ();// int wf_dbconnect( void ) // Connect to database using sqlca. // Return: 1 Success // 0 Error connecting to database SetPointer( HourGlass! ) // Set up the default transaction and connect to database // FOR WATCOM TESTING ONLY! sqlca = CREATE TRANSACTION sqlca.DBMS = "ODBC" sqlca.DBParm = "Connectstring='DSN=Rapids Database'" CONNECT USING SQLCA; IF sqlca.sqlcode <> 0 THEN // Error connecting to database MessageBox( "LOGIN", "ErroDAT*r " + String( sqlca.sqlcode ) + & sqlca.SQLErrText, StopSign!, OK! ) Return( 0 ) END IF // Successful connection Return( 1 ) // end wf_dbconnect() end function public function integer wf_dbdisconnect ();// wf_dbdisconnect( void ) // Disconnect from database using sqlca SetPointer( HourGlass! ) disconnect using sqlca; return( 1 ) // end wf_dbdisconnect() end function public function integer wf_load_calc_methods_list (ref transaction pt_trans_objeDAT*ct);// INT wf_load_calc_methods_list( TRANSACTION VAR pt_trans_object ) // Load the calculation methods list box // (Items will sort if box sort is enabled) // Returns: 1 Success // 0 Failure SetPointer( HourGlass! ) STRING ls_name // Declare cursor to retrieve methods DECLARE meth_cur CURSOR FOR SELECT name FROM rap_calculation_methods USING pt_trans_object; // Open cursor OPEN meth_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_DAT*emis.uof_sql_error( "wf_load_calc_methods()", ii_log_file, & pt_trans_object ) Return( 0 ) END IF // Clear lb lb_calc_methods.Reset() // Get first record FETCH meth_cur INTO :ls_name; IF pt_trans_object.sqlcode = 100 THEN // No records found MessageBox( "Emission Estimator", "Error: No calculation " + & "protocols found", StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN DAT* // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_calc_methods()", ii_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( 0 ) END IF // Loop through remaining records DO WHILE pt_trans_object.sqlcode = 0 // Add value to lb lb_calc_methods.AddItem( ls_name ) // Get next record FETCH meth_cur INTO :ls_name; IF pt_trans_object.sqlcode = 100 THEN // No additional records found--break out of loop EXIT DAT*ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_calc_methods()", ii_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( 0 ) END IF LOOP // Close cursor CLOSE meth_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_calc_methods()", ii_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object;DAT* Return( 0 ) END IF // Normal function exit lb_calc_methods.setState(1,True) //mas rev 6/15/94 COMMIT USING pt_trans_object; Return(1 ) // end wf_load_calc_methods_list() end function public function int wf_select_all_methods ();// INT wf_select_all_methods( VOID ) // Select all items in the calculation methods list box // Returns: 1 Success SetPointer( HourGlass! ) // Declare local variables INTEGER li_item FOR li_item=1 TO lb_calc_methods.TotalItems() lb_DAT*calc_methods.SetState( li_item, TRUE ) NEXT Return( 1 ) // end wf_select_all_methods() end function public function integer wf_deselect_all_methods ();// INT wf_deselect_all_methods( VOID ) // Deselect all items in the calculation methods list box // Returns: 1 Success SetPointer( HourGlass! ) // Declare local variables INTEGER li_item FOR li_item=1 TO lb_calc_methods.TotalItems() lb_calc_methods.SetState( li_item, FALSE ) NEXT Return( 1 ) // end wf_deselect_alDAT*l_methods() end function public function int wf_load_pollutants_list (ref transaction pt_trans_object);// Commented out by SWJ, 3/17/95 // This function is not used, so let it pass. return 1 // //// INT wf_load_pollutants_list( TRANSACTION VAR pt_trans_object ) //// Load the pollutants list box //// (Items will sort if box sort is enabled) //// Returns: 1 Success //// 0 Failure // //SetPointer( HourGlass! ) // //STRING ls_name // //// Declare cursor to retrieve polluDAT*tants ////DECLARE poll_cur CURSOR FOR //// SELECT name //// FROM rap_materials //// USING pt_trans_object; //// // //// mas 6/15/94 : select materials that are in TOXIC material group //// ////DECLARE poll_cur CURSOR FOR //// SELECT name //// 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 = 'TOXICS' ///DAT*/ ) //// USING pt_trans_object; ////// Open cursor // //// new select to select pollutants in TOXICS group // //DECLARE poll_cur CURSOR FOR // SELECT code // FROM rap_materials // WHERE rid in (SELECT child_ref_rid // FROM rap_materials, // rap_group_members // WHERE rap_materials.rid = & // rap_group_members.parent_ref_rid // AND rap_materials.code = 'TOXICDAT*S'); // //OPEN poll_cur; //IF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uo_em.uof_sql_error( "wf_load_pollutants_list()", ii_log_file, & // pt_trans_object ) // Return( 0 ) //END IF // //// Clear lb //lb_pollutant.Reset() // //// Get first record //FETCH poll_cur INTO :ls_name; //IF pt_trans_object.sqlcode = 100 THEN // // No records found // MessageBox( "Emission Estimator", "Error: No pollutants " + & // DAT* "found", StopSign!, OK! ) // ROLLBACK USING pt_trans_object; // Return( 0 ) //ELSEIF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uo_em.uof_sql_error( "wf_load_pollutants_list()", ii_log_file, & // pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( 0 ) //END IF // //// Loop through remaining records //DO WHILE pt_trans_object.sqlcode = 0 // // Add value to lb // lb_pollutant.AddItem( ls_name ) // // // Get next recordDAT* // FETCH poll_cur INTO :ls_name; // IF pt_trans_object.sqlcode = 100 THEN // // No additional records found--break out of loop // EXIT // ELSEIF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uo_em.uof_sql_error( "wf_load_pollutants_list()", ii_log_file, & // pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( 0 ) // END IF //LOOP // //// Close cursor //CLOSE poll_cur; //IF pt_trans_object.sqlcode <>DAT* 0 THEN // // SQL Error // uo_em.uof_sql_error( "wf_load_pollutants_list()", ii_log_file, & // pt_trans_object ) // ROLLBACK USING pt_trans_object; // Return( 0 ) //END IF // //// Normal function exit // //COMMIT USING pt_trans_object; //Return( 1 ) // //// end wf_load_pollutants_list() // end function public function integer wf_load_modes_list (ref transaction pt_trans_object);// INT wf_load_modes_list( TRANSACTION VAR pt_trans_object ) // Load thDAT*e modes list box // (Items will sort if box sort is enabled) // Returns: 1 Success // 0 Failure SetPointer( HourGlass! ) // Declare local variables STRING ls_name STRING ls_type STRING ls_default_mode INTEGER li_mode_ctr // mas added for default value setup INTEGER li_index // Initialize variables li_mode_ctr = 0 li_index = 0 ls_default_mode = "" // mas rev 6/15/94 // sets the default mode to be the mode // of process selected, // if process selectedDAT* REJ 01/29/96 IF gd_process_rid <> 0 THEN SELECT mode_type INTO :ls_default_mode FROM rap_processes WHERE rid = :gd_process_rid ; END IF // Declare cursor to retrieve modes DECLARE mode_cur CURSOR FOR SELECT type, name FROM rap_modes USING pt_trans_object; // Open cursor OPEN mode_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_modes_list()", ii_log_file, & pt_trans_object ) DAT*Return( 0 ) END IF // Clear lb lb_modes.Reset() // Get first record FETCH mode_cur INTO :ls_type, :ls_name; IF pt_trans_object.sqlcode = 100 THEN // No records found MessageBox( "Emission Estimator", "Error: No modes found", & StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_modes_list()", ii_log_file, & DAT* pt_trans_object ) ROLLBACK USING pt_trans_object; Return( 0 ) END IF // Loop through remaining records DO WHILE pt_trans_object.sqlcode = 0 // Add value to lb li_mode_ctr ++ lb_modes.AddItem( ls_name ) // MAS IF ls_type = "NORMAL" THEN li_index = li_mode_ctr; END IF IF ls_type = ls_default_mode THEN lb_modes.setState(li_mode_ctr, TRUE) END IF // Get next record FETCH mode_cur INTO :ls_type, :ls_name ; IF pt_trans_oDAT*bject.sqlcode = 100 THEN // No additional records found--break out of loop EXIT ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_modes_list()", ii_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( 0 ) END IF LOOP // Close cursor CLOSE mode_cur; IF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_load_modes_list()",DAT* ii_log_file, & pt_trans_object ) ROLLBACK USING pt_trans_object; Return( 0 ) END IF // Normal function exit IF ls_default_mode = "" THEN lb_modes.setState(li_index, TRUE) END IF COMMIT USING pt_trans_object; Return( 1 ) // end wf_load_modes_list() end function public function integer wf_select_all_modes ();// INT wf_select_all_modes( VOID ) // Select all items in the modes list box // Returns: 1 Success SetPointer( HourGlass! ) // DDAT*eclare local variables INTEGER li_item FOR li_item=1 TO lb_modes.TotalItems() lb_modes.SetState( li_item, TRUE ) NEXT Return( 1 ) // end wf_select_all_modes() end function public function integer wf_deselect_all_modes ();// INT wf_deselect_all_modes( VOID ) // Deselect all items in the modes list box // Returns: 1 Success SetPointer( HourGlass! ) // Declare local variables INTEGER li_item FOR li_item=1 TO lb_modes.TotalItems() lb_modes.SetState( li_item, FALSE )DAT* NEXT Return( 1 ) // end wf_deselect_all_modes() end function public function int wf_get_pollutants (ref int pi_num_pollutants, ref string ps_pollutants[], int pi_log_file, transaction pt_trans_object);// Commented out by SWJ, 3/17/95 // This function is not used so let it pass. return 1 // //// INTEGER wf_get_pollutants( INTEGER VAR pi_num_pollutants, //// STRING VAR ps_pollutants[], //// INTEGER pi_log_fiDAT*le, //// TRANSACTION VAR pt_trans_object) //// //// Returns: 1 Success //// 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 Who What //// ------- --- ----------------------------------------------- //// 26AUG94 MAS CREATED //// DAT*// //// 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_item //STRING ls_code //STRING ls_poll_code // //pi_num_pollutants = 0 // //// Loop through listbox items //FOR li_item = 1 TO w_emiss.lb_pollutant.TotalItems()DAT* // IF w_emiss.lb_pollutant.State( li_item ) = 1 THEN // // This item is selected -- get code for item // ls_poll_code = w_emiss.lb_pollutant.Text( li_item ) // SELECT code // INTO :ls_code // FROM rap_materials // WHERE code = :ls_poll_code // USING pt_trans_object; // // IF pt_trans_object.sqlcode <> 0 THEN // // SQL Error // uo_em.uof_sql_error( "wf_get_pollutants()", pi_log_file, & // pt_trans_oDAT*bject ) // ROLLBACK USING pt_trans_object; // Return( -1 ) // END IF // // // Stow the pollutant in the array // pi_num_pollutants++ // ps_pollutants[ pi_num_pollutants ] = ls_code // END IF //NEXT // //IF pi_num_pollutants <> 0 THEN // // The user specifically selected one or more pollutants--return // COMMIT USING pt_trans_object; //END IF // //// Both cases are o.k whether user selected from the list or not. //// If none was selecDAT*ted then the default pollutants will be used. //Return( 1 ) //// end wf_get_pollutants() // end function public function integer wf_get_user_inputs (integer pi_log_file, ref integer pi_num_calc_prots, ref string ps_calc_prots[], ref integer pi_num_modes, ref string ps_modes[], ref integer pi_num_pollutants, ref string ps_pollutants[]);// int wf_get_user_inputs(integer pi_log_file // integer var pi_num_calc_prots // string var ps_DAT*calc_prots[] // integer var pi_num_modes // string var ps_modes[] // Return: 1 success // 0 failure // -1 SQL error // // This function gets common user inputs // for an estimation session from w_emiss window. // // WHO WHEN WHAT // === ====== ==== // MAS 25AUG94 CREATED // IF w_emiss.cbx_background.checked THEN SetPointer( Arrow!) ELSE SetPointer( HourGlass!) END IF //DAT* Put user-selected calculation protocols in array IF uo_tl.uo_emis.uof_get_calc_prots( pi_num_calc_prots, & ps_calc_prots[], pi_log_file, sqlca ) <> 1 THEN // Error retrieving records or record not found ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, " " ) FileWrite( pi_log_file, "Ending emission estimation.~n~r"+& "Reading user-selected calculation protocols failed.") END IF Return( 0 ) END IF DAT* // Put user-selected modes in array IF uo_tl.uo_emis.uof_get_modes( pi_num_modes, ps_modes[], & pi_log_file, sqlca ) <> 1 THEN // Error retrieving records or record not found ROLLBACK USING sqlca; IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "Reading user-selected mode(s) failed.~n!r" + & "Ending emission estimation.") FileWrite( pi_log_file, " " ) END IF Return( 0 ) END IF // Get user-selected unit code. SWJ, 3DAT*/24/95 is_user_unit = dw_unit_code.GetItemString(1, 1) // Put user-selected pollutants in array uo_pollutant.uf_get_emittants(ps_pollutants, pi_num_pollutants) IF pi_num_pollutants > 0 THEN is_poll_calc_fail[pi_num_pollutants] = 'U' END IF Return (1) // end of wf_get_user_inputs end function public function integer wf_set_rid (integer pi_log_file, transaction pt_trans_object); // Returns: 1 Success // 0 Failure // -1 SQL Error // mlk 4/98 changed funtionDAT* to get all levels // still not getting device level // will populate all levels from process up and fills in source selector // array and screens SetPointer( HourGlass! ) str_emission_parm str_parm str_parm = message.PowerObjectParm // Try to get the rid passed in from the main system. il_start_rid = -1 is_start_level = str_parm.level // mlk 4/98 CHOOSE CASE upper(is_start_level) CASE "SOURCE" // Estimator entered from Source level il_start_rid = gl_source_rid DAT* il_source_rid = gl_source_rid CASE "PROCESS" // Estimator entered from Process level il_start_rid = gd_process_rid il_process_rid = gd_process_rid CASE "COUNTY" il_Start_rid = str_parm.rid il_county_rid = str_parm.rid CASE "STATE" il_start_rid = str_parm.rid il_State_rid = str_parm.rid CASE "NATION" il_start_rid = str_parm.rid il_nation_rid = str_parm.rid END CHOOSE IF ( IsNull( il_start_rid ) OR ( il_start_rid < 1 ) ) THEN // User eDAT*ither entered estimator directly from main menu, or // rid not supplied upon estimator startup. // Prompt user to pick estimation level by simulated click on level button. uo_ss.cb_source_selector.TriggerEvent( Clicked! ) IF ib_abort THEN RETURN(0) END IF ELSE // populate rids for source selector IF il_process_rid > 0 then // Set device rid SELECT device_rid INTO :il_device_rid FROM rap_processes WHERE rid = :il_process_rid USING pt_DAT*trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error--process record not found IF il_process_rid <> 0 THEN MessageBox( "Emission Estimator", "Process record not found " + & "for rid=" + String( il_process_rid ), StopSign!, OK! ) ELSE MessageBox( "Emission Estimator", "Process not selected. " + & "Please select process. ", StopSign!, OK! ) END IF ROLLBACK USING pt_trans_object; RetDAT*urn( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_set_rid()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF IF il_device_rid > 0 THEN // Set source rid SELECT source_rid INTO :il_source_rid FROM rap_devices WHERE rid = :il_device_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error--device record not found DAT* MessageBox( "Emission Estimator", "Device record not found " + & "for rid=" + String( il_device_rid ), StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_set_rid()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF IF il_source_rid > 0 then // Set county rid SELECT geographiDAT*c_county_rid INTO :il_county_rid FROM rap_sources WHERE rid = :il_source_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error--source record not found MessageBox( "Emission Estimator", "Source record not found " + & "for rid=" + String( il_source_rid ), StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_DAT*sql_error( "wf_set_rid()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF IF il_county_rid > 0 then // Set state rid SELECT parent_rid INTO :il_state_rid FROM rap_geographic_locations WHERE rid = :il_county_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error--county record not found MessageBox( "Emission Estimator", "County record not found " + & DAT* "for rid=" + String( il_county_rid ), StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_set_rid()", pi_log_file, pt_trans_object ) ROLLBACK USING pt_trans_object; Return( -1 ) END IF END IF IF il_State_rid > 0 then // Set nation rid SELECT parent_rid INTO :il_nation_rid FROM rap_geographic_locations WHERE riDAT*d = :il_state_rid USING pt_trans_object; IF pt_trans_object.sqlcode = 100 THEN // Error--state record not found MessageBox( "Emission Estimator", "State record not found " + & "for rid=" + String( il_state_rid ), StopSign!, OK! ) ROLLBACK USING pt_trans_object; Return( 0 ) ELSEIF pt_trans_object.sqlcode <> 0 THEN // SQL Error uo_tl.uo_emis.uof_sql_error( "wf_set_rid()", pi_log_file, pt_trans_object ) ROLLBACK USINGDAT* pt_trans_object; Return( -1 ) END IF END IF // populate source selector tables uo_ss.iclass_group.ids_sourceCriteria.insertRow(0) uo_ss.iclass_group.ids_sourceCriteria.object.nation_rid[1] = il_nation_rid IF il_state_rid > 0 THEN uo_ss.iclass_group.ids_sourceCriteria.object.State_rid[1] = il_state_rid end if IF il_county_rid > 0 THEN uo_ss.iclass_group.ids_sourceCriteria.object.County_rid[1] = il_County_rid end if IF il_source_rid > 0 THEN uo_ss.iDAT*class_group.ids_sourceCriteria.object.source_rid[1] = il_source_rid end if IF il_device_rid > 0 THEN uo_ss.iclass_group.ids_sourceCriteria.object.source_Sub1_rid[1] = il_device_rid uo_ss.iclass_group.ids_groupData.setItem(1, uo_ss.iclass_group.is_groupDataLevel,& uo_ss.iclass_group.ii_sourceSub1Level) END IF IF il_process_rid > 0 THEN uo_ss.iclass_group.ids_sourceCriteria.object.source_sub2_rid[1] = il_process_rid uo_ss.iclass_group.ids_groupData.setItem(1, uo_ss.icDAT*lass_group.is_groupDataLevel,& uo_ss.iclass_group.ii_sourceSub2Level) END IF uo_ss.iclass_group.ids_sourceCriteria.RowsCopy(1,1, Primary!, & uo_ss.iclass_group.ids_resultSet, 1, Primary!) // update text on object and update arrays uo_ss.st_source_count.text = '1' uo_ss.st_filter_count.text = '0' uo_ss.st_result_count.text = '1' uo_ss.st_data_level.text = str_parm.level string ls_str ls_str = ' ' uo_ss.iclass_group.of_GetSourceSQL(ls_str,0) END IF /DAT*/ Normal return Return( 1 ) // end wf_set_rid() end function public function string wf_get_county_name (long pl_county_rid);// Get current county name STRING ls_name = "" SELECT name INTO :ls_name FROM rap_geographic_locations WHERE rid = :pl_county_rid USING SQLCA; RETURN ls_name end function public function integer wf_checkdates (string start_date_str, string end_date_str, string cutoff_date_str);// int wf_checkdates( string start_date_str, string end_date_str ) /DAT*/ Check Start Date, and End Date for validity // Returns: 1 Success // 0 Failure SetPointer( HourGlass! ) // Check to make sure start date is valid IF NOT IsDate( start_date_str ) THEN MessageBox( "Emission Estimator", "Start Date is Invalid", & Exclamation!, OK! ) em_start.SetFocus() Return( 0 ) END IF // Check to make sure end date is valid IF NOT IsDate( end_date_str ) THEN MessageBox( "Emission Estimator", "End Date is Invalid", & DAT* Exclamation!, OK! ) em_end.SetFocus() Return( 0 ) END IF // Check to make sure cutoff date is valid IF NOT IsDate( cutoff_date_str ) THEN MessageBox( "Emission Estimator", "Cutoff Date is Invalid", & Exclamation!, OK! ) em_end.SetFocus() Return( 0 ) END IF // Check to make sure start date is before (or same as) end date IF DaysAfter( Date( start_date_str ), Date( end_date_str ) ) < 0 THEN MessageBox( "Emission Estimator", & DAT* "Start Date must be earlier than End Date", & Exclamation!, OK! ) em_start.SetFocus() Return( 0 ) END IF Return( 1 ) // end wf_checkdates() end function event open; // w_emiss.open // Modification History // When Who What // ------- --- ------------------------------------------------- // 11AUG94 PER Added window close events to transaction creation // failures. // 13SEP94 PER Removed instance variables to store database .iniDAT* // information. // 19SEP94 PER Added wf_set_rid() and general cleanup. // apr98 mlk added geo location parm to pass to window // added new source selector for choosing parms. // Initialize variables IF wf_initialize() = 0 THEN // Error during wf_initialize() Close( w_emiss ) END IF // Set rid passed in from main system, or allow user to set IF wf_set_rid( ii_log_file, sqlca ) = 0 THEN Close( w_emiss) END IF // end end event DAT* on close;// w_emiss.close // Declare local variables STRING ls_log_close // Check for open emission log file IF ii_log_file <> -1 THEN // Close emission log file uo_tl.uo_emis.uof_end_log( ii_log_file ) FileClose( ii_log_file ) ii_log_file = -1 END IF //\\uo_em.uof_abort_trans ( uo_em.uoit_emiss_tran ) //\\uo_em.uof_abort_trans ( uo_em.uoit_rid_tran ) //// THESE LINES FOR TEST ONLY!!! //// Disconnect from database //wf_dbdisconnect() //// END LINES FOR TESTDAT* ONLY!!! // end end on on w_emiss.create this.st_cutoff_date=create st_cutoff_date this.em_cutoff_date=create em_cutoff_date this.uo_ss=create uo_ss this.cbx_log_list=create cbx_log_list this.cb_browse=create cb_browse this.cb_view=create cb_view this.st_log_detail=create st_log_detail this.em_log_detail=create em_log_detail this.dw_composite_ef=create dw_composite_ef this.lb_option=create lb_option this.cbx_modes=create cbx_modes this.uo_tl=create uo_tl this.cbx_background=creDAT*ate cbx_background this.lb_modes=create lb_modes this.cbx_stop=create cbx_stop this.em_priority=create em_priority this.st_priority=create st_priority this.cbx_all_meth=create cbx_all_meth this.lb_calc_methods=create lb_calc_methods this.sle_log_file=create sle_log_file this.cb_ok=create cb_ok this.cb_cancel=create cb_cancel this.em_end=create em_end this.em_start=create em_start this.ddlb_interval=create ddlb_interval this.st_end=create st_end this.st_start=create st_start this.st_DAT*interval=create st_interval this.cbx_log_file=create cbx_log_file this.gb_log_file=create gb_log_file this.gb_option=create gb_option this.gb_calc_meth=create gb_calc_meth this.gb_mode=create gb_mode this.gb_interval=create gb_interval this.dw_input_ref_code=create dw_input_ref_code this.dw_ref_code=create dw_ref_code this.dw_unit_code=create dw_unit_code this.uo_pollutant=create uo_pollutant this.Control[]={this.st_cutoff_date,& this.em_cutoff_date,& this.uo_ss,& this.cbx_log_list,&DAT* this.cb_browse,& this.cb_view,& this.st_log_detail,& this.em_log_detail,& this.dw_composite_ef,& this.lb_option,& this.cbx_modes,& this.uo_tl,& this.cbx_background,& this.lb_modes,& this.cbx_stop,& this.em_priority,& this.st_priority,& this.cbx_all_meth,& this.lb_calc_methods,& this.sle_log_file,& this.cb_ok,& this.cb_cancel,& this.em_end,& this.em_start,& this.ddlb_interval,& this.st_end,& this.st_start,& this.st_interval,& this.cbx_log_file,& this.gb_log_file,& this.gDAT*b_option,& this.gb_calc_meth,& this.gb_mode,& this.gb_interval,& this.dw_input_ref_code,& this.dw_ref_code,& this.dw_unit_code,& this.uo_pollutant} end on on w_emiss.destroy destroy(this.st_cutoff_date) destroy(this.em_cutoff_date) destroy(this.uo_ss) destroy(this.cbx_log_list) destroy(this.cb_browse) destroy(this.cb_view) destroy(this.st_log_detail) destroy(this.em_log_detail) destroy(this.dw_composite_ef) destroy(this.lb_option) destroy(this.cbx_modes) destroy(this.uo_tl) DAT* destroy(this.cbx_background) destroy(this.lb_modes) destroy(this.cbx_stop) destroy(this.em_priority) destroy(this.st_priority) destroy(this.cbx_all_meth) destroy(this.lb_calc_methods) destroy(this.sle_log_file) destroy(this.cb_ok) destroy(this.cb_cancel) destroy(this.em_end) destroy(this.em_start) destroy(this.ddlb_interval) destroy(this.st_end) destroy(this.st_start) destroy(this.st_interval) destroy(this.cbx_log_file) destroy(this.gb_log_file) destroy(this.gb_option) destroy(DAT* this.gb_calc_meth) destroy(this.gb_mode) destroy(this.gb_interval) destroy(this.dw_input_ref_code) destroy(this.dw_ref_code) destroy(this.dw_unit_code) destroy(this.uo_pollutant) end on type st_cutoff_date from statictext within w_emiss integer x = 1481 integer y = 384 integer width = 421 integer height = 112 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long DAT* backcolor = 67108864 boolean enabled = false string text = "Emission Factor Cutoff Date" boolean focusrectangle = false end type type em_cutoff_date from editmask within w_emiss integer x = 1902 integer y = 400 integer width = 544 integer height = 96 integer taborder = 50 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 borderstyle borderstyle = stylelowered! masDAT*kdatatype maskdatatype = datemask! string mask = "mmm dd, yyyy" boolean spin = true double increment = 1 string minmax = "jan 01, 1900~~dec 31, 2100" end type type uo_ss from u_class_ss_client within w_emiss integer x = 37 integer y = 32 integer width = 1353 integer height = 496 integer taborder = 10 boolean border = true borderstyle borderstyle = stylelowered! end type on uo_ss.destroy call u_class_ss_client::destroy end on type cbx_log_list from checkbox within w_emiss iDAT*nteger x = 1490 integer y = 1428 integer width = 965 integer height = 80 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "List Level Selections in Log File" end type type cb_browse from commandbutton within w_emiss integer x = 2062 integer y = 1332 integer width = 320 integer height = 84 integer taborder = 160 integer textDAT*size = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" string text = "Files..." boolean cancel = true end type event clicked;// User wants to specify/choose a file to log information about // the emission calculation procedure. // // Modification History // When Who What // ------- --- ---------------------------------------------- // 25JUL94 PER Changed log file to .txt extension. SetPointer( HourDAT*Glass! ) // Declare local variables INTEGER li_ret_value STRING ls_docname STRING ls_named // User wants to open a log file // Make sure any other open log file is closed IF ii_log_file <> -1 THEN li_ret_value = MessageBox( "Emission Estimator", & "A log file is already open." + & "~n~r~n~rDo you want to close it?", & Question!, YesNo! ) If li_ret_value = 1 THEN uo_tl.uo_emis.uof_end_log( ii_log_file ) DAT* FileClose( ii_log_file ) ii_log_file = -1 sle_log_file.enabled = FALSE cbx_log_file.checked = FALSE ELSE Return END IF END IF // Get log file name from user li_ret_value = GetFileSaveName( "Select Log File", & ls_docname, ls_named, "TXT", & "Text Files (*.txt),*.txt, All Files (*.*),*.*") IF li_ret_value = 1 THEN // Check to see if specified log file already exists IF FileExists( ls_docname ) THEN DAT* // File already exists // Ask user to Append/Overwrite/Cancel OpenWithParm( w_select_file_mode, ls_docname ) // Button selected is returned in message.DoubleParm IF message.DoubleParm = 1 THEN // User wants to Replace file ii_log_file = FileOpen( ls_docname, LineMode!, Write!, & LockReadWrite!, Replace! ) ELSEIF message.DoubleParm = 2 THEN // User wants to Append file ii_log_file = FileDAT*Open( ls_docname, LineMode!, Write!, & LockReadWrite!, Append! ) ELSE Return END IF ELSE // File doesn't exist--create it ii_log_file = FileOpen( ls_docname, LineMode!, Write!, & LockReadWrite!, Replace! ) END IF // save name of file for releasing during long estimator runs REJ - 19FEB96 w_emiss.is_logname = ls_docname // uof_begin_log now uses is_logname, so it must follow the assignment oDAT*f is_logname uo_tl.uo_emis.uof_begin_log( ii_log_file ) sle_log_file.text = ls_docname sle_log_file.enabled = TRUE cbx_log_file.checked = TRUE END IF // end end event type cb_view from commandbutton within w_emiss integer x = 2450 integer y = 1332 integer width = 320 integer height = 84 integer taborder = 170 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" string text =DAT* "View..." end type on clicked;// User wants to view a log file SetPointer( HourGlass! ) // Declare local variables STRING ls_docname STRING ls_named INTEGER li_ret_status // Check to make sure the log file is currently closed. // (You cannot view an open file.) IF ii_log_file <> -1 THEN // Log file is open li_ret_status = MessageBox( "Emission Estimator", & "A log file must be closed before you can view it.~r~r" + & "Would you like to close thDAT* e log file that is currently open?", & Question!, YesNoCancel! ) IF li_ret_status = 1 THEN // User wants to close the log file. uo_tl.uo_emis.uof_end_log( ii_log_file ) FileClose( ii_log_file ) ii_log_file = -1 cbx_log_file.checked = FALSE sle_log_file.enabled = FALSE ELSEIF li_ret_status = 2 THEN // User wants to go ahead anyway // (they may want to view a different file) // (Continue below) ELSE // UsDAT*"er wants to cancel out Return END IF END IF // Allow the user to specify file to be viewed li_ret_status = GetFileOpenName( "Select Log File", & ls_docname, ls_named, "TXT", & "Text Files (*.txt),*.txt, All Files (*.*),*.*" ) // Use PowerBuilder Application Library file viewer to view selected file IF li_ret_status = 1 THEN f_display_file( ls_docname ) ELSEIF li_ret_status = -1 THEN // Error opening file. MessageBox( "EDAT*$mission Estimator", "Unable to open " + ls_docname, & Exclamation!, OK! ) END IF // end end on type st_log_detail from statictext within w_emiss integer x = 1481 integer y = 1332 integer width = 256 integer height = 84 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Log Detail" boolean fDAT*&ocusrectangle = false end type type em_log_detail from editmask within w_emiss integer x = 1765 integer y = 1332 integer width = 192 integer height = 84 integer taborder = 150 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 borderstyle borderstyle = stylelowered! string mask = "##" boolean spin = true double increment = 1 string minmax = "1~~4" end type typeDAT*( dw_composite_ef from datawindow within w_emiss boolean visible = false integer x = 1353 integer y = 1808 integer width = 110 integer height = 80 integer taborder = 210 string dataobject = "d_composite_ef" end type type lb_option from listbox within w_emiss boolean visible = false integer x = 73 integer y = 1568 integer width = 1280 integer height = 240 integer taborder = 120 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiDAT**ss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean enabled = false boolean vscrollbar = true boolean multiselect = true string item[] = {"Rule Effectiveness","Rule Penetration","Peak Season Ozone Daily Emissions","Peak Season CO Daily Emissions"} borderstyle borderstyle = stylelowered! end type type cbx_modes from checkbox within w_emiss integer x = 82 integer y = 1204 integer width = 722 integer height = 68 integer taborder = 100 integer textsize = -8 integeDAT*,r weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Use All Modes" end type on clicked;// User has clicked on checkbox IF this.checked THEN // User wants to use all modes // Select all modes wf_select_all_modes() // Disable modes list box lb_modes.enabled = FALSE ELSE // User wants to turn off all modes // Deselect all modes wf_DAT*.deselect_all_modes() // Enable modes list box lb_modes.enabled = TRUE END IF // end end on type uo_tl from uo_toplevel within w_emiss boolean visible = false integer x = 1207 integer y = 1808 integer width = 110 integer height = 84 end type on uo_tl.destroy call uo_toplevel::destroy end on type cbx_background from checkbox within w_emiss boolean visible = false integer x = 46 integer y = 1792 integer width = 942 integer height = 68 integer textsize = -8 integerDAT*0 weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Run Calculation in Background" boolean checked = true end type type lb_modes from listbox within w_emiss integer x = 78 integer y = 1280 integer width = 1280 integer height = 212 integer taborder = 110 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fonDAT*2tfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean hscrollbar = true boolean vscrollbar = true boolean multiselect = true borderstyle borderstyle = stylelowered! end type type cbx_stop from checkbox within w_emiss integer x = 82 integer y = 700 integer width = 960 integer height = 64 integer taborder = 70 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS SaDAT*4ns Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Stop At First Successful Estimate" end type type em_priority from editmask within w_emiss integer x = 736 integer y = 596 integer width = 229 integer height = 84 integer taborder = 60 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 borderstyle borderstyle = stylelowered! string mask = "#DAT*6#" boolean spin = true double increment = 1 string minmax = "1~~9" end type type st_priority from statictext within w_emiss integer x = 82 integer y = 620 integer width = 640 integer height = 64 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 = "Use Priorities 1 Through" long bordercolor = 16711680 bDAT*8oolean focusrectangle = false end type type cbx_all_meth from checkbox within w_emiss integer x = 82 integer y = 772 integer width = 521 integer height = 64 integer taborder = 80 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Use All Methods" end type on clicked;// User has clicked on checkbox IF this.checked THEN DAT*: // User wants to use all calculation methods // Select all methods wf_select_all_methods() // Disable calculation methods list box lb_calc_methods.enabled = FALSE ELSE // User wants to turn off all calculation methods // Deselect all methods wf_deselect_all_methods() // Enable calculation methods list box lb_calc_methods.enabled = TRUE END IF // end end on type lb_calc_methods from listbox within w_emiss integer x = 73 integer y = 844 integer width DAT*<= 1289 integer height = 244 integer taborder = 90 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean hscrollbar = true boolean vscrollbar = true boolean multiselect = true borderstyle borderstyle = stylelowered! end type type sle_log_file from singlelineedit within w_emiss integer x = 1586 integer y = 1220 integer width = 1189 integer height = 76 integer tDAT*>extsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean displayonly = true borderstyle borderstyle = stylelowered! end type type cb_ok from commandbutton within w_emiss integer x = 2542 integer y = 48 integer width = 329 integer height = 96 integer taborder = 220 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! stDAT*@ring facename = "MS Sans Serif" string text = "Calculate" end type event clicked;// User wants to calculate emissions // // Modification History // When Who What // ------- --- ----------------------------------------------- // 11AUG94 PER Modified to always calculate emissions in // background (batch) mode by "checking" // cbx_background and setting it to disabled and // invisible. // Added automatic log file close wheDAT*Bn estimation // run is completed before control is returned to // w_emiss. // Added prompt for opening log file when estimate // button is clicked and no log file is open. // 26AUG94 MAS Getting user inputs for calculation protocols and // modes are performed here instead of uof_emission_main. // 13SEP94 PER Commented out check on ddlb_level_id. // 19SEP94 PER Commented out check on cbx_facility and cbx_area. // DAT*D Put check back in for proper level_id. // 20SEP94 PER Added support for nation, state, and county estimation // levels. SetPointer( Hourglass! ) // Declare local variables INTEGER li_ret_status LONG ll_next_process_rid // 7/20/94 MAS--supports the downstreaming // in emission_main INTEGER li_num_calc_prots // number of protocols INTEGER li_num_modes // number of modes INTEGER li_num_pollutants // number of polDAT*Flutants STRING ls_calc_prots[] // array of protocols selected STRING ls_modes[] // array of list of modes selected STRING ls_pollutants[] // array of list of pollutants selected STRING ls_ref_code INTEGER li_item // 16FEB95 MAS STRING ls_name INTEGER li_index Integer li_loopcnt // Counter for For-Next loop // 28JUN96 REJ - Do not redraw invisible datawindows uo_tl.uo_emis.dw_emis_fact.SetRedraw(FALSE) uo_tl.uo_emis.dw_activity.SetRedraw(FALSE)DAT*H uo_tl.uo_emis.dw_calc_priority.SetRedraw(FALSE) dw_composite_ef.SetRedraw(FALSE) // initialize total fugitive emission (localize it later) 30DEC94 uo_tl.uo_emis.gd_total_fug_emission = 0 dw_composite_ef.Reset() id_estimator_time_stamp = DateTime(Today(), Now()) // Check to make sure Level id was selected IF not uo_ss.of_HasData() then // No Level id specified li_ret_status = MessageBox( "Emission Estimator", & "You must choose an estimation calculationDAT*J level " + & "before calculating.~n~r~n~rDo you want to choose a " + & "level?", Question!, YesNo! ) IF li_ret_status = 1 THEN // Simulate a level button click for the user uo_ss.cb_source_selector.TriggerEvent( Clicked! ) ELSE Return END IF else // load the arrays with data for emission est to user. do while upperBound(uo_ss.iclass_group.il_sourceSub1Array) > 1 or & upperBound(uo_ss.iclass_group.il_sourceSub2ArrDAT*Lay) > 1 if upperBound(uo_ss.iclass_group.il_sourceSub1Array) > 1 then li_ret_status = MessageBox( "Emission Estimator", & "You may only choose one device " + & "before calculating.~n~r~n~rDo you want to re-select devices ?" & , Question!, YesNo! ) IF li_ret_status = 1 THEN // Simulate a level button click for the user uo_ss.cb_source_selector.TriggerEvent( Clicked! ) ELSE Return EDAT*NND IF end if if upperBound(uo_ss.iclass_group.il_sourceSub2Array) > 1 then li_ret_status = MessageBox( "Emission Estimator", & "You may only choose one process " + & "before calculating.~n~r~n~rDo you want to re-select processes ?" & , Question!, YesNo! ) IF li_ret_status = 1 THEN // Simulate a level button click for the user uo_ss.cb_source_selector.TriggerEvent( Clicked! ) ELSE DAT*PReturn END IF end if loop END IF // Check to make sure unit code was selected. SWJ, 3/24/95 if Not dw_unit_code.uf_check_required('Emission Estimator') then dw_unit_code.SetFocus() return end if dw_ref_code.AcceptText() ls_ref_code = dw_ref_code.GetItemString(1, "code") // Check to make sure reference was selected // MAS 21NOV94 - reference code is required IF IsNull(ls_ref_code) THEN // No reference specified MessageBox( "Emission Estimator", "RefereDAT*Rnce Code required", & Exclamation!, OK! ) dw_ref_code.SetFocus() Return END IF // Accept input_reference_code li_index = dw_input_ref_code.AcceptText() IF li_index = 1 THEN is_input_ref_code = dw_input_ref_code.GetItemString(1, "code") ELSE dw_input_ref_code.SetFocus() Return END IF // Check for proper dates IF wf_checkdates( em_start.text, em_end.text, em_cutoff_date.text ) = 0 THEN // Bad date found Return END IF id_cutoffDate = date(em_cutoDAT*Tff_date.text) // Check for proper calculation method priority ending range IF Dec( em_priority.text ) < 1 OR Dec( em_priority.text ) > 9 THEN // Improper range MessageBox( "Emission Estimator", "Calculation method priority " + & "must be between 1 and 99", Exclamation!, OK! ) em_priority.SetFocus() Return END IF // Check to make sure log file is enabled if background calculation // was requested. IF ( cbx_background.checked AND ( NOT cbx_log_file.checked )DAT*V ) THEN // No log file specified--Give the user the opportunity to open one. li_ret_status = MessageBox( "Emission Estimator", & "You must open a log file before you can calculate " + & "emissions.~n~r~n~rDo you want to open a log file?", & Question!, YesNo! ) IF li_ret_status = 1 THEN // User wants to open a log file. // Simulate a click on cb_browse to allow the user to open one. cb_browse.TriggerEvent( Clicked! ) DAT*X IF ii_log_file = -1 THEN // User cancelled out of log file opening. cbx_log_file.SetFocus() Return END IF ELSE // User doesn't have an open log file and didn't want to open one. cbx_log_file.SetFocus() Return END IF END IF // load estimation methods // REJ 15MAR96 input reference code is now optional for all methods // and check speciation input reference code li_index = 0 FOR li_item = 1 TO lb_calc_methods.TotalItemsDAT*Z() IF w_emiss.lb_calc_methods.State( li_item ) = 1 THEN li_index++ // This item is selected -- get method code for item ls_name = w_emiss.lb_calc_methods.Text( li_item ) IF ls_name = 'EMISSION FACTOR' then is_method_types[li_index] = 'F' ELSEIF ls_name = 'MASS BALANCE' then is_method_types[li_index] = 'BC' ELSEIF ls_name = 'SPECIATION' then is_method_types[li_index] = 'P' END IF END IF NEXT ii_num_methods = DAT*\li_index // Display the popup background status window if this is a background run IF cbx_background.checked THEN Open(w_emiss_status) END IF // Get user's selections on calculation protocols, and modes MAS 26AUG94 // Intialize variable size arrays to minimize memory reallocations REJ 16JUL96 ls_calc_prots[100] = 'End' ls_modes[100] = 'End' ls_pollutants[100] = 'End' li_ret_status = wf_get_user_inputs(ii_log_file, li_num_calc_prots, ls_calc_prots[],& li_numDAT*^_modes, ls_modes[],+& li_num_pollutants, ls_pollutants[]) // look up data code priorities from rapids.ini file REJ 14MAR96 (Temporary) w_emiss.is_null_code_map = ProfileString(gs_iniFile, 'data code priority', 'null','not found') IF w_emiss.is_null_code_map = 'not found' THEN // Do this in case that rapids.ini does not have this key w_emiss.is_null_code_map = '99' SetProfileString(gs_iniFile, 'data code priority', 'null', w_emiss.is_null_code_map) END IF w_emiDAT*`ss.is_ro_code_map = ProfileString(gs_iniFile, 'data code priority', 'RO','not found') IF w_emiss.is_ro_code_map = 'not found' THEN // Do this in case that rapids.ini does not have this key w_emiss.is_ro_code_map = '00' SetProfileString(gs_iniFile, 'data code priority', 'RO', w_emiss.is_ro_code_map) END IF // Write user inputs to log file li_index = uo_tl.uo_emis.uof_log_inputs(ls_ref_code, ii_log_file, li_num_pollutants, ls_pollutants[]) IF li_ret_status = 1 THEN // Calculate thDAT*be estimated emission SetNull(is_data_type) SetNull(is_priority) SetNull(is_group_num) ib_abort = FALSE IF upperbound(uo_ss.iclass_group.il_NationArray) > 0 THEN // Calculate at the nation level FOR li_loopcnt = 1 to upperbound(uo_ss.iclass_group.il_NationArray) li_ret_status = uo_tl.uof_nation( DateTime( Date( em_start.text ) ), & DateTime( Date( em_end.text ) ), uo_ss.iclass_group.il_NationArray[li_loopcnt], & ls_ref_code, ii_log_file, li_nDAT*dum_calc_prots, & ls_calc_prots[], li_num_modes, ls_modes[], & li_num_pollutants, ls_pollutants[] ) IF li_ret_status = -2 then EXIT END IF next End if IF upperbound(uo_ss.iclass_group.il_StateArray) > 0 THEN // Calculate at the state level FOR li_loopcnt = 1 to upperbound(uo_ss.iclass_group.il_StateArray) li_ret_status = uo_tl.uof_state( DateTime( Date( em_start.text ) ), & DateTime( Date( em_end.text ) ), uo_ss.iclaDAT*fss_group.il_StateArray[li_loopcnt], & ls_ref_code, ii_log_file, li_num_calc_prots, & ls_calc_prots[], li_num_modes, ls_modes[], & li_num_pollutants, ls_pollutants[] ) IF li_ret_status = -2 then EXIT END IF next end if IF upperbound(uo_ss.iclass_group.il_CountyArray) > 0 THEN // Calculate at the county level FOR li_loopcnt = 1 to upperbound(uo_ss.iclass_group.il_CountyArray) li_ret_status = uo_tl.uof_county( DateTime( DDAT*hate( em_start.text ) ), & DateTime( Date( em_end.text ) ), uo_ss.iclass_group.il_CountyArray[li_loopcnt], & ls_ref_code, ii_log_file, li_num_calc_prots, & ls_calc_prots[], li_num_modes, ls_modes[], & li_num_pollutants, ls_pollutants[] ) IF li_ret_status = -2 then EXIT END IF NEXT end if w_emiss_status.sle_county.text = ' ' IF upperbound(uo_ss.iclass_group.il_sourceArray) > 0 THEN // Calculate at the source level DAT*j FOR li_loopcnt = 1 to upperbound(uo_ss.iclass_group.il_sourceArray) li_ret_status = uo_tl.uof_Source( & DateTime( Date( em_start.text ) ), & DateTime( Date( em_end.text ) ), & uo_ss.iclass_group.il_sourceArray[li_loopcnt], & ls_ref_code, "", "", & ii_log_file,li_num_calc_prots, ls_calc_prots[],& li_num_modes, ls_modes[], li_num_pollutants, & ls_pollutants[]) IF li_ret_status = -2 then EXIT END IF NEXT DAT*l end if IF upperBound(uo_ss.iclass_group.il_SourceSub1Array) > 0 THEN //il_device_rid // Calculate at the device level li_ret_status = uo_tl.uof_device ( DateTime( Date( em_start.text ) ), & DateTime( Date( em_end.text ) ), uo_ss.iclass_group.il_SourceSub1Array[1], ls_ref_code, "", "", & ii_log_file, li_num_calc_prots, ls_calc_prots[], li_num_modes, ls_modes[], & li_num_pollutants, ls_pollutants[]) end if IF upperBound(uo_ss.iclass_groDAT*nup.il_SourceSub2Array) > 0 THEN //il_process_rid // Calculate at the process level li_ret_status = uo_tl.uo_emis.uof_emissions_main( DateTime( Date( em_start.text ) ), & DateTime( Date( em_end.text ) ), uo_ss.iclass_group.il_SourceSub2Array[1], & ls_ref_code, "", "", & ii_log_file, ll_next_process_rid, & li_num_calc_prots, ls_calc_prots[], & li_num_modes, ls_modes[], li_num_pollutants, & ls_pollutants[] ) end iDAT*pf ELSE MessageBox("Emission Estimator", "Error reading user selections on~n~r"+& "calculation protocols, modes, pollutants", StopSign!, OK! ) END IF // 28JUN96 REJ - Do not redraw invisible datawindows uo_tl.uo_emis.dw_emis_fact.SetRedraw(TRUE) uo_tl.uo_emis.dw_activity.SetRedraw(TRUE) uo_tl.uo_emis.dw_calc_priority.SetRedraw(TRUE) // Close the popup background status window if this was a background run IF cbx_background.checked THEN Close( w_emiss_status ) ENDAT*rD IF // Close the log file IF ii_log_file <> -1 THEN // file is open uo_tl.uo_emis.uof_end_log( ii_log_file ) FileClose( ii_log_file ) ii_log_file = -1 cbx_log_file.checked = FALSE sle_log_file.enabled = FALSE END IF // Emission estimation completed MessageBox( "Emission Estimator", "Emission estimation complete", & Information!, OK! ) end event type cb_cancel from commandbutton within w_emiss integer x = 2542 integer y = 192 integer width = 329 DAT*t integer height = 96 integer taborder = 230 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" string text = "Exit" boolean cancel = true end type on clicked;// User wants to cancel out of window Close( w_emiss ) // end end on type em_end from editmask within w_emiss integer x = 1902 integer y = 292 integer width = 544 integer height = 96 integer taborder = 40 integer textsize = -8 DAT*v integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datemask! string mask = "mmm dd, yyyy" boolean spin = true double increment = 1 string minmax = "jan 01, 1900~~dec 31, 2100" end type type em_start from editmask within w_emiss integer x = 1902 integer y = 188 integer width = 544 integer height = 96 integer taborder = 3DAT*x0 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datemask! string mask = "mmm dd, yyyy" boolean spin = true double increment = 1 string minmax = "JAN 1, 1900~~DEC 31, 2100" end type type ddlb_interval from dropdownlistbox within w_emiss integer x = 1902 integer y = 100 integer width = 544 integDAT*zer height = 432 integer taborder = 20 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean sorted = false boolean vscrollbar = true string item[] = {"Yearly"} borderstyle borderstyle = stylelowered! end type type st_end from statictext within w_emiss integer x = 1490 integer y = 308 integer width = 261 integer height = 68 integer textsize = -8 integer weightDAT*| = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "End Date" boolean focusrectangle = false end type type st_start from statictext within w_emiss integer x = 1490 integer y = 212 integer width = 283 integer height = 64 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facenaDAT*~me = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Start Date" boolean focusrectangle = false end type type st_interval from statictext within w_emiss integer x = 1486 integer y = 108 integer width = 197 integer height = 68 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 booleaDAT*n enabled = false string text = "Interval" boolean focusrectangle = false end type type cbx_log_file from checkbox within w_emiss integer x = 1486 integer y = 1220 integer width = 64 integer height = 80 integer taborder = 140 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 16711680 long backcolor = 12632256 end type on clicked;// User has clicked the log check box SDAT*etPointer( Hourglass! ) IF cbx_log_file.checked THEN // User wants to open log file // Simulate a click on the [Browse...] button cbx_log_file.checked = FALSE sle_log_file.enabled = FALSE cb_browse.TriggerEvent( Clicked! ) ELSE // User wants to close log file IF ii_log_file <> -1 THEN uo_tl.uo_emis.uof_end_log( ii_log_file ) FileClose( ii_log_file ) ii_log_file = -1 END IF cbx_log_file.checked = FALSE sle_log_file.enabled = FALSE ENDAT*D IF // end end on type gb_log_file from groupbox within w_emiss integer x = 1445 integer y = 1152 integer width = 1371 integer height = 368 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Log File" end type type gb_option from groupbox within w_emiss boolean visible = false integer x = 46 integer y = 1504 integer wDAT*idth = 1353 integer height = 340 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Options" end type type gb_calc_meth from groupbox within w_emiss integer x = 37 integer y = 540 integer width = 1353 integer height = 596 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swissDAT*! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Calculation Method" end type type gb_mode from groupbox within w_emiss integer x = 37 integer y = 1152 integer width = 1353 integer height = 368 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Mode" end type type gb_inDAT*terval from groupbox within w_emiss integer x = 1445 integer y = 16 integer width = 1061 integer height = 512 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 string text = "Calculation Period" end type type dw_input_ref_code from u_dddw within w_emiss integer x = 1646 integer y = 1776 integer width = 1225 integer height = 112 integer taDAT*border = 200 string dataobject = "d_ref_codes_table_dddw" boolean border = false boolean livescroll = false end type on constructor;call u_dddw::constructor;string ls_err DataWindowChild dwic ls_err = dw_input_ref_code.Modify("ref_code_t.text = 'Input Reference:'") IF ls_err <> '' THEN MessageBox('dwModify dw_input_ref_code failed', ls_err) END IF // Make the external datawindow display by using InsertRow dw_input_ref_code.SetTransObject(SQLCA) dw_input_ref_code.InsertRow(0) DAT* //// Retrieve data for child datawindow // //IF dw_input_ref_code.dwGetChild("code", dwic) = -1 THEN // MessageBox(This.Title, "Application Error:~nReference Code - " + & // "Not a DataWindowChild.~nContact your technical support.") // return //END IF // //dwic.SetTransObject(sqlca) //// REJ 18MAR96 No longer retrieval argument //dwic.Retrieve() ////dwic.Retrieve('MASS FLOW') end on on itemfocuschanged;call u_dddw::itemfocuschanged;is_child_name = 'code' is_DAT*validation_table = 'rap_reference_codes' is_msg_name = 'Column - Input Reference' is_msg_text = 'Sorry! Not a valid reference code' end on type dw_ref_code from u_dddw within w_emiss integer x = 1646 integer y = 1664 integer width = 1225 integer height = 112 integer taborder = 190 string dataobject = "d_ref_codes_table_dddw" boolean border = false boolean livescroll = false end type event constructor;call super::constructor;string ls_err DataWindowChild dwc // Make the externDAT*)@)8z'8z&5830)@)8z(A@A8   1   16:/T13567:?@&AHBjCDEFIK M<OVQzRSTUWXbcflmnoqrsd pd_process_ridps_pollutantps_metric_codepd_start_date_timepd_end_date_timepst_input_material pi_countpi_ubpi_log_fileDAT*pt_trans_objectw_emissli_indexmat_curl>  $ 3 F lW-x @U> cbx_background6>checked uof_get_throughput_materials()uof_sql_error4Wcodepamtunitmetric_codeDAT*4W6> Emission EstimatorNo activity record found for Metric: Process: Start date: mmm d, yyyy h:mm:ss AM/PM End date: em_log_detail Y13text~ p No activity record found for metric: start date: end date:  ( 0 h x          h x H-<<R}--< 1GDAT*<d3 pd_arrayT pi_ubpi_increment<- & H-<<R}--< 80<d3 ps_array pi_ubpi_increment<- & End> ,$($::F@@8T:F@@DAT*8- M,D$- -  - L$1- -   -  Y- T$1d- \$1- d$8l!"- - ,$$#l8088z%8z&8z&z&8z&z&8z&58 0)@)8z(8:z&58 0)@)DAT*8z(:)@:@@8M,\$G 1<,t$$6%@%83! 88z%A@A8 8z%8z&z&A@A8 858 0)@)8z'8z&58 0)@)8z(A@A818- $180 - )L818- - 1DAT*!"#6$:FTHIJKMNOPQTXlYr\]glhilp4wx(d pd_process_ridps_pollutantps_reference_codepd_start_date_timepd_end_date_timepdb_input_valuesps_input_unitspi_num_inputspd_creation_date_timepi_log_filept_trans_objps_method_typeps_data_codew_emissli_statusactivity_cur@>  $ 6 I ZDAT* k z    @Y>Tx cbx_background6>checked il_prev_process_rid0V Procedure has not been executed or has no results6> Emission EstimatorNo activity record found for Metric: MASS FLOW Material: Reference Code: Start daDAT*te: mmm d, yyyy h:mm:ss AM/PM End date: il_orig_process_rid^ FTem_log_detail d13textdif| No activity record found for Metric: Reference Code: Material: Start Date: End Date: uof_get_input_activity_value()uof_sql_error4; ( D L T \ d   \ t   L  - 1<--!f- 8-z%8'z&DAT*8:z&-z&A@A8- 1<,T$d$6%@%83l!6- 8|Ri1@8i(@(8z'8z&-z&8z&-z&A@A8- 1<,$$6%@%83!-8v- 8-z%8z&-z&8z&-z&A@A8- 8S21 @8i(@(8z'8z&- DAT*z&8!z&- z&8z&-z&A@A8- 8%-z%8=z&S2(@(8z(8z&- z&8!z&- z&8z&-z&A@A8$f6rvd ps_factor_materialps_activity_materialpdb_activity_valueps_activity_unitps_controlps_factor_typeps_cd1_codeps_cd2_codepd_emission_factorps_activity_unit_codeps_emission_unit_codepi_log_filew_emiss DAT* 0 C T _ n z    @M0 Activity Record For used in place of material em_log_detailD13text\ Activity Record Found: D13\controlled Controlled factor found for First control: ,DAT* Second control: / Uncontrolled factor found: T d l  ",[,C81X1x1dx1 8$P$h$,\,D8111dpx$$$,^,E81DAT*11d1I1,$1<,$$6%@%83!,$80$z%A@A8,8$8@z%8Uz&d>1(@(8z(8lz&A@A81 4DThx!"#$&()*+0 23$405<7@9N:l;|<=>DE FXId4DAT* al_processridll_rcls_seasonsqlcaw_emissd &@,@o in_curseasonaladjfactorBil_curstaterid(2il_curcountyrid@3is_curscccodeXAB(2@3XABii_log_filePem_log_detailme13texttrP Seasonal Adjustment factor found for process: is_curprocessid>P Season Code: DAT* Value: B 8 P h p x        0 8 d 5,$($::F@@8T:F@@8C5$9}4@83@8M@8A@87668006M28;<63)D 8DAT* }81<v1<,\$l$6%@%83t!f8088z%A@A8,8z%8z&A@A8f87f8A0A@A8181<,|$$6%@%83!8z%A@A8O8< 80P8< 80Q8<DAT* 80R8< 80S8< 1G.$1%6/$1%6.8.80/8*/80G1I195$8)8$)(8I0$)D85IIL$)T8PHGG\$I8dJ8G1B1DAT*HGTG1*T380680580& 1)T380680580& 1(T:38068058'0& 1%T38Y068058`0& 1$T38Y0680580& 1#T38Y0680580& 1 Tb38DAT* 0680580& 1T38 068058Y0& 1T38 0680580& 1T@380680580& 1T380680580& 1T3806805850& 1 T 38e068058m0& 1 DAT*Th 38e0680580& 1 T 38e0680580& 1< 88$z%M2(@(8z(8-z&A@A8128/G(@(8z'688!8B@81! 26T$2)\8d$)l8=t$)|8}=1<DAT* 1<,$$6%@%83! 83z%8-z&6z&8z&A@A84 =1<H 1<. 88$z%M2(@(8z(8-z&A@A8-1 1<,$$6%@%83! 56A@A891}949 4BM??9<C1<DAT*M?MB!,$$6%@%83! 8 M?N(@(8z'A@A8 9<=87 9<= 9<=80!B9<CM?9 4@84"9}81}>1}>=>M?3<91<"O>< L$><8T)|8=1<O><DAT*=8!88"!&BM?8 9<=8 9<=8!99b" 9<=8 9<=8!"99"?9<C1<M?MB!,$$6%@%83!&88M?N(@(8z'A@A8&8M?NDAT*(@(8z'A@A898 9<=80~ O1=6 9<=6 9<=80 9<=O><="8P8< $><8$)<8S8< D$><8LKl8Q8< t$><8|)8R8< $><8)8v9DAT*481<Z9<CM?694@8481<78PO-)8}71<171<1<!,$$6%@%83!86z%8-z&3z&8 z&z&A@A88 0A@A8-148F 04 9<=8L P81DAT*<1<,P $X $6%@%83` !8p 8 z%A@A88 9<C2(@(8z'8 z&A@A849<CM? 9<=80 9<  $67M26 9<=6 9<=63&'@) 8 } 9<=80 6( DAT* 9<=671<T9<CM?094@84~71<~-1"&)"7&6)6@M80 0)L 8}71<1<,T $\ $6%@%83d !8t 8 z%&z&8 z&A@A88 )z%8 z&A@A89<CM?9DAT*4@84"71<"-1 9<=8 \RM@Nd 9<=8 RM@Nk1<, $ $6%@%83 !<8  9<=z%8' z&M?2(@(8z(A@A89<CM?d9<4@84( 9<=64 (6)'6DAT*L&P1=7&6P1=6@M80 0)< 8}71<\1<,D $L $6%@%83T !8t 8 z%&z&8 z&A@A88 P1=z%8d z&A@A89<CM?894@8471<-1 9<=8 S1CM@bNDAT* 9<=8 S1CM@iN1<,t $| $6%@%83 !8  9<=z%8' z&M?2(@(8z(A@A89<CM?94@84( 9<=6 (6)'6"9}4 9<=8 4"#d$!9}9<CM? 9<=80DAT* 9<  $6:1}:8:`$1<, $ $6%@%83 !8 0A@A8+O:<=679<=6O:<M255 9<=6N%66)  8 }71<2$%P:<="7%6P:<=6AN8 0) DAT*8}71<!1<, $( $6%@%830 !!8t 8 z%%z&8@ z&A@A88 P:<=z%8d z&A@A8\$"71<!-1"71<")Q:<=6%P:<=6+O:<N%63./S:<P:<Q:<)d     DAT*8  9<=8 "S:<CLNNd# 9<=8 >#S:<CLNNk#1<,l $t $6%@%83| !#8  9<=z%8 z&A@A8\$)P:<=6*Q:<=6-R:<=6!9}`$\$71<\$-1(!9}79<=6(M2DAT*55 9<=6N%66)  8 }71<(%)&7%6)6AN8 0) 8}71<~&1<, $ $6%@%83 !2&8t 8 z%%z&8@ z&A@A88 )z%8 z&A@A89<CM?Z&92&4@84&71<DAT*&-1+O1N%63./S1%Q1)     8  9<=8 n'RLNdt( 9<=8 'RLNkt(1<, $ $6%@%83 !,(8  9<=z%8 z&A@A89<CM?T(9,(4@84*Q1DAT*=6-R1=6!9}(71<(-1, $6*8-*!@*7*6, $6@8 0) 8}71<@*1<,( $0 $6%@%838 !!!@*8t 8 z%*z&8H z&A@A88[ ,l $z%A@A871<*9<CM?|*9DAT*T*4@84*71<*-1!# +9<CM?*9*4@8441(@(838+-8t -8 "-8v "-8x "+,-z%+,8z z%d,-8| -8~ "-8L "-8 "-87"-8 "T,,-z%d,,668DAT*8!-E1,E1E- $E%1,-F, $1) 8, $F8  $E%) 8, $F8 6) 8,$F8,6)(8,7,8$MD)X8},|M71<".17MR1655-3@3DAT*$@$@86JKL9,6)8}71<.-11</D1/$9}KLK?NVLK1C5M80655,66-6-$16)81</--10800LL1C5M80655,66-6-DAT*$16)81<0--10807LJ1C5M06655,66-6-$16)8}71<d1--11<2,$ $6%@%83(h2886z%8-z&0z&8Dz&LJi1@8i(@(8z(8-z&-z&8Qz&z&8Xz&DAT*A@A82886z%8-z&0z&8Dz&LJi1@8i(@(8z(8-z&-z&A@A8LL5`4hp?LLNV7LL1C5M80655,66-6-$16)x8}71<3--11<48LLi1@8i(@(8zDAT*'8-z&-z&A@A8,$$6%@%8348z%8Xz&A@A8-19 F1"#$6%:6T7d8p9:;>BRCfDEFHIK,LDOfRvST[\]8^V_tbcdei*j8kFnNoprvwxyz"{B}P~\l~$6J\n(:DAT*L^r*<Pbt  . @ R d x  & N l . 4 D H  \ :>BN` BNb " :"#$%+&-8.X/z0~35680:l<?BDFG(H2I6JRLVMZNnRSTV(XrYZ^eijDAT*k@mhr{|}",0LPhn~B| "BX|<V`d<P*48TXpv Z0@Lp z  ^0 !D #b & ( )!+R!/!0!2!3!4!5!6!:"A"B"C"D#E:#G>#H#L#N#O#P$R$S*$T.$VF$WL$Y\$Z`$]DAT*d$^p$h$k %l%ph%r|%s%u&y2&zL&{V&|Z&}v&~z&&&&8'X'j''''',(F(P(T(p(t(((((((( )p)))*@*T*n*x*|**********++ +>+R+++++<,P,T,d,,,,-H-x-----."..... / /"/@//////!/*0+0,0.010:41<H1=N1>T1Ad1Bx1C1Fd2Gh2M2O3R83[3]3^3_3b3c3fp4g4o4r4w4x4z4DAT*}5dh 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_input_output_flag ps_numer_material_code ps_denom_material_code ps_metric_coden ps_in_throughput_materialps_pollutantpdb_est_emissionps_emission_unit_codepi_log_filept_trans_oDAT*bjectpt_emiss_objectpt_rid_objectpl_next_process_ridps_profile_codeps_spec_filterpd_todayps_method_typepb_scc_at_strps_methodpi_curr_prioritypd_cutoff_datew_emisslb_successful_calclb_use_constantlb_init_flaglb_last_devicels_activity_unitls_numer_unit_codels_denom_unit_codels_curr_materialls_curr_unitls_unitls_factor_materialls_method_typels_quality_typels_cd1_codels_cd2_codels_metricls_priorityls_filterls_factor_typels_emiss_factor_statusls_for_factorsls_controllDAT*i_ret_statusli_num_factorsli_metric_loopli_emiss_loopli_ss_factor_numli_g_factor_numli_num_factor_rowsli_factor_rowld_curr_groupld_constantld_nullld_last_groupld_todayll_next_process_ridll_ill_jll_factorpriorityll_prevfactorpriorityll_factorrowpointerldb_mass_flow_valueldb_downstrmdis_valueldb_fugitive_dischargeldb_nullldb_activity_valuels_throughput_material_code ls_throughput_unit_code ls_emission_unit_codebl ls_quality_rating DAT*ld_emission_factor> case1254Xtd>  ' 9 L ]l>->----4-X@-td-  DAT*    1 $ , 6; D S0a Ak| 8@8A      'DAT* / B Q a m y    $   $4GU> c> o> w> DAT* 1   o@) 2 o@dE-p-o@--o@>-@ cbx_backgroundd6>checked @uof_emiss_factorce2em_log_detailAL13textdSPECIATION DAT* No Factors Found from Source Specific profile ... continuing with next emittant No Factors Found for profile ... continuing with next profileEMIS FACT No Factors Found ... continuing with next emittantL13dt Factors Found for profile Endis_controlcodeFFNOT FOUNDdw_emis_fact#setfilterI#filter #rowcount48#48#factor_prioritygetitemnumber DAT*tSPECIFICuncontrolled For Process Specific Uncontrolled Factors with Control Efficiencycontrolled For Process Specific Controlled Factors For Process Specific Uncontrolled FactorsSOURCE For Source Specific Uncontrolled Factors with Control Efficiency For Source Specific Controlled Factors For Source Specific Uncontrolled FactorsCOUNTY For County Specific Uncontrolled Factors with Control Efficiency For County Specific ControllDAT*ed Factors For County Specific Uncontrolled FactorsSTATE For State Specific Uncontrolled Factors with Control Efficiency For State Specific Controlled Factors For State Specific Uncontrolled FactorsGENERIC For Generic Uncontrolled Factors with Control Efficiency For Generic Controlled Factors For Generic Uncontrolled FactorsData Error: unknown factor type for process factor_priority = control_code_1#I# DAT*#48L13d No factors used.SQL ERROR: counting factors for L13dtL13d Record Group: E#throughput_material_codegetitemstringmVOCTOGEXHCL13d VOC to TOG Record Group: VOC to EXHC Record Group: is_denom_material&&#throughput_unit_code8m#emission_factorgetitemdecimaDAT*l\#unit_code6m#quality_typemuof_compare_factorsIL13dt More than one factor found for with the same throughput material.FOUNDC L13d Denominator material code for method_metric record type E, group number , resulted in more than one possible emission factor&uof_constant6f &&DECIMALuof_unit_convert<N8 L13dDAT*t No unit conversion information found to convert constant to be compatible with constant.*/L13dUnknown operator type in group &N8 L13dt based factor.L13d&M&L13d Starting search for activity datauof_activity_dataT DOUBLEN8 L13dt activityuof_log_actDAT*ivity_value1bJ L13d on emission factor recordT N8 L13dtbJ L13dis_user_unit@ j jN8 L13dt emission estimate to jLSUNABDFil_controlrid< Edw_composite_ef 25insertrow( 25process_rid EsetitemO 25material_codeP 25method_typeP uo_tl 05;uof_downstrDAT* eam_process2@il_uncontrolled_process_rid`cuof_default_parametersOgd_total_fug_emission*DOWNSTRMDISuof_activity_replace9KDISCHARGEKMASS FLOWKL13dt EMISSION = from method**K FUGITIVE EMISSION = L13d from  ( D \ l t|       DAT* ( 0 D L T \  T \ d l t |       <L |       < D l t       P X `    ( L T \ d    4 < D L T t | DAT*         ( 0 d l t |             ( 0 8 l           ( 8 X |         (`h p x   J,$($DAT*::F@@8T:F@@8800 828>08@08B08D08F08H08J0\$- )t8|$8)8$)8$666M2666666$$$ 3) 8}-1<DAT*$1l-1<l80- )T81-1<1)l8)81<8080:)@@81)$81<X808,0:)@@811)8$)8}1-<$8)88DAT*N8080:)@@818@8B"8D" $88>0)8<1808$0:)@@81p>5xr1F-<r$8J8L58080:)@@81>$DAT*8L1)8<1n808$0:)@@81<1}1}-1<B 1 -<.$ 8) 8  1-1<j180- )81%&'6(::TBfCzDEFGHJKORS>ZZcDAT*de f8h\rltyz{HXt>N*X 0^nr *.>Vfjd ps_emittant_material_codeps_scc_ams_codeps_in_throughput_materialps_profile_codepd_process_ridpi_num_factorspi_ss_factor_numpi_g_factor_numpi_log_filept_trans_objectps_methodpd_cutoff_datew_emissll_ils_testls_generic_factor_typels_specific_fDAT*actor_typels_state_factor_typels_county_factor_typels_source_factor_typels_retrieval_argumentsls_in_throughput_materialls_factortypell_rowll_rcln_factoramt " 2 L \> kz   @  DAT*  ) ? U l    cbx_backgroundd6>checked @EMIS FACTORGQRMSPFdw_emis_factAL#settransobject^dL#setfilterIL#filterL#il_curstaterid2il_curcountyrid3il_cursourcerid4retrieve2uof_emiss_factor() .. Retrieving DAT*emission factorsuof_sql_error4Fuof_log_factorsi\uof_discard_factors_by_date_and_typejtErroruo_emission::uof_emiss_factor(); call to uof_discard_factors_by_date_and_type() failed.uof_discard_factors_by_priority1guo_emission::uof_emiss_factor(); call to uof_discard_factors_by_priority() failed.i\L#rowcount4L#factor_typegetitemstringuo_emission::uof_emiss_factor(); getItemString() failed. L#setitemPuo_emisDAT* sion::uof_emiss_factor(); setItem() failed.in_curseasonaladjfactorWBL#amtgetitemnumber uo_emission::uof_emiss_factor(); getItemNumber() failed.WBL#OL#4F ( \ t |          T l  $         p x      DAT*"   *B ,$($::F@@8T:F@@8 M- x`- 0$1d,8$@$#8H08[8rz%z&8z&z&:)@:@@81<,$$6%@%83!8z%A@A88z%A@A86- P$1h- X$8`DAT*$01<080A@A8180- )816M #S3M pb1<,$$6%@%83!&8z%A@A88Bz%A@A81 - Hb- $1d,$$#8H08[8rz%z&8z&z&DAT*&:)@:@@81<,$$6%@%83!8z%A@A88Bz%A@A81$- $1V- $8`1<80A@A8180- )881$M #|S3@M pb1<,P$X$6%@%83`!DAT*(8pz%A@A88Bz%A@A816 :-T.X/\0`2d3h4l5p6t8x:|=?@EFbIMOPQS V0WTXdZh[t]^ae&n6o:p>qBsFtJuNvRxVzZ|h~@fBRVb|d pd_process_ridps_scc_ams_codeps_emittant_material_codeps_throughput_material_codepd_cutoff_dateps_emission_unit_coDAT**deps_throughput_unit_codepd_constantpi_log_filept_trans_objectw_emissld_exponent>  ' A ] l    @>  cbx_backgroundd6>checked 6> Emission EstimatorConstant not found for emittant material throughput material em_log_deDAT*,tail13textt Specific constant not found for emittant material: throughput material:  Select returned more than one row Found more than one specific constant.uof_constant()uof_sql_error4 t13 Specific constant found for emittant material: throughput material: i6> DAT*.13 Generic constant not found for emittant material:   Found more than one generic constant.4 t13 Generic constant found for emittant material:  ( 0 8 @   P X           8 @P X ` jDAT*01119}9}$),81z  1}  840  9} 9} 9}  8$8@)\8 =f  840 =68d  1 }8f  1 }8hDAT*2  1}8jF  1}8lx  1#}8n  1(}8p  1(} 9}v 1 t$8|)8 1%n 1 840 1 $8)8 1% 1 840 1DAT*4%84 1%84"l$#$#!")8<18 08'8Kz%:)@@81p9}9} 1%$1% 1%$1%! 1%$1% 1%$1%!"P  9} 1%DAT*6$1% 1%$1%!L$8| 1%6)81<8080:)@@81$8 1%6) 81<L8080:)@@81h 9}vvv11!)H8<11DAT*819} (@(8, 8P01H =j = T$8@8\0)`81<8080:)@@81  =<   1<R}h h   1<R}h$8p =)81< 8080:)@@DAT*:81>1,$1<!,$$6%@%83! ,$8$1%z%8z&$1%z&8z& z&A@A81 4$8<)T81<L 808\0:)@@81$)81< 8080:)@@81$1DAT*<:@) 81<, 8080:)@@81,\$1<,d$l$6%@%83t! ,$8(@(8z'8z&$z&8z&A@A8$8)81<V 808\0:)@@81 $)(81< 8080:)@@81DAT*>*6B&d)*+,-/0:4f5~78:;=>@(ABCZDtFGIJLMQR6TnUYa*cRdnf~hlmrvw|~<<LPdhlvz,Vjz   8 D h N  < L v  ,   F V    d`0 ll_rowcountll_rcll_rtll_ill_unDAT*xcontrolledcountll_controlledcountll_discardcountlb_controlsretrievedlb_controlefficienciesls_controlefficienciesls_control@ li_factorpriorityxls_factortype0 lb_factorcontrolledlb_factordiscardlb_factorignorecase52w_emiss(Dh %:MDAT*Bollutant for ll_i = 1 to 2 if ls_controlCodeMetric = "EPA CNTL CO" then // look for EPA CNTL CO record SELECT rap_device_codes.code INTO :ls_controlCode FROM rap_activities, rap_device_codes WHERE rap_activities.value = rap_device_codes.afs_control_code AND rap_activities.value <> '099' AND ref_rid = :ll_controlRid AND SUBSTR(metric_code,1) = :ls_controlCodeMetric AND SUBSTR(material_code,1) = :is_curPollutant AND DAT*D start_date_time <= :idt_startDateTime AND (end_date_time >= :idt_endDateTime OR end_date_time is null) AND rap_activities.value_type = :ls_controlCodeType USING SQLCA; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = 100 then // no record found if ls_controlCodeType = "2ND" then exit ls_controlCodeMetric = "CNTL CO GRP" else // EPA CNTL CO record retrieved successfully li_controlCount ++ DAT*F il_controlRid[li_controlCount] = ll_controlRid is_controlCode[li_controlCount] = ls_controlCode ls_controlCodeType = "2ND" //setup for another record retrieval continue end if end if //EPA CNTL CO if ls_controlCodeMetric = "CNTL CO GRP" then // look for CNTL CO GRP record ls_controlCode = ls_controlCodeType //used to get the value type into the function //and the control code back out if uof_cDAT*Hhoose_group_activities(ll_controlRid, is_curPollutant, ls_controlCodeMetric, ld_null, & ls_controlCode, idt_startDateTime, idt_endDateTime, w_emiss.ii_log_file, sqlca) then // CNTL CO GRP record retrieved successfully li_controlCount ++ il_controlRid[li_controlCount] = ll_controlRid is_controlCode[li_controlCount] = ls_controlCode ls_controlCodeType = "2ND" //setup for another record retrieval continue else // no record found exiDAT*Jt //ll_i end if end if //CNTL CO GRP next //ll_i if ls_controlCodeType = "2ND" then // return now, at least one process level control definition was found return li_controlCount //number of controls found else // no process level control definitions were found for current // pollutant, so treat the "CONTROL" device as uncontrolled exit //get out of the loop end if end if //ib_controlsByPollutant //control process found downstreaDAT*Lm from current upstream process li_controlCount ++ //if more than 2 chained control processes exist downstream from //current process, then return now -- only two controls are tracked if li_controlCount > 2 then exit //get out of the loop end if //set the instance arrays il_controlRid[li_controlCount] = ll_controlRid is_controlCode[li_controlCount] = ls_controlCode //set the next upstream process rid to current process rid ll_upstreamProcessRid = ll_controlRid //looDAT*Nk further downstream loop return li_controlCount //number of controls found end function public function integer uof_check_control_efficiencies (); //check for control efficiencies for any control processes //specified in il_controlRid[]. if control efficiencies are missing //for any process specified in il_controlRid[], then treat as //uncontrolled //Returns: -1 error; // 0 no or incomplete control efficiency info; // 1 valid control efficienDAT*Pcy info //MDY 2/99 long ll_rc long ll_i long ll_controlRid string ls_controlEffUnit double ld_controlEfficiency //check for valid control process if il_controlRid[1] = 0 then return 0 //loop to check for control efficiencies for up to two //control processes for ll_i = 1 to 2 //check for valid control process ll_controlRid = il_controlRid[ll_i] if ll_controlRid = 0 then exit //check for control efficiency for current control process //and current pollutant selDAT*Rect value_amt into :ld_controlEfficiency from rap_activities, rap_streams where ref_rid = rap_streams.rid and from_process_rid = :ll_controlRid and metric_code = 'CNTL EFFIC' and start_date_time <= :idt_startDateTime and (end_date_time >= :idt_endDateTime or end_date_time is null) and material_code = :is_curPollutant and value_amt is not null and value_unit_code is not null using sqlca; ll_rc = f_sqlCheck(SQLCA) if ll_rc < 0 then return -1 elseif ll_rc = DAT*T100 then //no control efficiency found for specific pollutant, //so look for a control efficiency for a pollutant group // search for applicable CNTL EFF GRP records if uof_choose_group_activities(ll_controlRid, is_curPollutant, 'CNTL EFF GRP', & ld_controlEfficiency, ls_controlEffUnit, idt_startDateTime, idt_endDateTime, & w_emiss.ii_log_file, sqlca) then ll_rc = 1 else //no control efficiency found for specific pollutant, or pollutant group /DAT*V/so look for control efficiency for any pollutant "@" select value_amt into :ld_controlEfficiency from rap_activities, rap_streams where ref_rid = rap_streams.rid and from_process_rid = :ll_controlRid and metric_code = 'CNTL EFFIC' and start_date_time <= :idt_startDateTime and (end_date_time >= :idt_endDateTime or end_date_time is null) and material_code = '@' and value_amt is not null and value_unit_code is not null using sqlca; llDAT*X_rc = f_sqlCheck(SQLCA) end if end if //handle the control efficiency retrieval result if ll_rc < 0 then return -1 elseif ll_rc = 100 then //no control efficiency found for current process return 0 end if //don't repeat if both control rids are the same //this condition can occur when control info is stored //at the process level for generic control devices (groups) if il_controlRid[1] = il_controlRid[2] then exit next return 1 end funcDAT*Ztion public function integer uof_calc_ef_set_cont_filter (ref integer pi_loop_num, decimal pd_source_process, ref long pl_target_process, string ps_pollutant, datetime pd_start_date_time, datetime pd_end_date_time, ref string ps_cntl_co_type, ref string ps_control, ref string ps_filter, ref string ps_cd1_code, ref string ps_cd2_code, integer pi_log_file, transaction pt_trans_object);// uof_calc_ef_set_ctl_filter // // Code removed from uof_calc_emission_factor and made into function so that DAT*\// uof_calc_emission_factor would be short enough to edit // // Returns 1 if successful // 0 if control not found and continue should be issued // -1 if SQL Error INTEGER li_ret_status, li_loop_mod2 li_loop_mod2 = MOD(pi_loop_num,2) IF li_loop_mod2 = 1 THEN ps_filter = ps_filter + & "IsNull(control_1_device_code) AND IsNull(control_2_device_code)" ps_control = "uncontrolled" RETURN 1 ELSEIF li_loop_mod2 = 0 THEN il_perfCount ++ ps_control = "controlled" DAT*^ IF IsNull(ps_CD1_code) THEN // Find downstream process, if we haven't yet li_ret_status = w_emiss.uo_tl.uof_downstream_process(& pd_source_process, pt_trans_object,pl_target_process) IF li_ret_status = 1 AND pl_target_process = 0 THEN // no downstream process found // this condition is same as not finding emission factor at all ps_CD1_code = 'NOT FOUND' IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 3 THEN FileWrite( pi_log_file, " nDAT*`o downstream process exists for " + & "process " + String( pd_source_process) +" ") END IF RETURN 0 ELSEIF li_ret_status = -1 THEN // SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SQL ERROR: retrieving downstream "+& "process for " + & "process " + String( pd_source_process) +" ") END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSEIF li_ret_status = 0 THEN // retrieved more than 1 possiblDAT*be downstream process IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, " Multiple down streams "+& "for " + String( pl_target_process) + & "Don't know which one to work with." + & "This feature not supported for Beta" +" ") END IF RETURN 0 ELSE // REJ 13FEB96 downstream process found li_ret_status = uof_control_device_code & (pl_target_process, ps_CD1_code, ps_cntl_co_type, ps_pollutant, DAT*d& pd_start_date_time, pd_end_date_time, pi_log_file, pt_trans_object) IF li_ret_status = 0 THEN // no control device code found // this condition is same as not finding emission factor at all ps_CD1_code = "NOT FOUND" IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " No control device code found for " + & "first downstream process") END IF RETURN 0 ELSEIF li_ret_status = -1 THEN /DAT*f/ SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SQL ERROR: retrieving control "+& "device code for process " + String( pd_source_process) +" ") END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSE IF ps_cntl_co_type <> '2ND' THEN pd_source_process = pl_target_process END IF END IF END IF ELSEIF ps_CD1_code = 'NOT FOUND' THEN RETURN 0 END IF // First control device is identifiedDAT*h // Add 2nd control device to filter for controlled factor, if there is a second control IF IsNull(ps_CD2_code) THEN IF ps_cntl_co_type <> '2ND' THEN li_ret_status = w_emiss.uo_tl.uof_downstream_process(pd_source_process, & pt_trans_object,pl_target_process) ELSE li_ret_status = 1 END IF IF li_ret_status = 1 AND pl_target_process = 0 THEN // no downstream process found, only one downstream control exists li_ret_status = 0 DAT*j IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( pi_log_file, " second downstream process does not " + & "exist.") END IF ps_filter = ps_filter + "IsNull(control_2_device_code) AND " + & "control_1_device_code = '" + ps_CD1_code + "'" RETURN 1 ELSEIF li_ret_status = -1 THEN // SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SQL ERROR: retrieving downstream "+DAT*l& "process for process " + String( pd_source_process) +" ") END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSEIF li_ret_status = 0 THEN // retrieved more than 1 possible downstream process IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 0 THEN FileWrite( pi_log_file, "Multiple down streams for " + & String( pl_target_process) + "Don't know which one to work with." + & "This feature noDAT*nt supported for Beta" +" ") END IF RETURN 0 ELSE // REJ 13FEB96 downstream process found li_ret_status = uof_control_device_code(pl_target_process, ps_CD2_code, & ps_cntl_co_type, ps_pollutant, pd_start_date_time, pd_end_date_time, & pi_log_file, pt_trans_object) IF li_ret_status = 0 THEN // no control device code found ps_CD2_code = "NOT FOUND" IF pi_log_file <> -1 AND Dec(w_emiss.em_log_detail.text) > 2 THEN FileWrite( DAT*ppi_log_file, " No control device code found for " + & "second downstream process") END IF ps_filter = ps_filter + "IsNull(control_2_device_code) AND " + & "control_1_device_code = '" + ps_CD1_code + "'" RETURN 1 ELSEIF li_ret_status = -1 THEN // SQL error IF pi_log_file <> -1 THEN FileWrite( pi_log_file, "SQL ERROR: retrieving control "+& "device code for process " + String( pd_source_process) +"DAT*r ") END IF ROLLBACK USING pt_trans_object; Return( -1 ) ELSE // 2nd control device found ps_filter = ps_filter + "control_1_device_code = '" + ps_CD1_code + & "' AND control_2_device_code = '" + ps_CD2_code + "'" END IF END IF ELSEIF ps_CD2_code = 'NOT FOUND' THEN ps_filter = ps_filter + "IsNull(control_2_device_code) AND " + & "control_1_device_code = '" + ps_CD1_code + "'" RETURN 1 ELSE ps_filter = ps_filter + "control_1_deviceDAT*t_code = '" + ps_CD1_code + & "' AND control_2_device_code = '" + ps_CD2_code + "'" END IF END IF // Normal Return RETURN 1 end function public function integer f_cleartable (string as_table);//******************************************************************************** // // Object: f_dlookup ( string as_refcolumn, string as_table, string as_condition ) returns any // Function: f_dLookup // Access: public // Arguments: string as_returndatacolumn // strDAT*ving as_table // string as_condition // Returns: any -- Returns the value of the data column name // Description: This is a Domain Lookup function where you give Column Name for // the data returned from the table and condition // //******************************************************************************** // Revision History // Date Name Revision //-------------------------------------------------------------------------------- // 08/13/2001 Michael Colombo InitDAT*,ial Version //******************************************************************************** string ls_sql string ls_type long ll_return long ll_sqldbcode string ls_sqlError, ls_newsyntax datastore lds_dynamic any la_null, la_data //la_null = '' //la_data = la_null lds_dynamic = create datastore if isnull(trim(as_table)) or trim(as_table) = '' then return -1 end if ls_sql = "select *" + & " from " + as_table if isnull(ls_sql) or ls_sql = '' then la_data= lDAT*z]r ----(-D4-P X@0 dw_emis_factdd#rowcount4 #factor_typegetitemstringLGPQRMSF#control_1_device_codeL#control_2_device_codeLib_controlsretrievedCib_controlsbypollutantDuof_get_controlsDAT*|lRAPIDSuof_discard_factors_by_priority(); call to uof_get_controls() failed.Cis_controlcodexFxFxFxFxFxF#setitemPErroruo_emission::uof_discard_factors_by_priority(); setItem() failed.#Puof_check_control_efficienciesm(N/A#_P#factor_priorityOii_log_filePem_log_detail13textP Control 1: xF ControlDAT*~ 2: xF Control Efficiencies: #factor_type AsetsortXJuo_emission::uof_discard_factors_by_priority(); setSort() failed.#sortcuo_emission::uof_discard_factors_by_priority(); sort() failed.#rowsdiscarduo_emission::uof_discard_factors_by_priority(); rowsDiscard() failed.P13P Discarded factor(s) for is_curpollutant- during CONTROL prioritization.#factor_priorDAT*ity D, quality_type AXJ#c , 8 \ t       p            H T ` h        4 T      \ d l t      ( m$),81DAT*<91"1""8408:8_z%:)@@891}<J<=8* 9}F8N9}F8r9}F89}F89}F89}F89}F8&9}FDAT*8F9} < 1 $8),8 1 4$8)<8 1% 1%"<8408:8Dz%8{z&:)@@89p1 $8)81 $8)81%1 801%8DAT*1 801%1%p91 $8)81 $8)81%41 801%l1 801%1%91 $8)81 $8DAT*)81%h1 801%1 801%1%9 1 $8)81 $8) 81%1 801%1 801%1% 9DAT*B  1 ($8)08 1 8$8)@8 1% 1 80 1%  1 80 1% 1%B 9}x  1 H$8)P8 1 X$8)`8 1%  1 8DAT*0 1%>  1 80 1% 1%x 9}##!  1% 1% 1% 1%!  9 ##" 9d 1 h$8)p81 x$8)81% 1 801% 1DAT* 801%1%d  11%,c,F811d" 9 11%,c,G811d", 9 1% 1%d 91 $8)81 $8)8DAT*1%(1 801%`1 801%1% 11%,c,H811d"9 11%,pd,I811d"~9 1% 1%9956"9<;r=ABDAT*CDE&F>GJHbInJKLMNOPQRS"T:VFYJZR[\]`2e<fDghij8npoxpqr4slwxyz0{h|"d V B J  > x    \  < N ` n  , d l (`*8V~dEX al_row1al_row2as_exclude ls_sccamscode@ lsDAT*_unitcode@ ls_throughputmaterialcodej@ ls_throughputunitcode@ ls_factortype@ ls_profilecode@ ls_control1devicecode @ ls_control2devicecode@ ls_meascode@ ld_epadate@ lb_epadatelb_sccamscodelb_unitcodelb_throughputmaterialcodelb_throughputunitcodelb_factortypelb_profilecodelb_control1devicecodelb_control2devicecodelb_control1matchlb_control2matchli_ill_rcll_rowcountcase66sqlcaDAT*$@X$<TD$-@0-XL-d-----$ -<0-TH-`kyDAT*:u _b%te+7 co?@0 dw_emis_factdd#rowcount4 Erroruo_emission::uof_compare_factors(); input row value(s) out of range.epa_datescc_ams_codeunit_codethroughput_material_codethroughput_unit_codefactor_typeprofile_codecontrol_1_device_codecontrol_2_device_code#getitemdatetime#DDAT*ATA Error: column 'epa_date' can't be NULL in table 'rap_emission_factors'#getitemstring############### ,  , 4 <             DAT*     ( 0 8 @ H P X ` h p x      F1$),8x4$8<)X88`8a08g0:)@@81$8)88`L8a08g0:)@@81DAT*b68^8^8^8 ^8 ^82 ^8T^j68j8j8j8 j8 j8> j8DAT*`j,$1<,$ $6%@%8>!1,$80A@A8L,8$8@0A@A8111",\$8d(@(8z'8z&(@(8z(A@A811"T,$8(@(8z'8z&(@(8z(DAT*A@A811",$8(@(8z'8z&(@(8z(A@A8 1 1"\,4$8< (@(8z'8_z& (@(8z(A@A8 1 1",|$8 (@(8z'8z& (@(8z(A@A8 12,$8 (@(8z'A@A8DAT*1,$8(@(8z'A@A81,$8(@(8z'A@A81@t $%&'<+L-V.f/z012345678 9$:.;F<P=T?^AbBrCDEFGHIJKLM0N:ORP\Q`VjXtZx\]^ _`<cLdjhimTnrrsw\xz|}2Bd( ai_loglevelll_roDAT*wll_rcll_genericll_genericcontrolledll_statell_statecontrolledll_countyll_countycontrolledll_sourcell_sourcecontrolledll_processll_processcontrolledll_genericspeciatell_processspeciatell_unknownll_totalls_factortypels_controlcodecase45case65w_emiss!,AJ]g{DAT*   U d@ @; dw_emis_factdd#rowcount4 #factor_typegetitemstringtoHErroruo_emission::uof_log_factors(); getItemString() failed.#control_1_device_codeHGQRMSPFii_log_filePem_log_detail13textPDAT* Factor(s) Found:P No Factors Found.P Generic/Uncontrolled: Generic/Controlled: P State/Uncontrolled: State/Controlled: P County/Uncontrolled: County/Controlled: P Source/Uncontrolled: Source/Controlled: P Process/Uncontrolled: Process/Controlled: P Generic/Speciate: P Process/Speciate: DAT* P Unknown Type(s):  , 4 X        8 \   4 |     d 1 80 1 8011 1,$)@811  9}11Y =1 H$8)`DAT*81%x1 8h01 l$8)81%8088z%8z&:)@@81 1%68 n1 1 }8 1 1 }8 1 1}8 1 1}8 DAT*N1 1#}8  1 1(}8" 1 1(}1R =1 $$8),81%1 8h01 4$8)<81% 808D8z%8z&:)@@81DAT*1%1%1%1%!~1%681 1 }(8 1 1 }(8D1 1}(8|1 1}(81 1#}(8 1 1(}(8"$1DAT* 1(}(1%1%1%1%!1%1%1%1%!" )8#1%1%1%1%"z 1R    9}1%1%  1 1DAT*   = $880)81< 8080:)@@81 $8)81<& 8080:)@@81d$)t81< 808|0:)@@81$1 :@)81< 8080:)@@81DAT*1 ,4$1<,L$\$6%@%83d! ,t$8|(@(8z'8z&$z&8z&A@A81 ,$1<,$$6%@%83! ,$8|(@(8z'8z& $z&8z&A@A8 *+,8-F.T0b1479<=@AxBCFDAT*KL6NJOjQRTUWXZ*[J]b^`acgilmHpqruz {z~ @Xx $(Vbvz( 8 v  & P ~   l  8  d ( ls_factortyped@ ld_epadate@ li_priority@ll_rcll_rowcountll_ill_kll_datediscardcountll_typediscardcountDAT*ll_discardcountll_discardrowlb_rowdiscardls_excludecompareJ case75case128w_emiss0H@-0$-H<-TZfkp--  @1 factor_typeDAT*epa_datedw_emis_fact#rowcount44#getitemstring:Pd#getitemdatetimetErroruo_emission::uof_discard_factors_by_date_and_time(); DATA Error: column 'epa_date' can't be NULL in table 'rap_emission_factors'GPQRMSF#P#tuo_emission::uof_discard_factors_by_date(); uof_compare_factors0hq#_setitemPuo_emission::uof_discard_factors_by_date_and_type(); setItem() failed.#factor_type ADAT*setsortX uo_emission::uof_discard_factors_by_date_and_type(); setSort() failed.#sortcluo_emission::uof_discard_factors_by_date_and_type(); sort() failed.#rowsdiscarduo_emission::uof_discard_factors_by_date_and_type(); rowsDiscard() failed.ii_log_file'Pem_log_detailr<13textT'P Discarded factor(s) for is_curpollutant- during DATE prioritization.'P<13TDAT*t'P- during TYPE prioritization., @ H ` l  $ , 4 <      d t   4 L \ dt        >%4Ld|,Hd|DAT*,8g$ 80$680$b80$80$80 $80$$80,$>480<$jD80L$T80\$d80DAT*,J81181d(181 $0 <!H"T#`$l%x&'()*+-.01 263b45678>9j:<=>?@A$B(d" al_processridll_rcsqlca<@l8 il_curnationrid1is_curnationname 7il_curstaterid<2is_curstatenameT8DAT*il_curcountyridl3is_curcountyname9il_cursourcerid4is_cursourceid:is_cursourcename(;is_cursiccode@il_curdevicerid5is_curdeviceid <is_curdevicename 4=il_curprocessrid P6is_curprocessidl>is_curprocessname?is_curscccodeA 7 7T8T899::;;@@<<4=4=l>l>??DAT*AA 4 L d |       , H d |                 $ , 4 < D L T \ d T @88011|08080 |L$DAT* 1}9,0h,K81$1F1d1"F,j,L8111d8T 1<!1,c`ethxptuyDAT*{ $04B`p*.BR,048<PZ^bld ll_rcll_countll_ill_upstreamprocessridll_controlridls_controlcodels_controlcodetypels_controlcodemetricld_nullli_controlcountsqlcaw_emiss2@ O bDAT*tabsequence=32766 border="0" color="0" x="6601" y="8" height="64" width="210" format="[general]" html.valueishtml="0" name=profile_code 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=11 alignment="0" tabsequence=32766 border="0" color="0" x="6249" y="8" height="64" width="343" format="[geDAT* w @@x il_controlrid Eis_controlcode Fil_curprocessrid86CONTROLib_controlsbypollutant\D\D\D1STEPA CNTL COis_curpollutant-idt_startdatetime+idt_enddatetime,2NDCNTL CO GRP E F-+,ii_log_file Puof_choose_group_activitiesP4 E F E F 0 L t DAT*|          , P X ` h p  $1%1611R1z $%1z<$T$l$,Po,O8111dt$68|0$5$5,DAT*$,) 8 1$$,0q,P81181d81$1%$1%vzH16b #%&'*,-./4"8:?BDEIKRSTW(^8`vbzdV ll_rcll_ill_controlridls_controleffunitld_controlefficiencysqlcaDAT*w_emiss! 3 H@N@p il_controlridEEidt_startdatetime$(+idt_enddatetimeD,is_curpollutant\-\-CNTL EFF GRPd(+D,ii_log_filePuof_choose_group_activitiesP(+D,EE  < T l t       DAT*  n R -1<}1<l-8z%8H01X 1<X d8l0-  ,$M )8} 1<-1! 80 1<,$$6%@%83! 88z%M2(@(8z(8z&A@A81 1<f 1DAT*<L 8 8Bz%8z&M2(@(8z(8z&A@A8 1 1<: 1<,P$X$6%@%83`!& 8p8z%-(@(8z(8z&8z&8z&A@A81 -Gi 655  )8 } 1<4 80 1<,$$6DAT*%@%83!  8 8Iz%A@A81 1< 1< 8b8z%M2(@(8z(8z&A@A8 1-8-G- 81-  -8l ,$M )8}~ 1} 1<-1!l 1} 1<,$DAT*$6%@%83!& 88z%A@A8-8z%8(z&- z&8Bz&1  1< 1< 8 8Dz%M2(@(8z(8z&A@A8 1  1< 1<,\$d$6%@%83l! 8|-(@(8z'8z&8z&8z&A@A81DAT*  -Gi 655  )8 } 1< 80 1<,$$6%@%83! 8 8z%A@A8-8z%8(z&- z&8Bz&1  1<  1<l  8b8z%M2(@(8z(8z&A@A8 1 -8(z%- z&8z&- z&8Bz&DAT*X - 8 -8z%8(z&- z&8Bz&1X -8(z%- z&8z&- z&8Bz&1 0FXh!"#f&')*.L/R0b2z38&:6;:?BCDG I0KHL\OPQRSWX^`a0chdlg~ijko&qXrhtuxyz|}^(:  l r  DAT* X d pi_loop_numpd_source_processpl_target_processps_pollutantpd_start_date_timepd_end_date_timeps_cntl_co_typeps_controlps_filterps_cd1_codeps_cd2_codepi_log_filept_trans_objectli_ret_statusli_loop_mod2w_emiss@> &8 E X i y    DAT* @ IsNull(control_1_device_code) AND IsNull(control_2_device_code)uncontrolledil_perfcountRUIcontrolleduo_tlw5;uof_downstream_processl2NOT FOUNDem_log_detail13textsql no downstream process exists for process SQL ERROR: retrieving downstream process for 13t Multiple down streams for Don't know which oneDAT* to work with.This feature not supported for Betauof_control_device_codeG13t No control device code found for first downstream processSQL ERROR: retrieving control device code for process 2NDw5;213 second downstream process does not exist.IsNull(control_2_device_code) AND control_1_device_code = ''process for process 13tMultiple down streams for GDAT*13tsecond downstream process' AND control_2_device_code = 'd     P X `       \ d l   j8"B188&z%z&8" oV,680)<81DAT*8D08^0@880)81t16+@+8,)8)81o W!"2%B(b)~*+,-/01263J4p5t679ACdr as_tablels_sqlls_typell_returnll_sqldbcodels_sqlerrorls_newsyntaxlds_dynamicla_nullla_datasqlca DAT*   *7 C P "\dl@( datastoretr"select * from syntaxfromsqld-Error - Invalid data typePlease enter the correct data typecreate[settransobjectretrieve<    N 1)881PDAT*)X8`$h$R818p08z0:)@@81$$S81<8p080:)@@811,Xf  0<d @ uoit_emiss_tran%uof_create_trans_objectD uoit_rid_tran@$D %%SQL Erroruo_emission::constructor(); errDAT*or on COMMIT for uoit_emiss_tran.@$@$uo_emission::constructor(); error on COMMIT for uoit_rid_tran. 8 P X ` h   $0$8$<@$H$\P$,'v1,'X$< \d ::message"'@#`8 uoit_emiss_tran%uoit_rid_tranns $%% $ $DAT* 0 8 @ H P X *$8*@X*`px$$$ |,Bd P dw_calc_priority!dw_activity,",dw_emis_factH#Hcontrolhc@!,"H# $8 @X `p x   0$0$DAT*H$d P dw_calc_priority!dw_activity$"dw_emis_fact8# 0 H AB"?#@123456789: ; < = > ?@ABCDEFGHIJKLMNOPQ R!S"T#U$V%W&X'Y(Z)[*\+],^-_.`/a0b1c2dDAT*3e4f5g6h7i8j9k:l;m<n=o>L"#2 { uof_abort_transuof_activity_valueuof_source_device_processuof_sql_erroruof_get_riduof_get_calc_protsuof_use_calc_protuof_begin_loguof_end_loguof_get_modesuof_use_mode_typeuof_get_pollutantsuof_get_spec_profileuof_pmuof_get_mass_fractionsuof_speciation_scc_amsuof_metricsuof_emissions_mainuof_uncont_poll_listuof_create_trans_objectuof_get_scc_at_streamuof_speciation_pollutant_listDAT*uof_control_device_codeuof_log_inputsuof_compare_factorsuof_activity_get_valueuof_activity_replaceuof_activity_insertuof_default_calc_successuof_unit_convertuof_default_parametersuof_choose_group_activitiesuof_activity_updateuof_cont_poll_listuof_control_emission_mainuof_activity_datauof_activity_retrieveuof_process_infouof_calc_mass_balanceuof_priority_listuof_increment_arrayuof_get_profile_codeuof_pollutant_listuof_build_poll_listuof_increment_array_intuof_get_throughput_DAT*materialsuof_increment_array_decuof_increment_array_struof_get_input_activity_valueuof_log_activity_valueuof_get_seasonal_adj_factoruof_calc_emission_factoruof_emiss_factoruof_constantuof_discard_factors_by_priorityuof_log_factorsuof_discard_factors_by_date_and_typeuof_get_process_infouof_get_controlsuof_check_control_efficienciesuof_calc_ef_set_cont_filterf_cleartablef_db_errorf_get_sequencef_speciation_value_typef_sqlcheck+constructor+destructor+create+destroyDAT* +ES_@r      ':Ourges_get}teodeuse_pi_polncDAT*"nt_proof_pol_i_matro_cod/sprofi@utuof_Wtad_wes uot_ma!nsetri"_modes#cs$%h&SRrans'())IMRS>*tio geQ+r(e,$ }-.utect /oufor 0t un.1ar$2DAT*RAPIDS Emission Background Status Windowforward global type w_emiss_status from window end type type sle_county from singlelineedit within w_emiss_status end type type st_1 from statictext within w_emiss_status end type type sle_material from singlelineedit within w_emiss_status end type type sle_process from singlelineedit within w_emiss_status end type type sle_device from singlelineedit within w_emiss_status end type type sle_source from singlelineedit within w_emiss_status end tyDAT* pe type st_material from statictext within w_emiss_status end type type st_process from statictext within w_emiss_status end type type st_device from statictext within w_emiss_status end type type st_source from statictext within w_emiss_status end type type cb_cancel from commandbutton within w_emiss_status end type end forward global type w_emiss_status from window integer x = 462 integer y = 496 integer width = 1998 integer height = 920 boolean titlebar = true string title =DAT*  "Emission Estimator Status" boolean controlmenu = true windowtype windowtype = popup! long backcolor = 67108864 sle_county sle_county st_1 st_1 sle_material sle_material sle_process sle_process sle_device sle_device sle_source sle_source st_material st_material st_process st_process st_device st_device st_source st_source cb_cancel cb_cancel end type global w_emiss_status w_emiss_status on w_emiss_status.create this.sle_county=create sle_county this.st_1=create st_1 this.sleDAT*_material=create sle_material this.sle_process=create sle_process this.sle_device=create sle_device this.sle_source=create sle_source this.st_material=create st_material this.st_process=create st_process this.st_device=create st_device this.st_source=create st_source this.cb_cancel=create cb_cancel this.Control[]={this.sle_county,& this.st_1,& this.sle_material,& this.sle_process,& this.sle_device,& this.sle_source,& this.st_material,& this.st_process,& this.st_device,& this.st_sDAT*ource,& this.cb_cancel} end on on w_emiss_status.destroy destroy(this.sle_county) destroy(this.st_1) destroy(this.sle_material) destroy(this.sle_process) destroy(this.sle_device) destroy(this.sle_source) destroy(this.st_material) destroy(this.st_process) destroy(this.st_device) destroy(this.st_source) destroy(this.cb_cancel) end on type sle_county from singlelineedit within w_emiss_status integer x = 613 integer y = 64 integer width = 1317 integer height = 88 integer taborDAT*der = 10 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean autohscroll = false boolean displayonly = true borderstyle borderstyle = stylelowered! end type type st_1 from statictext within w_emiss_status integer x = 352 integer y = 80 integer width = 233 integer height = 72 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamiDAT*ly fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "County:" alignment alignment = right! boolean focusrectangle = false end type type sle_material from singlelineedit within w_emiss_status integer x = 613 integer y = 544 integer width = 1317 integer height = 88 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = DAT*"MS Sans Serif" long textcolor = 33554432 boolean autohscroll = false boolean displayonly = true borderstyle borderstyle = stylelowered! end type type sle_process from singlelineedit within w_emiss_status integer x = 613 integer y = 424 integer width = 1317 integer height = 88 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean autohscroll = false boolean diDAT*splayonly = true borderstyle borderstyle = stylelowered! end type type sle_device from singlelineedit within w_emiss_status integer x = 613 integer y = 304 integer width = 1317 integer height = 88 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean autohscroll = false boolean displayonly = true borderstyle borderstyle = stylelowered! end type type sle_sourDAT*ce from singlelineedit within w_emiss_status integer x = 613 integer y = 184 integer width = 1317 integer height = 88 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean autohscroll = false boolean displayonly = true borderstyle borderstyle = stylelowered! end type type st_material from statictext within w_emiss_status integer x = 352 integer y = 552 integerDAT* width = 233 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 = "Material:" alignment alignment = right! boolean focusrectangle = false end type type st_process from statictext within w_emiss_status integer x = 27 integer y = 432 integer width = 558 integer height = 80 integer textsDAT*ize = -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 = "Process (ID / Name):" alignment alignment = right! boolean focusrectangle = false end type type st_device from statictext within w_emiss_status integer x = 27 integer y = 312 integer width = 558 integer height = 72 integer textsize = -8 integer weight = 700 fontpiDAT* tch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Device (ID / Name):" alignment alignment = right! boolean focusrectangle = false end type type st_source from statictext within w_emiss_status integer x = 27 integer y = 200 integer width = 558 integer height = 72 integer textsize = -8 integer weight = 700 fontpitch fontpitch = variable! fontfamily fDAT*ontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 8388608 long backcolor = 67108864 boolean enabled = false string text = "Source (ID / Name):" alignment alignment = right! boolean focusrectangle = false end type type cb_cancel from commandbutton within w_emiss_status integer x = 887 integer y = 672 integer width = 329 integer height = 112 integer taborder = 20 integer textsize = -10 integer weight = 700 fontpitch fontpitch = variable! fontfamily fontfamily DAT*$3end_d34s_rencD5inlepQ6io_nex7ri_lq8f_9emis:;cooll_<retran=l_ess_>ps_sesnum_f_scc_.#.#fii_nuF$pans_F$uof_F$_ptantF$nt_typF$roviceF$efeynF$log_F$ru+deF$nDAT*&dF$F$_rtF$_rp_reF$F$*Q?_seridF$v_raF$ourid^@`jAFrB2  widthheightbackcolortabtextcolordw_calc_prioritydw_activitydw_emis_factuoit_rid_tranuoit_emiss_tranis_denom_materialis_numer_materialib_protocol_retrievedii_num_protocolsgd_total_fug_emissionidt_startdatetimeidt_enddatetimeis_curpollutantDAT*(is_curcalcmethodis_speciationvaluetypeii_firststandardprofileil_curnationridil_curstateridil_curcountyridil_cursourceridil_curdeviceridil_curprocessridis_curnationnameis_curstatenameis_curcountynameis_cursourceidis_cursourcenameis_curdeviceidis_curdevicenameis_curprocessidis_curprocessnameis_cursiccodeis_curscccodein_curseasonaladjfactorib_controlsretrievedib_controlsbypollutantil_controlrid@is_controlcode@ii_usedspecthruputsis_usedspecthruputsDAT**il_perfcount , = I Vdt>/sGraWrfDAT*.levingbagoroleri)es;IWhos pl/ p/ta w/pe] o DAT*na_null else ls_newsyntax = SQLCA.syntaxFromSQL(ls_sql, "", ls_sqlError) if len(ls_sqlError) > 0 then messagebox('Error - Invalid data type', 'Please enter the correct data type') //signalerror(-1, ls_sqlerror) else ls_sqlError = "" lds_dynamic.create(ls_newsyntax, ls_sqlError) if len(ls_sqlError) > 0 then signalerror(-1, ls_sqlerror) else lds_dynamic.settransobject(SQLCA) ll_return = lds_dynamic.retrieve() if ll_return > 0 then else enDAT*0 @@@1    @     >hpDAT*23331F<$2@x345 46QpL7cx8q94: DAT*4p; 0< J|L= l> ?H@\A 0B,C\DD DAT*6pEd F(GH+II8,J<KbL Ma@ N X ODAT*8 P H P Q h p R!! S"" < T##  \U$$ @ V%% HW&& PX'' Y((k DAT*:$Z))  H[**8 \++ t ],, t^--  _..`//Va00 Xb11 tc22d33DAT*< `e44 f55 g66+h77gi88wj99k::l;;m<<n== DAT*>o>>"Q?L!#T@-UA5VB2  2 - xywidthheighttaborderdataobjectx%  "] o% DAT*@ @ @ @ 2  2 " xywidthheighttaborderd%  ] o%  @  DAT*B@ @ 2  2 - xywidthheighttaborderdataobjectx%   "] o%    @ @ @ DAT*D2  2 Y throughput_materialthroughput_amtfractiondensitytransfer_effthroughput_unitx  + 4 < I       2  2 " codeamtmetric_codeunitP        2  DAT*F 2 % material_codeamtunitfoundP      2  2 + material_codevalue_amtunitfoundP   %   2  2 material_codeamtfound<  DAT*  DAT*Jstylestructuremailrecipientenvironmentmailfiledescriptionmailmessagedatawindowchildlistviewitemtreeviewitemconnectioninfopowerobjectuo_emissionuo_emisuo_emission`dw_calc_priorityuo_emission`dw_activityuo_emission`dw_emis_facttransactionuo_emission`uost_mass_baluo_emission`uost_input_materialuo_emission`uost_densityuo_emission`uost_xfer_effuo_emission`uost_mass_fractionw_emisspointerw_emiss_statusmessagel@DAT*L(@4@A@M@W@e@q@ @ @ @ @ @@@. 8@D^,~ s_g! @DAT*N@!@<@         @5 (!pe J!     ,$($::F@@8T:F@@8}--DAT*P< 6:T`xdx pl_source_ridpt_src_trans_objectpi_log_filepl_source_listpi_num_sourcew_emissll_ridli_cntH *H6-Tb@jq0 cbx_background6>checked  ( ,$($::F@@8T:DAT*RF@@8-\-0$1-11}-8$1d1}1-@$1G.1}1-H$1-P$8X!1}11}16:TX\j !"# $%*'d(v)*+.dJ pl_src_pDAT*Trocess_ridpt_trans_objectpl_target_processw_emissnindd +=@Ez8 cbx_background6>checked  Select returned more than one row ( 0 8 @ H P ,$($::F@@8T:F@@8--0$11<DAT*V1}1}1}  6 :TX\j d9 pl_process_ridpt_trans_objectw_emissncntnindd '@/48 cbx_background6>checked  ( 0  ,$($::F@@8T:F@@8-DAT*X-0$1111  6 :TX\jd8 pl_process_ridpt_proc_trans_objw_emissll_cntP )@18 cbx_background6>checked  ( 0  ,$($::F@@8T:F@@8-DDAT*Z-0$1111  6 :TX\jd: pl_device_ridpt_proc_trans_objectw_emissll_cntP +@38 cbx_background6>checked  ( 0 ,$($::F@@8T:F@@81}DAT*v1}1d 11d}<$)T8}1<1\)t81<8,|$$#8080@81<&80A@A888 z%(@(8z(A@A880A@A81}1}XDAT*^Displays a .txt file; opened by f_display_file function.forward global type w_file_display from Window end type type cb_print from commandbutton within w_file_display end type type st_name from statictext within w_file_display end type type dw_displayfile from datawindow within w_file_display end type type cb_exit from commandbutton within w_file_display end type type st_filename from statictext within w_file_display end type end forward global type w_file_display from Window int DAT*`X=23 int Y=24 int Width=2894 int Height=1708 boolean TitleBar=true string Title="File Display" long BackColor=79741120 boolean ControlMenu=true boolean MinBox=true boolean MaxBox=true boolean Resizable=true WindowType WindowType=popup! cb_print cb_print st_name st_name dw_displayfile dw_displayfile cb_exit cb_exit st_filename st_filename end type global w_file_display w_file_display event open;///////////////////////////////////////////////////////////////////////// // // EvDAT*bent : w_file_display.open // // Purpose: // This event gets the filename from the parameter and // imports the file into dw_1. If an error occurs, the user // is notified via a messagebox and this window is closed. // The window is "opened" from public function f_file_display. // // Log: // // DATE NAME REVISION //------ ------------------------------------------------------------- // Powersoft Corporation INITIAL VERSION // ////////////////////////////////////DAT*d///////////////////////////////////// long ll_result string ls_msg st_filename.text = message.stringparm ll_result = dw_displayfile.importfile(st_filename.text) if ll_result < 0 then choose case ll_result case -3 ls_msg = "Invalid argument" case -4 ls_msg = "Invalid input" case -5 ls_msg = "Could not open the file" case -6 ls_msg = "Could not close the file" case -7 ls_msg = "Error reading the file" case -8 ls_msg = "Not a .TXT file" DAT*fcase else ls_msg = string(ll_result, "0")+ " Unknown error" end choose messagebox("File Display Error", ls_msg) close(this) end if end event on w_file_display.create this.cb_print=create cb_print this.st_name=create st_name this.dw_displayfile=create dw_displayfile this.cb_exit=create cb_exit this.st_filename=create st_filename this.Control[]={this.cb_print,& this.st_name,& this.dw_displayfile,& this.cb_exit,& this.st_filename} end on on w_file_display.destroy destroyDAT*h(this.cb_print) destroy(this.st_name) destroy(this.dw_displayfile) destroy(this.cb_exit) destroy(this.st_filename) end on event resize;///////////////////////////////////////////////////////////////////////// // // Event : w_file_display.resize // // Purpose: // Resizes the Datawindow based on the new size of the window // Log: // // DATE NAME REVISION //------ ------------------------------------------------------------- // Powersoft Corporation INITIAL VERSION // /DAT*j//////////////////////////////////////////////////////////////////////// //mdy integer li_change integer li_dwWidth integer li_stWidth //grab the dw width before resize - mdy li_dwWidth = dw_displayFile.width //original resize dw line resize(dw_displayfile, WorkSpaceWidth( this) - dw_displayfile.x, WorkSpaceHeight( this) - dw_displayfile.y) //mdy //get the width change li_change = dw_displayFile.width - li_dwWidth //determine the st width li_stWidth = st_fileName.width + liDAT*l_change //change the width of the st if li_stWidth > 0 then st_fileName.width = li_stWidth end if end event type cb_print from commandbutton within w_file_display int X=274 int Y=16 int Width=219 int Height=80 int TabOrder=20 string Text="&Print" int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type on clicked;//////////////////////////////////////////////////////DAT*n/////////////////// // // Event : w_file_display.cb_print.clicked! // // Purpose: // This event calls public function f_print_file to handle // printing the currently displayed file. // Log: // // DATE NAME REVISION //------ ------------------------------------------------------------- // Powersoft Corporation INITIAL VERSION // ///////////////////////////////////////////////////////////////////////// f_print_file(st_filename.text) return end on type st_name fromDAT*p statictext within w_file_display int X=549 int Y=16 int Width=293 int Height=80 string Text="File Name: " Alignment Alignment=Center! long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type dw_displayfile from datawindow within w_file_display int X=18 int Y=112 int Width=2798 int Height=1456 int TabOrder=30 string DataObject="d_file_display" DAT*r BorderStyle BorderStyle=StyleLowered! boolean HScrollBar=true boolean VScrollBar=true end type type cb_exit from commandbutton within w_file_display int X=18 int Y=16 int Width=224 int Height=84 int TabOrder=10 string Text="E&xit" boolean Default=true int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type on clicked;//////////////////////////////////////////////////////DAT*t/////////////////// // // Event : w_file_display.cb_exit.clicked! // // Purpose: // This event closes window w_file_display. // Log: // // DATE NAME REVISION //------ ------------------------------------------------------------- // Powersoft Corporation INITIAL VERSION // ///////////////////////////////////////////////////////////////////////// close(parent) end on type st_filename from statictext within w_file_display int X=841 int Y=16 int Width=1975 int Height=DAT*80 boolean Border=true BorderStyle BorderStyle=StyleLowered! string Text="c:\whatever" long BackColor=79741120 int TextSize=-10 int Weight=400 string FaceName="Arial" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type DAT*x55<=666    )  8}1<1<1N1<@1}1<v8(0A@A86:%T&f'x(-./47F8d:;<>@&G8KfRSTXZ\@]T`vdS pd_start_datepd_end_datepl_source_ridps_referenceps_ini_fileDAT*zps_ini_sectionpi_log_filepi_num_calc_protsps_calc_prots pi_num_modesps_modes pi_num_pollutantsps_pollutants w_emissli_dev_ctrli_num_devicell_device_listli_return_statusli_dev_ubls_source_namels_source_id  "0 = I Xdv-DAT*|--@--7 F qH cbx_background6>checked itr_source0%uof_source_name8D0%uof_device_list<d6> Emission EstimatorNo devices found for given sourceError: No devices found for given sourceEnding emission estimation for source DAT*~uof_device7 ====================================================================== ( < T \ t |     .,$($::F@@8T:F@@81}1}12 112},@$8H,`$t$)8}1<1)DAT*81<`,$$#8080@81<N80A@A888<z%(@(8z(A@A88D0A@A81}1}<=H)h8}1<p$8P08,$,$1DAT*1!")8}1<,1<8080@8, 1()@81<P$55Gi666    )l8}1<1,t|)8}1DAT*<8088z%(@(8z(@81<$8P081v1<1}6:$T%f&x',-./58n9;<=?,ANE`FHIJLOVPQRSUXY8_acefg0iklnqrdR pd_start_datepd_end_datepl_device_ridps_referenceps_ini_filDAT*eps_ini_sectionpi_log_filepi_num_calc_protsps_calc_prots pi_num_modesps_modes pi_num_pollutantsps_pollutants w_emissli_indll_next_processll_curr_processli_proc_ctrli_num_processll_process_listh li_pro_ub<  "0 = I Xdv-DAT*--@<*-H cbx_background6>checked is_start_level@0SDeviceil_source_ridOZitr_deviceh$uof_source_name8|h$uof_process_list=6> Emission EstimatorNo process found for deviceError: No processes for giveDAT*n deviceEnding emission estimation for device h$uof_downstream_process 2Ph$il_uncontrolled_process_ridxcxch$uof_orig_process3il_orig_process_ridTErrorFunction uof_orig_process failedil_prev_process_rid Vh$uof_process_grp40uo_emisH!uof_emissions_mainBX Vh$2PProcess has more than one downstream process - h$ ( @ ` t    DAT*  H h p        ( @ P l t |   ^$1d$, $0$#8808K8Yz%(@(8z(:)@:@@8-1<-8t8z%(@(8z(A@A88080$1$80-DAT*)818080-1<-80A@A8-83@3$8 0)@)8z'8z&@$80)@)8z(A@A8-8$z%89z&z&A@A8,<$D$H,X$h8pz%z&,$80,$801DAT*   4R >l |"#%&,-/2v4567":Hde pl_source_ridpi_log_filept_trans_objectls_source_namels_source_idw_emissw_emiss_status" 2 A N@@V@p cbx_background6>checked(Emission EstimatorSource record not found for sourceDAT*_rid Source record not found for source_rid uo_emis!uof_source: name selectuof_sql_error4 SOURCE BEGIN - Date/Time: mmm dd, yyyyh:mm:ss am/pm Source ID/Name: /6>(sle_source L/ text ` / sle_device t.`sle_process-`  0    < D X h     H ,$($::F@@8T:F@DAT*@81d 1<$#L$-T)t81<1,$$$1l$80-$)8$1-1<-80A@A8-8,$z%A@A8|$ $$$1,$840-HDAT*$)P8X$|$1 |$ `$h$1d,p$x$#28088z%,$z&:)@:@@8-1<-8,$z%A@A8-8,$z%A@A8-80A@A81$$$1n,$840-H$)PDAT*8X$|$11}`$h$1<   |$ p$x$1d$$1$80-$)8$|$112)8$$$1d$80DAT*-$)8$$1|$ 1}  H55 <6  )8  8 }1<2HD1}-1<-80A@A8-8@,`$z%A@A86:"T)l*,:<=>@AND\HlIJNOQRNS\DAT*Vt[\^_b2cFevgklno4pBsZtjunx{(^lFTd|*.2DH\~d3 pd_start_datepd_end_datepl_state_ridps_referencepi_log_filepi_num_calc_protsps_calc_prots pi_num_modesps_modesew pi_num_pollutantsps_pollutants w_emissll_county_ridli_loopli_num_countiesli_ret_statusll_county_ridsli_cnty_DAT*ubcounty_curh|  "/ <HhZ-t--@-d'>h cbx_background6>checked itr_state0#DAT*Xuo_emisD!0#uof_create_trans_objectD\0#is_state_name_0#0#D!uof_state()0#uof_sql_error40# Beginning estimation for state: _0#D!uof_state(): openH0#40#0#6> Emission EstimatorNo counties found for state: ,_Error: No counties found for state: _Ending emission estimation for state: _0#D!uofDAT*forward global type w_growth from Window end type type rb_append from radiobutton within w_growth end type type rb_overwrite from radiobutton within w_growth end type type cb_view from commandbutton within w_growth end type type sle_log_file_name from singlelineedit within w_growth end type type cb_browse from commandbutton within w_growth end type type uo_ss from u_class_ss_client within w_growth end type type st_merge_mode_t from statictext within w_growth end type type st_overwDAT*rite_mode_t from statictext within w_growth end type type rb_delete_mode from radiobutton within w_growth end type type rb_merge_mode from radiobutton within w_growth end type type cb_close from commandbutton within w_growth end type type cb_calculate from commandbutton within w_growth end type type st_status from statictext within w_growth end type type st_factor_count from statictext within w_growth end type type st_output_count from statictext within w_growth end type type st_ouDAT*tput_activity_count_t from statictext within w_growth end type type st_input_count_t from statictext within w_growth end type type st_input_count from statictext within w_growth end type type gb_log_file from groupbox within w_growth end type type gb_status from groupbox within w_growth end type type st_factor_count_t from statictext within w_growth end type type gb_growth_parameters from groupbox within w_growth end type type dw_growth_parameters from datawindow within w_growth endDAT* type type gb_merge_mode from groupbox within w_growth end type end forward global type w_growth from Window int X=329 int Y=552 int Width=3026 int Height=1396 boolean TitleBar=true string Title="Emission Estimates Growth" long BackColor=79741120 boolean ControlMenu=true boolean MinBox=true boolean MaxBox=true string Icon="EMISS.ICO" rb_append rb_append rb_overwrite rb_overwrite cb_view cb_view sle_log_file_name sle_log_file_name cb_browse cb_browse uo_ss uo_ss st_merge_modDAT*e_t st_merge_mode_t st_overwrite_mode_t st_overwrite_mode_t rb_delete_mode rb_delete_mode rb_merge_mode rb_merge_mode cb_close cb_close cb_calculate cb_calculate st_status st_status st_factor_count st_factor_count st_output_count st_output_count st_output_activity_count_t st_output_activity_count_t st_input_count_t st_input_count_t st_input_count st_input_count gb_log_file gb_log_file gb_status gb_status st_factor_count_t st_factor_count_t gb_growth_parameters gb_growth_parameters DAT*dw_growth_parameters dw_growth_parameters gb_merge_mode gb_merge_mode end type global w_growth w_growth type variables string is_inputReferenceCode string is_outputReferenceCode boolean ib_updateMode = TRUE //true for update output //false for delete output long il_stateRid, il_stateRidLast long il_countyRid, il_countyRidLast string is_sccCode, is_sccCodeLast string is_materialCode, is_materialCodeLast integer ii_baseYear, ii_baDAT*seYearLast integer ii_projectedYear, ii_projectedYearLast long il_inputActivityCount long il_growthFactorCount long il_outputActivityCount u_ds_base ids_activity //records to be grown u_ds_base ids_factor //growth factors u_ds_base ids_output //output of grown activities string is_logFilePathName = "" string is_logFileName = "" integer ii_logFileHandle = -1 boolean ib_appendMode = TRUE boolean ib_calculating = FALSE boolean ib_cancel = FALSE end variables forward prototyDAT*pes public function integer of_setdata () public function integer of_retrieveinput () public function integer of_retrievefactors () public function integer of_retrieveoutput () public function integer of_calculate () public subroutine of_setstatus (string as_status) public subroutine of_setstatus () public function integer of_openlogfile () public function integer of_closelogfile () public function integer of_writelogmessage (string as_message, integer ai_linesbefore, integer ai_linesaftDAT*er, integer ai_timestamp) public function integer of_writelogmessage (string as_message) end prototypes public function integer of_setdata (); //set the instance variables and the data sources for the growth operation //make sure source criteria have been selected if not uo_ss.of_hasData() then messageBox("Data Required", "Please select Source Criteria.", none!) uo_ss.cb_source_selector.setFocus() return 0 end if //make sure input parameters are set and initialize //parameDAT*ter instance variables ii_baseYear = dw_growth_parameters.getItemNumber(1, "base_year") if isNull(ii_baseYear) then messageBox("Data Required", "Please select Base Year.", none!) dw_growth_parameters.setFocus() dw_growth_parameters.setColumn("base_year") ii_baseYear = 0 return 0 end if ii_projectedYear = dw_growth_parameters.getItemNumber(1, "projected_year") if isNull(ii_projectedYear) then messageBox("Data Required", "Please select Projected Year.", none!) dw_growth_parameteDAT*rs.setFocus() dw_growth_parameters.setColumn("projected_year") ii_projectedYear = 0 return 0 end if is_inputReferenceCode = trim(dw_growth_parameters.getItemString(1, "input_reference")) if is_inputReferenceCode = "" or isNull(is_inputReferenceCode) then messageBox("Data Required", "Please select Input Data Reference Code.", none!) dw_growth_parameters.setFocus() dw_growth_parameters.setColumn("input_reference") is_inputReferenceCode = "" return 0 end if is_outputReferenceDAT*Code = trim(dw_growth_parameters.getItemString(1, "output_reference")) if is_outputReferenceCode = "" or isNull(is_outputReferenceCode) then messageBox("Data Required", "Please select Output Data Reference Code.", none!) dw_growth_parameters.setFocus() dw_growth_parameters.setColumn("output_reference") is_outputReferenceCode = "" return 0 end if //make sure input and output reference codes are different if is_outputReferenceCode = is_inputReferenceCode then messageBox("Data ConflDAT*ict", "The Output Data Reference Code must be different " +& "than the Input Data Reference Code.", exclamation!) dw_growth_parameters.setFocus() dw_growth_parameters.setColumn("output_reference") is_inputReferenceCode = "" is_outputReferenceCode = "" return 0 end if //make sure log file name has been specified if isNull(sle_log_file_name.text) or sle_log_file_name.text = "" then messageBox("Data Required", "Please enter Log File name.", none!) sle_log_file_name.setFocus() DAT* is_logFilePathName = "" is_logFileName = "" return 0 else //make sure is_logFilePathName is set if upper(sle_log_file_name.text) <> upper(is_logFilePathName) then is_logFilePathName = sle_log_file_name.text is_logFileName = sle_log_file_name.text end if end if //initialize datastores ids_activity.dataObject = "d_growth_activity_select" ids_factor.dataObject = "d_growth_factor_select" ids_output.dataObject = "d_growth_output_select" ids_activity.setTransObject(sqlcaDAT*) ids_factor.setTransObject(sqlca) ids_output.setTransObject(sqlca) ids_activity.reset() ids_factor.reset() ids_output.reset() //initialize data counters il_inputActivityCount = 0 il_outputActivityCount = 0 il_growthFactorCount = 0 st_input_count.text = string(il_inputActivityCount) st_output_count.text = string(il_outputActivityCount) st_factor_count.text = string(il_growthFactorCount) return 1 end function public function integer of_retrieveinput (); //retrieve the iDAT*nput activity data long ll_rc datetime ldt_startDateTime datetime ldt_endDateTime string ls_messageText setPointer(hourGlass!) //use base year to create start and end dates for activity retrieval ldt_startDateTime = datetime(date(string(ii_baseYear) + "/01/01")) ldt_endDateTime = datetime(date(string(ii_baseYear) + "/12/31")) //update the SQL for ids_activity to reflect source selection criteria ll_rc = uo_ss.iclass_group.of_modObjectSQL(ids_activity) if ll_rc < 0 then ls_messDAT*ageText = "w_growth::of_retrieveInput(); " +& "call to uo_ss.iclass_group.of_modObjectSQL() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return -1 elseif ll_rc = 0 then ls_messageText = "No source group criteria data was " +& "added to ids_activity SQL." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return 0 end if //retrieve theDAT* input activities il_inputActivityCount = ids_activity.retrieve( & ldt_startDateTime, & ldt_endDateTime, & is_inputReferenceCode, & uo_ss.iclass_group.il_nationArray, & uo_ss.iclass_group.il_stateArray, & uo_ss.iclass_group.il_countyArray, & uo_ss.iclass_group.il_sourceArray, & uo_ss.iclass_group.il_sourceSub1Array, & uo_ss.iclass_group.il_sourceSub2Array) if il_inputActivityCount < 0 then ls_messageText = "w_growth::of_retrieveInput(); retrieve() failed." DAT* this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return -1 elseif il_inputActivityCount = 0 then ls_messageText = "No activity data found matching: " +& "~r~n Base Year = " + string(ii_baseYear) +& "~r~n Reference Code = " + is_inputReferenceCode this.of_writeLogMessage("No Input Data: " + ls_messageText, 1, 1, 0) messageBox("No Input Data", ls_messageText, information!) return 0 end if return il_inputAcDAT*tivityCount end function public function integer of_retrievefactors (); //retrieve growth factors for input data string ls_messageText setPointer(hourGlass!) //if none of the growth factor selection parameters have changed, //then don't do anything if il_stateRid = il_stateRidLast and & il_countyRid = il_countyRidLast and & is_sccCode = is_sccCodeLast and & is_materialCode = is_materialCodeLast and & ii_baseYear = ii_baseYearLast and & ii_projectedYear = ii_projeDAT*ctedYearLast then return 0 end if //retrieve the growth factors for the current input activity il_growthFactorCount = ids_factor.retrieve(il_stateRid, il_countyRid, & is_sccCode, is_materialCode, ii_baseYear, ii_projectedYear) if il_growthFactorCount < 0 then ls_messageText = "w_growth::of_retrieveFactors(); retrieve() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return -1 end if il_stateRidLDAT*ast = il_stateRid il_countyRidLast = il_countyRid is_sccCodeLast = is_sccCode is_materialCodeLast = is_materialCode ii_baseYearLast = ii_baseYear ii_projectedYearLast = ii_projectedYear return il_growthFactorCount end function public function integer of_retrieveoutput (); //retrieve output data for merge/update option long ll_rc datetime ldt_startDateTime datetime ldt_endDateTime string ls_messageText setPointer(hourGlass!) //use projected year to create start and end daDAT*tes for activity retrieval ldt_startDateTime = datetime(date(string(ii_projectedYear) + "/01/01")) ldt_endDateTime = datetime(date(string(ii_projectedYear) + "/12/31")) //update the SQL for ids_output to reflect source selection criteria ll_rc = uo_ss.iclass_group.of_modObjectSQL(ids_output) if ll_rc < 0 then ls_messageText = "w_growth::of_retrieveOutput(); " +& "call to uo_ss.iclass_group.of_modObjectSQL() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) meDAT*ssageBox("Error", ls_messageText, exclamation!) return -1 elseif ll_rc = 0 then ls_messageText = "No source group criteria data was " +& "added to ids_output SQL." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return 0 end if //retrieve the output activities il_outputActivityCount = ids_output.retrieve( & ldt_startDateTime, & ldt_endDateTime, & is_outputReferenceCode, & uo_ss.iclass_group.il_natiDAT*onArray, & uo_ss.iclass_group.il_stateArray, & uo_ss.iclass_group.il_countyArray, & uo_ss.iclass_group.il_sourceArray, & uo_ss.iclass_group.il_sourceSub1Array, & uo_ss.iclass_group.il_sourceSub2Array) if il_outputActivityCount < 0 then ls_messageText = "w_growth::of_retrieveOutput(); retrieve() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) return -1 end if return il_outputActivityCount end DAT*function public function integer of_calculate (); //growth calculation main function long ll_rc long ll_row long ll_outputRowcount long ll_outputRid long ll_activityRefRid string ls_searchString double ln_activityValue double ln_growthFactor double ln_newValue date ld_outputStartDate date ld_outputEndDate boolean lb_mergeUpdate string ls_metricCode string ls_dataCode string ls_valueUnitCode string ls_messageText long ll_factorsUsed = 0 long ll_recordsDeleted = 0 long ll_DAT*recordsInserted = 0 long ll_recordsUpdated = 0 //set the output start and end dates ld_outputStartDate = date(string(ii_projectedYear) + "/01/01") ld_outputEndDate = date(string(ii_projectedYear) + "/12/31") //start the log file this.of_writeLogMessage("BEGINNING GROWTH CALCULATIONS", 1, 1, 1) this.of_writeLogMessage("Input Parameters") this.of_writeLogMessage("-----------------") this.of_writeLogMessage("Base Year: " + string(ii_baseYear)) this.of_writeLogMessage("ProjeDAT*cted Year: " + string(ii_projectedYear)) this.of_writeLogMessage("Input Reference Code: " + is_inputReferenceCode) this.of_writeLogMessage("Output Reference Code: " + is_outputReferenceCode) if ib_updateMode then this.of_writeLogMessage("Data Generation: Update", 0, 1, 0) else this.of_writeLogMessage("Data Generation: Delete", 0, 1, 0) end if //retrieve the input activities if update mode was selected if ib_updateMode then setPointer(hourGlass!) this.of_DAT*setStatus("Retrieving Input Activity Data...") il_inputActivityCount = this.of_retrieveInput() if il_inputActivityCount < 0 then post close(this) return -1 elseif il_inputActivityCount = 0 then this.of_setStatus() return 0 end if //set the input record counter st_input_count.text = string(il_inputActivityCount) this.of_writeLogMessage("Input Activity Data: " + string(il_inputActivityCount) + " records retrieved.") //if user cancelled then just get out yieDAT*ld() if ib_cancel then return 0 end if //retrieve the output activities setPointer(hourGlass!) this.of_setStatus("Retrieving Output Activity Data...") il_outputActivityCount = this.of_retrieveOutput() if il_outputActivityCount < 0 then post close(this) return -1 end if //set the output record counter st_output_count.text = string(il_outputActivityCount) this.of_writeLogMessage("Output Activity Data: " + string(il_outputActivityCount) + " records retrieved.") //if usDAT*er cancelled then just get out yield() if ib_cancel then return 0 //if the update mode is turned off, then delete the current output data if not ib_updateMode then this.of_setStatus("Deleting Old Output Activity Data...") if il_outputActivityCount > 0 then this.of_writeLogMessage("Old output activity data will be deleted.") end if if ids_output.rowCount() > 0 then ll_rc = ids_output.rowsMove(1, ids_output.rowCount(), primary!, ids_output, 1, delete!) if ll_rc < 0 then lDAT*s_messageText = "dw_growth::of_calculate(); call to rowsMove() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) post close(this) return -1 end if end if ll_recordsDeleted = il_outputActivityCount il_outputActivityCount = 0 else if il_outputActivityCount > 0 then this.of_writeLogMessage("Old output activity data will be updated.") end if end if //if not in update mode, skip everything down tDAT*o the database update if ib_updateMode then //set the output record counter st_output_count.text = string(il_outputActivityCount) //retrieve the growth factors for each input activity //and calculate an output record setPointer(hourGlass!) this.of_setStatus("Calculating Growth...") this.of_writeLogMessage("Beginning Growth Calculations.", 1, 1, 0) for ll_row = 1 to ids_activity.rowCount() //if user cancelled then just get out yield() if ib_cancel then return 0 DAT* //grab the row-specific growth selection parameters and other data il_stateRid = ids_activity.getItemNumber(ll_row, "state_rid") il_countyRid = ids_activity.getItemNumber(ll_row, "county_rid") is_sccCode = ids_activity.getItemString(ll_row, "scc_code") is_materialCode = ids_activity.getItemString(ll_row, "material_code") ll_activityRefRid = ids_activity.getItemNumber(ll_row, "ref_rid") ln_activityValue = ids_activity.getItemNumber(ll_row, "value_amt") ls_metricCode = iDAT*ds_activity.getItemString(ll_row, "metric_code") ls_dataCode = ids_activity.getItemString(ll_row, "data_code") ls_valueUnitCode = ids_activity.getItemString(ll_row, "value_unit_code") //retrieve the growth factors for the current activity. //growth factors are already sorted with the user supplied //factors at the top, and the generic factors at the bottom. //no more than 2 factors should exist for the given parameters il_growthFactorCount = this.of_retrieveFactors() if DAT*il_growthFactorCount < 0 then post close(this) return -1 elseif il_growthFactorCount = 0 then if ids_factor.rowCount() = 0 then continue //move on to next activity end if elseif il_growthFactorCount > 2 then ls_messageText = "More than 2 growth factors were found for:" +& "~r~n SCC/AMS Code = " + is_sccCode +& "~r~n Material Code = " + is_materialCode +& "~r~n Base Year = " + string(ii_baseYear) +& "~r~n Projected Year = " + string(ii_projDAT*ectedYear) +& "~r~n State RID = " + string(il_stateRid) +& "~r~n County RID = " + string(il_countyRid) this.of_writeLogMessage("Growth Factor Error: " + ls_messageText, 1, 1, 0) messageBox("Growth Factor Error", ls_messageText, information!) continue //move on to next activity end if //increment the growth factor counter if il_growthFactorCount > 0 then st_factor_count.text = string(long(st_factor_count.text) + 1) ll_factorsUsed += 1 end if /DAT*/read the first factor record (highest priority) ln_growthFactor = ids_factor.getItemNumber(1, "growth_factor") if ln_growthFactor < 0 then ls_messageText = "w_growth::of_calculate(); call to getItemNumber() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) post close(this) return -1 end if //calculate the new value ln_newValue = ln_activityValue * ln_growthFactor //if the record geneDAT*ration mode is merge, then search for a match //in the output data set and update it. If no match is found, insert //a new output record. lb_mergeUpdate = FALSE if ib_updateMode then ls_searchString = "state_rid = " + string(il_stateRid) + " and " +& "county_rid = " + string(il_countyRid) + " and " +& "ref_rid = " + string(ll_activityRefRid) + " and " +& "scc_code = '" + is_sccCode + "' and " +& "material_code = '" + is_materialCode + "' and " +& "metrDAT*ic_code = '" + ls_metricCode + "' and " +& "data_code = '" + ls_dataCode + "' and " +& "value_unit_code = '" + ls_valueUnitCode + "'" ll_rc = ids_output.find(ls_searchString, 1, ids_output.rowCount()) if ll_rc < 0 then ls_messageText = "w_growth::of_calculate(); call to find() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) post close(this) return -1 elseif ll_rc > 0 then DAT* //update the existing record using the growth factor ids_output.setItem(ll_rc, "value_amt", ln_newValue) ids_output.setItem(ll_rc, "value", string(ln_newValue, "##.####")) ids_output.setItem(ll_rc, "reference_type", "GROWTH") ids_output.setItem(ll_rc, "creation_date_time", datetime(today(), now())) lb_mergeUpdate = TRUE ll_recordsUpdated += 1 end if end if //if the merge update flag is false, then add a new output row. //this flag will be falseDAT* whenever mergeMode is FALSE or if //if mergeMode is TRUE but no output record was updated. if not lb_mergeUpdate then //copy the current activity record to the output buffer ll_rc = ids_activity.RowsCopy(ll_row, ll_row, primary!, ids_output, & ids_output.rowCount() + 1, primary!) if ll_rc < 0 then ls_messageText = "w_growth::of_calculate(); call to rowsCopy() failed." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_DAT*messageText, exclamation!) post close(this) return -1 end if //apply the growth factor and give the new row a new rid, correct //start and end dates for the projected year, new reference code and //current date/time stamp il_outputActivityCount = ids_output.rowCount() ll_outputRid = f_get_sequence() if ll_outputRid < 0 then post close(this) return -1 end if ids_output.setItem(il_outputActivityCount, "rid", ll_outputRid) ids_output.seDAT*tItem(il_outputActivityCount, "start_date_time", datetime(ld_outputStartDate)) ids_output.setItem(il_outputActivityCount, "end_date_time", datetime(ld_outputEndDate)) ids_output.setItem(il_outputActivityCount, "reference_code", is_outputReferenceCode) ids_output.setItem(il_outputActivityCount, "value_amt", ln_newValue) ids_output.setItem(il_outputActivityCount, "value", string(ln_newValue, "##.####")) ids_output.setItem(il_outputActivityCount, "reference_type", "GROWTH") idDAT*s_output.setItem(il_outputActivityCount, "creation_date_time", & datetime(today(), now())) //increment the output record counter st_output_count.text = string(il_outputActivityCount) ll_recordsInserted += 1 end if next end if this.of_writeLogMessage("Updating the database.", 0, 1, 0) this.of_setStatus("Updating the database...") //update the output buffer and commit ll_rc = ids_output.update() if ll_rc < 0 then ls_messageText = "w_growth::of_calculDAT*ate(); ids_output.update() failed. " +& "No changes made to database." this.of_writeLogMessage("ERROR: " + ls_messageText, 1, 1, 0) messageBox("Error", ls_messageText, exclamation!) ROLLBACK USING SQLCA; post close(this) return -1 else COMMIT USING SQLCA; if f_sqlCheck(sqlca) < 0 then ROLLBACK USING SQLCA; post close(this) return -1 end if end if this.of_writeLogMessage("Growth Factors Applied: " + string(ll_factorsUsed)) this.of_writeLogMessage("Records DelDAT*eted: " + string(ll_recordsDeleted)) this.of_writeLogMessage("Records Updated: " + string(ll_recordsUpdated)) this.of_writeLogMessage("Records Inserted: " + string(ll_recordsInserted)) //end the log file this.of_writeLogMessage("COMPLETED GROWTH CALCULATIONS", 1, 1, 1) this.of_setStatus("Done") return 1 end function public subroutine of_setstatus (string as_status); //set the calculation status indicator st_status.text = as_status end subroutine public subroutine of_DAT*setstatus (); //default status indicator setting this.of_setStatus("Ready") end subroutine public function integer of_openlogfile (); //open the log file long ll_rc boolean lb_create = FALSE //close log file if already open this.of_closeLogFile() //see if log file already exists if not fileExists(is_logFilePathName) then lb_create = TRUE //use the append/overwrite flag to determine mode if ib_appendMode then //append mode ii_logFileHandle = fileOpen(is_logFilePathNDAT*ame, lineMode!, write!, & lockReadWrite!, append!) else //overwrite mode ii_logFileHandle = fileOpen(is_logFilePathName, lineMode!, write!, & lockReadWrite!, replace!) end if //handle a file open error if ii_logFileHandle < 0 then if lb_create then messageBox("Error", "File '" + upper(is_logFilePathName) +& "' could not be created. Please make sure " +& "the correct path and file name are specified.", exclamation!) sle_log_file_name.setFocusDAT*() else messageBox("Error", "File '" + upper(is_logFilePathName) +& "' could not be opened. The file may already be " +& "opened or locked by another user.", exclamation!) sle_log_file_name.setFocus() end if return -1 end if return 1 end function public function integer of_closelogfile (); long ll_rc //close the log file if it's open if ii_logFileHandle > 0 then ll_rc = fileClose(ii_logFileHandle) if ll_rc < 0 then messageBox("Error", "w_growthDAT*::of_closeLogFile(); file close failed.") return -1 end if ii_logFileHandle = -1 end if return 1 end function public function integer of_writelogmessage (string as_message, integer ai_linesbefore, integer ai_linesafter, integer ai_timestamp); //write a message to the log file // input: // as_message - message to be written // ai_linesBefore - number of blank lines before message // ai_linesAfter - number of blank lines after message // ai_timeStamp - >0 means inDAT*clude time stamp string ls_linesBefore = "" string ls_linesAfter = "" string ls_timeStamp = "" integer li_rc if ii_logFileHandle < 0 then messageBox("Error", "w_growth::of_writeLogMessage(); log file is not open.", exclamation!) return -1 end if for li_rc = 1 to ai_linesBefore ls_linesBefore = ls_linesBefore + "~r~n" next for li_rc = 1 to ai_linesAfter ls_linesAfter = ls_linesAfter + "~r~n" next if ai_timeStamp > 0 then ls_timeStamp = string(dateTime(today(), nDAT* ow()), "mm-dd-yy hh:mm:ss AM/PM") + ": " end if li_rc =fileWrite(ii_logFileHandle, ls_linesBefore + ls_timeStamp + as_message + ls_linesAfter) if li_rc < 0 then messageBox("Error", "w_growth::of_writeLogMessage(); call to fileWrite() failed.", exclamation!) return -1 end if return 1 end function public function integer of_writelogmessage (string as_message); //write a message to the log file //this is an overloaded function that takes only one argument // input: // as_messDAT* age - message to be written integer li_rc //call overloaded of_writeLogMessage with default values for //lines before, lines after and timestamp li_rc = this.of_writeLogMessage(as_message, 0, 0, 0) return li_rc end function on w_growth.create this.rb_append=create rb_append this.rb_overwrite=create rb_overwrite this.cb_view=create cb_view this.sle_log_file_name=create sle_log_file_name this.cb_browse=create cb_browse this.uo_ss=create uo_ss this.st_merge_mode_t=createDAT* st_merge_mode_t this.st_overwrite_mode_t=create st_overwrite_mode_t this.rb_delete_mode=create rb_delete_mode this.rb_merge_mode=create rb_merge_mode this.cb_close=create cb_close this.cb_calculate=create cb_calculate this.st_status=create st_status this.st_factor_count=create st_factor_count this.st_output_count=create st_output_count this.st_output_activity_count_t=create st_output_activity_count_t this.st_input_count_t=create st_input_count_t this.st_input_count=create st_input_counDAT*t this.gb_log_file=create gb_log_file this.gb_status=create gb_status this.st_factor_count_t=create st_factor_count_t this.gb_growth_parameters=create gb_growth_parameters this.dw_growth_parameters=create dw_growth_parameters this.gb_merge_mode=create gb_merge_mode this.Control[]={this.rb_append,& this.rb_overwrite,& this.cb_view,& this.sle_log_file_name,& this.cb_browse,& this.uo_ss,& this.st_merge_mode_t,& this.st_overwrite_mode_t,& this.rb_delete_mode,& this.rb_merge_mode,& thiDAT*s.cb_close,& this.cb_calculate,& this.st_status,& this.st_factor_count,& this.st_output_count,& this.st_output_activity_count_t,& this.st_input_count_t,& this.st_input_count,& this.gb_log_file,& this.gb_status,& this.st_factor_count_t,& this.gb_growth_parameters,& this.dw_growth_parameters,& this.gb_merge_mode} end on on w_growth.destroy destroy(this.rb_append) destroy(this.rb_overwrite) destroy(this.cb_view) destroy(this.sle_log_file_name) destroy(this.cb_browse) destroy(thDAT*is.uo_ss) destroy(this.st_merge_mode_t) destroy(this.st_overwrite_mode_t) destroy(this.rb_delete_mode) destroy(this.rb_merge_mode) destroy(this.cb_close) destroy(this.cb_calculate) destroy(this.st_status) destroy(this.st_factor_count) destroy(this.st_output_count) destroy(this.st_output_activity_count_t) destroy(this.st_input_count_t) destroy(this.st_input_count) destroy(this.gb_log_file) destroy(this.gb_status) destroy(this.st_factor_count_t) destroy(this.gb_growth_parameters) deDAT*stroy(this.dw_growth_parameters) destroy(this.gb_merge_mode) end on event open; //create datastore for activity data ids_activity = create u_ds_base if not isValid(ids_activity) then messageBox("Error", "w_growth::open(); ids_activity create failed.", exclamation!) post close(this) return -1 end if //create datastore for growth factors ids_factor = create u_ds_base if not isValid(ids_factor) then messageBox("Error", "w_growth::open(); ids_factor create failed.", exclamation!)DAT* post close(this) return -1 end if //create datastore for output activity records ids_output = create u_ds_base if not isValid(ids_output) then messageBox("Error", "w_growth::open(); ids_output create failed.", exclamation!) post close(this) return -1 end if end event event close; if isValid(ids_activity) then destroy ids_activity end if if isValid(ids_factor) then destroy ids_factor end if if isValid(ids_output) then destroy ids_output end if end evenDAT*t event closequery; //don't let the window close if calculating //w_growth::of_calculate() uses yield() to process events //asynchronously while calculations are running, so this code //is needed to prevent the window from being closed while //of_calculate is running if ib_calculating then return 1 end if return 0 end event type rb_append from radiobutton within w_growth int X=1847 int Y=640 int Width=293 int Height=96 int TabOrder=80 string Text="Append" BorderStyle DAT*BorderStyle=StyleLowered! boolean Checked=true boolean LeftText=true long TextColor=8388608 long BackColor=67108864 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; if this.checked then ib_appendMode = TRUE else ib_appendMode = FALSE end if return 1 end event type rb_overwrite from radiobutton within w_growth int X=1445 int Y=640 int Width=32DAT*9 int Height=96 int TabOrder=70 string Text="Overwrite" BorderStyle BorderStyle=StyleLowered! boolean LeftText=true long TextColor=8388608 long BackColor=67108864 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; if this.checked then ib_appendMode = FALSE else ib_appendMode = TRUE end if return 1 end event type cb_view from commandbutton withiDAT* n w_growth int X=2597 int Y=640 int Width=293 int Height=80 int TabOrder=90 string Text="View..." int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; long ll_rc string ls_filePathName string ls_fileName ls_filePathName = is_logFilePathName ls_fileName = is_logFileName //close the log file if it's open parent.of_closeLogFile() //allow the userDAT*" to select the file ll_rc = getFileOpenName("Select File to View", ls_filePathName, ls_fileName, "txt", & "Text Files (*.txt),*.txt, All Files (*.*),*.*") // Use PowerBuilder Application Library file viewer to view selected file if ll_rc = 1 then f_display_file(ls_filePathName) elseif ll_rc = -1 then messageBox("Error", "w_growth::cb_view::clicked(); " +& "call to getOpenFileName() Failed.", exclamation!) end if return 1 end event type sle_log_file_name from singleDAT*$lineedit within w_growth int X=1445 int Y=544 int Width=1134 int Height=80 int TabOrder=60 BorderStyle BorderStyle=StyleLowered! long TextColor=33554432 int TextSize=-10 int Weight=400 string FaceName="Arial" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event modified; //synchronize the displayed name and instance variable names is_logFilePathName = sle_log_file_name.text is_logFileName = sle_log_file_name.text return 1 DAT*& end event type cb_browse from commandbutton within w_growth int X=2597 int Y=544 int Width=293 int Height=80 int TabOrder=50 string Text="Browse..." int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; long ll_rc string ls_filePathName string ls_fileName ls_filePathName = is_logFilePathName ls_fileName = is_logFileName //open the file selectDAT*(ion dialogue box ll_rc = getFileSaveName("Select or Enter Log File Name", & ls_filePathName, ls_fileName, "txt", & "Text Files (*.txt),*.txt, All Files (*.*),*.*") if ll_rc < 0 then messageBox("Error", "w_growth.cb_browse::clicked(); " +& "call to getFileSaveName() failed.", exclamation!) return -1 elseif ll_rc = 0 then //user cancelled return 0 end if //synchronize the displayed name and instance variable names is_logFilePathName = ls_filePathName is_logFileName = DAT**ls_fileName sle_log_file_name.text = is_logFilePathName return 1 end event type uo_ss from u_class_ss_client within w_growth int X=37 int Y=48 int Width=1298 int Height=400 int TabOrder=10 boolean Border=true BorderStyle BorderStyle=StyleLowered! end type on uo_ss.destroy call u_class_ss_client::destroy end on type st_merge_mode_t from statictext within w_growth int X=1445 int Y=112 int Width=1243 int Height=128 boolean Enabled=false string Text="UPDATE data for curDAT*,rent Source Selection, Projected Year and Output Reference Code:" boolean FocusRectangle=false long TextColor=8388608 long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_overwrite_mode_t from statictext within w_growth int X=1445 int Y=272 int Width=1243 int Height=128 boolean Enabled=false string Text="DELETE data for current Source SelectDAT*.ion, Projected Year and Output Reference Code:" boolean FocusRectangle=false long TextColor=8388608 long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type rb_delete_mode from radiobutton within w_growth int X=2706 int Y=272 int Width=91 int Height=128 int TabOrder=40 boolean LeftText=true long TextColor=8388608 long BackColor=79741120 int TextDAT*0Size=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; if this.checked then ib_updateMode = FALSE else ib_updateMode = TRUE end if return 1 end event type rb_merge_mode from radiobutton within w_growth int X=2706 int Y=112 int Width=91 int Height=128 int TabOrder=30 boolean Checked=true boolean LeftText=true long BackColor=79741120 int TextSize=-10 int Weight=400 string FaceName="AriDAT*2al" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; if this.checked then ib_updateMode = TRUE else ib_updateMode = FALSE end if return 1 end event type cb_close from commandbutton within w_growth int X=2578 int Y=1152 int Width=347 int Height=96 int TabOrder=110 string Text="Close" int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! DAT*4 end type event clicked; close(parent) end event type cb_calculate from commandbutton within w_growth int X=2578 int Y=992 int Width=347 int Height=96 int TabOrder=100 string Text="&Calculate" boolean Default=true int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked; long ll_rc setPointer(hourGlass!) //this button is the calculate and the canceDAT*6l button if this.text = "&Calculate" then //validate input data, set instance variables and initialize datastores if parent.of_setData() <= 0 then return 0 end if //start the log file if parent.of_openLogFile() <= 0 then return -1 end if //allow user to cancel growth calculations this.text = "Cancel" //run main calculation function ib_calculating = TRUE ll_rc = parent.of_calculate() ib_calculating = FALSE if ll_rc < 0 then parent.of_setStatus("ErroDAT*8r") end if //if user cancelled if ib_cancel then parent.of_setStatus("Cancelled") parent.of_writeLogMessage("GROWTH CALCULATIONS CANCELLED BY USER", 1, 1, 1) messageBox("Cancelled", "Growth calculations cancelled.", information!) ib_cancel = FALSE end if //reset button text this.text = "&Calculate" //close the log file parent.of_closeLogFile() else //this button was changed to the Cancel button while calculating //w_growth::of_calculate() uses yield(DAT*:) to process events //asynchronously while calculations are running, so this allows //the ib_cancel flag to be set dynamically, which causes of_calculate() //to return immediately ib_cancel = TRUE end if end event type st_status from statictext within w_growth int X=1445 int Y=848 int Width=878 int Height=80 boolean Enabled=false boolean BringToTop=true boolean Border=true BorderStyle BorderStyle=StyleLowered! string Text="Ready" boolean FocusRectangle=false long BackColDAT*<or=79741120 long BorderColor=8388608 int TextSize=-10 int Weight=400 string FaceName="Arial" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_factor_count from statictext within w_growth int X=2048 int Y=1136 int Width=274 int Height=80 boolean Enabled=false boolean BringToTop=true boolean Border=true BorderStyle BorderStyle=StyleLowered! string Text="0" Alignment Alignment=Center! boolean FocusRectangle=false long BackColor=79741120 int TextSize=-DAT*>10 int Weight=400 string FaceName="Arial" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_output_count from statictext within w_growth int X=2048 int Y=1040 int Width=274 int Height=80 boolean Enabled=false boolean BringToTop=true boolean Border=true BorderStyle BorderStyle=StyleLowered! string Text="0" Alignment Alignment=Center! boolean FocusRectangle=false long BackColor=79741120 int TextSize=-10 int Weight=400 string FaceName="Arial" FontFamiDAT*@ly FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_output_activity_count_t from statictext within w_growth int X=1445 int Y=1056 int Width=585 int Height=80 boolean Enabled=false boolean BringToTop=true string Text="Output Activity Count:" boolean FocusRectangle=false long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_input_count_t from statictext DAT*Bwithin w_growth int X=1445 int Y=960 int Width=585 int Height=80 boolean Enabled=false boolean BringToTop=true string Text="Input Activity Count:" boolean FocusRectangle=false long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_input_count from statictext within w_growth int X=2048 int Y=944 int Width=274 int Height=80 boolean Enabled=false boolean BringToTop=true DAT*D boolean Border=true BorderStyle BorderStyle=StyleLowered! string Text="0" Alignment Alignment=Center! boolean FocusRectangle=false long BackColor=79741120 int TextSize=-10 int Weight=400 string FaceName="Arial" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type gb_log_file from groupbox within w_growth int X=1390 int Y=480 int Width=1536 int Height=272 string Text="Log File" BorderStyle BorderStyle=StyleLowered! long TextColor=33554432 long BackColor=67DAT*F108864 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type gb_status from groupbox within w_growth int X=1390 int Y=784 int Width=987 int Height=464 string Text="Status" long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type st_factor_count_t from statictextDAT*H within w_growth int X=1445 int Y=1152 int Width=585 int Height=80 boolean Enabled=false boolean BringToTop=true string Text="Growth Factor Count:" boolean FocusRectangle=false long BackColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type gb_growth_parameters from groupbox within w_growth int X=37 int Y=480 int Width=1298 int Height=768 string Text="Growth Parameters" long BackDAT*JColor=79741120 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type type dw_growth_parameters from datawindow within w_growth int X=73 int Y=576 int Width=1225 int Height=512 int TabOrder=20 boolean BringToTop=true string DataObject="d_growth_parameters" boolean Border=false end type event constructor; dataWindowChild dwc long ll_rc //retrieve data for base year dropdown if this.getChild("basDAT*Le_year", dwc) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "error in call to getChild() for base year.", exclamation!) return -1 end if dwc.setTransObject(sqlca) ll_rc = dwc.retrieve(0000, 9999) if ll_rc < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "retrieve() for base year failed.", exclamation!) return -1 elseif ll_rc = 0 then dwc.insertRow(0) end if //retrieve data for projected year dDAT*Nropdown if this.getChild("projected_year", dwc) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "error in call to getChild() for projected year.", exclamation!) return -1 end if dwc.setTransObject(sqlca) ll_rc = dwc.retrieve(0000, 9999) if ll_rc < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "retrieve() for projected year failed.", exclamation!) return -1 elseif ll_rc = 0 then dwc.insertRow(0) eDAT*Pnd if //retrieve data for input reference dropdown if this.getChild("input_reference", dwc) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "error in call to getChild() for input reference code.", exclamation!) return -1 end if dwc.setTransObject(sqlca) ll_rc = dwc.retrieve() if ll_rc < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "retrieve() for input reference code failed.", exclamation!) returDAT*Rn -1 elseif ll_rc = 0 then dwc.insertRow(0) end if //retrieve data for output reference dropdown if this.getChild("output_reference", dwc) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "error in call to getChild() for output reference code.", exclamation!) return -1 end if dwc.setTransObject(sqlca) ll_rc = dwc.retrieve() if ll_rc < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::constructor(); " +& "retrieve() for ouDAT*Ttput reference code failed.", exclamation!) return -1 elseif ll_rc = 0 then dwc.insertRow(0) end if //make the external datawindow display using insertRow() this.setTransObject(sqlca) this.insertRow(0) end event event itemchanged; dataWindowChild dwc integer li_year choose case upper(dwo.name) case "BASE_YEAR" //if the base year changed, retrieve the projected year //dropdown to reflect projected years that exist for //the given base year if this.getChild("pDAT*Vrojected_year", dwc) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::itemChanged(); " +& "error in call to getChild() for projected year.", exclamation!) return 0 end if li_year = integer(data) dwc.setTransObject(sqlca) if dwc.retrieve(li_year, li_year) < 0 then MessageBox("Error", "w_growth.dw_growth_parameters::itemChanged(); " +& "retrieve() for projected year failed.", exclamation!) return 0 end if end choose return 0 DAT*_ end event type gb_merge_mode from groupbox within w_growth int X=1390 int Y=32 int Width=1536 int Height=416 string Text="Output Data Generation" long BackColor=80269524 int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type DAT*Z_state(): fetch10#40#0#0#0#D!uof_state(): fetch20#40#uof_incr_unb_array;0#0#D!uof_state(): commit0#40#uof_county>,Ending estimation for state: _ ( < L T t |           $ , H P X ` h p DAT*\x     $ , H P X ` h p x              $ 8 ` bD ,$($::F@@8T:F@@812 1<$#L$`$t$|)81<1 $DAT*^$$1t$80-$)8$1-1<-80A@A8-8 z%A@A8$ ($0$18$8@0-T$)\8d$$1 $  l$t$1d,|$$#&808DAT*`8z% z&:)@:@@8-1<-8 z%A@A8-8 z%A@A8-80A@A81` $$1N$8$0-<$)D8L$$1`1}T$\$1<   $ T d$l$1dDAT*bt$|$1x$80-$)8$$11 )8`$$$1D$80-$)8 $1$1}|55<=6  )4DAT*d 8 r-1<L-80A@A8-8< z%A@A816:"T&l')79:;= >VAdEtFGKLNOLPZRrWXZ[^&_:a`cfgijk"m:nJoNr`uyz|}>Ldtx&4D\&Ld/ pd_start_datepd_end_datepl_nation_ridps_referencepi_log_filepi_num_calc_DAT*fprotsps_calc_prots pi_num_modesps_modes- pi_num_pollutantsps_pollutants w_emissll_state_ridls_nameli_loopli_num_statesll_state_rids޿li_state_ubstate_curl |  "0 =Il[-x--@DAT*h  -2$d>[ cbx_background6>checked itr_nation0&uo_emisD!iw_parentT'ii_log_filehP0&uof_create_trans_objectD0&0&0&D!uof_nation()_da0&uof_sql_errorti40& Beginning estimation for nation: 0&D!uof_nation(): open0&40&DAT*j0&6> Emission EstimatorNo states found for nation: Error: No states found for nation: Ending emission estimation for nation: 0&D!uof_nation(): fetch1T0&40&0&0&0&D!uof_nation(): fetch20&40&uof_incr_unb_arrayi;0&0&D!uof_nation(): commit:0&40&uof_state19(Ending estimation for nation:  DAT*l( < L ` t |          ( 0 8 T \ d l t |      < D L T \ d l t |              4 D-<<R}--< 18d3 DAT*n pl_arrayTpi_ubpi_increment<- & ,$($::F@@8T:F@@8 - -0$1R1} - < -8$1, 1<N--612)T8--< p-1<|DAT*p1}1}-\$1dl$8t0-)81} -6:$T'p(*+-/234576:N<R=f>x?|BCEIKd pl_source_ridpt_dev_trans_objectpi_log_filepl_device_listpi_num_devicepi_dev_ubw_emissll_ridli_cntdevice_cursqlcaH *HDAT*r6-Tbl@t{ >@@ cbx_background6>checked uof_incr_unb_array;@uo_emisd!uof_device_list()uof_sql_error4 ( 0 8 T \ l  ,$($::F@@8T:F@@8- -DAT*t0$1@$8H0-)l81-t$1--1<R- -|$1d2-$1$8H0-)81--12)8-16: T"p$&*,.0*1.3L5z6789=@Cd pl_devDAT*vice_ridpt_proc_trans_objectpi_log_filepl_process_listrpi_num_processpi_pro_ubw_emissprocess_curH +H7-Tcm@u >X cbx_background6>checked uo_emis8!uof_process_list()uof_sql_error4[8!4[uof_incr_unb_array; ( 0 DAT*x@ l t |      b,$($::F@@8T:F@@81d,@$<}< 1< 8H0X$#Zh$|$$)81<Z8088z%:)@@81 -$ $ $1($800DAT*z-T$)l8t$1-1<J-8|0A@A8-8~ z%A@A8,$$,$ 6$- $8$$1\$80-$)8$$1 $ T  $($1d,DAT*|0$8$#8@08S8iz% z&:)@:@@8-1<-8r z%A@A8-8 z%A@A8-8|0A@A8$1V$$1D$80-$)8$$1V1}$$1<  <DAT*~ 6 $ $ $1d($0$18$8@0-X$)`8h$$112)8$12)8V$$$$1$80-$)8$1DAT*1}55<=68080-  )  8}1<^-/@/8, $6:@:@:@:]@:@:8}1< ($-0)881< 1 -@$H$P$1 X$8`0-$)DAT*8$1$$$18 $80-$)8$1-1< -8|0A@A8-8 z%A@A86:,T.z/2357JEZG^HbJxLMQUVW$ZJ[f_`abc&f4gLl\m`nopstv>xd|}~ 0@DVxDAT*Tbz&H~FZ^v $ ( > `  ( 8 L n  dq( pd_start_datepd_end_datepl_county_ridps_referencepi_log_filepi_num_calc_protsps_calc_prots pi_num_modesps_modes pi_num_pollutantsps_pollutants w_emissll_source_ridls_namels_typeli_loopli_num_sourcesli_ret_statusll_source_ridsdls_source_DAT*types li_src_ubsource_curw_emiss_statusl$@  "0 =Il[-x--@  $-@0-DAT*L V >onb@h cbx_background6>checked ii_start_rid_ub0]Enditr_countyL"uo_emis`!iw_parentp'ii_log_filePL"uof_create_trans_objectDErroruo_toplevel::uof_county(); invalid transaction object itr_countyL"L"L"`!uof_county() getting county nameL"uof_sql_errorty4\L" Beginning estimation for county: 6> sle_couDAT*ntyt*text_erL"L"`!uof_county(): openL"4\L"L"6> Emission EstimatorNo sources found for county: Error: No sources found for county: Ending emission estimation for county: L"`!uof_county(): fetch1L"4\L"L"L"L"`!uof_county(): fetch2L"4\L"uof_incr_unb_array;p`!uof_increment_arrayYDAT*L"L"`!uof_county(): commitL"4\L"uof_source6is_lognamet`!L"DL"L"`!uof_county() :getting county0L"4\L"L"L"`!L"4\L"Ending estimation for county:  ( @ X h |         ( T l t      DAT*        ( 0 8            ( 0 8 X ` h               ( 0 8 @ H P X            d DAT*neral]" html.valueishtml="0" name=scc_ams_code 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=13 alignment="0" tabsequence=32766 border="0" color="0" x="6821" y="8" height="64" width="1193" format="[general]" html.valueishtml="0" name=process_rid visible="1" edit.limit=0 edit.case=any edDAT*it.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=15 alignment="0" tabsequence=32766 border="0" color="0" x="8023" y="8" height="64" width="1152" format="[general]" html.valueishtml="0" name=factor_priority visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0 font.face="MS Sans Serif" font.height="-8" font.weiDAT*&ght="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" ) DAT* arg_tranobj  $),8@$)H8\$)d8x$)8$)8,1,$<Zxd ::message@X itr_county"uof_disconnect?itr_nation4&?itr_stateP#?itr_sourcel%?itr_device$DAT*? , @ H \ d x     v $$,$@$T)t81<*|$$1<*$$80A@A8$$88z%A@A8$$80A@A8$$$$8)@81<BH$DAT*P$1<BX$`$80A@A8h$p$88xz%A@A8$$80A@A8,\1j,$b *zBd ::message@ iw_parent'uo_emis!'ii_log_file4Pitr_device_H$uof_create_trans_objectD\'4P'4PDAT*Error creating process transaction object#'4PEnding emission estimation for device '4P H!'4Pitr_source,%D\'4P'4P'4Psource '4P $ , @ T t |          $ 8 @ H P X ` h p    @*DAT*(0$ |d 8 uo_emis!control c@! ( 0 $d  uo_emis! "#123456789: ; < = > ?L"#2 ( uof_source_listuof_downstream_processuof_orig_processuof_process_grpuof_device_grpuofDAT*_sourceuof_deviceuof_source_nameuof_stateuof_nationuof_incr_unb_arrayuof_device_listuof_process_listuof_countyuof_disconnectf_db_errorf_sqlcheck+destructor+constructor+create+destroy /@P_@ju      DAT* ocridhig2 { widthheightborderbackcolortabtextcoloruo_emisitr_countyitr_stateitr_deviceitr_sourceitr_nationiw_parent &3 ;FP[fDAT*q] o  @@1    @   aD1\2x34DAT*"56 $7 /d@8px9 :  ; ; <  (= p>  DAT* ?'#'"L))8d  destroyL"#2  +destroy2  xybackcolor<7 ` ]DAT* o7`  @@1    @     >DAT*883`33)DAT* .H")3>GQ[chr] o8.H @ @DAT*2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextalignmentfocusrectangle,  .H")3>GQ[c hr] DAT* o.H @  @d:F@@8,9},!J1X,!$ 0d w_emiss::message(@)!@*$ ib_abortyQ DAT* "&"2  +clicked2 \ xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcancelw  Ip"+2<G!P'U] owIp DAT*@! @' "DAT* @@@     &  x;0 .b$$$68,H1V,,$.dDAT* ::message@!4 st_filename. textidt $ , ""2  +clickedf_print_file(2 a xywidthheighttabordertexttextsizeweightfacenamefontcharsetfontfamilyfontpitch  P"'0DAT*7@LW] oP  @C"2  2 l xywidthheighttextalignmentbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch% DAT* %P(2;BKWb] o%%P  @@@2  DAT*2 O xywidthheighttaborderdataobjectborderstylehscrollbarvscrollbar p "-9D] op  @ @  DAT*J@8,01>,$d ::message@!  ""2  +clicked2 i xywidthheighttabordertextdefaulttextsizeweightfacenamefontcharsetfontfamilyfontpitch  T "'DAT*/8?HT_] oT   @C"2  2 u xywidthheightborderborderstyletextbackcolortextsizeweightfacenamefontcharsetfontDAT*familyfontpitchI  P ,1;DKT`k] oIP  @DAT*5@DAT* ii_baseyearMYProjected Year: OYInput Reference Code: is_inputreferencecode)BYOutput Reference Code: is_outputreferencecodeiCYib_updatemodeolDData Generation: Update@YData Generation: DeleteYDRetrieving Input Activity Data...of_setstatus|"il_inputactivitycount8Qof_retrieveinputr cxX8Q8Q}"st_input_count;d as_messageli_rc( $ of_writelogmessagDAT*e N*4*<L*Tp*x*****(*0D*Ld*l*****0*8L*Th*p**DAT***$$$,$4$<$D$L$T$\$d$l$t$|$$$$$$$$$$$$ |,BXn 4J`vd H DAT* rb_append*rb_overwrite$+$cb_viewD,Dsle_log_file_name\-\cb_browse_u.uo_ss_t/ st_merge_mode_t0//st_overwrite_mode_t122rb_delete_mode233rb_merge_mode344cb_closeT84585cb_calculateT56T6st_statust67t7st_factor_count788st_output_count899st_output_activity_count_t9:DAT*:st_input_count_t:;;st_input_counti ;< <gb_log_file@<>@>gb_status\=?\?st_factor_count_te x>@x@gb_growth_parameterserr?AAdw_growth_parametersrd @CCgb_merge_modeedAEEcontrol c@*$+D,\-./ 0/122334845T56t6778899::; ;<@<>\=?x>@?A@CAE 4DAT* <L Tp x     ( 0D Ld l     0 8L Th p      $ , 4 < D L T \ d l t |    DAT*        V$,$<$X$l$|$$$$$$ $ $8$P$t$$$$$$ $,$D$*8FT b p ~  &DAT*4Bd L rb_append*rb_overwriteerw+cb_view4,sle_log_file_nameD-cb_browse`.uo_sst/ st_merge_mode_t0/st_overwrite_mode_t12rb_delete_mode23rb_merge_mode34cb_close45cb_calculate56st_status67st_factor_count(78st_output_count@89st_output_activity_count_tX9:st_input_count_t|:;st_input_count;gb_statusFDAT*@=?st_factor_count_t>@gb_growth_parameters?Adw_growth_parameters@Cgb_merge_mode4AE , < X l |          8 P t        , D j,4$#z8<08B0:)@@8@81|j$#8<08DAT*0:)@@8@81j$#n8<080:)@@8@81,+1,+$*Xn z  Lbnd ::message+@JP ids_activityTFu_ds_baserw FTFErrorw_growth::open(); ids_activity create failed.ids_factorpUF FDAT*pUFw_growth::open(); ids_factor create failed.ids_outputqVF FVFw_growth::open(); ids_output create failed. ,4 |     $  $4$@<$P$`X$,+z1,+`$ 2 @ R`d ::message+@Jh8 ids_activityTFDAT*TFids_factor(UF(UFids_outputeDVFDVF  4 < P X ` .$11  d  ib_calculating[   & wxyz{|}~  FG&2 of_setdataof_retrieveinputof_retrievefactorsof_retrieveoutputof_calculateof_setstatusof_openlogfileof_clDAT*oselogfileof_writelogmessagef_get_sequencef_sqlcheck+create+destroy+open+close+closequeryh$7IV Vcr  '(   2 b xywidthheighttitDAT*lebartitlebackcolorcontrolmenuminboxmaxboxiconrb_appendrb_overwritecb_viewsle_log_file_namecb_browseuo_ssst_merge_mode_tst_overwrite_mode_trb_delete_moderb_merge_modecb_closecb_calculatest_statusst_factor_countst_output_countst_output_activity_count_tst_input_count_tst_input_countgb_log_filegb_statusst_factor_count_tgb_growth_parametersdw_growth_parametersgb_merge_modeis_inputreferencecodeis_outputreferencecodeib_updatemodeil_stateridil_stateridlastil_countyridDAT*il_countyridlastis_scccodeis_scccodelastis_materialcodeis_materialcodelastii_baseyearii_baseyearlastii_projectedyearii_projectedyearlastil_inputactivitycountil_growthfactorcountil_outputactivitycountids_activityids_factorids_outputis_logfilepathnameis_logfilenameii_logfilehandleib_appendmodeib_calculatingib_cancelI ( t"(2DAT*>ELQ [ h p   / 2 3 4d@ 5 6 7 8 9! :. ;? <N >Z ?d @v A()DAT* C Ed.ofecp@Op@T#p@.Y=p@M^ap@mra}t_$FFFVVDAT* *;IX] oI( t  X1 @@@      / 2 3 4 5 DAT* 6 7 8 9 : ; < > ? @ A C EFFFVVwx$xy7zDAT*I{` |`}m~|P dX   g& gDAT*FgGN$((9}<09}1$(<d 8 checkedib_appendmodeZZ ( 0 ""2  +clicked2 xywidthheighttabordertextborderstylecheckedlefttexttextcolorbackcolortextsizeweightfacenamefontcharsetDAT*fontfamilyfontpitchT7  %`P"'3;DNXahq}] o7%`P DAT* @@g"N$((9}<09}1$(<d 8 checkedib_appendmodeZZ ( 0 ""2  +clicked2 xywidthheighttabordertextborderstylelefttextteDAT*xtcolorbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch@  I`F"'3<FPY`iu] oI`F DAT* @@g" $64$6)L88T08h08l0O@O8<16818088z%:)@@81  0BDAT*d* ll_rcls_filepathnamels_filename<   is_logfilepathnameWis_logfilename$Xof_closelogfile<Select File to ViewtxtText Files (*.txt),*.txt, All Files (*.*),*.*Errorw_growth::cb_view::clicked(); call to getOpenFileName() Failed. 4 L ""2 +clickedf_display_file(typeromman,th2 a xywidthDAT*heighttabordertexttextsizeweightfacenamefontcharsetfontfamilyfontpitch%   %PZ"'07@LW] o% %PZ  @DAT*g"f8$H$6`h$p$61*Td x0 is_logfilepathnameWsle_log_file_name$-textogf@is_logfilenamePX$-@ 8 H ` h p ,,2  +modifiedtypeil2 r xywidthheighttaborderbordDAT* erstyletextcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch  nP<".8AHQ]h] o nP< EDAT*" @@ @@@g,X $64$68<08Z08^0U@U8<18088z%:)@@811166$$6DAT*$1  0|Fd* ll_rcls_filepathnamels_filename<  8 is_logfilepathnameWis_logfilenamem$XSelect or Enter Log File NametxtText Files (*.txt),*.txt, All Files (*.*),*.*Errorw_growth.cb_browse::clicked(); call to getFileSaveName() failed.W$Xsle_log_file_name-textW 4   DAT*&   ""2  +clickedtype f2 a xywidthheighttabordertexttextsizeweightfacenamefontcharsetfontfamilyfontpitch%   %P2"'07@@LW] o%  %P2DAT*(  @g"8d  destroy L"#2  +destroy2 5 xywidthheighttaborderborderborderstyle% 0  DAT**")] o%0  @@!1        " # $ % & ' ( ) * + ,-2  DAT*, 2 xywidthheightenabledtextfocusrectangletextcolorbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch, p !&5?IRYbny] opDAT*.  01@2  2 xywidthheightenabledtextfocusrectangletextcolorbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch,  !4DAT*0&5?IRYbny] o  401@N$((9}<09DAT*2}1$(<d 8 checkedib_updatemodeDD ( 0 "3"2  +clickedtype_m2 m xywidthheighttaborderlefttexttextcolorbackcolortextsizeweightfacenamefontfamilyfontpitch   [("+5DAT*4?HOXc] o [( @ @ @@g"N$((9}<09}1$(<dDAT*6 8 checkedib_updatemodeDD ( 0 "4"2  +clickedtypemo2 k xywidthheighttabordercheckedlefttextbackcolortextsizeweightfacenamefontfamilyfontpitch  p ["*3=FMDAT*8V a ] o p[ @   @ @@g"J@8,+01>,+$d ::message+@J  DAT*:"5"2  +clickedtypefr2 a xywidthheighttabordertexttextsizeweightfacenamefontcharsetfontfamilyfontpitch   [`n"'07@LW] o [`n DAT*< @g"8:F@@8$8)081<b1)H81<1P8X0p9})8<9}180)8$80)880DAT*>111)8808 0:)@@8@9}H80)`8h9},+1,,+p$ 6 Vb!"(#D$~%),.58d ll_rc::message(+@Jx text&Calculateof_setdataw#of_openlogfile~8CancDAT*@elib_calculating_[of_calculate*),{x_[Errorof_setstatuse|ib_cancel\Cancelled|GROWTH CALCULATIONS CANCELLED BY USERof_writelogmessage Growth calculations cancelled.\of_closelogfileP\ 0 H P p       @ H ` h p "6"2  +clickedtypeat2 i xywDAT*Bidthheighttabordertextdefaulttextsizeweightfacenamefontcharsetfontfamilyfontpitch   [`d"'/8?H T _ ] o [`d    DAT*D @g"2  2 xywidthheightenabledbringtotopborderborderstyletextfocusrectanglebackcolorbordercolortextsizeweightfacenamefontfamilyfontpitchT P nP!,3?DSDAT*F]iry] oPnP @ 012  2 xywidthheightenabledbringtotopborderborderstyletextalignmentfocusDAT*HrectanglebackcolortextsizeweightfacenamefontfamilyfontpitchT p P!,3?D0N]gpw] opP DAT*J@ 012  2 xywidthheightenabledbringtotopborderborderstyletextalignmentfocusrectanglebackcolortextsizeweightfacenamefontfamilyfontpitchT  P!,3DAT*L?D0N]gpw] oP @ 012  2 x xywidDAT*Nthheightenabledbringtotoptextfocusrectanglebackcolortextsizeweightfacenamefontfamilyfontpitch  IP!,1@JSZcn] o IP @DAT*P 01@2  2 x xywidthheightenabledbringtotoptextfocusrectanglebackcolortextsizeweightfacenamefontfamilyfontpitch  IP!,1@JDAT*RSZcn] oIP @ 01@2  2 xywidthheightenabledbringtotopborderborderstyletextalignmentfocusrectanglebackcolortextsizeweightfacenaDAT*TmefontfamilyfontpitchT  P!,3?D0N]gpw] oP @DAT*V 012  2 x xywidthheighttextborderstyletextcolorbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitchn  *4>GNDAT*XWcn] on  @2  2 V xywidthheighttextbackcolortextsizeweightfacenamefontfamilyfontpitchn  DAT*Z(18AL] on @ @@2  2 x xywidthheightenabledbringtotoptextfocusrectanglebackcolortextsizeweightfacenamefontfamilyfontpitchDAT*\  IP!,1@JSZcn] oIP @ 01@DAT*^2  2 V xywidthheighttextbackcolortextsizeweightfacenamefontfamilyfontpitch%  (18AL] o% @DAT*` @@+8)81<n8$08*8Yz%:)@@81,%)811')818$08*8z%:)@@81*1*1)88)81<8$08*8z%:)@@81,%DAT*b),811')481*8$08*8<z%:)@@81T1T1)d88l)|81<8$08*8z%:)@@81,%)8)81H8$08*8z%:)@@81r1r1)88)81DAT*d<8$08*8z%:)@@81,%)T8)\81f8$08*8dz%:)@@8111)8,%)81)8,+1,+$. b n*X !#$&%:)T*,/012485D6X:r;=@ABC"EVFDAT*fbGvKLOd" dwcll_rcsqlca::messageP %@G+@J base_yeargetchildoErrorw_growth.dw_growth_parameters::constructor(); error in call to getChild() for base year.settransobjectretrievetat}retrieve() for base year failed.insertrowsprojected_yearoerror in call to getChild() for projected year.}retrieve() for projected year DAT*vfailed.sinput_referenceoerror in call to getChild() for input reference code.|retrieve() for input reference code failed.soutput_reference@oerror in call to getChild() for output reference code.|retrieve() for output reference code failed.0s^(     , 4 d |     T \     ` DAT*jforward global type w_select_file_mode from Window end type type cb_cancel from commandbutton within w_select_file_mode end type type cb_append from commandbutton within w_select_file_mode end type type cb_overwrite from commandbutton within w_select_file_mode end type type mle_message from multilineedit within w_select_file_mode end type end forward global type w_select_file_mode from Window int X=1074 int Y=904 int Width=1467 int Height=540 boolean TitleBar=true string Title=DAT*l"Select File Mode" long BackColor=79741120 WindowType WindowType=response! cb_cancel cb_cancel cb_append cb_append cb_overwrite cb_overwrite mle_message mle_message end type global w_select_file_mode w_select_file_mode event open;// Set display message // Message passed in from calling window mle_message.text = "File '" + upper(message.StringParm) + "' already exists. " +& "Overwrite or Append?" end event on w_select_file_mode.create this.cb_cancel=create cb_cancel thisDAT*n.cb_append=create cb_append this.cb_overwrite=create cb_overwrite this.mle_message=create mle_message this.Control[]={this.cb_cancel,& this.cb_append,& this.cb_overwrite,& this.mle_message} end on on w_select_file_mode.destroy destroy(this.cb_cancel) destroy(this.cb_append) destroy(this.cb_overwrite) destroy(this.mle_message) end on type cb_cancel from commandbutton within w_select_file_mode int X=951 int Y=304 int Width=329 int Height=96 int TabOrder=30 string Text="CancelDAT*p" boolean Cancel=true int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type event clicked;// User wants to cancel CloseWithReturn( Parent, 3 ) // end end event type cb_append from commandbutton within w_select_file_mode int X=549 int Y=304 int Width=329 int Height=96 int TabOrder=10 string Text="Append" boolean Default=true int TextSize=-8 int Weight=700 string DAT*rFaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFamily FontFamily=Swiss! FontPitch FontPitch=Variable! end type on clicked;// User wants to append data to existing file CloseWithReturn( Parent, 2 ) // end end on type cb_overwrite from commandbutton within w_select_file_mode int X=146 int Y=304 int Width=329 int Height=96 int TabOrder=20 string Text="&Overwrite" int TextSize=-8 int Weight=700 string FaceName="MS Sans Serif" FontCharSet FontCharSet=Ansi! FontFaDAT*tmily FontFamily=Swiss! FontPitch FontPitch=Variable! end type on clicked;// User wants to overwrite data in existing file CloseWithReturn( Parent, 1 ) // end end on type mle_message from multilineedit within w_select_file_mode int X=73 int Y=48 int Width=1298 int Height=240 Alignment Alignment=Center! boolean Border=false boolean DisplayOnly=true long BackColor=79741120 int TextSize=-10 int Weight=400 string FaceName="Arial" FontCharSet FontCharSet=Ansi! FontFamily FontDAT*:Family=Swiss! FontPitch FontPitch=Variable! end type DAT*x89n 8^8(N82)L81<8T08Z8z%:)@@816e@e8},%)8)81N8T08Z8z%:)@@811, @ n BNd. rowdwodatadwcli_yearcase5sqlca DDAT*z  ! (%@G  name__get_attribute BASE_YEARprojected_yeargetchild:oAErrorw_growth.dw_growth_parameters::itemChanged(); error in call to getChild() for projected year.settransobjectretrieve}retrieve() for projected year failed. L   %C/CL%/2 " +constructor+itemchanged(type_peterDAT*|up2 ? xywidthheighttaborderbringtotopdataobjectborderI @ "-8] oI@ @  @ Dg%DAT*~L+l/2  2 b xywidthheighttextbackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitchn  (18AMX] on DAT*  @@DAT*?H T _ ] o%0I`      @"X1I+@8,>1L,$$d ::message@ DAT* ""2  +clicked2 a xywidthheighttabordertexttextsizeweightfacenamefontcharsetfontfamilyfontpitch 0 I`"'07@LW] o0I` DAT* @"2  2 z xywidthheightalignmentborderdisplayonlybackcolortextsizeweightfacenamefontcharsetfontfamilyfontpitch Ian 0ri HEes(1# S*l6_g@DAT*IP_cY:oe p] oI0 E @ 1@@DAT*T @j$868$0,"P1^,"($6d ::message"@'0 text1  ( ,,2  +modified2 xywidthheighttaboDAT*rdertextsizeweightfontpitchfontfamilyfacenametextcoloralignmentborderstylemaskspinincrementminmaxT  7X"+2<GTPZdpu z] o7XDAT* ET @@ @ 1@@!  (,j$868$0,"P1^,"($DAT*6d ::message"@'0 text1  ( ,",2  +modified2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcoloralignmentborderstylemaskspinincrementminmaxT X 7X"+DAT*2<GTPZdpuz] oX7X ET @@ @ 1@DAT*al datawindow display by using InsertRow dw_ref_code.SetTransObject(SQLCA) dw_ref_code.InsertRow(0) // Retrieve data for child datawindow IF dw_ref_code.GetChild("code", dwc) = -1 THEN MessageBox(This.Title, "Application Error:~nReference Code - " + & "Not a DataWindowChild.~nContact your technical support.") return END IF dwc.SetTransObject(sqlca) dwc.Retrieve() // REJ 18MAR96 No longer a retrieval argument //dwc.Retrieve('DOWNSTRMDIS') end event on iteDAT*mfocuschanged;call u_dddw::itemfocuschanged;is_child_name = 'code' is_validation_table = 'rap_reference_codes' is_msg_name = 'Column - Reference Code' is_msg_text = 'Sorry! Not a valid reference code' end on type dw_unit_code from u_dw_unit_code within w_emiss integer x = 1646 integer y = 1552 integer width = 1225 integer height = 112 integer taborder = 180 end type type uo_pollutant from u_pollutant_ee within w_emiss integer x = 1445 integer y = 544 integer width = 1408 integeDAT*r height = 624 integer taborder = 130 boolean border = false end type on uo_pollutant.destroy call u_pollutant_ee::destroy end on DAT*00" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=10 alignment="0" tabsequence=100 border="0" color="0" x="5257" y="8" height="64" width="453" format="[general]" html.valueishtml="0" name=scc_ams_code visible="1" edit.limit=10 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.charsDAT*et="0" background.mode="1" background.color="536870912" ) column(band=detail id=11 alignment="0" tabsequence=110 border="0" color="0" x="5719" y="8" height="64" width="283" format="[general]" html.valueishtml="0" name=sub_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="536870DAT*912" ) htmltable(border="0" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" ) DAT*@! (,2  2 r xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenamebackcolortextborderdisplayonly 4  "+2<GT@PDAT*Z _f] o4  ET @  1@@2  2 b xwidthheighttabordertextsizeweightfontpitchfontfamilyfacenameDAT*\nd type type gb_1 from groupbox within w_set_max_choices integer x = 27 integer width = 1376 integer height = 628 integer taborder = 60 integer textsize = -10 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 end type DAT*= swiss! string facename = "Arial" string text = "Cancel" boolean cancel = true end type on clicked;// User wants to abort out of the background emission estimation // procedure SetPointer( Hourglass! ) w_emiss.ib_abort = TRUE // end end on DAT*4" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" ) DAT*textcolorbackcolor `t< )0:EN@X] o`t< @ @ @DAT*="402" 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="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="67108864" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" ) DAT*"0Nl|dG as_throughput_materialll_rclsvaluetypelsvaluetypenamesqlcad %1 A@  SPECIATED FROM 2 + f_speciation_value_typef_sqlcheck(  2  DAT*1)x88,88z%81< ,1,$, ,88z%81<,l1z,$, , $1d,88z%81<,1,<$,D$1L$1)`8h$8pDAT*6)8, ,,88z%81<,1,$>1< $8)8$)8$9)8$,) 81)@8H$)X8`$9)h8j8p08z0@8DAT*,1,$  6^n R"#$&*+2,Z-.013689.:8=p>@ABCDH>IBKjdu ll_selected_rowll_rowli_countli_row_counterls_mat_group ls_codesqlcaemit_cursor::messageD(D7-P X@^t>DAT*k@ dw_material%reset/dw_material_group,!getselectedrowH,!getitemstringhAll EmittantsFail on declaring emit_cursor cursor. Contact your technical support. Fail on open emit_cursor cursor. Fail on fetching emit_cursor cursor. %insertrow@(T%codesetitemPuFail on closing emit_cursor cursor. rue,!rap_materials_codeahDAT*,!H%setredraw!%settransobject^uf_retrieve_emittants3(%sortcP%!EmittantsPlease select one or more material groups $ @ X ` x     < D L ` h            @ H X ` h  ""2  +clickedf_db_errordDAT*2  ] o(D  @   @ "$2  2  ] oDAT*td @ @  2  2  ] o)04 @    @ DAT* 2  2  ] oWT    @@ @DAT*apis_poll_calc_failstis_lognameid_cutoffdate@d $07>HT^#c r   . 0 1 2 3 5raDAT* 8d@ 9 ; > ? @!  A B% C2 DB FO GU Hou_ If Ju_o L} Myp N O P R S T U V DAT*X& YD [r  ^.!*og7ceFdrZ_ipstx_gbndewdwt_dat_pori@'>/ntLu_hd_uDAT*`siopo/}<ou"0?pdP/p{ ] o   X1DAT*# @@@    . 0 1 2 3 5 8 9 ; > ? @ A B C D F G H I J L M N O P R S T U V X Y [ ^DAT*>333 wx#xyC z]{sDAT*|(}4~ p@    ( P,8U&DAT*>UFEWMW2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle  p")3>DAT*GQ[ch ] op @ @ 2  2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorborderstyDAT*lemaskdatatypemaskspinincrementminmaxTn  `2"+2<GPZfs"x}/] on `2 EDAT* @@ @L1@" x/8d  destroyL"#2  +destroy2 5 xywidthheighttaborderborderborderstyleDAT*%  I ")] o% I  @@ 1        ! " # $ % & ' ( ) * +,DAT*MW2  2 ` xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortext  P")3>GQ[] oPDAT*  @@@:F@@8$1<d808/8Kz%:)@:@@8}1<6p$$$)8$/@/81}$9}$9DAT*}d,5P1^,5$8 0808 0U@U8}1<63@38:@8,5P>5X^`6:@:@:@:]@:@:8},5h>5px6:@:@:@:]@:@:8},51,5$26:@:@:@:]@:DAT*@:8}6$$$)8$6$9}$9},51,5 $ 6v26#d&(+-/1Z3x568:?2ALB~CDIdN li_ret_valuels_docnamels_named::messagew_select_file_modemessagex  DAT* )5@j3:@mF5@j ii_log_filePEmission EstimatorA log file is already open. Do you want to close it?uo_tlh5;uo_emisx!Puof_end_log9PPsle_log_fileef=Fenabledcbx_log_fileFPcheckedSelect Log FileTXTText Files (*.txt),*.txt, All Files (*.*),*.*@?P@PPis_lognameth5;DAT*x!Puof_begin_logce8=Ftext=FFP p           P X` h px                "0"2  +clickedtype f2 \ xywidthheighttabordertextsizeweightfontpitchfontDAT*familyfacenametextcancel 4 @T"+2<GPU] o4@T @ @VU"DAT*x:F@@8$1<|808/8cz%:)@:@@8}1<6$$$)8$/@/81}$ 9}$$49}|1<N|,5h1v,5<$8D08T08X0O@O8}1<6DAT*8D1<D808z%:)@:@@8,5^1l,5$ 6v2JN%|+,-/ 5Dd4 ls_docnamels_namedli_ret_status::messageP  *5@jh ii_log_filePEmission EstimatorA log file must be closed before you can view it. Would you like to close tDAT*he log file that is currently open?uo_tl5;uo_emis!Puof_end_log9PPcbx_log_fileFPcheckedsle_log_fileyou=Fenabled,Select Log FileTXTText Files (*.txt),*.txt, All Files (*.*),*.*Unable to open na          $ 4 <  "1"2 +clickedf_display_file(typeromman;th2 UDAT* xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametext  4 @T"+2<GP] o 4@T @ @DAT*VU"2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle 4 T")3>GQ[ch] DAT* o4T @ @2  2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorborderstylemaskspinincrementminmax@ 4 TDAT*"+2<GPZfkp0z] o4T E @@ @DAT*1@@ (2  2 5 visiblexywidthheighttaborderdataobjectInP!*8] InP @ 8DAT*@ @ 62  2  visiblexywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorenabledvscrollbarmultiselectitemse borderstyleTI !x*3:DODAT*Xbju1] I x @ @@@11$D),8@$P9}t)p8DAT*x$9},51,5$" @ DVtd ::message5@j@ checkedwf_select_all_modeslb_modest b47?enabledHwf_deselect_all_modesX47?H , @ P p x   "9"2  +clicked2 i xywidthheighttabordertextsizeweigDAT*htfontpitchfontfamilyfacenametextcolorbackcolortextR  Dd"+2<GPZdd] oRDd  @DAT*d@@VU":8d  destroy;L"#2  +destroy2 ! visiblexywidthheightdnT] nT DAT*@@ t1    @   <=====MW2  2 x visiblexywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextchecked,.DAT*D!@*1;FOYckp] .D  @@2 DAT* 2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorhscrollbarvscrollbarmultiselectborderstyle,N  n"+2<GPZep|] oNDAT*n @ @@@@112  2 i xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortextR  @F"DAT*+2<GPZd ] oR@F  @ @@2  2 xywidthheighttabordertextsizeweightfontpitchfonDAT* tfamilyfacenametextcolorborderstylemaskspinincrementminmax@ T T<"+2<GPZfkph z. ] oTT< EDAT*  @@ @4 1@@ ` . 2  2 xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextbordercolorfocusrectangle,R l DAT*@")3>G@Q[cp ht] oRl@ @ p @DAT*$D)08H$X9}t)x8$9},51,5$" @ DVtd ::message5@j@ checkedwf_select_all_methods{lb_calc_methods8<DenabledPwf_deselect_all_methods|`8<DP 0 H X x    "C"2 DAT* +clicked2 i xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortextR  @P"+2<GPZd ] oR @P DAT* @ @@VU"2  2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorhscrollbarvscrollbarmultiselectborderstyle,I L ZDAT*"+2<GPZep|] oIL Z @ @@@@ 1 12  2DAT* i xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolordisplayonlyborderstyle2  L")3>GQ]] o2L E@DAT* @@ @@@:F@@8$ $8$9)L8T$\$p$9)x8$$$9)8$9)8$$1G$)843@3$@$@8DAT*D$)X8#B8`08s8z%8z&:)@:@@8}1<$$:W@)8>,5*18,5$h $8$T$1\$d$$1"h$$$18`088z%:)@:@@8}1<T$$:W@) 8,5DAT*n1|,5$$$$,$1d8`0848Uz%:)@:@@8}1<6$$:W@)8d,5P1^,5$B$8`0)8#$)8,51,5$$),84$18<)P88`08X0:)@:DAT* @@8p$)x8,51,5$ $)8} 1<$18<)8h$)8,5T1b,5$$ $6$$$6<$D$6)\81<,51,5d$|$$6@8DAT*"$$6%@%83$$6%@%83"28`088z%:)@:@@8$) 8,51,,5($@$P$h$p$#! 8`08x8z%:)@:@@8}1<F $:W@)8$1<B $)8,5. 1< ,5$DAT*$  $)(8,5| 1 ,50$ 1} 1}  H$)\8  d$ )t81<   |$ )8 8 $ < 80  8 $ < 80  8 $ < 80  }$DAT*&$X =@81d 801d 801d 80$)08}L,.68T08g08l0@8x$8l 80,.68T08g0$6@8,.68T0808l0@8$8lDAT*( 80,.68T080$6@8 $$6$)8}1< @8 @88 @8L 9}T $\ $t $1 1} | $ $ $ < $ $ $6DAT**@8@8 $ $6@8@8 $ $ $ <=6 ) 8 }1<  $ $ $1 1}`  $ $( $ <0 $8 $@ $6@8@8H $P $6@8@DAT*,8X $` $h $ <=6p ) 8 }1<V $ $ $1\ 1}  $ $ $ <\ $ $ $6@8@8 $ $6@8@8 $ $ $ <6 DAT*.)  8 }1<X\,=4 $< 8D 0H $P $h $16 1} p $x $ $ <6 $ $ $6@8@8 $ $6@8@8 $ $ $ <=68 08 0 $DAT*0) 8}1<26 $ $ $1z $ $ $6@8@8 $ $6@8@8( $0 $8 $1=68 08 0@ $)T 8}\ $d $l $1t $| $ $ $6@8DAT*2@8 $ $6@8@8 $ $ $1=Gi68 08 0 $) 8}8`08 8 z%:)@:@@8, $4 $< $9)D 8L $T $\ $9)d 8l $t $| $9) 8 $ $,=@8 DAT*4$1< $ $ $) 8 $/@/8 1} $ 9}$9}8`080:)@:@@8,51,58$+,N-.124 8b:>@A BD>FBIJNP$QPRTVW[]^2_6cdihjknos&u0wdx|}~:h@2DAT*6f B F b  H \  " < X t J h  . J 4Xl @ 6@TX\#$.'2*6-f4z7@AFGJH~KLPRS2TRUlVZ\d li_ret_statusll_next_process_ridli_num_calc_protsli_num_modesli_num_pollutantsls_calc_prots ls_modes DAT*8ls_pollutants ls_ref_codeli_itemls_nameli_indexli_loopcnt::messagew_emiss_statusgs_inifilel@*<Il[-x--  5@j=@n.@@ uo_tld5;uo_emisDAT*:!dw_emis_fact(#setredraw!@5;!dw_activityd"!@5;!dw_calc_priority !!@dw_composite_ef25!@5;!gd_total_fug_emission*25reset/ id_estimator_time_stampauo_ss<,of_hasdata@3LEmission EstimatorYou must choose an estimation calculation level before calculating. Do you want to choose a level?<,cb_source_selector+#triggerevent DAT*<<,iclass_group(,$il_sourcesub1array@ <,(,$il_sourcesub2arrayl <,(,$@ You may only choose one device before calculating. Do you want to re-select devices ?<,+# <,(,$l You may only choose one process before calculating. Do you want to re-select processes ?<,+# dw_unit_code$N[uf_check_requiredN[setfocusdw_rDAT*>ef_code MYaccepttext  MYcodegetitemstringdAReference Code required MYdw_input_ref_codew_LX is_input_ref_codeackLXALXem_startoupAJtextrc`em_endu@Iem_cutoff_dates,+wf_checkdatesstLid_cutoffdate`dlu ,+em_priority9A9A Calculation method priority must be bDAT*@etween 1 and 999Acbx_backgroundA06>checkedHcbx_log_filerapXFPHYou must open a log file before you can calculate emissions. Do you want to open a log file?cb_browsed.0 ii_log_filePXFPXFPlb_calc_methods8<Dtotalitems?P8<Dstate<l8<D=EMISSION FACTORis_method_typeshFMASS BALANCEhBCSPECIATION^hPii_num_methodsDAT*Bi06>HEndPwf_get_user_inputsis_null_code_map 8rdata code prioritynullnot found8r8r998ris_ro_code_mapqROqq00q5;!Puof_log_inputsHis_data_type8dis_priority eis_group_num( fib_abort@ Q<,(,$il_nationarrayd <,(,$d 5;AJ@I<,(,$d Puof_nation: <DAT*D,(,$il_statearray <,(,$ 5;AJ@I<,(,$ Puof_state9x <,(,$il_countyarray <,(,$ 5;AJ@I<,(,$ Puof_county> sle_county( * <,(,$il_sourcearrayX <,(,$X 5;AJ@I<,(,$X $Puof_source6 DAT*F<,(,$@ 5;AJ@I<,(,$@ Puof_device7H <,(,$l 5;!AJ@I<,(,$l Puof_emissions_mainB Error reading user selections on calculation protocols, modes, pollutants5;!(#!@5;!d"!@5;!!!@06>HP5;!Puof_end_log9 PPDAT*HXFPHsle_log_file =FenabledEmission estimation complete   8 L T \ p x            4 D X       8 T \ d           $ ,         DAT*J  , 4 P p x              $ < D \ d |          ( @ P h p         ( 0 H \ d t |         0 LDAT*L x             8 L T \ t |                  ( 0 8 @ H P X ` h p                 DAT*N 4 < H P h p x                    ( 0 8 @ T \ d l t |          , 4 < D L T \ d l t |       DAT*P        8 "G"2  +clickedtypem 2 U xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametext  0 I`"+2<G@P ] o 0IDAT*R` @ @ VU"L@8,521@,5$d ::message5@j  "H"2  +clickedtype f2 \ xywidthheighttabordertextsizeweigDAT*Thtfontpitchfontfamilyfacenametextcancel   I`"+2<GP U] o I` @ @ VU"DAT*V2  2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorborderstylemaskdatatypemaskspinincrementminmaxTn $ `("+2<GPZfs"xDAT*X}0 /] on$ `( E @@ @ 1@" ( /2  2 xywidthheighttabordDAT*ertextsizeweightfontpitchfontfamilyfacenametextcolorborderstylemaskdatatypemaskspinincrementminmaxTn  `"+2<G@PZfs"x} @8 ] on `DAT*ertextsizeweightfontpitchfontfamilyfacenametextcolorborderstylemaskdatatypemaskspinincrementminmaxTn  `"+2<G@PZfs"x} @8 ] on `DAT*ertextsizeweightfontpitchfontfamilyfacenametextcolorborderstylemaskdatatypemaskspinincrementminmaxTn  `"+2<G@PZfs"xH} @8 ] on `DAT*`rdertextsizeweightfontpitchfontfamilyfacenametextcoloralignmentborderstylemaskspinincrementminmaxTpe c n 7 X04nt"bO+xt2 T<igGTeNP" Zhadmips!utczyp] o7XDAT*b ET @@ @ 1@@! (,j$868$0,"P1^,"($DAT*d6d ::message"@'0 text1  ( ,",2  +modified 2 xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcoloralignmentborderstylemaskspinincrementminmaxT X 7X"+DAT*f2<GT@PZdpuz@] oX7X ET @@ @ 1@DAT*h@! (,2  2 r xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenamebackcolortextborderdisplayonly 4  "+2<GT@PDAT*jZ _f] o4  ET @  1@@2  2 b xwidthheighttabordertextsizeweightfontpitchfontfamilyfacenameDAT*textcolorbackcolor `t< )0:EN@X] o`t< @ @ @DAT*"0Nl|dG as_throughput_materialll_rclsvaluetypelsvaluetypenamesqlcad ^@%^@1  A@  SPECIATED FROM 2 + f_speciation_value_typef_sqlcheck(pecomm wi2  DAT*pd if end if end if end if destroy(lds_dynamic) return la_data end function event constructor;this.uof_create_trans_object(-1,this.uoit_emiss_tran) this.uof_create_trans_object(-1,this.uoit_rid_tran) COMMIT USING this.uoit_emiss_tran; if f_sqlCheck(this.uoit_emiss_tran) < 0 then messageBox("SQL Error", "uo_emission::constructor(); error on COMMIT for uoit_emiss_tran.", exclamation!) return -1 end if COMMIT USING this.uoit_rid_tran; if f_sqlCheck(this.uoit_rid_tran)DAT*r < 0 then messageBox("SQL Error", "uo_emission::constructor(); error on COMMIT for uoit_rid_tran.", exclamation!) return -1 end if return 0 end event event destructor;disconnect using uoit_emiss_tran; disconnect using uoit_rid_tran; //*** MDY 01/21/98: Added DESTROY statements for transaction objects // created for this user object if isValid(uoit_emiss_tran) then destroy uoit_emiss_tran if isValid(uoit_rid_tran) then destroy uoit_rid_tran end event on uo_emissioDAT*tn.create this.dw_calc_priority=create dw_calc_priority this.dw_activity=create dw_activity this.dw_emis_fact=create dw_emis_fact this.Control[]={this.dw_calc_priority,& this.dw_activity,& this.dw_emis_fact} end on on uo_emission.destroy destroy(this.dw_calc_priority) destroy(this.dw_activity) destroy(this.dw_emis_fact) end on type dw_calc_priority from datawindow within uo_emission integer x = 37 integer y = 400 integer width = 2592 integer height = 176 integer taborder = 30 DAT* string dataobject = "d_calc_protocol" end type type dw_activity from datawindow within uo_emission integer x = 37 integer y = 204 integer width = 2592 integer height = 176 integer taborder = 20 end type type dw_emis_fact from datawindow within uo_emission integer x = 37 integer y = 12 integer width = 2592 integer height = 176 integer taborder = 10 string dataobject = "d_emission_factor_matches" end type DAT*xforward global type u_pollutant_ee from u_pollutant end type end forward global type u_pollutant_ee from u_pollutant end type global u_pollutant_ee u_pollutant_ee on u_pollutant_ee.create call super::create end on on u_pollutant_ee.destroy call super::destroy end on type dw_material_group from u_pollutant`dw_material_group within u_pollutant_ee end type type cb_remove_all from u_pollutant`cb_remove_all within u_pollutant_ee end type type cb_add_all from u_pollutant`cb_DAT*zadd_all within u_pollutant_ee end type type st_2 from u_pollutant`st_2 within u_pollutant_ee end type event st_2::clicked;// Purpose: To store all selected material groups into an array and // retrieve materials for all highlighted material groups long ll_selected_row, ll_row integer li_count, li_row_counter = 1 string ls_mat_group[], ls_code SetPointer(HourGlass!) //SDJ 11/20/97 - Reset values in dw_material dw_material.Reset() ll_selected_row = dw_material_group.GetSeleDAT*|ctedRow(0) if ll_selected_row > 0 then if dw_material_group.GetItemString(ll_selected_row, 1) = 'All Emittants' then declare emit_cursor cursor for select distinct emittant_material_code from rap_emission_factors order by emittant_material_code using SQLCA; if f_db_error(SQLCA, "Fail on declaring emit_cursor cursor. " + & "Contact your technical support.") = 1 then return end if open emit_cursor; if f_db_error(SQLCA, "Fail on open emit_cursor cursor.DAT*~ " + & "Contact your technical support.") = 1 then return end if fetch emit_cursor into :ls_code; if sqlca.sqlcode <> 100 then if f_db_error(SQLCA, "Fail on fetching emit_cursor cursor. " + & "Contact your technical support.") = 1 then return end if end if do while sqlca.sqlcode = 0 ll_row = dw_material.InsertRow(0) dw_material.SetItem(ll_row, 'code', ls_code) fetch emit_cursor into :ls_code; loop close emit_cursor; if f_db_errDAT*or(SQLCA, "Fail on closing emit_cursor cursor. " + & "Contact your technical support.") = 1 then return end if else do while ll_selected_row > 0 li_count++ ls_mat_group[li_count] = & dw_material_group.GetItemString(ll_selected_row, & 'rap_materials_code') ll_selected_row = dw_material_group.GetSelectedRow(ll_selected_row) loop dw_material.SetRedraw(FALSE) dw_material.SetTransObject(SQLCA) uf_retrieve_emittants(ls_mat_group, li_row_counter, DAT*Selection Window for speciation 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="5368DAT*70912" ) 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=long updatewhereclauseDAT*=yes name=priority dbname="rap_activities.priority" ) column=(type=char(4) updatewhereclause=yes name=decode dbname="decode" ) retrieve="SELECT 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 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.reDAT*f_rid = :al_stream_rid ) AND SUBSTR(rap_activities.metric_code,1) = :as_metric_code ) AND ((SUBSTR(rap_activities.material_code,1) = :as_material_code ) OR (SUBSTR(rap_activities.material_code,1,3) = 'PM,' AND :as_material_code = 'PM') OR (SUBSTR(rap_activities.material_code,1,5) = 'PM10,' AND :as_material_code = 'PM10')) 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 ORDEDAT*R BY decode, value_amt DESC" 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", string)) ) text(band=header alignment="2" text="Value Amount" border="0" color="8388608" x="9" y="8" height="52" width="430" 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=DAT*"0" background.mode="1" background.color="536870912" ) text(band=header alignment="2" text="Value Unit Code" border="0" color="8388608" x="448" y="8" height="52" width="430" html.valueishtml="0" name=value_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="Reference Code" border="0" color="8388608" x="887" y="8" height="52" wDAT*idth="430" 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="553648127" ) text(band=header alignment="0" text="Decode" border="0" color="8388608" x="1326" y="8" height="52" width="320" 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" backgroDAT*und.mode="1" background.color="553648127" ) text(band=header alignment="0" text="Material Code" border="0" color="8388608" x="1655" y="8" height="52" width="430" 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="1" background.color="553648127" ) text(band=header alignment="0" text="Priority" border="0" color="8388608" x="2094" y="8" height="52" width="425" html.valueishtml="0"DAT* name=t_3 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="553648127" ) column(band=detail id=2 alignment="1" tabsequence=32766 border="0" color="0" x="9" y="8" height="64" width="430" 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" foDAT*nt.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=32766 border="0" color="0" x="448" y="8" height="64" width="430" 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.familDAT*y="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="887" y="8" height="64" width="430" 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" backgrDAT*ound.mode="1" background.color="536870912" ) column(band=detail id=6 alignment="0" tabsequence=32766 border="0" color="0" x="1326" y="8" height="64" width="320" format="[general]" html.valueishtml="0" name=decode 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=1 alignment="0" tabsequence=DAT*32766 border="0" color="0" x="1655" y="8" height="64" width="430" format="[general]" html.valueishtml="0" name=material_code 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=5 alignment="0" tabsequence=32766 border="0" color="0" x="2094" y="8" height="64" width="425" format="[general]" htmlDAT*.valueishtml="0" name=priority 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" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" netscapelayers="0" ) DAT*1) dw_material.Sort() dw_material.SetRedraw(TRUE) end if else MessageBox('Emittants', 'Please select one or more material groups') end if end event type dw_material from u_pollutant`dw_material within u_pollutant_ee end type type st_1 from u_pollutant`st_1 within u_pollutant_ee end type type gb_1 from u_pollutant`gb_1 within u_pollutant_ee end type DAT* E @@ @T 1@"  8 2  2  xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorsortedvscrollbaritem DAT*borderstylet,n d "+2<G@PZatl 1 ] ond  E@ DAT*@@ @ 1 2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle 4 D")3>GQDAT*[c h] o4D @  @2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle DAT* @")3>GQ[c h] o@ @  @DAT*2  2 w xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolorenabledtextfocusrectangle l D")3>GQ[c h] olDDAT* @  @ :F@@8$($0$89}P$`9}t$:W@)8Z$1<$$$)8$/@/81}DAT*$9}$ 9},5t1,5$4 R p <Zd ::message5@j cbx_log_fileFPchecked FP sle_log_file@=FenabledXcb_browseh.0triggerevent |ii_log_filePuo_tl5;uo_emis!Puof_end_log9PPFP @=FXDAT* ( 0 8 P ` t               "P"2  +clickedtypeil2 d xywidthheighttabordertextsizeweightfontpitchfontfamilyfacenametextcolorbackcolor  @P"+2DAT*<GPZ] o@P  @ @@VU"2  2 ` xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackDAT*colortext  [p")3>GQ[ ] o[p @ @ @2  2 h DAT* visiblexywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortext.IT!*1;FOYc ] .IT @DAT* @ @2  2 ` xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortext%  IT")3>GQ[& ] o%ITDAT* @ @& @2  2 ` xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortext%  Ip")3>GQDAT*[9 ] o%Ip @ @9 @2  2 ` xywidthheighttextsizeweightfontpitchfontfamilyfacenametextcolorbackcolortext  %"DAT*)3>GQ[> ] o% @ @> @%W8($80)\88dz8e06@8$,/)8$DAT*1)8,51,5$@T z d8 ancestorreturnvaluels_errdwicsqlca::messaged # (/@=.5@j8 constructordw_input_ref_codedLXref_code_t.text = 'Input Reference:'modifyzUdwModify dw_input_ref_code failedLXsettransobject^LXinsertrow(( \ DAT*     1W8(800L8T0t8|080,51,5$:Tnd0 +row+dwoancestorreturnvalue::messageP 6&5@j( itemfocuschangedis_child_namecodeis_validation_tableRef5"rap_referDAT*ence_codesis_msg_nameh Column - Input Referenceis_msg_text!Sorry! Not a valid reference code( L t   %X1XL%OP-/10.2 ' +constructor+itemfocuschanged(typerede f w2 ? xywidthheighttaborderdataobjectborderlivescrolln  pDAT*"Q - 4 ] onp @ Q    @ 6 _U%Lvt\1T %W8DAT* $,/)88@$1)T8\$8d)t81<$688z%@8,51,5$,/)8)8,5:1H,5 $8 Z   d7 ancestorreturnvaluels_errdwcsqlca::messaged # '/@DAT*=-5@jX constructordw_ref_codeMYsettransobject_^(MYinsertrow(HMYcodegetchildoititle -| Application Error: Reference Code - Not a DataWindowChild. Contact your technical support.(retrieveal| 8 @ T \ t       1W8(800L8T0t8|DAT*080,51,5$:Tnd0 +row+dwoancestorreturnvalue::messageP 6&5@j( itemfocuschangedis_child_namecodeis_validation_tablense5"rap_reference_codesis_msg_nameh Column - Reference Codeis_msg_text!Sorry! Not a valid reference code,( L t  DAT* %Y1YL%OP-/10.2 ' +constructor+itemfocuschanged(typedem u_n 2 ? xywidthheighttaborderdataobjectborderlivescrolln  p"Q - 4 ] onp @DAT* Q    @ 6 _U%Lvt1L%OP'-/10.2  2 " xywidthheighttaborderdn  DAT*p] onp @ m  6 \]8d  destroy^2  +destroyDAT*2 ) xywidthheighttaborderborderx  p"] o p @@ h 1    @   _ ` a b c d e 3DAT*B 3MW