iode.Simulation.model_simulate_SCC
- Simulation.model_simulate_SCC(self, from_period: str | Period, to_period: str | Period, pre_name: str = '_PRE', inter_name: str = '_INTER', post_name: str = '_POST')
Simulates a model previously decomposed into Strongly Connex Components (SCC) and reordered. It is intended to be called after the method
Simulation.model_calculate_SCC().To improve performance at simulation start-up, the simulation process has been divided into 2 stages. The first only deals with model reordering (see method
Simulation.model_calculate_SCC()), the second with simulation (see methodSimulation.model_simulate()).- Parameters:
- from_periodstr or Period
The starting period for the simulation.
- to_periodstr or Period
The ending period for the simulation.
- pre_namestr, optional
Name of the list representing the pre-recursive equations. Default to “_PRE”.
- inter_namestr, optional
Name of the list representing the interdependent equations. Default to “_INTER”.
- post_namestr, optional
Name of the list representing the post-recursive equations. Default to “_POST”.
Examples
>>> from iode import SAMPLE_DATA_DIR, equations, identities, lists, scalars, variables >>> from iode import Simulation >>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs") >>> identities.load(f"{SAMPLE_DATA_DIR}/fun.idt") >>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst") >>> scalars.load(f"{SAMPLE_DATA_DIR}/fun.scl") >>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var") >>> simu = Simulation()
Step 1 - Compute the Strongly Connex Components (SCC) decomposition
>>> simu.model_calculate_SCC(10); >>> lists["_PRE"] ['BRUGP', 'DTH1C', 'EX', 'ITCEE', ..., 'ZZF_', 'DTH1', 'PME', 'PMS', 'PMT'] >>> len(lists["_PRE"]) 31 >>> lists["_INTER"] ['PMAB', 'PXAB', 'ULCP', 'SSH3P', ..., 'YSSG', 'WCF_', 'ITEP', 'EXC', 'ITT'] >>> len(lists["_INTER"]) 204 >>> lists["_POST"] ['IFU', 'SSHFF', 'PBBP', 'OCUF', ..., 'GAP', 'FLGR', 'FLF', 'DPUU', 'BENEF'] >>> len(lists["_POST"]) 39
Step 2 - Simulate the model based on the 3 lists _PRE, _INTER and _POST
>>> # exogeneous variable >>> equations["UY"].lec 'UY := NATY-NDOMY-NIY-NGY-(EFXY-EFMY)-NFY' >>> # reset values >>> variables["UY", "2000Y1:2015Y1"] = 0.0 >>> variables["UY", "2000Y1:2015Y1"] [0.0, 0.0, ..., 0.0, 0.0] >>> # endogenous variable >>> identities["XNATY"] 'grt NATY' >>> variables["XNATY", "2000Y1:2015Y1"] [0.22, 0.699999988079071, 0.4, 0.7, ..., -0.20000000298023224, -0.20000000298023224]
>>> simu.model_simulate_SCC("2000Y1", "2015Y1")
>>> variables["UY", "2000Y1:2015Y1"] [624.1822680369564, 645.0533712662168, 661.5778936891761, ..., 525.2940777398553]