added new files from jagadish and vignesh folders

This commit is contained in:
Deepthi
2021-03-29 13:25:33 +05:30
parent 7c647da30b
commit aa44ad9d0a
50 changed files with 13665 additions and 5835 deletions

104
MMT_SQL/ods/PTO-PHA_ods.txt Normal file
View File

@@ -0,0 +1,104 @@
drop function if exists mmt_staging2.fn_PTO_PHA_ODS;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_PTO_PHA_ODS()
RETURNS void AS $$
begin
/*************************************************************
Function Name:fn_PTO_PHA_ODS
Function Desc: This function populates data into ODS blocks
File Format: PTOBST
Sheet Format: PTOBST_PHA
Creation Date: March 21 2021
Updation Date:
Author: compegence team
Function Call: select mmt_staging2.fn_PTO_PHA_ODS()
***************************************************************/
SET search_path TO mmt_staging2;
insert into mmt_ods.PTO_Key_Perf_Parameters
(client_id,function_id,test_condtion,test_file_ref_no,
tractor_model,tractor_make,pto_gear_ratio,specific_gravity_of_fuel,dyno_constant,pto_power_hp,
pto_sfc_gm_per_hp_hr,backup_torque_pct,engine_oil_temp_c,coolant_temp_c,rated_engine_speed_rpm,
engine_high_idle_speed_rpm,engine_low_idle_speed_rpm,maximum_equi_crankshaft_torque_nm,
equi_crankshaft_torque_at_max_power_nm,ambient_presure_mm_of_hg,related_humidity_pct,
exhaust_temperature_c,back_pressure_mm_of_hg,engine_oil_pressure_bar,test_engineer,test_bed,
location_name,total_run_hrs,test_date,test_file_format,test_file_sheet_format
)
select
client_id,function_id,test_condition,file_syspk,
model,make,pto_gear_ratio::numeric,specific_gravity_of_fuel::numeric,dyno_constant::numeric,pto_power_hp::numeric,
pto_sfc_gm_hp::numeric,backup_torque::numeric,engine_oil_temp::numeric,coolant_temp::numeric,
rated_engine_speed::numeric,engine_high_idle_speed::numeric,engine_low_idle_speed::numeric,
maximum_equ_crankshaft::numeric,equ_crankshaft_torque_at_maximum_power::numeric,
ambient_pressure_mm_of_hg::numeric,relative_humidity::numeric,
exhaust_temperature::numeric,back_pressure::numeric,engine_oil_pressure_bar::numeric,test_engineer,test_bed,
place,total_run_hrs::int, to_Date(test_Date, 'DD-MM-YYYY'),file_format,sheet_mnemonic
from mmt_staging2.PTOBST_PHA_key_perfomrance_parameters_block
where ods_record=1;
/* block */
insert into mmt_ods.PTO_Perf_Results
(
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
tractor_make,
tractor_model,
pto_test_type,serial_number,speed_engine_rpm,
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
pressure_lub_oil_bar,rh_pct
)
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
test_condition,c2,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
c11::numeric,
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
from mmt_staging2.PTOBST_PHA_2Hrs_max_power_test_block
where ods_record=1 ;
/* block */
insert into mmt_ods.PTO_Perf_Results
(
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
tractor_make,
tractor_model,
pto_test_type,serial_number,speed_engine_rpm,
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
pressure_lub_oil_bar,rh_pct
)
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
test_condition,c2,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
c11::numeric,
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
from mmt_staging2.PTOBST_PHA_varying_speed_test_block
where ods_record=1 ;
/* block */
insert into mmt_ods.pto_engine_oil_consumption
(
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
tractor_make,
tractor_model,
srl_no,
oil_consumption_gm_per_hr,
oil_consumption_pct_of_fuel_consumption
)
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
c2::int,c3::numeric,c5::numeric
from mmt_staging2.PTOBST_PHA_Engine_oil_consumption_block
where ods_record=1;
end
$$ LANGUAGE plpgsql;