CADETProcess.simulator.SimulatorBase#
- class CADETProcess.simulator.SimulatorBase(time_resolution, resolution_cutoff, n_cycles, evaluate_stationarity, n_cycles_min, n_cycles_batch, n_cycles_max, raise_exception_on_max_cycles)[source]#
Bases:
StructureBase class for Solver APIs.
Holds the configuration of the individual solvers and provides an interface for calling the run method. The class converts the process configuration into the API’s configuration format and converts the results back to the CADETProcess format.
- Attributes:
- time_resolutionfloat
Time interval for user solution times. The default value is 1 second.
- resolution_cutofffloat
Solution times closer to section times than the cutoff value are removed to avoid IDAS errors. The default value is 1e-3 seconds.
- n_cyclesint
Number of cycles to be simulated. The default is 1.
- evaluate_stationaritybool
If True, simulate until stationarity is reached. The default is False
- n_cycles_minint
Minimum number of cycles to be simulated if evaluate_stationarity is True. The default is 5.
- n_cycles_maxint
Maximum number of cycles to be simulated if evaluate_stationarity is True. The default is 100.
- raise_exception_on_max_cyclesbool
Raise an exception when the maximum number of cycles is exceeded. The default is False
- evaluate(process: Process, previous_results: SimulationResults | None = None, **kwargs: Any) SimulationResults#
Simulate the process.
Depending on the state of evaluate_stationarity, the process is simulated until the termination criterion is reached.
- Parameters:
- processProcess
The process to be simulated.
- previous_resultsSimulationResults, optional
Results of the previous simulation run for initial conditions.
- **kwargs
Additional keyword arguments.
- Returns:
- resultsSimulationResults
Results of the final cycle of the simulation.
- Raises:
- TypeError
If the process is not an instance of Process.
- CADETProcessError
If the process is not configured correctly.
See also
- evaluate_stationarity#
Parameter descriptor constrained to boolean values.
Notes
This class also supports casting integers 0 and 1 to their boolean equivalents.
- get_section_times_complete(process: Process) list[float][source]#
Get the section times for multiple cycles of a process.
- Parameters:
- processProcess
The process to simulate.
- Returns:
- list
Section times for multiple cycles of a process.
See also
get_section_timesn_cyclesget_solution_time_completeCADETProcess.processModel.Process.section_times
- get_solution_time(process: Process, cycle: int = 1) ndarray[source]#
Get the time vector for one cycle of a process.
- Parameters:
- processProcess
The process to simulate.
- cycleint, optional
The cycle number, by default 1.
- Returns:
- np.ndarray
Time vector for one cycle.
See also
CADETProcess.processModel.Process.section_timesget_solution_time_complete
- get_solution_time_complete(process: Process) list[float][source]#
Get the time vector for multiple cycles of a process.
- Parameters:
- processProcess
The process to simulate.
- Returns:
- list[float]
Time vector for multiple cycles of a process.
- n_cycles#
Parameter descriptor for unsigned integer parameters.
- n_cycles_batch#
Parameter descriptor for unsigned integer parameters.
- n_cycles_max#
Parameter descriptor for unsigned integer parameters.
- n_cycles_min#
Parameter descriptor for unsigned integer parameters.
- raise_exception_on_max_cycles#
Parameter descriptor constrained to boolean values.
Notes
This class also supports casting integers 0 and 1 to their boolean equivalents.
- resolution_cutoff#
Parameter descriptor for unsigned floating-point parameters.
- set_state_from_results(process: Process, results: SimulationResults) Process[source]#
Set the process state from the simulation results.
- Parameters:
- processProcess
The process to set the state for.
- resultsSimulationResults
The simulation results containing the state information.
- Returns:
- Process
The process with the updated state.
- simulate(process: Process, previous_results: SimulationResults | None = None, **kwargs: Any) SimulationResults[source]#
Simulate the process.
Depending on the state of evaluate_stationarity, the process is simulated until the termination criterion is reached.
- Parameters:
- processProcess
The process to be simulated.
- previous_resultsSimulationResults, optional
Results of the previous simulation run for initial conditions.
- **kwargs
Additional keyword arguments.
- Returns:
- resultsSimulationResults
Results of the final cycle of the simulation.
- Raises:
- TypeError
If the process is not an instance of Process.
- CADETProcessError
If the process is not configured correctly.
See also
- simulate_n_cycles(process: Process, n_cyc: int, previous_results: SimulationResults | None = None, **kwargs: Any) SimulationResults[source]#
Simulate the process for a given number of cycles.
- Parameters:
- processProcess
The process to be simulated.
- n_cycint
The number of cycles to simulate.
- previous_resultsSimulationResults, optional
Results of the previous simulation run.
- **kwargs
Additional keyword arguments.
- Returns:
- resultsSimulationResults
Results of the final cycle of the simulation.
- Raises:
- TypeError
If the process is not an instance of Process.
See also
simulatesimulate_to_stationarityStationarityEvaluatorrun
- simulate_to_stationarity(process: Process, results: SimulationResults | None = None, **kwargs: Any) SimulationResults[source]#
Simulate the process until stationarity is reached.
- Parameters:
- processProcess
The process to be simulated.
- resultsSimulationResults, optional
Results of the previous simulation run.
- **kwargs
Additional keyword arguments.
- Returns:
- resultsSimulationResults
Results of the final cycle of the simulation.
- Raises:
- TypeError
If the process is not an instance of Process.
- CADETProcessError
If the simulation doesn’t terminate successfully and raise_exception_on_max_cycles is True.
See also
simulaterunStationarityEvaluator
- property stationarity_evaluator: StationarityEvaluator#
StationarityEvaluator: The stationarity evaluator.
- time_resolution#
Parameter descriptor for unsigned floating-point parameters.