pytanksim.core.simulationgenerator
Main module of pytanksim, used to generate simulations.
Functions
|
Generate a dynamic simulation object. |
|
Automatically run and restart simulations until a target is reached. |
Module Contents
- pytanksim.core.simulationgenerator.generate_simulation(storage_tank: pytanksim.classes.storagetankclasses.StorageTank | pytanksim.classes.storagetankclasses.SorbentTank, boundary_flux: pytanksim.classes.basesimclass.BoundaryFlux, simulation_params: pytanksim.classes.basesimclass.SimParams, simulation_type: str = 'Default', phase: int = 1) pytanksim.classes.twophasefluidsimclasses.BaseSimulation
Generate a dynamic simulation object.
- Parameters:
storage_tank (Union[StorageTank, SorbentTank]) – An object with the properties of the storage tank. Can either be of the class StorageTank or its child class SorbentTank.
boundary_flux (BoundaryFlux) – An object containing information about the mass and energy entering and leaving the control volume of the tank.
simulation_params (SimParams) – An object containing various parameters for the dynamic simulation.
simulation_type (str, optional) –
A string describing the type of the simulation to be run. The default is “Default”. The valid types are:
Default
: A regular dynamic simulation with no constraints.Cooled
: A simulation where the tank is cooled to maintain a constant pressure. Here, the cooling power becomes one of the output variables. Typically used for simulating refueling after the tank has reached maximum allowable working pressure, or for simulating zero boil-off systems which are actively cooled.Heated
: A simulation where the tank is heated to maintain a constant pressure. Here, the heating power becomes one of the output variables. Typically used for simulating discharging when the tank has reached the minimum supply pressure of the fuel cell system.Venting
: A simulation where the tank vents the fluid stored inside to maintain a constant pressure. Here, the amount vented becomes an output variable. Typically used to simulate boil-off or refueling with a feed-and-bleed scheme.
phase (int, optional) – Specifies whether the fluid being stored is a single phase (1) or a two-phase (2) liquid and gas mixture. The default is 1 for single phase.
- Returns:
A simulation object which can be
run()
to output a SimResults object. Which class will be generated depends on the parameters provided to this function.- Return type:
A child class of BaseSimulation
- pytanksim.core.simulationgenerator.automatic_simulation(storage_tank: pytanksim.classes.storagetankclasses.StorageTank | pytanksim.classes.storagetankclasses.SorbentTank, boundary_flux: pytanksim.classes.basesimclass.BoundaryFlux, simulation_params: pytanksim.classes.basesimclass.SimParams, stop_at_max_pres: bool = False, stop_at_min_pres: bool = False, handle_max_pres: str = 'Cooled', handle_min_pres: str = 'Heated') pytanksim.classes.twophasefluidsimclasses.SimResults
Automatically run and restart simulations until a target is reached.
- Parameters:
storage_tank (Union[StorageTank, SorbentTank]) – An object with the properties of the storage tank. Can either be of the class StorageTank or its child class SorbentTank.
boundary_flux (BoundaryFlux) – An object containing information about the mass and energy entering and leaving the control volume of the tank.
simulation_params (SimParams) – An object containing various parameters for the dynamic simulation.
stop_at_max_pres (bool, optional) – Whether or not the simulation is to be stopped when the tank hits its maximum allowable working pressure. The default is False.
stop_at_min_pres (bool, optional) – Whether or not the simulation is to be stopped when the tank hits its minimum supply pressure. The default is False.
handle_max_pres (str, optional) – A string indicating how the simulation is to continue if the tank has reached its maximum allowable working pressure. “Cooled” means that the tank will not vent any gas, but will be actively cooled down. “Venting” means that the tank will begin to vent the exact amount of fluid inside to maintain the maximum pressure. The default is “Cooled”.
handle_min_pres (str, optional) – A string indicating how the simulation is to continue if the tank has reached its minimum supply pressure. “Heated” means exactly enough heat will be provided to the tank to maintain the minimum supply pressure. “Continue” means the simulation will restart without changing any parameters. The default is “Heated”.
- Returns:
An object for storing and manipulating the results of the dynamic simulations.
- Return type: