コード例 #1
0
ファイル: mosACMs.py プロジェクト: cechrist/cardoon
    def eval_cqs(self, vPort, getOP = False):
        """
        Calculates drain current. Input is a vector as follows:
        vPort = [vdb , vgb , vsb]

        If getOP = True, return normal output vector plus operating
        point variables in tuple: (iVec, qVec, opV)
        """
        # Invert all voltages in case of a P-channel device
        vPort1 = self._tf * vPort

        vp = (vPort1[1] - self._vthT) / self.n
        
        # Normalized currents
        i_f = inv_f((vp - vPort1[2]) / self._Vt)
        i_r = inv_f((vp - vPort1[0]) / self._Vt)
        
        idrain = self._IS * (i_f - i_r) 

        iVec, qVec = np.array([idrain]), np.array([])

        if getOP:
            # Create operating point variables dictionary
            return {'VD': vPort[0],
                    'VG': vPort[1],
                    'VS': vPort[2],
                    'IDS': idrain,
                    'Vth': self._vthT,
                    'IS': self._IS, 
                    'vp': vp,
                    'i_f': i_f,
                    'i_r': i_r}
        else:
            # Return numpy array with one element per current source.
            return (iVec, qVec)
コード例 #2
0
ファイル: mosACMs.py プロジェクト: AndySze/cardoon
    def eval_cqs(self, vPort, saveOP = False):
        """
        Calculates drain current. Input is a vector as follows:
        vPort = [vdb , vgb , vsb]

        If saveOP = True, return normal output vector plus operating
        point variables in tuple: (iVec, qVec, opV)
        """
        # Invert all voltages in case of a P-channel device
        vPort1 = self._tf * vPort

        vp = (vPort1[1] - self._vthT) / self.n
        
        # Normalized currents
        i_f = inv_f((vp - vPort1[2]) / self._Vt)
        i_r = inv_f((vp - vPort1[0]) / self._Vt)
        
        idrain = self._IS * (i_f - i_r) 

        iVec, qVec = np.array([idrain]), np.array([])

        if saveOP:
            # This is neccesary to keep the AD library happy: all
            # variables in vector must be adoubles
            vth = 0. * vp + self._vthT
            IS = 0. * vp + self._IS
            # Create operating point variables vector
            opV = np.array([vth, vp, i_f, i_r, IS])
            return (iVec, qVec, opV)
        else:
            # Return numpy array with one element per current source.
            return (iVec, qVec)
コード例 #3
0
ファイル: mosACMs.py プロジェクト: manasdas17/cardoon
    def eval_cqs(self, vPort, getOP=False):
        """
        Calculates drain current. Input is a vector as follows:
        vPort = [vdb , vgb , vsb]

        If getOP = True, return normal output vector plus operating
        point variables in tuple: (iVec, qVec, opV)
        """
        # Invert all voltages in case of a P-channel device
        vPort1 = self._tf * vPort

        vp = (vPort1[1] - self._vthT) / self.n

        # Normalized currents
        i_f = inv_f((vp - vPort1[2]) / self._Vt)
        i_r = inv_f((vp - vPort1[0]) / self._Vt)

        idrain = self._IS * (i_f - i_r)

        iVec, qVec = np.array([idrain]), np.array([])

        if getOP:
            # Create operating point variables dictionary
            return {
                'VD': vPort[0],
                'VG': vPort[1],
                'VS': vPort[2],
                'IDS': idrain,
                'Vth': self._vthT,
                'IS': self._IS,
                'vp': vp,
                'i_f': i_f,
                'i_r': i_r
            }
        else:
            # Return numpy array with one element per current source.
            return (iVec, qVec)