Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 2271-2284 (lines=14) @@
2268
                    )
2269
2270
        for n in self.INVESTSTORAGES:
2271
            if valid_sequence(n.storage_costs, len(m.TIMESTEPS)):
2272
                # We actually want to iterate over all TIMEPOINTS except the
2273
                # 0th. As integers are used for the index, this is equicalent
2274
                # to iterating over the TIMESTEPS with one offset.
2275
                if not m.TSAM_MODE:
2276
                    for t in m.TIMESTEPS:
2277
                        storage_costs += (
2278
                            self.storage_content[n, t + 1] * n.storage_costs[t]
2279
                        )
2280
                else:
2281
                    for t in m.TIMESTEPS_ORIGINAL:
2282
                        storage_costs += (
2283
                            self.storage_content[n, t + 1]
2284
                            * n.storage_costs[t + 1]
2285
                        )
2286
2287
        self.storage_costs = Expression(expr=storage_costs)
@@ 833-846 (lines=14) @@
830
        storage_costs = 0
831
832
        for n in self.STORAGES:
833
            if valid_sequence(n.storage_costs, len(m.TIMESTEPS)):
834
                # We actually want to iterate over all TIMEPOINTS except the
835
                # 0th. As integers are used for the index, this is equicalent
836
                # to iterating over the TIMESTEPS with one offset.
837
                if not m.TSAM_MODE:
838
                    for t in m.TIMESTEPS:
839
                        storage_costs += (
840
                            self.storage_content[n, t + 1] * n.storage_costs[t]
841
                        )
842
                else:
843
                    for t in m.TIMESTEPS_ORIGINAL:
844
                        storage_costs += (
845
                            self.storage_content[n, t + 1]
846
                            * n.storage_costs[t + 1]
847
                        )
848
849
        self.storage_costs = Expression(expr=storage_costs)