Open esaber76 opened 8 months ago
Need screenshots from 1.0. What are the mechanics for doing the changes. Scott and Dwayne will meet to discuss further.
Notes:
Note that changes refer to differences compared with the Official (CAMDECMPS) USC, not the last USC saved in the Workspace (CAMDECMPSWKS).
Updating an Existing (in Official) USC:
Adding a New USC (compared to Official):
USC Affects on MP Notes:
Get UNIT_STACK_CONFIGURATION (USC) and UNIT data to combine into Monitoring Plans:
Note that the queries should run in the following order and for a specific plant (facility) to update the Working Table.
Common Stacks and Pipes
select fac.Oris_Code,
fac.Facility_Name,
extract( year from usc.Begin_Date ) as Begin_Year,
extract( quarter from usc.Begin_Date ) as Begin_Quarter,
extract( year from usc.End_Date ) as End_Year,
extract( quarter from usc.End_Date ) as End_Quarter,
( stp.Stack_Name || ', ' || string_agg( unt.Unitid, ', ' order by unt.Unitid ) ) as Location_List
from camd.PLANT fac
join camd.UNIT unt
on unt.Fac_Id = fac.Fac_Id
join camdecmpswks.UNIT_STACK_CONFIGURATION usc
on usc.Unit_Id = unt.Unit_Id
join camdecmpswks.STACK_PIPE stp
on stp.Stack_Pipe_Id = usc.Stack_Pipe_Id
and stp.Stack_Name like 'C%'
where fac.Oris_Code in ( 3, 641, 708, 994, 1356, 1893, 2866, 2876, 2878, 3407, 10307, 52130, 55284 )
group
by fac.Oris_Code,
fac.Facility_Name,
extract( year from usc.Begin_Date ),
extract( quarter from usc.Begin_Date ),
extract( year from usc.End_Date ),
extract( quarter from usc.End_Date ),
stp.Stack_Name
order
by Oris_Code,
Stack_Name,
Begin_Year,
Begin_Quarter,
End_Year,
End_Quarter;
Multiple Stacks (and Pipes)
select fac.Oris_Code,
fac.Facility_Name,
extract( year from usc.Begin_Date ) as Begin_Year,
extract( quarter from usc.Begin_Date ) as Begin_Quarter,
extract( year from usc.End_Date ) as End_Year,
extract( quarter from usc.End_Date ) as End_Quarter,
( string_agg( stp.Stack_Name, ', ' order by stp.Stack_Name ) || unt.Unitid || ', ' ) as Location_List
from camd.PLANT fac
join camd.UNIT unt
on unt.Fac_Id = fac.Fac_Id
join camdecmpswks.UNIT_STACK_CONFIGURATION usc
on usc.Unit_Id = unt.Unit_Id
join camdecmpswks.STACK_PIPE stp
on stp.Stack_Pipe_Id = usc.Stack_Pipe_Id
and stp.Stack_Name like 'M%'
where fac.Oris_Code in ( 3, 641, 708, 994, 1356, 1893, 2866, 2876, 2878, 3407, 10307, 52130, 55284 )
group
by fac.Oris_Code,
fac.Facility_Name,
extract( year from usc.Begin_Date ),
extract( quarter from usc.Begin_Date ),
extract( year from usc.End_Date ),
extract( quarter from usc.End_Date ),
unt.Unitid
order
by Oris_Code,
Unitid,
Begin_Year,
Begin_Quarter,
End_Year,
End_Quarter;
Units Alone
select lst.Oris_Code,
lst.Facility_Name,
extract( year from lst.Begin_Date ) as Begin_Year,
extract( quarter from lst.Begin_Date ) as Begin_Quarter,
extract( year from lst.End_Date ) as End_Year,
extract( quarter from lst.End_Date ) as End_Quarter,
lst.Location_List
from (
select fac.Oris_Code,
fac.Facility_Name,
(
select max( mth.Begin_Date)
from camdecmpswks.MONITOR_LOCATION loc
join camdecmps.MONITOR_METHOD mth
on mth.Mon_Loc_Id = loc.Mon_Loc_Id
where loc.Unit_Id = unt.Unit_Id
) as Begin_Date,
(
select min( uos.Begin_Date)
from camd.UNIT_OP_STATUS uos
where uos.Unit_Id = unt.Unit_Id
and uos.Op_Status_Cd = 'RET'
) as End_Date,
unt.Unitid as Location_List
from camd.PLANT fac
join camd.UNIT unt
on unt.Fac_Id = fac.Fac_Id
where fac.Oris_Code in ( 3, 641, 708, 994, 1356, 1893, 2866, 2876, 2878, 3407, 10307, 52130, 55284 )
) lst
order
by Oris_Code,
Location_List,
Begin_Year,
Begin_Quarter,
End_Year,
End_Quarter;
Main Logic:
/* pseudocode is 1 based, not 0 based. */
currentCursor := workingTable ordered by IdentifierKey
currentRecord := currentCursor.Fetch
while ( currentRecord.Exists )
compareCursor := workingTable where ( IdentifierKey > currentRecord.IdentifierKey ) ordered by IdentifierKey
compareRecord := compareCursor.Fetch
mergeOccurred := false
while ( compareRecord.Exists ) and ( not mergeOccurred )
if ( currentRecord.Locations ∩ compareRecord.Locations ≠ Ø ) and ( currentRecord.Period ∩ compareRecord.Period ≠ Ø )
{ Add workingTable rows based on merge logic, which will replace the currentRecord and compareRecord rows with the next IdentifierKeys }
workingTable.Delete( compareRecord.IdentifierKey )
workingTable.Delete( currentRecord.IdentifierKey )
mergeOccurred := true
else
/* Get the next compare row if a merge did not occur. */
compareRecord := compareCursor.Fetch
end if
end while
if ( not mergeOccurred )
/* Current was not merged so move to the next row as the current row. */
currentRecord := currentCursor.Fetch
else
/* Recreate the currentCursor to account for deletions and inserts, and start with the first entry */
currentCursor := workingTable ordered by IdentifierKey
currentRecord := currentCursor.Fetch
end if
end while
combinedLocations = currentRecord.Locations ∪ compareRecord.Locations
case
when ( compareRecord.Period.Begin = currentRecord.Period.Begin ) and ( compareRecord.Period.End = currentRecord.Period.End )
workingTable <= [ combinedLocations, currentRecord.Period.Begin, currentRecord.Period.End ]
when ( compareRecord.Period.Begin = currentRecord.Period.Begin ) and ( compareRecord.Period.End < currentRecord.Period.End )
if ( currentRecord.Locations = compareRecord.Locations )
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, currentRecord.Period.End ]
else
workingTable <= [ combinedLocations, compareRecord.Period.Begin, compareRecord.Period.End ]
workingTable <= [ currentRecord.Locations, compareRecord.Period.End + 1, currentRecord.Period.End ]
end if
when ( compareRecord.Period.Begin = currentRecord.Period.Begin ) and ( compareRecord.Period.End > currentRecord.Period.End )
if ( currentRecord.Locations = compareRecord.Locations )
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, compareRecord.Period.End ]
else
workingTable <= [ combinedLocations, currentRecord.Period.Begin, currentRecord.Period.End ]
workingTable <= [ compareRecord.Locations, currentRecord.Period.End + 1, compareRecord.Period.End ]
end if
when ( compareRecord.Period.Begin < currentRecord.Period.Begin ) and ( compareRecord.Period.End = currentRecord.Period.End )
if ( currentRecord.Locations = compareRecord.Locations )
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, compareRecord.Period.End ]
else
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, currentRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, currentRecord.Period.Begin, currentRecord.Period.End ]
end if
when ( compareRecord.Period.Begin > currentRecord.Period.Begin ) and ( compareRecord.Period.End = currentRecord.Period.End )
if ( currentRecord.Locations = compareRecord.Locations )
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, currentRecord.Period.End ]
else
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, compareRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, compareRecord.Period.Begin, compareRecord.Period.End ]
end if
when ( compareRecord.Period.Begin < currentRecord.Period.Begin ) and ( compareRecord.Period.End < currentRecord.Period.End )
case
when ( compareRecord.Locations = combinedLocations ) and ( currentRecord.Locations = combinedLocations )
workingTable <= [ combinedLocations, compareRecord.Period.Begin, currentRecord.Period.End ]
when ( compareRecord.Locations = combinedLocations )
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, compareRecord.Period.End ]
workingTable <= [ currentRecord.Locations, compareRecord.Period.End + 1, currentRecord.Period.End ]
when ( currentRecord.Locations = combinedLocations )
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, currentRecord.Period.Begin - 1 ]
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, currentRecord.Period.End ]
else
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, currentRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, currentRecord.Period.Begin, compareRecord.Period.End ]
workingTable <= [ currentRecord.Locations, compareRecord.Period.End + 1, currentRecord.Period.End ]
end case
when ( compareRecord.Period.Begin > currentRecord.Period.Begin ) and ( compareRecord.Period.End > currentRecord.Period.End )
case
when ( currentRecord.Locations = combinedLocations ) and ( compareRecord.Locations = combinedLocations )
workingTable <= [ combinedLocations, currentRecord.Period.Begin, compareRecord.Period.End ]
when ( currentRecord.Locations = combinedLocations )
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, currentRecord.Period.End ]
workingTable <= [ compareRecord.Locations, currentRecord.Period.End + 1, compareRecord.Period.End ]
when ( compareRecord.Locations = combinedLocations )
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, compareRecord.Period.Begin - 1 ]
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, compareRecord.Period.End ]
else
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, compareRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, compareRecord.Period.Begin, currentRecord.Period.End ]
workingTable <= [ compareRecord.Locations, currentRecord.Period.End + 1, compareRecord.Period.End ]
end case
when ( compareRecord.Period.Begin < currentRecord.Period.Begin ) and ( compareRecord.Period.End > currentRecord.Period.End )
if ( compareRecord.Locations = combinedLocations )
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, compareRecord.Period.End ]
else
workingTable <= [ compareRecord.Locations, compareRecord.Period.Begin, currentRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, currentRecord.Period.Begin, currentRecord.Period.End ]
workingTable <= [ compareRecord.Locations, currentRecord.Period.End + 1, compareRecord.Period.End ]
end if
when ( compareRecord.Period.Begin > currentRecord.Period.Begin ) and ( compareRecord.Period.End < currentRecord.Period.End )
if ( currentRecord.Locations = combinedLocations )
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, currentRecord.Period.End ]
else
workingTable <= [ currentRecord.Locations, currentRecord.Period.Begin, compareRecord.Period.Begin - 1 ]
workingTable <= [ combinedLocations, compareRecord.Period.Begin, compareRecord.Period.End ]
workingTable <= [ currentRecord.Locations, compareRecord.Period.End + 1, currentRecord.Period.End ]
end if
end case
Existing "Ending" MP
New MP Reporting Frequency Rules
Although this example uses two units at a common stack, it could be unit program rows at a single unit, or the combinations of a number of unit program rows at a number of units.
MP Begin | MP End | U1 UMCB | U1 End | U1 OS Ind | U2 UMCB | U2 End | U2 OS Ind | Freq 1 | Freq 2 | Freq 3 | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
2022 Q1 | 1/1/2022 | 0 | 2022-01-01 | 0 | Q: 2022 Q1-> | ||||||
2022 Q1 | 2023 Q3 | 1/1/2022 | 0 | 2022-01-01 | 0 | Q: 2022 Q1- 2023 Q3 | |||||
2022 Q1 | 3/31/2022 | 0 | 2022-03-31 | 0 | Q: 2022 Q1-> | ||||||
2022 Q1 | 1/1/2022 | 0 | 2022-04-01 | 0 | Q: 2022 Q1-> | ||||||
2022 Q1 | 4/1/2022 | 0 | 2022-04-01 | 0 | Q: 2022 Q1-> | 1 | |||||
2022 Q1 | 1/1/2022 | 1 | 2022-01-01 | 1 | OS: 2022 Q1-> | ||||||
2022 Q1 | 2023 Q3 | 1/1/2022 | 1 | 2022-01-01 | 1 | OS: 2022 Q1- 2023 Q3 | |||||
2022 Q1 | 3/31/2022 | 1 | 2022-03-31 | 1 | OS: 2022 Q1-> | ||||||
2022 Q1 | 1/1/2022 | 1 | 2022-05-01 | 1 | OS: 2022 Q1-> | ||||||
2022 Q1 | 4/1/2022 | 1 | 2022-05-01 | 1 | Q: 2022 Q1 - 2022 Q1 | OS: 2022 Q2 -> | 1 | ||||
2022 Q2 | 5/1/2022 | 1 | 2022-07-01 | 1 | Q: 2022 Q1 - 2022 Q1 | OS: 2022 Q2 -> | |||||
2022 Q2 | 5/1/2022 | 1 | 2022-07-01 | 0 | Q: 2022 Q1 - 2022 Q1 | OS: 2022 Q2 - 2022 Q2 | Q: 2022 Q3 -> | ||||
2022 Q2 | 5/1/2022 | 0 | 2022-07-01 | 1 | Q: 2022 Q1 -> | 1 | |||||
2022 Q2 | 5/1/2022 | 1 | 2022-07-01 | 0 | Q: 2022 Q1 - 2022 Q1 | OS: 2022 Q2 - 2022 Q3 | Q: 2022 Q4 -> | ||||
2022 Q1 | 1/1/2022 | 1 | 2022-09-15 | 2024-05-16 | 0 | OS: 2022 Q1 - 2022 Q2 Q: 2022 Q3 - 2024 Q2 | OS: 2024 Q3 -> | ||||
2022 Q1 | 1/1/2022 | 0 | 2022-09-15 | 2024-05-16 | 1 | Q: 2022 Q1 -> |
Notes
ORIS Code | Facility Name | Facility Id | Notes |
---|---|---|---|
3 | Barry | 1 | Variety of MP |
641 | Gulf Clean Energy Center | 126 | Complex Changes |
708 | Hammond | 149 | Complex Changes |
994 | IPL - Petersburg Generating Station | 191 | Complex Changes |
1356 | Ghent | 272 | Problematic in ECMPS 1.0 |
1893 | Boswell Energy Center | 372 | Common Stack Created and Disbanded |
2866 | W H Sammis | 554 | Many Changes |
2876 | Kyger Creek | 558 | Split Common Stacks |
2878 | Bay Shore | 560 | Retire Common Stack and Split Unit |
3407 | Kingston | 650 | Complex with CS Combine |
6090 | Sherburne County | 814 | Retired Unit |
6264 | Mountaineer (1301) | 860 | Annual and OS Only Units |
10307 | Bellingham | 1092 | Common Pipe |
52130 | BP Whiting Business Unit | 7699 | Common Pipe (Inactive) |
55284 | Big Sandy Peaker Plant | 1398 | Commom Pipe Change |
The tables exist in both the CAMDECMPS (Official) and CAMDECMPSWKS (Workspace). The changes occur in the Workspace versions and are submitted to the Official versions.
Unit Stack Configuration Editing Requirements
There is not currently a way to add or end stack/pipe relationships.
Need the ability to modify a unit to stack/pipe connection's begin and end dates.After the changes above have been made, display the following and allow the user to accept or reject the changes.
Indication of whether there are submitted emissions that are no longer covered by the changed configuration.Note: Right now in 2.0, users are unable to delete records and would need to revert to official and start over.
Interface:
Other considerations:
Also Read the Following Comments