This commit is contained in:
Anders Sandstrom
2023-08-07 10:16:24 +02:00
parent 23fc3b602d
commit 5a8aa08a86
4 changed files with 51 additions and 23 deletions

View File

@@ -177,14 +177,14 @@ record(ao,"$(P)Plg-Mtn${INDEX}-AxCmd-RB"){
field(VAL, "1")
}
record(ao,"$(P)Plg-Mtn${INDEX}-SmpHz-RB"){
record(ai,"$(P)Plg-Mtn${INDEX}-SmpHz-RB"){
info(asyn:READBACK,"1")
field(DESC, "Sample rate")
field(DTYP,"asynInt32")
field(OUT, "@asyn(PLUGIN.MOTION_${INDEX},$(ADDR=0),$(TIMEOUT=1000))plugin.motion_${INDEX}.samplerate")
field(DOL, "0")
field(DTYP,"asynFloat64")
field(INP, "@asyn(PLUGIN.MOTION_${INDEX},$(ADDR=0),$(TIMEOUT=1000))plugin.motion_${INDEX}.samplerate")
field(VAL, "1")
field(EGU, "Hz")
field(SCAN, "I/O Intr")
}
record(ai,"$(P)Plg-Mtn${INDEX}-BuffSze"){

View File

@@ -150,7 +150,7 @@ ecmcMotionPlg::ecmcMotionPlg(int objIndex, // index of this object (if s
printf("Warning selected sample rate faster than ecmc rate, rate will be set to ecmc rate.\n");
cfgSampleRateHz_ = ecmcSampleRateHz_;
}
// Se if any data update cycles should be ignored
// example ecmc 1000Hz, fft 100Hz then ignore 9 cycles (could be strange if not multiples)
ignoreCycles_ = ecmcSampleRateHz_ / cfgSampleRateHz_ -1;

View File

@@ -28,6 +28,7 @@ IOC_TEST:Axis1-VelAct
IOC_TEST:Axis1-PosSet
IOC_TEST:Axis1-PosErr
IOC_TEST:Axis1-PLC-Err
IOC_TEST:Plg-Mtn0-SmpHz-RB
IOC_TEST:Plg-Mtn0-BuffSze
IOC_TEST:Plg-Mtn0-ElmCnt
IOC_TEST:MCU-AppMode
@@ -172,10 +173,10 @@ IOC_TEST:m0-Dom-WC-Zero
IOC_TEST:m0-Dom-WC-Incomplete
IOC_TEST:m0-Dom-WC-Complete
IOC_TEST:m0-Stat-OK
REQMOD:raspberrypi-8270:exit
REQMOD:raspberrypi-8270:MODULES
REQMOD:raspberrypi-8270:VERSIONS
REQMOD:raspberrypi-8270:MOD_VER
REQMOD:raspberrypi-5109:exit
REQMOD:raspberrypi-5109:MODULES
REQMOD:raspberrypi-5109:VERSIONS
REQMOD:raspberrypi-5109:MOD_VER
IOC_TEST:Axis1-Arr-Stat
IOC_TEST:Axis1-PLC-Expr-RB
IOC_TEST:Plg-Mtn0-PosAct-Arr
@@ -245,18 +246,18 @@ IOC_TEST:m0-SlvRsp
IOC_TEST:m0-Dom-WC
IOC_TEST:m0s001-Enc01-LtchRst
IOC_TEST:Axis1-Cmd_
REQMOD:raspberrypi-8270:BaseVersion
REQMOD:raspberrypi-8270:require_VER
REQMOD:raspberrypi-8270:ecmccfg_VER
REQMOD:raspberrypi-8270:asyn_VER
REQMOD:raspberrypi-8270:exprtk_VER
REQMOD:raspberrypi-8270:motor_VER
REQMOD:raspberrypi-8270:ruckig_VER
REQMOD:raspberrypi-8270:ecmc_VER
REQMOD:raspberrypi-5109:BaseVersion
REQMOD:raspberrypi-5109:require_VER
REQMOD:raspberrypi-5109:ecmccfg_VER
REQMOD:raspberrypi-5109:asyn_VER
REQMOD:raspberrypi-5109:exprtk_VER
REQMOD:raspberrypi-5109:motor_VER
REQMOD:raspberrypi-5109:ruckig_VER
REQMOD:raspberrypi-5109:ecmc_VER
IOC_TEST:m0s001-HWType
IOC_TEST:m0s002-HWType
IOC_TEST:Axis1-MsgTxt
REQMOD:raspberrypi-8270:ecmc_plugin_motion_VER
REQMOD:raspberrypi-5109:ecmc_plugin_motion_VER
IOC_TEST:m0s001-Drv01-Stat
IOC_TEST:m0s001-Enc01-Stat
IOC_TEST:m0s001-Stat_
@@ -308,7 +309,6 @@ IOC_TEST:MCU-Cfg-AX-FrstObjId
IOC_TEST:MCU-Cfg-PLG{Index}-NxtObjId
IOC_TEST:MCU-Cfg-PLG-FrstObjId
IOC_TEST:Plg-Mtn0-AxCmd-RB
IOC_TEST:Plg-Mtn0-SmpHz-RB
IOC_TEST:MCU-Cfg-Eng-Mode
IOC_TEST:m0s001-Enc01-LchAutRstSp
IOC_TEST:m0s002-BO01

View File

@@ -30,6 +30,9 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
import matplotlib.pyplot as plt
import threading
# Allow buffering of 10s data, need to add setting for this
xMaxTime = 10
# List of pv names
pvlist = [ 'BuffSze',
'ElmCnt',
@@ -90,6 +93,8 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
for pv in pvlist:
self.data[pv] = None
self.data['test'] = None
#Set some default plot colours
self.plotColor={}
@@ -267,8 +272,30 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
self.setWindowTitle("ecmc Mtn Main plot: prefix=" + self.pvPrefixStr + " , mtnId=" + str(self.mtnPluginId) +
", rate=" + str(self.sampleRate))
def buildPvNames(self):
print('HEHEHEHHEH')
def addData(self, pvName, values):
# Check if first assignment
if self.data['test'] is None:
self.data['test'] = values
return
self.data['test'].extend(values)
# check if delete in beginning is needed
currcount = len(self.data['test'])
if self.sampleRateValid:
print('Sample rate = ' +str(self.sampleRate))
allowedcount = int(xMaxTime * self.sampleRate)
else:
print('Warninf sample rate not defined')
allowedcount = 10000
allowedcount = 100
print('currcount = ' + str(currcount) + " allowedcount = "+str(allowedcount))
if currcount > allowedcount:
self.data['test']=self.data['test'][currcount-allowedcount:]
print('DATA:')
print(self.data['test'])
def buildPvNames(self):
# Pv names based on structure: <prefix>Plugin-Mtn<mtnPluginId>-<suffixname>
for pv in pvlist:
self.pvnames[pv]=self.buildPvName(pv)
@@ -398,6 +425,7 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
if(np.size(value)) > 0:
self.MtnYDataValid = True
self.data['PosAct-Arr'] = value
self.addData('test',[1,2,3,4,5,6,7,8,9,10])
def sig_cb_PosSet_Arr(self,value):
self.data['PosSet-Arr'] = value
@@ -751,8 +779,8 @@ class ecmcMtnMainGui(QtWidgets.QDialog):
self.axBinary.set_title(self.title)
if autozoom:
ymin = np.min(self.data['PosAct-Arr'])
ymax = np.max(self.data['PosAct-Arr'])
ymin = 0
ymax = 1
# ensure different values
if ymin == ymax:
ymin=ymin-1