Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket2828 add ioc triton #1

Merged
merged 24 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
O.*/
/db
/bin
/dbd
/include
/lib
/templates
envPaths
cdCommands
dllPath.bat
runIOC.bat
runIOC.sh
relPaths.sh
*.tag
/data/
/doc/
*_info_positions.req
*_info_settings.req
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Makefile for Asyn triton support
#
# Created by ynq66733 on Tue Dec 19 09:31:58 2017
# Based on the Asyn streamSCPI template

TOP = .
include $(TOP)/configure/CONFIG

DIRS := configure
DIRS += $(wildcard *[Ss]up)
DIRS += $(wildcard *[Aa]pp)
DIRS += $(wildcard ioc[Bb]oot)

include $(TOP)/configure/RULES_TOP
13 changes: 13 additions & 0 deletions configure/CONFIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#CONFIG
include $(TOP)/configure/CONFIG_APP
# Add any changes to make definitions here

#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040

# Use this when your IOC and the host use different paths
# to access the application. Typically this will be
# used with the Microsoft FTP server or with NFS mounts. Use
# is indicated by failure of the cdCommands script on
# vxWorks. You must rebuild in the iocBoot directory
# before this takes effect.
#IOCS_APPL_TOP = <the top of the application as seen by the IOC>
21 changes: 21 additions & 0 deletions configure/CONFIG_APP
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CONFIG_APP

include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)

CONFIG=$(EPICS_BASE)/configure
include $(CONFIG)/CONFIG

INSTALL_LOCATION = $(TOP)
ifdef INSTALL_LOCATION_APP
INSTALL_LOCATION = $(INSTALL_LOCATION_APP)
endif

ifdef T_A
-include $(TOP)/configure/O.$(T_A)/CONFIG_APP_INCLUDE
endif

# dbst based database optimization (default: NO)
DB_OPT = NO
13 changes: 13 additions & 0 deletions configure/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## configure/Makefile

TOP=..
include $(TOP)/configure/CONFIG

# Set the following to NO to disable consistency checking of
# the support applications defined in $(TOP)/configure/RELEASE
CHECK_RELEASE = YES

TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))

include $(TOP)/configure/RULES
5 changes: 5 additions & 0 deletions configure/RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# optional extra local definitions here
-include $(TOP)/configure/RELEASE.private

include $(TOP)/../../../ISIS_CONFIG
-include $(TOP)/../../../ISIS_CONFIG.$(EPICS_HOST_ARCH)
5 changes: 5 additions & 0 deletions configure/RULES
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#CONFIG
include $(EPICS_BASE)/configure/RULES

# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile
2 changes: 2 additions & 0 deletions configure/RULES_DIRS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#RULES_DIRS
include $(EPICS_BASE)/configure/RULES_DIRS
3 changes: 3 additions & 0 deletions configure/RULES_TOP
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#RULES_TOP
include $(EPICS_BASE)/configure/RULES_TOP

78 changes: 78 additions & 0 deletions documentation/devtriton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>triton Instrument Support</title>
<meta name="generator" content="amaya 8.5, see http://www.w3.org/Amaya/" />
</head>

<body>
<h1>Using triton instrument support in an application</h1>

<p>Several files need minor modifications to use triton instrument support in
an application.</p>
<ol>
<li>Add the full path to the triton support directory to the
application <tt>configure/RELEASE</tt> file:<br />
<tt>triton=</tt><em>xxxx</em><tt>/modules/instrument/triton/&lt;release&gt;</tt><br />
Where <tt>&lt;release&gt;</tt> is the release number of of the triton support.</li>
<li>Add stream and asyn support to application database definition file<br />
The application database definition file must include the database
definition files for the stream package and for any needed ASYN
drivers. There are two ways that this can be done:
<ul>
<li>If you are building your application database definition file from
an <em>xxx</em><tt>Include.dbd</tt> file you include the additional database
definitions in that file:<br />
<tt>include "base.dbd"</tt><br />
<tt>include "stream.dbd"</tt><br />
<tt>include "drvAsynIPPort.dbd"</tt></li>
<li>If you are building your application database definition file from
the application Makefile you specify the aditional database
definitions there:<br />
<em>xxx</em><tt>_DBD += base.dbd</tt><br />
<em>xxx</em><tt>_DBD += stream.dbd</tt><br />
<em>xxx</em><tt>_DBD += drvAsynIPPort.dbd</tt><br /></li>
</ul>
</li>
<li>Add the stream and asyn support libraries to the application<br />
You must link the stream support library and the ASYN support library
with the application. Add the following lines: <br />
<em>xxx</em><tt>_LIBS += stream</tt><br />
<em>xxx</em><tt>_LIBS += asyn</tt><br />
before the <br />
<em>xxx</em><tt>_LIBS += $(EPICS_BASE_IOC_LIBS)</tt><br />
in the application Makefile.</li>
<li>Load the triton support database records in the application startup script:<br />
<tt>cd $(triton)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>(<tt>cd triton</tt> if using the vxWorks shell)<br />
<tt>dbLoadRecords("db/devtriton.db,"P=</tt><em>&lt;P&gt;</em><tt>,R=</tt><em>&lt;R&gt;</em><tt>,PORT=</tt><em>&lt;PORT&gt;</em><tt>,A=</tt><em>&lt;A&gt;</em><tt>")</tt><br />
You'll have to provide appropriate values for the PV name prefixes
(<em>&lt;P&gt;</em> and <em>&lt;R&gt;</em>), the port name (<em>&lt;PORT&gt;</em>) and the device address
(<em>&lt;A&gt;</em>). The port name must match the value specified in
an ASYN <tt>drv</tt><em>xxxxx</em><tt>Configure</tt> command.
</li>
</ol>
<h1>Installation and Building</h1>
After obtaining a copy of the distribution, it must be installed and built
for use at your site.
<ol>
<li>Create an installation directory for the module. The path name
of this directory should end with <tt>modules/instrument/triton</tt>.</li>
<li>Place the distribution file into this directory.</li>
<li>Execute the following commands:<br />
<tt>cd modules/instrument/triton</tt><br />
<tt>gunzip triton&lt;release&gt;.tar.gz</tt><br />
<tt>tar xvf triton&lt;release&gt;.tar</tt><br />
<tt>cd &lt;release&gt;</tt><br />
Where <tt>&lt;release&gt;</tt> is the release number of of the triton support.
</li>
<li>Edit the <tt>configure/RELEASE</tt> file and set the paths to your
installation of EPICS base, stream and ASYN support modules.</li>
<li>Execute <tt>make</tt> in the top level directory.</li>
</ol>
</body>
</html>


9 changes: 9 additions & 0 deletions tritonSup/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TOP=..
include $(TOP)/configure/CONFIG
#=======================================

# Install .dbd and .db files
DATA += devtriton.proto

#=======================================
include $(TOP)/configure/RULES
180 changes: 180 additions & 0 deletions tritonSup/devtriton.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
InTerminator = LF;
OutTerminator = CR LF;

# Some commands take a (very) long time to reply.
# This is particularly noticeable for setting closed loop mode, for example.
ReplyTimeout = 20000;
ReadTimeout = 20000;
WriteTimeout = 20000;

# Have to increase the lock timeout because if a command takes a very long time to reply it will
# still hold the exclusive lock for the comms port, so other commands cannot use it.
LockTimeout = 30000;

#
# Throughout this file PVs often have to be hardcoded as there is a length limit on input links which gets exceeded
#

getChanUid {
out "READ:SYS:DR:CHAN:\$1";
in "STAT:SYS:DR:CHAN:\$1:%s";
}

getSampleUid {
out "READ:DEV:H1:HTR:LOOP";
in "STAT:DEV:H1:HTR:LOOP:SENS:%s";
}

getChanTemp {
out "READ:DEV:%(\$1)s:TEMP:SIG:TEMP";
in "STAT:DEV:%*[^:]:TEMP:SIG:TEMP:%fK";
@mismatch {
# If temperature was not found.
in "STAT:DEV:%*[^:]:TEMP:SIG:TEMP:NOT_FOUND";
}
}

setP {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:P:%f";
in "%*s";
}

getP {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:P";
in "STAT:DEV:%*[^:]:TEMP:LOOP:P:%f";
}

setI {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:I:%f";
in "%*s";
}

getI {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:I";
in "STAT:DEV:%*[^:]:TEMP:LOOP:I:%f";
}

setD {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:D:%f";
in "%*s";
}

getD {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:D";
in "STAT:DEV:%*[^:]:TEMP:LOOP:D:%f";
}

setTSetpoint {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:TSET:%f";
in "%*s";
}

getTSetpoint {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:TSET";
in "STAT:DEV:%*[^:]:TEMP:LOOP:TSET:%fK";
}

setHtrRange {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:RANGE:%f";
in "%*s";
}

getHtrRange {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:RANGE";
in "STAT:DEV:%*[^:]:TEMP:LOOP:RANGE:%fmA";
}

getHtrType {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:HTR";
in "STAT:DEV:%*[^:]:TEMP:LOOP:HTR:%s";
}

getHtrPower {
out "READ:DEV:%(\$1HEATER:TYPE)s:HTR:SIG:POWR";
# ASSUMPTION - always returns heater power in uW.
in "STAT:DEV:%*[^:]:HTR:SIG:POWR:%fuW";
}

getHtrRes {
out "READ:DEV:%(\$1HEATER:TYPE)s:HTR:RES";
# ASSUMPTION - always returns heater resistance in Ohms.
in "STAT:DEV:%*[^:]:HTR:RES:%fOhm";
}

getClosedLoop {
out "READ:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:MODE";
in "STAT:DEV:%*[^:]:TEMP:LOOP:MODE:%{OFF|ON}";
}

setClosedLoop {
out "SET:DEV:%(\$1SAMPLE:UID)s:TEMP:LOOP:MODE:%{OFF|ON}";
in "STAT:SET:DEV:%*[^:]:TEMP:LOOP:MODE:%*{OFF|ON}:VALID";
}

getValveState {
# Argument 1 = Valve number
out "READ:DEV:V\$1:VALV:SIG:STATE";
in "STAT:DEV:V%*i:VALV:SIG:STATE:%{OPEN|CLOSE|NOT_FOUND}";
}

getChanState {
out "READ:DEV:\$1:TEMP:MEAS:ENAB";
in "STAT:DEV:%*[^:]:TEMP:MEAS:ENAB:%{OFF|ON}";
}

setChanState {
out "SET:DEV:\$1:TEMP:MEAS:ENAB:%{OFF|ON}";
in "%*s";
}

getStatus {
out "READ:SYS:DR:STATUS";
ExtraInput = Ignore; # If we get more than 512 chars in response, discard the excess and do not throw an error.
in "STAT:SYS:DR:STATUS:%512c";
}

getAutomation {
out "READ:SYS:DR:ACTN";
ExtraInput = Ignore; # If we get more than 512 chars in response, discard the excess and do not throw an error.
in "STAT:SYS:DR:ACTN:%512c";
}

getPressure {
out "READ:DEV:\$1:PRES:SIG:PRES";
in "STAT:DEV:%*[^:]:PRES:SIG:PRES:%fmB";
}

arbitrary {
out "%(\$1ARBITRARY:SP)#s";
ExtraInput = Ignore;
# Will always get a reply of some sort to a correct command.
# Need to wait for the reply to arrive as some commands take a long time to process.
# If we don't wait for the reply our reads and writes get out of sync which causes issues.
in "%(\$1ARBITRARY)#512s";
}

getTime {
out "READ:SYS:TIME";
in "STAT:SYS:TIME:%s";
}

getIDN {
out "*IDN?";
ExtraInput = Ignore; # If we get more than 512 chars in response, discard the excess and do not throw an error.
in "%512c";
}

readSig {
out "READ:DEV:\$1:TEMP:SIG";
in "STAT:DEV:%*[^:]:TEMP:SIG:TEMP:%(\$2:TEMP)fK:RES:%(\$2:RES)fOhm";
}

readExcitation {
out "READ:DEV:\$1:TEMP:EXCT";
in "STAT:DEV:%*[^:]:TEMP:EXCT:TYPE:%(\$2:EXCITATION:TYPE)[^:]:MAG:%(\$2:EXCITATION)f%(\$2:EXCITATION.EGU)s";
}

readMeas {
out "READ:DEV:\$1:TEMP:MEAS";
in "STAT:DEV:%*[^:]:TEMP:MEAS:PAUS:%(\$2:PAUSE)fs:DWEL:%(\$2:DWELL)fs:ENAB:%*[^:]";
}