Esempio n. 1
0
def test_config():

    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})
    m.fs.properties = PhysicalParameterTestBlock()

    m.fs.unit = Reboiler(default={"property_package": m.fs.properties})

    assert len(m.fs.unit.config) == 9

    assert not m.fs.unit.config.has_boilup_ratio
    assert m.fs.unit.config.material_balance_type == \
        MaterialBalanceType.useDefault
    assert m.fs.unit.config.energy_balance_type == \
        EnergyBalanceType.useDefault
    assert m.fs.unit.config.momentum_balance_type == \
        MomentumBalanceType.pressureTotal
    assert hasattr(m.fs.unit, "heat_duty")
Esempio n. 2
0
    def btx_fctp(self):
        m = ConcreteModel()
        m.fs = FlowsheetBlock(default={"dynamic": False})

        m.fs.properties = BTXParameterBlock(
            default={
                "valid_phase": ('Liq', 'Vap'),
                "activity_coeff_model": "Ideal",
                "state_vars": "FcTP"
            })

        m.fs.unit = Reboiler(
            default={
                "property_package": m.fs.properties,
                "has_boilup_ratio": True,
                "has_pressure_change": True
            })

        return m
Esempio n. 3
0
    def build(self):
        """Build the model.

        Args:
            None
        Returns:
            None
        """
        # Call UnitModel.build to setup dynamics
        super(TrayColumnData, self).build()

        # Create set for constructing indexed trays
        if self.config.number_of_trays is not None:
            self.tray_index = RangeSet(1, self.config.number_of_trays)
            self._rectification_index = RangeSet(
                1, self.config.feed_tray_location - 1)
            self._stripping_index = RangeSet(
                self.config.feed_tray_location + 1,
                self.config.number_of_trays)

        else:
            raise ConfigurationError("The config argument number_of_trays "
                                     "needs to specified and cannot be None.")

        # Add trays
        # TODO:
        # 1. Add support for multiple feed tray locations
        # 2. Add support for specifying which trays have side draws
        self.rectification_section = Tray(self._rectification_index,
                                          default={
                                              "has_liquid_side_draw":
                                              self.config.has_liquid_side_draw,
                                              "has_vapor_side_draw":
                                              self.config.has_vapor_side_draw,
                                              "has_heat_transfer":
                                              self.config.has_heat_transfer,
                                              "has_pressure_change":
                                              self.config.has_pressure_change,
                                              "property_package":
                                              self.config.property_package,
                                              "property_package_args":
                                              self.config.property_package_args
                                          })

        self.feed_tray = Tray(
            default={
                "is_feed_tray": True,
                "has_liquid_side_draw": self.config.has_liquid_side_draw,
                "has_vapor_side_draw": self.config.has_vapor_side_draw,
                "has_heat_transfer": self.config.has_heat_transfer,
                "has_pressure_change": self.config.has_pressure_change,
                "property_package": self.config.property_package,
                "property_package_args": self.config.property_package_args
            })

        self.stripping_section = Tray(self._stripping_index,
                                      default={
                                          "has_liquid_side_draw":
                                          self.config.has_liquid_side_draw,
                                          "has_vapor_side_draw":
                                          self.config.has_vapor_side_draw,
                                          "has_heat_transfer":
                                          self.config.has_heat_transfer,
                                          "has_pressure_change":
                                          self.config.has_pressure_change,
                                          "property_package":
                                          self.config.property_package,
                                          "property_package_args":
                                          self.config.property_package_args
                                      })

        # Add condenser
        self.condenser = Condenser(
            default={
                "condenser_type": self.config.condenser_type,
                "temperature_spec": self.config.condenser_temperature_spec,
                "property_package": self.config.property_package,
                "property_package_args": self.config.property_package_args
            })

        # Add reboiler
        self.reboiler = Reboiler(
            default={
                "has_boilup_ratio": True,
                "has_pressure_change": self.config.has_pressure_change,
                "property_package": self.config.property_package,
                "property_package_args": self.config.property_package_args
            })

        # Add extension to the feed port
        self.feed = Port(extends=self.feed_tray.feed)

        # Add extensions to rectification section

        # Add extensions to stripping section

        # Construct arcs between trays, condenser, and reboiler
        self._make_rectification_arcs()
        self._make_stripping_arcs()
        self._make_feed_arcs()
        self._make_condenser_arcs()
        self._make_reboiler_arcs()

        TransformationFactory("network.expand_arcs").apply_to(self)