From f60da78022bbcaccf4d78b528ccc8d39cede7b92 Mon Sep 17 00:00:00 2001 From: aalfonsi Date: Tue, 10 Oct 2023 16:10:06 -0600 Subject: [PATCH] Closes #17 --- src/CashFlows.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CashFlows.py b/src/CashFlows.py index 098e7179b..e07ca3e70 100644 --- a/src/CashFlows.py +++ b/src/CashFlows.py @@ -1101,11 +1101,19 @@ def calculateCashflow(self, variables, lifetimeCashflows, lifetime, verbosity): ## FIXME what if I have set the values already? # get variable values, if needed need = {'alpha': self._alpha, 'driver': self._driver} + # load alpha, driver from variables if need be need = self.loadFromVariables(need, variables, lifetimeCashflows, lifetime) # for Capex, use m * alpha * (D/D')^X alpha = need['alpha'] driver = need['driver'] + # check if not-zero alpha > 1 + maskAlpha = np.where(alpha != 0.0, )[0] + if len(maskAlpha) > 1: + if len(np.where(driver != 0.0, )[0]) == 1: + val = driver[np.where(driver != 0.0, )] + driver[maskAlpha] = val + reference = self.getParam('reference') if reference is None: reference = 1.0