CADETProcess.simulator.Cadet#
- class CADETProcess.simulator.Cadet(timeout, use_dll, time_resolution, resolution_cutoff, n_cycles, evaluate_stationarity, n_cycles_min, n_cycles_batch, n_cycles_max, raise_exception_on_max_cycles)[source]#
Bases:
SimulatorBaseCADET class for running a simulation for given process objects.
- Attributes:
- install_path: str
Path to the root of the CADET installation
- time_outUnsignedFloat
Maximum duration for simulations
- model_solver_parametersModelSolverParameters
Container for solver parameters
- unit_discretization_parametersUnitDiscretizationParameters
Container for unit discretization parameters
- discretization_weno_parametersDiscretizationWenoParameters
Container for weno discretization parameters in units
- adsorption_consistency_solver_parametersConsistencySolverParameters
Container for consistency solver parameters
- solver_parametersSolverParameters
Container for general solver settings
- time_integrator_parametersSolverTimeIntegratorParameters
Container for time integrator parameters
- return_parametersReturnParameters
Container for return information of the system
- ..todo::
Implement method for loading CADET file that have not been generated with CADETProcess and create Process
See also
- add_inlet_section(model_units: Dict, sec_index: int, unit_index: int, coeffs: ndarray) None[source]#
Add piecewise cubic polynomial section to inlet.
- add_parameter_section(model_units: Dict, sec_index: int, unit_index: int, unit_model: UnitBaseClass, parameter: str, state: ndarray) None[source]#
Add section value to parameter branch.
- cadet_connections(flow_rates: dict, flow_sheet: FlowSheet) list[source]#
list: Connections matrix for flow_rates state.
- Parameters:
- flow_ratesdict
UnitOperations with outgoing flow rates.
- flow_sheetFlowSheet
Object which hosts units (for getting unit index).
- Returns:
- lslist
Connections matrix for DESCRIPTION.
- check_cadet() bool[source]#
Check if CADET installation can run a basic LWE example.
- Returns:
- bool
True if the test simulation completed successfully, False otherwise.
- Raises:
- CADETProcessError
If the simulation fails, an exception is raised with the error message.
Notes
This method tests the CADET installation by executing a basic LWE (Load, Wash, Elute) example. It creates a CADET model using the LWE data stored in an HDF5 file and runs the simulation. After the simulation, it checks the return code to determine if the test was successful.
- create_lwe(file_path=None)[source]#
Create basic LWE example and loads the configuration into self.
- Parameters:
- file_pathPath, optional
Path to store HDF5 file. If None, temporary file will be created and deleted after simulation.
- get_adsorption_config(binding: BindingBaseClass) Dict[source]#
Config branch /input/model/unit_xxx/adsorption for individual unit.
Binding model parameters are extracted and converted to CADET format.
- Parameters:
- bindingBindingBaseClass
Binding model
See also
- get_cadet_version() tuple[str, str][source]#
Get version and branch name of the currently instanced CADET build.
- Returns:
- tuple[str, str]
The CADET version as x.x.x and the branch name.
- Raises:
- ValueError
If version and branch name cannot be found in the output string.
- RuntimeError
If any unhandled event during running the subprocess occurs.
- get_input_model(process: Process) Dict[source]#
Config branch /input/model/.
See also
model_connectionsmodel_solvermodel_unitsinput_model_parameters
Notes
!!! External functions not implemented yet
- get_input_solver(process: Process) Dict[source]#
Config branch /input/solver/.
See also
solver_sectionssolver_time_integrator
- get_model_units(process: Process) Dict[source]#
Config branches for all units /input/model/unit_000 … unit_xxx.
See also
- get_parameter_sensitivities(process: Process) Dict[source]#
Config branches for all parameter sensitivities /input/sensitivity/param_000 … param_xxx.
- get_port_index(flow_sheet: FlowSheet, unit: UnitBaseClass, port: str) int[source]#
Return port index in CADET format xxx.
- Parameters:
- portstring
Indexed port
- unitUnitOperation
port of unit
- Returns:
- port_indexindex
Return the port_index in CADET format xxx
- get_process_config(process: Process) Dict[source]#
Create the CADET config.
- Returns:
- configDict
/
Notes
Sensitivities not implemented yet.
- get_reaction_config(reaction: ReactionBaseClass) Dict[source]#
Config branch /input/model/unit_xxx/reaction for individual unit.
Reaction model parameters are extracted and converted to CADET format.
- Parameters:
- reactionReactionBaseClass
Reaction model
See also
- get_simulation_results(process: Process, cadet: Cadet, time_elapsed: float | None = None, return_information: dict | None = None) SimulationResults[source]#
Read simulation results from CADET configuration.
- Parameters:
- processProcess
Process that was simulated.
- cadetCadetAPI
Cadet object with simulation results.
- time_elapsedfloat
Time of simulation.
- return_information: ReturnInformation
CADET-cli return information.
- Returns:
- resultsSimulationResults
Simulation results including process and solver configuration.
- ..todo::
Implement method to read .h5 files that have no process associated.
- get_unit_config(unit: UnitBaseClass) Dict[source]#
Config branch /input/model/unit_xxx for individual unit.
The unit operation parameters are converted to CADET format
See also
Notes
In CADET, the parameter unit_config[‘discretization’].NBOUND should be moved to binding config or unit config
- get_unit_index(process: Process, unit: UnitBaseClass) str[source]#
Return unit index in CADET format unit_xxx.
- Parameters:
- processProcess
process to be simulated
- unitUnitOperation
Indexed object
- Returns:
- unit_indexstr
Return the unit index in CADET format unit_XXX
- get_unit_return_parameters(process: Process) Dict[source]#
Config branches for all units /input/return/unit_000 … unit_xxx.
- load_simulation_results(process: Process, file_path: PathLike) SimulationResults[source]#
Load simulation results.
- set_section_dependent_parameters(model_units: Dict, process: Process) None[source]#
Add time dependent model parameters to units.
- timeout#
Parameter descriptor for unsigned floating-point parameters.
- use_dll#
Parameter descriptor constrained to boolean values.
Notes
This class also supports casting integers 0 and 1 to their boolean equivalents.