def __init__(self, t, u, show_plot=False): SimulationInput.__init__(self) self._t = t self._T = t[-1] self._u = u self.scale = 1 if show_plot: pw = pg.plot(title="InterpTrajectory") pw.plot(self._t, self.__call__(time=self._t)) pw.plot([0, self._T], self.__call__(time=[0, self._T]), pen=None, symbolPen=pg.mkPen("g")) pg.QtGui.QApplication.instance().exec_()
def __init__(self, y0, y1, z0, z1, t0, dt, params): SimulationInput.__init__(self) # store params self._tA = t0 self._dt = dt self._dz = z1 - z0 self._m = params.m # []=kg mass at z=0 self._tau = params.tau # []=m/s speed of wave translation in string self._sigma = params.sigma # []=kgm/s**2 pretension of string # construct trajectory generator for yd ts = max(t0, self._dz * self._tau) # never too early self.trajectory_gen = SmoothTransition((y0, y1), (ts, ts + dt), 2) # create vectorized functions self.control_input = np.vectorize(self._control_input, otypes=[np.float]) self.system_state = np.vectorize(self._system_sate, otypes=[np.float])
def __init__(self, const=0): SimulationInput.__init__(self) self._const = const