split epics related devices into epics.py
also split the configfile: test.cfg for normal playing around epics.cfg for playing with epics Change-Id: Id91042fbbdcb6972b1493419960667b39f56f17e
This commit is contained in:
parent
69b979cdd0
commit
44537ad0d9
11
etc/epics.cfg
Normal file
11
etc/epics.cfg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[server]
|
||||||
|
bindto=0.0.0.0
|
||||||
|
bindport=10767
|
||||||
|
interface = tcp
|
||||||
|
framing=eol
|
||||||
|
encoding=text
|
||||||
|
|
||||||
|
[device epicspv]
|
||||||
|
class=devices.epics.EPICS_PV
|
||||||
|
sensor="test_sensor"
|
||||||
|
max_rpm="very high"
|
12
etc/test.cfg
12
etc/test.cfg
@ -16,7 +16,11 @@ maxheaterpower=10
|
|||||||
class=devices.test.Temp
|
class=devices.test.Temp
|
||||||
sensor="X34598T7"
|
sensor="X34598T7"
|
||||||
|
|
||||||
[device epicspv]
|
[device T2]
|
||||||
class=devices.test.EPICS_PV
|
class=devices.demo.CoilTemp
|
||||||
sensor="test_sensor"
|
sensor="X34598T8"
|
||||||
max_rpm="very high"
|
|
||||||
|
[device T3]
|
||||||
|
class=devices.demo.CoilTemp
|
||||||
|
sensor="X34598T9"
|
||||||
|
|
||||||
|
51
src/devices/epics.py
Normal file
51
src/devices/epics.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# *****************************************************************************
|
||||||
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
# Module authors:
|
||||||
|
# Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
|
||||||
|
# *****************************************************************************
|
||||||
|
|
||||||
|
"""testing devices"""
|
||||||
|
|
||||||
|
import random
|
||||||
|
|
||||||
|
from devices.core import Readable, Driveable, PARAM
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from epics import PV
|
||||||
|
except ImportError:
|
||||||
|
PV=None
|
||||||
|
|
||||||
|
|
||||||
|
class EPICS_PV(Driveable):
|
||||||
|
"""pyepics test device."""
|
||||||
|
|
||||||
|
PARAMS = {
|
||||||
|
'sensor': PARAM("Sensor number or calibration id",
|
||||||
|
validator=str, readonly=True),
|
||||||
|
'max_rpm': PARAM("Maximum allowed rpm",
|
||||||
|
validator=str, readonly=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
def read_value(self, maxage=0):
|
||||||
|
p1 = PV('testpv.VAL')
|
||||||
|
return p1.value
|
||||||
|
|
||||||
|
def write_target(self, target):
|
||||||
|
p1 = PV('test.VAL')
|
||||||
|
p1.value = target
|
@ -26,8 +26,6 @@ import random
|
|||||||
from devices.core import Readable, Driveable, PARAM
|
from devices.core import Readable, Driveable, PARAM
|
||||||
from validators import floatrange
|
from validators import floatrange
|
||||||
|
|
||||||
from epics import PV
|
|
||||||
|
|
||||||
|
|
||||||
class LN2(Readable):
|
class LN2(Readable):
|
||||||
"""Just a readable.
|
"""Just a readable.
|
||||||
@ -76,20 +74,3 @@ class Temp(Driveable):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EPICS_PV(Driveable):
|
|
||||||
"""pyepics test device."""
|
|
||||||
|
|
||||||
PARAMS = {
|
|
||||||
'sensor': PARAM("Sensor number or calibration id",
|
|
||||||
validator=str, readonly=True),
|
|
||||||
'max_rpm': PARAM("Maximum allowed rpm",
|
|
||||||
validator=str, readonly=True),
|
|
||||||
}
|
|
||||||
|
|
||||||
def read_value(self, maxage=0):
|
|
||||||
p1 = PV('testpv.VAL')
|
|
||||||
return p1.value
|
|
||||||
|
|
||||||
def write_target(self, target):
|
|
||||||
p1 = PV('test.VAL')
|
|
||||||
p1.value = target
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user