227 lines
4.6 KiB
Plaintext
227 lines
4.6 KiB
Plaintext
drop function if exists mmt_staging2.fn_PTO_report_ODS;
|
|
CREATE OR REPLACE FUNCTION mmt_staging2.fn_PTO_report_ODS()
|
|
RETURNS void AS $$
|
|
begin
|
|
|
|
SET search_path TO mmt_staging2;
|
|
|
|
insert into mmt_ods.test_instance_tractor_info
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
tractor_engine_hp,
|
|
configuration,
|
|
fip_type,
|
|
steering_type,
|
|
transmission_type,
|
|
wheel_drive_type
|
|
)
|
|
select
|
|
client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,tractor_HP::int,configuration,FIP_type,steering_type,transmission_type,wheel_drive_type
|
|
from
|
|
mmt_staging2.PTO_report_tractor_specs_block;
|
|
|
|
insert into mmt_ods.test_instance
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model
|
|
)
|
|
select
|
|
client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model
|
|
from
|
|
mmt_staging2.PTO_report_tractor_specs_block;
|
|
|
|
insert into mmt_ods.test_instance_engine_info
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
rated_rpm,
|
|
engine_to_pto_ratio_540_pto
|
|
)
|
|
select
|
|
client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,rated_rpm::int,engine_to_pto_ratio
|
|
from mmt_staging2.PTO_report_tractor_specs_block;
|
|
|
|
|
|
/*block */
|
|
|
|
insert into mmt_ods.PTO_Perf_Report_Summary
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
pto_category ,
|
|
pto_sub_category ,
|
|
power_kw,
|
|
speed_rpm_pto ,
|
|
speed_rpm_engine ,
|
|
fuel_consumption_ltr_per_hr ,
|
|
fuel_consumption_kg_per_h ,
|
|
sfc_kg_per_kwh ,
|
|
specifc_energy_kwh_per_ltr
|
|
)
|
|
|
|
select
|
|
client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,
|
|
c2,
|
|
c3,
|
|
c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric
|
|
from mmt_staging2.PTOBST_RPT_PTO_performance_report_block where ods_record=1
|
|
order by rank;
|
|
|
|
|
|
/*block */
|
|
insert into mmt_ods.PTO_Perf_Report_Details
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
ambient_type,
|
|
no_load_max_engine_speed_rpm,
|
|
equi_crankshaft_torque_at_max_power_nm,
|
|
max_equi_crankshaft_torque_nm,
|
|
engine_speed_at_max_equi_crankshaft_torque_rpm,
|
|
pct_backup_torque,
|
|
pct_smoke_level_max_light_absorption_coef_per_mtr,
|
|
range_of_atm_conditions_temp_c,
|
|
range_of_atm_conditions_pressure_kpa,
|
|
range_of_atm_conditions_rel_humidity_pct
|
|
)
|
|
select
|
|
client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,
|
|
c3,
|
|
c4::int,
|
|
c5::numeric,
|
|
c6::numeric,c7::int,c8::numeric,
|
|
c9::numeric,c10,c11,c12
|
|
from mmt_staging2.PTOBST_RPT_MMTKeyword1_block
|
|
where ods_record=1;
|
|
|
|
/* block */
|
|
|
|
insert into mmt_ods.PTO_Perf_Report_Details
|
|
(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
ambient_type,
|
|
max_temp_engine_oil_c,
|
|
max_temp_coolant_water_c,
|
|
max_temp_fuel_c,
|
|
max_temp_air_intake_c,
|
|
max_temp_exhaust_gas_c,
|
|
pressure_at_max_power_intake_air_kpa,
|
|
pressure_at_max_power_exhst_gas_bfr_turbo_charger_kpa,
|
|
consumptions_lub_oil_gkwh,
|
|
consumptions_coolant_water_pct_of_total_coolant_capacity
|
|
)
|
|
|
|
select client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,
|
|
c3,
|
|
c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,c11::numeric,c12::numeric
|
|
from mmt_staging2.PTOBST_RPT_MMTKeyword2_block
|
|
where ods_record=1 and c3='High Ambient';
|
|
|
|
update mmt_ods.PTO_Perf_Report_Details a
|
|
set
|
|
max_temp_engine_oil_c=c4::numeric,
|
|
max_temp_coolant_water_c=c5::numeric,
|
|
max_temp_fuel_c=c6::numeric,
|
|
max_temp_air_intake_c=c7::numeric,
|
|
max_temp_exhaust_gas_c=c8::numeric,
|
|
pressure_at_max_power_intake_air_kpa=c9::numeric,
|
|
pressure_at_max_power_exhst_gas_bfr_turbo_charger_kpa=c10::numeric,
|
|
consumptions_lub_oil_gkwh=c11::numeric,
|
|
consumptions_coolant_water_pct_of_total_coolant_capacity=c12::numeric
|
|
from mmt_staging2.PTOBST_RPT_MMTKeyword2_block b
|
|
where a.ambient_type=b.c3
|
|
and a.ambient_type='Natural Ambient' and ods_record=1;
|
|
|
|
/* block */
|
|
|
|
insert into mmt_ods.PTO_Perf_Test_Observations(
|
|
client_id,
|
|
function_id,
|
|
test_file_ref_no,
|
|
test_file_format,
|
|
test_file_sheet_format,
|
|
tractor_make,
|
|
tractor_model,
|
|
srl_no,
|
|
characteristic,
|
|
category_evaluative_or_non_evaluative,
|
|
requirements_as_per_is_12207_2008,
|
|
values_declared_by_the_applicant_d_rqmt,
|
|
as_observed,
|
|
whether_meets_the_requirements_yn
|
|
|
|
)
|
|
select client_id,
|
|
function_id,
|
|
file_syspk,
|
|
file_format,
|
|
sheet_mnemonic,
|
|
make,model,c3,c4,c7,c8,c10::numeric,c11::numeric,c12
|
|
from mmt_staging2.PTOBST_RPT_PTO_Performance_Test_Observations_Summary_block
|
|
where rank in (3,4) and ods_record=1
|
|
;
|
|
|
|
end
|
|
$$ LANGUAGE plpgsql; |