How to use the gekko.chemical.StreamObj function in gekko

To help you get started, we’ve selected a few gekko examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BYU-PRISM / GEKKO / gekko / chemical.py View on Github external
'''
        y = stream(fixed=True)

        Output: Stream Object 
        y = StreamObj()
          P = Pressure (Pa)
          T = Temperature (K)
          ndot = Molar flow rate (kmol/sec)
          x = Array of mole fractions
          phase = Phase (solid, liquid, vapor)
          fixed = Gekko parameter (True) or variable (False) if None or []
        '''
        self._thermo_obj = True

        # create stream object
        y = StreamObj()
        y.name = self.add_obj('Feed')
        
        if self.sl>=1:
            # pressure
            y.P = self.cxn(y.P,101325.0,y.name+'.P',fixed)
            # temperature
            y.T = self.cxn(y.T,300.0,y.name+'.T',fixed)
            # stream phase
            y.phase = self.set_phase(y,phase=y.phase)
        # molar flow
        y.ndot = self.cxn(y.ndot,1.0,y.name+'.ndot',fixed)
        # mole fractions
        y.x = self.cxnl(y.x,self.dfrac(),fixed=fixed)
        # additional equation for last mole fraction
        if isinstance(y.x[-1],GKVariable):
            self.m.Equation(y.x[-1]==1-sum(y.x[0:-1]))