Beispiel #1
0
    def eig(self, speeds):
        '''Returns the eigenvalues and eigenvectors of the Whipple bicycle
        model linearized about the nominal configuration.

        Parameters
        ----------
        speeds : ndarray, shape (n,) or float
            The speed at which to calculate the eigenvalues.

        Returns
        -------
        evals : ndarray, shape (n, 4)
            eigenvalues
        evecs : ndarray, shape (n, 4, 4)
            eigenvectors

        Notes
        -----
        If you have a flywheel defined, body D, it will completely be ignored
        in these results. These results are strictly for the Whipple bicycle
        model.

        '''
        # this allows you to enter a float
        try:
            speeds.shape
        except AttributeError:
            speeds = np.array([speeds])

        par = io.remove_uncertainties(self.parameters['Benchmark'])

        M, C1, K0, K2 = bicycle.benchmark_par_to_canonical(par)

        m, n = 4, speeds.shape[0]
        evals = np.zeros((n, m), dtype='complex128')
        evecs = np.zeros((n, m, m), dtype='complex128')
        for i, speed in enumerate(speeds):
            A, B = bicycle.ab_matrix(M, C1, K0, K2, speed, par['g'])
            w, v = np.linalg.eig(A)
            evals[i] = w
            evecs[i] = v

        return evals, evecs
Beispiel #2
0
    def eig(self, speeds):
        '''Returns the eigenvalues and eigenvectors of the Whipple bicycle
        model linearized about the nominal configuration.

        Parameters
        ----------
        speeds : ndarray, shape (n,) or float
            The speed at which to calculate the eigenvalues.

        Returns
        -------
        evals : ndarray, shape (n, 4)
            eigenvalues
        evecs : ndarray, shape (n, 4, 4)
            eigenvectors

        Notes
        -----
        If you have a flywheel defined, body D, it will completely be ignored
        in these results. These results are strictly for the Whipple bicycle
        model.

        '''
        # this allows you to enter a float
        try:
            speeds.shape
        except AttributeError:
            speeds = np.array([speeds])

        par = io.remove_uncertainties(self.parameters['Benchmark'])

        M, C1, K0, K2 = bicycle.benchmark_par_to_canonical(par)

        m, n = 4, speeds.shape[0]
        evals = np.zeros((n, m), dtype='complex128')
        evecs = np.zeros((n, m, m), dtype='complex128')
        for i, speed in enumerate(speeds):
            A, B = bicycle.ab_matrix(M, C1, K0, K2, speed, par['g'])
            w, v = np.linalg.eig(A)
            evals[i] = w
            evecs[i] = v

        return evals, evecs
Beispiel #3
0
    def canonical(self, nominal=False):
        """
        Returns the canonical velocity and gravity independent matrices for
        the Whipple bicycle model linearized about the nominal
        configuration.

        Parameters
        ----------
        nominal : boolean, optional
            The default is false and uarrays are returned with the
            calculated uncertainties. If true ndarrays are returned without
            uncertainties.

        Returns
        -------
        M : uarray, shape(2,2)
            Mass matrix.
        C1 : uarray, shape(2,2)
            Velocity independent damping matrix.
        K0 : uarray, shape(2,2)
            Gravity independent part of the stiffness matrix.
        K2 : uarray, shape(2,2)
            Velocity squared independent part of the stiffness matrix.

        Notes
        -----

        The canonical matrices complete the following equation:

            M * q'' + v * C1 * q' + [g * K0 + v**2 * K2] * q = f

        where:

            q = [phi, delta]
            f = [Tphi, Tdelta]

        phi
            Bicycle roll angle.
        delta
            Steer angle.
        Tphi
            Roll torque.
        Tdelta
            Steer torque.
        v
            Bicylce speed.

        If you have a flywheel defined, body D, it will completely be
        ignored in these results. These results are strictly for the Whipple
        bicycle model.

        """

        par = self.parameters['Benchmark']

        M, C1, K0, K2 = bicycle.benchmark_par_to_canonical(par)

        if nominal is True:
            return (unumpy.nominal_values(M), unumpy.nominal_values(C1),
                    unumpy.nominal_values(K0), unumpy.nominal_values(K2))
        elif nominal is False:
            return M, C1, K0, K2
        else:
            raise ValueError('nominal must be True or False')
Beispiel #4
0
    def canonical(self, nominal=False):
        """
        Returns the canonical velocity and gravity independent matrices for the
        Whipple bicycle model linearized about the nominal configuration.

        Returns
        -------
        M : uarray, shape(2,2)
            Mass matrix.
        C1 : uarray, shape(2,2)
            Velocity independent damping matrix.
        K0 : uarray, shape(2,2)
            Gravity independent part of the stiffness matrix.
        K2 : uarray, shape(2,2)
            Velocity squared independent part of the stiffness matrix.
        nominal : boolean, optional
            The default is false and uarrays are returned with the calculated
            uncertainties. If true ndarrays are returned without uncertainties.

        Notes
        -----

        The canonical matrices complete the following equation:

            M * q'' + v * C1 * q' + [g * K0 + v**2 * K2] * q = f

        where:

            q = [phi, delta]
            f = [Tphi, Tdelta]

        phi
            Bicycle roll angle.
        delta
            Steer angle.
        Tphi
            Roll torque.
        Tdelta
            Steer torque.
        v
            Bicylce speed.

        If you have a flywheel defined, body D, it will completely be ignored
        in these results. These results are strictly for the Whipple bicycle
        model.

        """

        par = self.parameters['Benchmark']

        M, C1, K0, K2 = bicycle.benchmark_par_to_canonical(par)

        if nominal is True:
            return (unumpy.nominal_values(M),
                    unumpy.nominal_values(C1),
                    unumpy.nominal_values(K0),
                    unumpy.nominal_values(K2))
        elif nominal is False:
            return M, C1, K0, K2
        else:
            raise ValueError('nominal must be True or False')