示例#1
0
 def setUp(self):
     self._frame = CarbonFrame(10, 100)
     self._frontWheel = RoadWheel("Front RoadWheel", 10, 100)
     self._backWheel1 = MountainWheel("Back MountainWheel", 10, 100)
     self._backWheel2 = RoadWheel("Back RoadWheel", 10, 100)
     self._bike = BicycleModel("Good Build", self._frontWheel,
                               self._backWheel2, self._frame)
class BicyleModelTest(unittest.TestCase):

    def setUp(self):
        self._frame = CarbonFrame(10, 100)
        self._frontWheel = RoadWheel("Front RoadWheel", 10, 100)
        self._backWheel1 = MountainWheel("Back MountainWheel", 10, 100)
        self._backWheel2 = RoadWheel("Back RoadWheel", 10, 100)
        self._bike = BicycleModel(
            "Good Build", self._frontWheel, self._backWheel2, self._frame
        )

    def test_different_heel_type_init(self):
        self.assertRaises(
            AssertionError,
            BicycleModel,
            "Error Build",
            self._frontWheel,
            self._backWheel1,
            self._frame
        )

    def test_get_cost(self):
        self.assertEqual(30, self._bike.get_cost())

    def test_get_weight(self):
        self.assertEqual(300, self._bike.get_weight())

    def test_change_cost(self):
        self._bike.change_cost_by_percentage(0.1)
        self.assertEqual(33, self._bike.get_cost())
 def setUp(self):
     self._frame = CarbonFrame(10, 100)
     self._frontWheel = RoadWheel("Front RoadWheel", 10, 100)
     self._backWheel1 = MountainWheel("Back MountainWheel", 10, 100)
     self._backWheel2 = RoadWheel("Back RoadWheel", 10, 100)
     self._bike = BicycleModel(
         "Good Build", self._frontWheel, self._backWheel2, self._frame
     )
示例#4
0
class BicyleModelTest(unittest.TestCase):
    def setUp(self):
        self._frame = CarbonFrame(10, 100)
        self._frontWheel = RoadWheel("Front RoadWheel", 10, 100)
        self._backWheel1 = MountainWheel("Back MountainWheel", 10, 100)
        self._backWheel2 = RoadWheel("Back RoadWheel", 10, 100)
        self._bike = BicycleModel("Good Build", self._frontWheel,
                                  self._backWheel2, self._frame)

    def test_different_heel_type_init(self):
        self.assertRaises(AssertionError, BicycleModel, "Error Build",
                          self._frontWheel, self._backWheel1, self._frame)

    def test_get_cost(self):
        self.assertEqual(30, self._bike.get_cost())

    def test_get_weight(self):
        self.assertEqual(300, self._bike.get_weight())

    def test_change_cost(self):
        self._bike.change_cost_by_percentage(0.1)
        self.assertEqual(33, self._bike.get_cost())
示例#5
0
    return figure(1), figure(2)


from scipy.integrate import odeint
from sympy import (Dummy, lambdify, symbols, zeros)
from sympy.physics.mechanics import dynamicsymbols
from numpy.linalg import solve
from numpy import (array, hstack, linspace, pi)

from model import BicycleModel
from bicycle import (benchmark_parameters, benchmark_to_moore, 
                      pitch_from_roll_and_steer)

# Import BicycleModel
biModel = BicycleModel()
left = biModel.mass_matrix_full()
right = biModel.forcing_full()

# symbols
# here, we introduce ua and uad, since forcing equations have them.
# we need to check the forcing?
ua = biModel._auxiliarySpeeds
uad = biModel._auxiliarySpeedsDerivative
ua_zero = {uai:0 for uai in ua}
uad_zero = {uadi:0 for uadi in uad}
q = biModel._coordinatesInde + biModel._coordinatesDe
u = biModel._speedsInde + biModel._speedsDe
T4 = biModel._inputForces[0]
dummy_symbols = [Dummy() for i in q+u]
symbols_dict = dict(zip(q+u, dummy_symbols))