Definition Objects
- pydantic model flodym.MFADefinition
All the information needed to define an MFA system, compiled of lists of definition objects.
- Config:
protected_namespaces: tuple = ()
- Fields:
dimensions (List[flodym.mfa_definition.DimensionDefinition])flows (List[flodym.mfa_definition.FlowDefinition])parameters (List[flodym.mfa_definition.ParameterDefinition])processes (List[str])stocks (List[flodym.mfa_definition.StockDefinition])
- Validators:
check_dimension_letters»all fields
- field dimensions: List[DimensionDefinition] [Required]
List of definitions of dimensions used in the model.
- field flows: List[FlowDefinition] [Required]
List of definitions of flows used in the model.
- field parameters: List[ParameterDefinition] [Required]
List of definitions of parameters used in the model.
- field processes: List[str] [Required]
List of process names used in the model.
- field stocks: List[StockDefinition] [Required]
List of definitions of stocks used in the model.
- validator check_dimension_letters » all fields
Check that dimension letters used for flows, stocks and parameters are part of the defined dimensions.
- pydantic model flodym.FlowDefinition
Define the model flows.
Examples
>>> from flodym import FlowDefinition >>> flow_one = FlowDefinition(from_process_name='fabrication', to_process_name='use', dim_letters=('r', 't')) >>> flow_two = FlowDefinition(from_process_name='use', to_process_name='end_of_life', dim_letters=('r', 't'))
These are then used in the :py:class:MFADefinition, for creating a custom MFA System.
- Config:
protected_namespaces: tuple = ()
- Fields:
dim_letters (tuple)from_process_name (str)name_override (str | None)to_process_name (str)
- Validators:
check_dimensions»dim_letters
- field dim_letters: tuple [Required]
letters of the dimensions that the object is defined on
- field from_process_name: str [Required]
Process from which the flow originates.
- field name_override: str | None = None
Optional name for the flow. Will be generated from the connecting process names if not provided.
- field to_process_name: str [Required]
Process to which the flow goes.
- validator check_dimensions » dim_letters
- pydantic model flodym.StockDefinition
Define the model stocks.
- Config:
protected_namespaces: tuple = ()
- Fields:
dim_letters (tuple)lifetime_model_class (type | None)name (str)process_name (str | None)solver (str | None)subclass (type)time_letter (str)
- Validators:
check_dimensions»dim_letterscheck_lifetime_model»all fieldsinit_solver»all fields
- field dim_letters: tuple [Required]
letters of the dimensions that the object is defined on
- field lifetime_model_class: type | None = None
Lifetime model used for the stock. Only needed if type is not simple_flow_driven. Available lifetime models can be found in
flodym.lifetime_models.
- field name: str = 'undefined stock'
Name of the stock.
- field process_name: str | None = None
Name of the process to which the stock is connected.
- field solver: str | None = 'manual'
Algorithm to use for solving the equation system in the stock-driven DSM. Options are: “manual” (default), which uses an own python implementation, and “lapack”, which calls the lapack trtrs routine via scipy. The lapack implementation is more precise. Speed depends on the dimensionality, but the manual implementation is usually faster.
- field subclass: type [Required]
type of stock. Can be any found in
flodym.stocks.
- field time_letter: str = 't'
Letter of the time dimension, to ensure it’s the first appearing in dim_letters.
- validator check_dimensions » dim_letters
- validator check_lifetime_model » all fields
- validator init_solver » all fields
- pydantic model flodym.ParameterDefinition
Define the model parameters.
- Config:
protected_namespaces: tuple = ()
- Fields:
dim_letters (tuple)name (str)
- Validators:
check_dimensions»dim_letters
- field dim_letters: tuple [Required]
letters of the dimensions that the object is defined on
- field name: str [Required]
Name of the parameter.
- validator check_dimensions » dim_letters
- pydantic model flodym.DimensionDefinition
Define the model dimensions.
Examples
>>> from flodym import DimensionDefinition >>> time_definition = DimensionDefinition(name='Time', letter='t', dtype=int) >>> region_definition = DimensionDefinition(name='Region', letter='r', dtype=str)
- Config:
protected_namespaces: tuple = ()
- Fields:
dtype (type)letter (str)name (str)
- field dtype: type [Required]
- field letter: str [Required]
- Constraints:
min_length = 1
max_length = 1
- field name: str [Required]
- Constraints:
min_length = 2