-
Notifications
You must be signed in to change notification settings - Fork 0
feature/refresh_emission_view_noxmasscems #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see changes needed in comments
mhv.FLOW_CALC_ADJUSTED_HRLY_VALUE AS ADJ_FLOW_USED, | ||
mhv.FLOW_MODC_CD AS FLOW_MODC, | ||
mhv.FLOW_PCT_AVAILABLE AS FLOW_PMA, | ||
dhv.CALC_PCT_MOISTURE AS PCT_H2O_USED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE #1: All the DHV.
aliases will need to be dhv.NOX_
since the original DHV alias joined on the NOX parameter...
INNER JOIN camdecmps.DERIVED_HRLY_VALUE DHV
ON DHV.HOUR_ID = HOD.HOUR_ID AND DHV.PARAMETER_CD = 'NOX'
dhv.CALC_PCT_MOISTURE AS PCT_H2O_USED, | ||
CASE | ||
WHEN (DHV.CALC_PCT_MOISTURE IS NOT NULL) THEN | ||
WHEN (dhv.CALC_PCT_MOISTURE IS NOT NULL) THEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see note #1
AND mhv.MON_LOC_ID = hod.MON_LOC_ID | ||
AND mhv.RPT_PERIOD_ID = hod.RPT_PERIOD_ID | ||
INNER JOIN camdecmps.MONITOR_FORMULA mf_HI | ||
ON mf_HI.MON_FORM_ID = dhv.MON_FORM_ID AND mf_HI.EQUATION_CD LIKE 'F-26%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original code used the DHV
alias which was the NOX
parameter vs the HI
parameter
INNER JOIN camdecmps.MONITOR_FORMULA MF
ON DHV.MON_FORM_ID = MF.MON_FORM_ID AND MF.EQUATION_CD LIKE 'F-26%'
ON DHV.HOUR_ID = H2O_MHV.HOUR_ID AND H2O_MHV.PARAMETER_CD = 'H2O' | ||
LEFT OUTER JOIN camdecmps.DERIVED_HRLY_VALUE H2O_DHV | ||
ON DHV.HOUR_ID = H2O_DHV.HOUR_ID AND H2O_DHV.PARAMETER_CD = 'H2O' | ||
mf.EQUATION_CD AS NOX_MASS_FORMULA_CD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mf
alias is undefined as you have mf_HI
alias below which is using the HI
parameter vs the NOX
parameter
INNER JOIN camdecmps.MONITOR_FORMULA mf_HI
ON mf_HI.MON_FORM_ID = dhv.MON_FORM_ID AND mf_HI.EQUATION_CD LIKE 'F-26%'
LEFT OUTER JOIN camdecmps.DERIVED_HRLY_VALUE H2O_DHV | ||
ON DHV.HOUR_ID = H2O_DHV.HOUR_ID AND H2O_DHV.PARAMETER_CD = 'H2O' | ||
mf.EQUATION_CD AS NOX_MASS_FORMULA_CD, | ||
dhv.ADJUSTED_HRLY_VALUE AS RPT_NOX_MASS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see note #1
ON DHV.HOUR_ID = H2O_DHV.HOUR_ID AND H2O_DHV.PARAMETER_CD = 'H2O' | ||
mf.EQUATION_CD AS NOX_MASS_FORMULA_CD, | ||
dhv.ADJUSTED_HRLY_VALUE AS RPT_NOX_MASS, | ||
dhv.CALC_ADJUSTED_HRLY_VALUE AS CALC_NOX_MASS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see note #1
…ipts into feature/5793_Refactor_Refresh_EV_DB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note the file comments and individual comments. In some cases the select statements for the inserts will not actually run, Mostly because of alias and column name issues, but in some cases because of columns not included in the pivotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script only joined to DERIVED_HRLY_VALUE once (HI) and MONITOR_HRLY_VALUE once (FLOW). The benefit of the pivot method is that it allows the multiple join on either table to become a single join. But since only one join is involved, this change would complicate the code with no benefit.
I believe that this change should be reverted.
hod.HR_LOAD as UNIT_LOAD, | ||
hod.LOAD_UOM_CD as LOAD_UOM, | ||
hod.HOUR_ID, | ||
dhv_HIT.MODC_CD as HI_MODC, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For any column with a "dhv_hit" alias the alias should be "dhv" and the "HIT_" should prefix the column name.
dhv_HIT.MODC_CD as HI_MODC,
dhv_HIT.ADJUSTED_HRLY_VALUE AS RPT_HEAT_INPUT,
dhv_HIT.CALC_ADJUSTED_HRLY_VALUE AS CALC_HEAT_INPUT,
dhv_HIT.MODC_CD as HI_MODC, | ||
dhv_HIT.ADJUSTED_HRLY_VALUE AS RPT_HEAT_INPUT, | ||
dhv_HIT.CALC_ADJUSTED_HRLY_VALUE AS CALC_HEAT_INPUT, | ||
dhv_SO2M.FUEL_CD as SO2M_FUEL_TYPE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For any column with a "dhv_so2m" alias the alias should be "dhv" and the "SO2M__" should prefix the column name.
dhv_SO2M.FUEL_CD as SO2M_FUEL_TYPE,
dhv_SO2M.ADJUSTED_HRLY_VALUE AS RPT_SO2_MASS,
dhv_SO2M.CALC_ADJUSTED_HRLY_VALUE AS CALC_SO2_MASS,
md_SO2R.DEFAULT_VALUE as SO2_EMISS_RATE, | ||
dhv_SO2M.ADJUSTED_HRLY_VALUE AS RPT_SO2_MASS, | ||
dhv_SO2M.CALC_ADJUSTED_HRLY_VALUE AS CALC_SO2_MASS, | ||
dhv_NOXM.FUEL_CD as NOXM_FUEL_TYPE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For any column with a "dhv_noxm" alias the alias should be "dhv" and the "NOXM__" should prefix the column name.
dhv_NOXM.OPERATING_CONDITION_CD,
dhv_NOXM.ADJUSTED_HRLY_VALUE as RPT_NOX_MASS,
dhv_NOXM.CALC_ADJUSTED_HRLY_VALUE as CALC_NOX_MASS,
END as NOX_EMISS_RATE, | ||
NOXM_DHV.ADJUSTED_HRLY_VALUE as RPT_NOX_MASS, | ||
NOXM_DHV.CALC_ADJUSTED_HRLY_VALUE as CALC_NOX_MASS, | ||
CO2M_DHV.FUEL_CD as CO2M_FUEL_TYPE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For any column with a "dhv_co2m" alias the alias should be "dhv" and the "CO2M__" should prefix the column name.
dhv_CO2M.FUEL_CD as CO2M_FUEL_TYPE,
dhv_CO2M.ADJUSTED_HRLY_VALUE as RPT_CO2_MASS,
dhv_CO2M.CALC_ADJUSTED_HRLY_VALUE as CALC_CO2_MASS,
AND dhv.MON_LOC_ID = hod.MON_LOC_ID | ||
AND dhv.RPT_PERIOD_ID = hod.RPT_PERIOD_ID | ||
JOIN camdecmps.MONITOR_SYSTEM ms_NOXR | ||
ON dhv_NOXR.MON_SYS_ID = ms_NOXR.MON_SYS_ID AND ms_NOXR.SYS_TYPE_CD='NOXE' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, note the general comment on this file, which affects this line.
Additionally, the MON_SYS_ID column was not included as a column in the camdecmps.get_derived_hourly_values_pivoted function. So that function will need to be updated to include MON_SYS_ID.
LEFT JOIN camdecmps.MONITOR_SYSTEM ms | ||
ON hff.MON_SYS_ID = ms.MON_SYS_ID | ||
LEFT JOIN camdecmps.MONITOR_SYSTEM ms_NOXR | ||
ON hpff_NOXR.MON_SYS_ID = ms_NOXR.MON_SYS_ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, note the general comment on this file, which affects this line.
Additionally, the MON_SYS_ID column was not included as a column in the camdecmps.get_hourly_param_fuel_flow_pivotedfunction. So that function will need to be updated to include MON_SYS_ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script only joined to DERIVED_HRLY_VALUE once (SO2). The benefit of the pivot method is that it allows the multiple joins on a table to become a single join. But since only one join is involved, this change would complicate the code with no benefit.
I believe that this change for DERIVED_HRLY_VALUE should be reverted despite any additional comments about DHV.
LEFT OUTER JOIN camdecmps.MONITOR_FORMULA AS mf | ||
ON hpff_SO2.MON_FORM_ID = mf.MON_FORM_ID | ||
LEFT OUTER JOIN camdecmps.MONITOR_FORMULA AS mf_SUMMATION | ||
ON dhv_SO2.MON_FORM_ID = mf_SUMMATION.MON_FORM_ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "dhv_SO2.MON_FORM_ID" reference should be "dhv.SO2_MON_FORM_ID".
LEFT OUTER JOIN camdecmps.MONITOR_SYSTEM ms | ||
ON hff.MON_SYS_ID = ms.MON_SYS_ID | ||
LEFT OUTER JOIN camdecmps.MONITOR_FORMULA AS mf | ||
ON hpff_SO2.MON_FORM_ID = mf.MON_FORM_ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "hpff_SO2.MON_FORM_ID" reference should be "hpff.SO2_MON_FORM_ID".
Ticket
Refactor Refresh Emissions Views Database Procedures
Change