.. _cash-flow-model-library: Cash flow model library ======================= Besides cash flow tables, costs and incomes associated with operations or tree value models can also be defined with cash flow models; i.e., models predicting the unit price changes over time based on some variables. All cash flow models have the same set of input parameters: - *table* -- cash flow table object (for details, see simo.builder.modelbase.cashflowtable.py) - *date* -- current date as datetime object - *variables* -- cash flow model input variables - *parameters* -- cash flow model parameters - *errors* -- container for returning errors from the model Below is an example of a stochastic timber assortment price model:: def random_prices(table, date, variables, parameters, errors): ret = True index = (1,2) # the initial year is now fixed to 2008 n = date.year - 2008 + 1 # load the prices and compute standardized delta (increment), simulate # prices for the next n years prices, delta_st = _load_prices() P = _simulate(prices, delta_st, n, 2) # store the prices of the last year table.set_values(index, PINELOG, P[-1,0]) table.set_values(index, SPRUCELOG, P[-1,1]) table.set_values(index, BIRCHLOG1, P[-1,2]) table.set_values(index, BIRCHLOG2, P[-1,2]) table.set_values(index, PINEPULP, P[-1,3]) table.set_values(index, SPRUCEPULP, P[-1,4]) table.set_values(index, BIRCHPULP1, P[-1,5]) table.set_values(index, BIRCHPULP2, P[-1,5]) return ret