Code Duplication    Length = 14-14 lines in 2 locations

src/oemof/solph/components/_generic_storage.py 2 locations

@@ 2221-2234 (lines=14) @@
2218
                    )
2219
2220
        for n in self.INVESTSTORAGES:
2221
            if valid_sequence(n.storage_costs, len(m.TIMESTEPS)):
2222
                # We actually want to iterate over all TIMEPOINTS except the
2223
                # 0th. As integers are used for the index, this is equicalent
2224
                # to iterating over the TIMESTEPS with one offset.
2225
                if not m.TSAM_MODE:
2226
                    for t in m.TIMESTEPS:
2227
                        storage_costs += (
2228
                            self.storage_content[n, t + 1] * n.storage_costs[t]
2229
                        )
2230
                else:
2231
                    for t in m.TIMESTEPS_ORIGINAL:
2232
                        storage_costs += (
2233
                            self.storage_content[n, t + 1]
2234
                            * n.storage_costs[t + 1]
2235
                        )
2236
2237
        self.storage_costs = Expression(expr=storage_costs)
@@ 783-796 (lines=14) @@
780
        storage_costs = 0
781
782
        for n in self.STORAGES:
783
            if valid_sequence(n.storage_costs, len(m.TIMESTEPS)):
784
                # We actually want to iterate over all TIMEPOINTS except the
785
                # 0th. As integers are used for the index, this is equicalent
786
                # to iterating over the TIMESTEPS with one offset.
787
                if not m.TSAM_MODE:
788
                    for t in m.TIMESTEPS:
789
                        storage_costs += (
790
                            self.storage_content[n, t + 1] * n.storage_costs[t]
791
                        )
792
                else:
793
                    for t in m.TIMESTEPS_ORIGINAL:
794
                        storage_costs += (
795
                            self.storage_content[n, t + 1]
796
                            * n.storage_costs[t + 1]
797
                        )
798
799
        self.storage_costs = Expression(expr=storage_costs)