@@ -564,7 +564,7 @@ def _load_tech_group_members(
564564 filtered_data : Sequence [tuple [object , ...]],
565565 ) -> None :
566566 """Loads members into the indexed set `tech_group_members`."""
567- model = TemoaModel ()
567+ model = self . model
568568 validator = self .viable_techs .members if self .viable_techs else None
569569 for group_name , tech in filtered_data :
570570 if validator is None or tech in validator :
@@ -582,7 +582,7 @@ def _load_time_season(
582582 """
583583 Loads time_season as a flat ordered set of season names.
584584 """
585- model = TemoaModel ()
585+ model = self . model
586586 if not filtered_data :
587587 logger .warning ('No time_season table found. Loading a single filler season "S".' )
588588 seasons_to_load : list [tuple [object , ...]] = [('S' ,)]
@@ -599,7 +599,7 @@ def _load_time_season_sequential(
599599 """
600600 Composite loader for time_season_sequential and its associated index sets.
601601 """
602- model = TemoaModel ()
602+ model = self . model
603603 if filtered_data :
604604 seg_frac_data = [
605605 (row [0 ], row [2 ]) for row in filtered_data
@@ -623,7 +623,7 @@ def _load_existing_capacity(
623623 Handles different queries for myopic vs. standard runs and also
624624 populates the `tech_exist` set.
625625 """
626- model = TemoaModel ()
626+ model = self . model
627627 cur = self .con .cursor ()
628628 mi = self .myopic_index
629629
@@ -652,7 +652,6 @@ def _load_existing_capacity(
652652 self ._load_component_data (data , model .vintage_exist , vintage_exist_data )
653653
654654 # Collect existing capacity data indices
655- self .viable_existing_techs = {row [1 ] for row in rows_to_load }
656655 self .viable_existing_rt = {(row [0 ], row [1 ]) for row in rows_to_load }
657656 self .viable_existing_rtv = {(row [0 ], row [1 ], row [2 ]) for row in rows_to_load }
658657
@@ -672,7 +671,7 @@ def _load_retired_existing_capacity(
672671 )
673672 return
674673
675- model = TemoaModel ()
674+ model = self . model
676675 cur = self .con .cursor ()
677676 mi = self .myopic_index
678677
@@ -701,12 +700,12 @@ def _load_lifetime_tech(
701700 filtered_data : Sequence [tuple [object , ...]],
702701 ) -> None :
703702 """Loads the lifetime_tech component."""
704- model = TemoaModel ()
703+ model = self . model
705704 cur = self .con .cursor ()
706705 rows_to_load = cur .execute ('SELECT region, tech, lifetime FROM lifetime_tech' ).fetchall ()
707706 rt_getter = itemgetter (0 , 1 )
708707 if self .viable_rt :
709- valid_rt = self .viable_rt .members | self .viable_existing_rt
708+ valid_rt = self .viable_rt .member_tuples | self .viable_existing_rt
710709 rows_to_load = [item for item in rows_to_load if rt_getter (item ) in valid_rt ]
711710 self ._load_component_data (data , model .lifetime_tech , rows_to_load )
712711
@@ -717,7 +716,7 @@ def _load_lifetime_process(
717716 filtered_data : Sequence [tuple [object , ...]],
718717 ) -> None :
719718 """Loads the lifetime_process component."""
720- model = TemoaModel ()
719+ model = self . model
721720 cur = self .con .cursor ()
722721 mi = self .myopic_index
723722
@@ -743,7 +742,7 @@ def _load_lifetime_survival_curve(
743742 filtered_data : Sequence [tuple [object , ...]],
744743 ) -> None :
745744 """Loads the lifetime_survival_curve component."""
746- model = TemoaModel ()
745+ model = self . model
747746 cur = self .con .cursor ()
748747 mi = self .myopic_index
749748
@@ -771,7 +770,7 @@ def _load_global_discount_rate(
771770 filtered_data : Sequence [tuple [object , ...]],
772771 ) -> None :
773772 """Loads the required singleton global_discount_rate."""
774- model = TemoaModel ()
773+ model = self . model
775774 if filtered_data :
776775 data [model .global_discount_rate .name ] = {None : cast ('float' , filtered_data [0 ][0 ])}
777776 else :
@@ -787,7 +786,7 @@ def _load_default_loan_rate(
787786 filtered_data : Sequence [tuple [object , ...]],
788787 ) -> None :
789788 """Loads the optional singleton default_loan_rate."""
790- model = TemoaModel ()
789+ model = self . model
791790 if filtered_data :
792791 data [model .default_loan_rate .name ] = {None : cast ('float' , filtered_data [0 ][0 ])}
793792
@@ -799,7 +798,7 @@ def _load_efficiency(
799798 filtered_data : Sequence [tuple [object , ...]],
800799 ) -> None :
801800 """Loads the main efficiency parameter, which is pre-calculated."""
802- model = TemoaModel ()
801+ model = self . model
803802 self ._load_component_data (data , model .efficiency , self .efficiency_values )
804803
805804 def _load_linked_techs (
@@ -832,7 +831,7 @@ def _load_ramping_down(
832831 filtered_data : Sequence [tuple [object , ...]],
833832 ) -> None :
834833 """Composite loader for ramp_down_hourly and its index set `tech_downramping`."""
835- model = TemoaModel ()
834+ model = self . model
836835 self ._load_component_data (data , model .ramp_down_hourly , filtered_data )
837836 if filtered_data :
838837 tech_data = sorted ({(row [1 ],) for row in filtered_data })
@@ -848,7 +847,7 @@ def _load_ramping_up(
848847 filtered_data : Sequence [tuple [object , ...]],
849848 ) -> None :
850849 """Composite loader for ramp_up_hourly and its index set `tech_upramping`."""
851- model = TemoaModel ()
850+ model = self . model
852851 self ._load_component_data (data , model .ramp_up_hourly , filtered_data )
853852 if filtered_data :
854853 tech_data = sorted ({(row [1 ],) for row in filtered_data })
@@ -864,7 +863,7 @@ def _load_rps_requirement(
864863 filtered_data : Sequence [tuple [object , ...]],
865864 ) -> None :
866865 """Handles deprecation warning for renewable_portfolio_standard."""
867- model = TemoaModel ()
866+ model = self . model
868867 self ._load_component_data (data , model .renewable_portfolio_standard , filtered_data )
869868 if filtered_data :
870869 logger .warning (
0 commit comments