Example #1
0
##############################################################################
"""
Storage of models for the IDAES Flowsheet Visualizer.

Currently implemented methods are trivial storage in memory and storage to a file.
"""
# stdlib
from abc import ABC, abstractmethod
import json
from pathlib import Path
from typing import Dict, Union
# package
from idaes import logger
from . import errors

_log = logger.getLogger(__name__)


class DataStore(ABC):
    @abstractmethod
    def save(self, data: Union[Dict, str]):
        """Save data.

        Args:
            data: Data to save.
        """
        pass

    @abstractmethod
    def load(self) -> Dict:
        """Load data.
from pyomo.core.base.units_container import _PyomoUnit

# Import IDAES cores
from idaes.core import (declare_process_block_class,
                        ReactionParameterBlock,
                        ReactionBlockDataBase,
                        ReactionBlockBase,
                        MaterialFlowBasis)
from idaes.core.util.exceptions import (
    BurntToast, ConfigurationError, PropertyPackageError)

import idaes.logger as idaeslog


# Set up logger
_log = idaeslog.getLogger(__name__)


class GenericReactionPackageError(PropertyPackageError):
    # Error message for when a property is called for but no option provided
    def __init__(self, block, prop):
        self.prop = prop
        self.block = block

    def __str__(self):
        return f"Generic Reaction Package instance {self.block} called for " \
               f"{self.prop}, but was not provided with a method " \
               f"for this property. Please add a method for this property " \
               f"in the reaction parameter configuration."

Example #3
0
                                              number_activated_constraints)
from idaes.core import (MaterialBalanceType, EnergyBalanceType,
                        MaterialFlowBasis)
from idaes.core.util.initialization import fix_state_vars, revert_state_vars
from idaes.core.util import constants
import idaes.core.util.scaling as iscale

# Import Python libraries
import idaes.logger as idaeslog

# Some more inforation about this module
__author__ = "Boiler Subsystem Team  J. Ma, M. Zamarripa, T. Burgard"
__version__ = "3"

# Set up logger
_log = idaeslog.getLogger('idaes.unit_model.properties')


@declare_process_block_class("FlueGasParameterBlock")
class FlueGasParameterData(PhysicalParameterBlock):
    """
    Property Parameter Block Class

    Contains parameters and indexing sets associated with properties for flue
    gas. The ideal gas assumption is applied.

    """
    def build(self):
        """ Add contents to the block."""
        super(FlueGasParameterData, self).build()
        self._state_block_class = FlueGasStateBlock