Commit ef3e87dd authored by Mateus Goto's avatar Mateus Goto

[new] Charts working with some bugs

parent b96ab0c6
......@@ -500,18 +500,22 @@ class NHR9400():
value = self.__s.recv(1024)
return self.receiveFloat(value)
def getVoltageArray(self):
array = []
def getPoints(self):
self.__s.send("CLS\n".encode())
self.__s.send("SENSe:SWEep:POINts?\n".encode())
points = self.__s.recv(1024)
points = self.receiveFloat(points)
for i in range(int(points/130)):
return self.receiveFloat(points)
def getVoltageArray(self, points):
array = []
for i in range(int((points/130))):
self.__s.send(("FETC:ARR:VOLT? " + str(i*130) +"\n").encode())
value = self.__s.recv(1024)
value = self.receiveArray(value)
array = array + value
return array
#Fetch the average power of all channels
def getPower(self):
self.__s.send("FETC:POW?\n".encode())
......
import json
from random import randint
from asyncio import sleep
from channels.generic.websocket import AsyncWebsocketConsumer
from NHR9400series.NHR9410 import NHR9410
from Control_Interface.controlInterface import controlInterface
......@@ -10,15 +8,14 @@ interface = controlInterface()
interface.newNhr("9410")
nhr10 = []
nhr10 = interface.getNhr9410()
points = nhr10[0].getPoints()
class GraphConsumer(AsyncWebsocketConsumer):
async def connect(self):
await self.accept()
for i in range(1000):
array = nhr10[0].getVoltageArray()
print(len(array)/10)
for j in range(int(len(array)/4)):
await self.send(json.dumps({'value': array[j*4]}))
array = nhr10[0].getVoltageArray(points)
for j in range(int(len(array)/30)):
await self.send(json.dumps({'value': array[j*29]}))
await sleep(0.1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment