Exemplo n.º 1
0
    def __init__(self, initScript=None):
        """
        set up the basic flowsheet
        """
        UnitOperations.UnitOperation.__init__(self, initScript)

        self.feedBalance = Balance.BalanceOp()
        self.AddUnitOperation(self.feedBalance, 'FeedBalance')

        self.feedBalance.SetParameterValue(NUSTOUT_PAR + Balance.S_MAT, 1)
        self.feedBalance.SetParameterValue(
            Balance.BALANCETYPE_PAR,
            Balance.MOLE_BALANCE | Balance.ENERGY_BALANCE)

        self.SetParameterValue(NUSTIN_PAR + Balance.S_MAT, 1)
        self.SetParameterValue(NUSTIN_PAR + Balance.S_ENE, 1)

        self.splitter = SimpleComponentSplitter()
        self.splitter.borrowedSplits = self
        self.AddUnitOperation(self.splitter, 'Splitter')

        for port in self.splitter.GetPorts(MAT | OUT):
            self.BorrowChildPort(port, port.GetName())

        self.ConnectPorts('FeedBalance', OUT_PORT + '0', 'Splitter', IN_PORT)
Exemplo n.º 2
0
    def __init__(self, initScript=None):
        """Init the flash

        Init Info:
        nuLiqphases = 2
        nuStreamsIn = 2

        """
        super(LLStage, self).__init__(initScript)

        #Create a separator
        self.innerFlash = innerFlash = Flash.SimpleFlash()
        self.AddUnitOperation(innerFlash, FLASH)

        #Create a balance
        self.innerMixer = innerMixer = Balance.BalanceOp()
        self.AddUnitOperation(innerMixer, MIX)

        #Initialize params
        self.InitializeParameters()

        #Share the ports directly
        self.ports_mat_OUT = innerFlash.ports_mat_OUT
        self.ports_mat_IN = innerMixer.ports_mat_IN

        #Connect the balance to the separator
        self.ConnectPorts(MIX, OUT_PORT + str(0), FLASH, IN_PORT)
Exemplo n.º 3
0
    def __init__(self, initScript=None):
        super(ConvReactor, self).__init__(initScript)
        self.isoRxn = IsothermalConvReactor()
        self.AddUnitOperation(self.isoRxn, 'IsoRxn')
        self.isoRxn.containerUnitOp = self

        self.heater = Heater.Heater()
        self.AddUnitOperation(self.heater, 'RxnHeater')

        self.baln = Balance.BalanceOp()
        self.AddUnitOperation(self.baln, 'EneBalance')

        #Initialize with one energy In and Out as a default
        #The parameter QEXOTHERMIC_ISPOS_PAR will set the missing energy port
        self.baln.SetParameterValue(NUSTIN_PAR + Balance.S_ENE, 1)
        self.baln.SetParameterValue(NUSTOUT_PAR + Balance.S_ENE, 1)
        self.baln.SetParameterValue(Balance.BALANCETYPE_PAR,
                                    Balance.ENERGY_BALANCE)

        # to create an Energy Out port for export
        self.balEneSensor = Sensor.EnergySensor()
        self.AddUnitOperation(self.balEneSensor, 'BalEneSensor')
        self.eneSensor = Sensor.EnergySensor()
        self.AddUnitOperation(self.eneSensor, 'EneSensor')
        self.eneStream = Stream.Stream_Energy()
        self.AddUnitOperation(self.eneStream, 'EneStream')

        # connect the child unit ops
        self.ConnectPorts('IsoRxn', OUT_PORT + 'Q', 'EneBalance',
                          IN_PORT + 'Q0')
        self.ConnectPorts('RxnHeater', IN_PORT + 'Q', 'EneBalance',
                          OUT_PORT + 'Q0')
        self.ConnectPorts('IsoRxn', OUT_PORT, 'RxnHeater', IN_PORT)

        self.ConnectPorts('EneSensor', OUT_PORT, 'EneStream', IN_PORT)
        #
        self.ConnectPorts('BalEneSensor', SIG_PORT, 'EneSensor', SIG_PORT)

        # borrow child ports
        self.BorrowChildPort(self.eneStream.GetPort(OUT_PORT), OUT_PORT + 'Q')
        self.BorrowChildPort(self.isoRxn.GetPort(IN_PORT), IN_PORT)
        self.BorrowChildPort(self.heater.GetPort(OUT_PORT), OUT_PORT)
        self.BorrowChildPort(self.heater.GetPort(DELTAP_PORT), DELTAP_PORT)

        self.SetParameterValue(NURXN_PAR, 0)
        self.SetParameterValue(SIMULTANEOUSRXN_PAR, 1)
        self.SetParameterValue(QEXOTHERMIC_ISPOS_PAR, 1)
Exemplo n.º 4
0
    def __init__(self, initScript=None):
        super(EquilibriumReactor, self).__init__(initScript)
        self.itnRxn = InternalEqmReactor()
        self.AddUnitOperation(self.itnRxn, 'itnRxn')
        self.itnRxn.containerUnitOp = self

        self.baln = Balance.BalanceOp()
        self.AddUnitOperation(self.baln, 'EneBalance')

        self.baln.SetParameterValue(NUSTIN_PAR + Balance.S_ENE, 1)
        self.baln.SetParameterValue(Balance.BALANCETYPE_PAR,
                                    Balance.ENERGY_BALANCE)

        # to create an Energy Out port for export
        self.balEneSensor = Sensor.EnergySensor()
        self.AddUnitOperation(self.balEneSensor, 'BalEneSensor')
        self.eneSensor = Sensor.EnergySensor()
        self.AddUnitOperation(self.eneSensor, 'EneSensor')
        self.eneStream = Stream.Stream_Energy()
        self.AddUnitOperation(self.eneStream, 'EneStream')

        # connect the child unit ops
        self.ConnectPorts('itnRxn', OUT_PORT + 'Q', 'EneBalance',
                          IN_PORT + 'Q0')
        self.ConnectPorts('EneSensor', OUT_PORT, 'EneStream', IN_PORT)
        self.ConnectPorts('BalEneSensor', SIG_PORT, 'EneSensor', SIG_PORT)

        # borrow child ports
        self.BorrowChildPort(self.eneStream.GetPort(OUT_PORT), OUT_PORT + 'Q')
        self.BorrowChildPort(self.itnRxn.GetPort(IN_PORT), IN_PORT)
        self.BorrowChildPort(self.itnRxn.GetPort(OUT_PORT), OUT_PORT)
        self.BorrowChildPort(self.itnRxn.GetPort(DELTAP_PORT), DELTAP_PORT)

        self.SetParameterValue(NURXN_PAR, 0)
        self.SetParameterValue(CALCOPTION_PAR,
                               1)  #use table to correlate constant
        self.SetParameterValue(CONSTBASIS_PAR,
                               1)  #use partial pressure to calculate constant
        self.SetParameterValue(
            BASISPUNIT_PAR,
            'atm')  #VMG pressure unit when partial pressure as basis
        self.SetParameterValue(QEXOTHERMIC_ISPOS_PAR, 1)
Exemplo n.º 5
0
    def __init__(self, initScript=None):
        """Init pump - build it from Idealpump,
        Heater and Set operations
        """
        super(Pump, self).__init__(initScript)

        # the isentropic compressor
        self.ideal = IdealPump()
        self.AddUnitOperation(self.ideal, 'Ideal')

        # a heater to add the waste heat to the outlet
        self.waste = Heater.Heater()
        self.AddUnitOperation(self.waste, 'Waste')
        self.waste.GetPort(DELTAP_PORT).SetValue(0.0, FIXED_V)

        # connect them
        self.ConnectPorts('Ideal', OUT_PORT, 'Waste', IN_PORT)

        # energy sensors (needed for signals)
        self.idealQ = Sensor.EnergySensor()
        self.AddUnitOperation(self.idealQ, 'IdealQ')
        self.ConnectPorts('Ideal', IN_PORT + 'Q', 'IdealQ', OUT_PORT)

        self.wasteQ = Sensor.EnergySensor()
        self.AddUnitOperation(self.wasteQ, 'WasteQ')
        self.ConnectPorts('Waste', IN_PORT + 'Q', 'WasteQ', OUT_PORT)

        self.totalQ = Sensor.EnergySensor()
        self.AddUnitOperation(self.totalQ, 'TotalQ')

        # create a signal stream for the efficiency
        self.effStream = Stream.Stream_Signal()
        self.effStream.SetParameterValue(SIGTYPE_PAR, GENERIC_VAR)
        self.AddUnitOperation(self.effStream, 'EfficiencySig')

        #set relation between ideal and total Q
        self.set = Set.Set()
        self.AddUnitOperation(self.set, 'Set')
        self.set.SetParameterValue(SIGTYPE_PAR, ENERGY_VAR)
        self.set.GetPort(Set.ADD_PORT).SetValue(0.0, FIXED_V)
        self.ConnectPorts('TotalQ', SIG_PORT, 'Set', SIG_PORT + '0')
        self.ConnectPorts('IdealQ', SIG_PORT, 'Set', SIG_PORT + '1')
        self.ConnectPorts('EfficiencySig', OUT_PORT, 'Set', Set.MULT_PORT)

        # energy stream balance
        self.mix = Balance.BalanceOp()
        self.AddUnitOperation(self.mix, 'Mix')
        self.mix.SetParameterValue(NUSTIN_PAR + Balance.S_ENE, 1)
        self.mix.SetParameterValue(NUSTOUT_PAR + Balance.S_ENE, 2)
        self.mix.SetParameterValue(Balance.BALANCETYPE_PAR,
                                   Balance.ENERGY_BALANCE)

        # connect the mixer ports
        self.ConnectPorts('IdealQ', IN_PORT, 'Mix', OUT_PORT + 'Q0')
        self.ConnectPorts('WasteQ', IN_PORT, 'Mix', OUT_PORT + 'Q1')
        self.ConnectPorts('TotalQ', OUT_PORT, 'Mix', IN_PORT + 'Q0')

        # export the flow ports
        self.BorrowChildPort(self.ideal.GetPort(IN_PORT), IN_PORT)
        self.BorrowChildPort(self.waste.GetPort(OUT_PORT), OUT_PORT)
        self.BorrowChildPort(self.totalQ.GetPort(IN_PORT), IN_PORT + 'Q')
        self.BorrowChildPort(self.effStream.GetPort(IN_PORT), EFFICIENCY_PORT)
        self.BorrowChildPort(self.ideal.GetPort(DELTAP_PORT), DELTAP_PORT)

        #Change the type of the energy port such that it is in Work units and scaling
        self.totalQ.GetPort(IN_PORT).GetProperty().SetTypeByName(WORK_VAR)