.. _cashflowmodel-py:
######################
cashflowmodel.py
######################
>>> from simo.builder.modelbase.modelbase import ModelbaseDef
>>> tdf = open('../../simulator/xml/schemas/Typedefs_SIMO.xsd')
>>> typedef = tdf.read()
>>> tdf.close()
>>> sf = open('../../simulator/xml/schemas/cash_flow_modelbase.xsd')
>>> schema = sf.read()
>>> sf.close()
>>> xml = u'''
...
... random_prices
... cashflowmodels.py
... python
...
...
... timber_prices
...
...
...
...
... Testname
... Testlevel
...
...
...
...
... '''
>>> class Lexicon(object):
... def __init__(self):
... self.models = {}
... def get_variable_ind(self, level, variable, active=False):
... return (1, 1)
... def get_level_ind(self, level):
... return 1
... def add_model(self, mtype, mname):
... if mtype not in self.models:
... self.models[mtype] = set()
... self.models[mtype].add(mname)
>>> mb = ModelbaseDef(typedef)
>>> mb.schema = ('cash_flow', schema)
>>> mb.xml = ('testxml', xml, Lexicon(), '', 'cash_flow')
>>> mb.xml['cash_flow']['testxml'][:16]
u'>> cf = mb.obj['cash_flow']['testxml']['random_prices']
>>> cf.name
'random_prices'
>>> cf.language
'python'
>>> cf.variables
[(1, 1)]
****************************************
class CashFlowModelParam(object):
****************************************
Variable values for cash flow model, defined in modelchain.
def __init__(self, ns, elem, lexicon, model):
=============================================