Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions control/tests/phaseplot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

class TestPhasePlot(unittest.TestCase):
def setUp(self):
pass;
pass

def testInvPendNoSims(self):
phase_plot(self.invpend_ode, (-6,6,10), (-6,6,10));
phase_plot(self.invpend_ode, (-6,6,10), (-6,6,10))

def testInvPendSims(self):
phase_plot(self.invpend_ode, (-6,6,10), (-6,6,10),
X0 = ([1,1], [-1,1]));
X0 = ([1,1], [-1,1]))

def testInvPendTimePoints(self):
phase_plot(self.invpend_ode, (-6,6,10), (-6,6,10),
X0 = ([1,1], [-1,1]), T=np.linspace(0,5,100));
X0 = ([1,1], [-1,1]), T=np.linspace(0,5,100))

def testInvPendLogtime(self):
phase_plot(self.invpend_ode, X0 =
Expand All @@ -46,12 +46,15 @@ def testInvPendAuto(self):
[[-2.3056, 2.1], [2.3056, -2.1]], T=6, verbose=False)

def testOscillatorParams(self):
m = 1; b = 1; k = 1; # default values
# default values
m = 1
b = 1
k = 1
phase_plot(self.oscillator_ode, timepts = [0.3, 1, 2, 3], X0 =
[[-1,1], [-0.3,1], [0,1], [0.25,1], [0.5,1], [0.7,1],
[1,1], [1.3,1], [1,-1], [0.3,-1], [0,-1], [-0.25,-1],
[-0.5,-1], [-0.7,-1], [-1,-1], [-1.3,-1]],
T = np.linspace(0, 10, 100), parms = (m, b, k));
T = np.linspace(0, 10, 100), parms = (m, b, k))

def testNoArrows(self):
# Test case from aramakrl that was generating a type error
Expand All @@ -71,7 +74,7 @@ def d1(x1x2,t):
# Sample dynamical systems - inverted pendulum
def invpend_ode(self, x, t, m=1., l=1., b=0, g=9.8):
import numpy as np
return (x[1], -b/m*x[1] + (g*l/m) * np.sin(x[0]))
return (x[1], -b/m*x[1] + (g*l/m)*np.sin(x[0]))

# Sample dynamical systems - oscillator
def oscillator_ode(self, x, t, m=1., b=1, k=1, extra=None):
Expand Down