iode.Simulation.model_calculate_SCC
- Simulation.model_calculate_SCC(nb_iterations: int, pre_name: str = '_PRE', inter_name: str = '_INTER', post_name: str = '_POST', list_eqs: str | List[str] = None, quiet: bool = False) bool[source]
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).
- quietbool, optional
If True, suppresses the log messages during the SCC decomposition process. Default to False.
- Returns:
- bool
True if the model was successfully reordered.
Examples
>>> from iode import SAMPLE_DATA_DIR, equations, lists, scalars, variables >>> from iode import Simulation >>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs") Loading .../fun.eqs 274 objects loaded >>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst") Loading .../fun.lst 17 objects loaded >>> scalars.load(f"{SAMPLE_DATA_DIR}/fun.scl") Loading .../fun.scl 161 objects loaded >>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var") Loading .../fun.var 394 objects loaded
>>> simu = Simulation() >>> success = simu.model_calculate_SCC(10) Pseudo-linking equations .... Calculating SCC... Calculating SCC... -> #PRE 31 - #INTER 204 - #POST 39 Reordering interdependent block... Reordering interdependent block... >>> success True
>>> 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