Ejemplo n.º 1
0
 def run(self):
     if self.makeprg:
         self.makedaqprg()
         acsc.loadBuffer(self.hc, 19, self.prg, 1024)
         acsc.runBuffer(self.hc, 19)
     collect = acsc.readInteger(self.hc, acsc.NONE, "collect_data")
     while collect == 0:
         time.sleep(0.01)
         collect = acsc.readInteger(self.hc, acsc.NONE, "collect_data")
     while self.collectdata:
         time.sleep(self.sleeptime)
         t0 = acsc.readReal(self.hc, acsc.NONE, "start_time")
         newdata = acsc.readReal(self.hc, acsc.NONE, "data", 0, 2, 0, self.dblen//2-1)
         t = (newdata[0] - t0)/1000.0
         self.data["time"] = np.append(self.data["time"], t)
         self.data["carriage_vel"] = np.append(self.data["carriage_vel"], newdata[1])
         self.data["turbine_rpm"] = np.append(self.data["turbine_rpm"], newdata[2])
         time.sleep(self.sleeptime)
         newdata = acsc.readReal(self.hc, acsc.NONE, "data", 0, 2, self.dblen//2, self.dblen-1)
         t = (newdata[0] - t0)/1000.0
         self.data["time"] = np.append(self.data["time"], t)
         self.data["time"] = self.data["time"] - self.data["time"][0]
         self.data["carriage_vel"] = np.append(self.data["carriage_vel"], newdata[1])
         self.data["turbine_rpm"] = np.append(self.data["turbine_rpm"], newdata[2])
Ejemplo n.º 2
0
    def on_timer_slow(self):
        self.axis_enabled = acsc.getMotorEnabled(self.hcomm, self.axis)

        if self.axis_enabled:
            self.ui.enableAxis.setChecked(True)
            self.ui.enableAxis.setText("Disable")
            self.ui.enableAxis.setIcon(QIcon(":icons/cancelx.png"))
        else:
            self.ui.enableAxis.setChecked(False)
            self.ui.enableAxis.setText("Enable")
            self.ui.enableAxis.setIcon(QIcon(":icons/checkmark.png"))
            self.jogmode = False
            acsc.stopBuffer(self.hcomm, 5)

        if self.simulator == False:
            self.homecounter = acsc.readInteger(self.hcomm, None,
                                                "homeCounter_tow")
Ejemplo n.º 3
0
for n in xrange(3):
    prg.addptp(0, 10000, "/e")
    prg.addptp(0, 0, "/e")
prg.addline("WAIT 10000")
prg.addline("STOPDC")
prg.addstopline()

acsc.setAcceleration(hc, 0, 10000)
acsc.loadBuffer(hc, 0, prg, 1024)
acsc.runBuffer(hc, 0)

astate = acsc.getAxisState(hc, 0)
#print astate

for n in xrange(3):
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, 0, dblen/2-1)
    print acsc.readInteger(hc, acsc.NONE, "S_DCN")
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, dblen/2, dblen-1)
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])

print acsc.readReal(hc, acsc.NONE, "foo")
acsc.printLastError()
acsc.closeComm(hc)

plt.plot(t, data)
plt.show()
Ejemplo n.º 4
0
    prg.addptp(0, 10000, "/e")
    prg.addptp(0, 0, "/e")
prg.addline("WAIT 10000")
prg.addline("STOPDC")
prg.addstopline()

acsc.setAcceleration(hc, 0, 10000)
acsc.loadBuffer(hc, 0, prg, 1024)
acsc.runBuffer(hc, 0)

astate = acsc.getAxisState(hc, 0)
#print astate

for n in range(3):
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, 0, dblen / 2 - 1)
    print(acsc.readInteger(hc, acsc.NONE, "S_DCN"))
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, dblen / 2, dblen - 1)
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])

print(acsc.readReal(hc, acsc.NONE, "foo"))
acsc.printLastError()
acsc.closeComm(hc)

plt.plot(t, data)
plt.show()