iode.Simulation.model_calculate_SCC

Simulation.model_calculate_SCC(self, nb_iterations: int, pre_name: str = '_PRE', inter_name: str = '_INTER', post_name: str = '_POST', list_eqs: str | List[str] = None)

Decompose the model into Strongly Connex Components (SCC) and reorder it.

Three lists are created: pre-recursive, interdependent and post-recursive equations. When reordering the model, the number of triangulation iterations for the interdependent block must be specified. This value only affects the list of interdependent equations. These 3 lists only need to be constructed once for a given model.

Parameters:
nb_iterationsint

Number of triangulation iterations to be performed.

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”.

list_eqsstr or list(str), optional

List of equations representing the model. Default to empty (all equations).

Examples

>>> from iode import SAMPLE_DATA_DIR, equations, lists, scalars, variables 
>>> from iode import Simulation
>>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs")
>>> 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()
>>> simu.model_calculate_SCC(10);
>>> lists["_PRE"]           
['BRUGP', 'DTH1C', 'EX', 'ITCEE', ..., 'DTH1', 'PME', 'PMS', 'PMT']
>>> len(lists["_PRE"])
31
>>> lists["_INTER"]         
['PMAB', 'PXAB', 'ULCP', 'SSH3P', ..., 'WCF_', 'ITEP', 'EXC', 'ITT']
>>> len(lists["_INTER"])
204
>>> lists["_POST"]          
['IFU', 'SSHFF', 'PBBP', 'OCUF', ..., 'FLGR', 'FLF', 'DPUU', 'BENEF']
>>> len(lists["_POST"])
39