EPICS

undefined
 
EPICS
’Stream’ Device Support
 
Klemen Vodopivec
Kay Kasemir
 
Feb 2022
 
 
What is a “streaming” device?
 
Text (ASCII) bi-directional protocol
(Usually) one connection per device
Command & response
What is the current temperature on channel A?
 
KRDG A?
Reply
 
+077.350E+0\n
Serial (RS-232, RS485), Networked (TCP), GPIB (IEEE-488)
 
Handled by EPICS “StreamDevice”
 
 
Examples
 
Temperature controllers
Lakeshore
Omega
Vacuum pumps
Varian
Power supplies
Agilent
Spellman
Moxa (modbus, profinet, serial, etc.)
 
Pro/Cons
 
Seems easy
Human-readable
Testable with minicom, telnet, nc, HyperTerm, Putty, …
Create Visual Basic, LabVIEW, Python …
demo in no time
But beware!
Speed and Terminators (CR, LF, CR/LF, …) can magically
change
Was set to something, then device power-cycled …
Must handle timeouts
Don
t just hang!
Must handle errors
Don
t read 
MODEL 340
 as 340 Kelvin
 
EPICS 
StreamDevice Idea
Protocol File
demo.proto
Terminator = 
CR
;
getTempA
{
  out "
KRDG A?
";
  in "
%f
";
}
Record
record(ai, "Temp:A")
{
  field(DTYP,"
stream
")
  field(INP, "@
demo.proto
 
getTempA 
TC1
")
  field(SCAN,"5 second")
}
IOC st.cmd
drvAsynIPPortConfigure ("
TC1
", "192.168.164.10:23")
 
EPICS StreamDevice features
 
Connection management through asyn
Automatically connect
Re-connect after disconnects
Allow many records to communicate via one connection
Threading, queuing, …
Handle timeouts, errors
Put records into 
alarm
 state
Debug options
Log every byte sent/received (as part of asyn)
 
Adding StreamDevice support to IOC
configure/RELEASE or RELEASE.local:
ASYN=/path/to/asyn
STREAM=/path/to/StreamDevice
demoApp/src/Makefile
demo_DBD += stream.dbd
demo_DBD += asyn.dbd
demo_DBD += drvAsynIPPort.dbd
demo_LIBS += asyn
demo_LIBS += stream
 
See /ics/examples/08_streamDemoApp
 
EPICS Database
record(ai, "B")
{
  field (DTYP, "
stream
")
  field (INP,  "
@demo.proto
 
getB
 
NC
")
  field (SCAN, "5 second")
}
record(ai, "A")
{
  field (DTYP, "
stream
")
  field (INP,  "
@demo.proto getA NC
")
  field (SCAN, "I/O Intr")
}
record(ao, "current")
{
  field (DTYP, "
stream
")
  field (OUT,  "
@demo.proto setCurrent NC
")
  field (EGU,  "A")
  field (PREC, "2")
  field (DRVL, "0")
  field (DRVH, "60")
  field (LOPR, "0")
  field (HOPR, "60
)
}
 
s
t
r
e
a
m
-
d
e
m
o
.
d
b
 
See /ics/examples/08_streamDemoApp/Db
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
Protocol File
Terminator = CR LF;
InTerminator = LF;
ReplyTimeout = 10000;
ReadTimeout = 10000;
# 
Used with SCAN 
… second
# triggered from DB record.
# Prompts, then expects "B 5"
getB
{
    out "B?";
    in "B %f
;
    @mismatch
    {
        # Commented out for demo
        #disconnect;
    }
}
 
 
# Used with SCAN, "I/O Intr”.
# Reacts to "A 5" at any time
getA
{
   PollPeriod = 50;
   in "A %f";
}
# Example with initialization,
# otherwise only writes when processed
setCurrent
{
    out "CURRENT %.2f";
    @init
    {
        out "CURRENT?";
        in "CURRENT %f A";
    }
}
 
stream-demo.proto
 
IOC Startup File
epicsEnvSet ("STREAM_PROTOCOL_PATH", "path/to/proto/files")
drvAsynIPPortConfigure ("NC", "127.0.0.1:6543")
# Log some asyn info and in/out texts
# ASYN_TRACE_ERROR     0x0001
# ASYN_TRACEIO_DEVICE  0x0002
# ASYN_TRACEIO_FILTER  0x0004
# ASYN_TRACEIO_DRIVER  0x0008
# ASYN_TRACE_FLOW      0x0010
# ASYN_TRACE_WARNING   0x0020
asynSetTraceMask("NC", 0, 4)
asynSetTraceIOMask("NC", 0, 6)
dbLoadRecords("db/stream-demo.db","user=training")
 
 
iocBoot/iocdemo/st.cmd
 
See /ics/examples/iocBoot/ioc_streamDemo
 
Example Session
B?
 
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
 
A 3.14
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:16.875 NC read
A 3.14\n
41 20 33 2e 31 34 0a
 
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
 
A 3.14
 
B?
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:16.875 NC read
A 3.14\n
41 20 33 2e 31 34 0a
2018/12/04 16:18:21.519 NC wrote
B?\r\n
42 3f 0d 0a
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
 
A 3.14
 
B?
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:16.875 NC read
A 3.14\n
41 20 33 2e 31 34 0a
2018/12/04 16:18:21.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
 
A 3.14
 
B?
 
 
B?
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:16.875 NC read
A 3.14\n
41 20 33 2e 31 34 0a
2018/12/04 16:18:21.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms
2018/12/04 16:18:36.519 NC wrote
B?\r\n
42 3f 0d 0a
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
Example Session
B?
 
B 12
 
B?
 
A 3.14
 
B?
 
 
B?
 
34
2018/12/04 16:18:11.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:11.902 NC read
B 12\n
42 20 31 32 0a
2018/12/04 16:18:16.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:16.875 NC read
A 3.14\n
41 20 33 2e 31 34 0a
2018/12/04 16:18:21.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms
2018/12/04 16:18:36.519 NC wrote
B?\r\n
42 3f 0d 0a
2018/12/04 16:18:36.893 NC read
34\n
33 34 0a
2018/12/04 16:18:36.893 NC B: Input "34" mismatch after 0 bytes
2018/12/04 16:18:36.893 NC B: got "34" where "B " was expected
 
IOC console output
 
NetCat interactive demo
‘nc -l 127.0.0.1 6543
 
More to try
 
Note how IOC once asks for “CURRENT?” at startup
Later, writing to “current” record will write that value to device
Device might at any time send “A {some number}”
 
More in StreamDevice Manual (online)
 
Supports most EPICS records, incl. waveform
Can handle tricky protocols
Value skipping (ie. ROI %*d %d)
Multi-line messages
Checksums
Format converters
 
 
https://paulscherrerinstitute.github.io/StreamDevice/
 
Check asyn for connection details
 
drvAsynSerialPortConfigure
Baud, bits, parity, stop etc.
drvAsynIPPortConfigure
Hostname and port
 
https://epics.anl.gov/modules/soft/asyn/
 
https://epics.anl.gov/modules/soft/asyn/R4-38/asynDriver.html
 
StreamDevice…
 
Allows you to concentrate on the protocol,
handles the rest
Connection
Threads
Parse results
Update record’s value
and alarm state
Slide Note
Embed
Share

EPICS Stream Device Support at Oak Ridge National Laboratory (ORNL) managed by UT-Battelle, LLC for the US Department of Energy involves using streaming devices for bi-directional communication, protocol handling, and data acquisition. Learn about streaming devices, their applications in temperature control, and examples of devices supported. Explore the advantages, challenges, and implementation of EPICS Stream Device, along with features like connection management, error handling, and debugging options. Discover how to add Stream Device support to an IOC and configure the necessary libraries.

  • EPICS
  • Streaming Device
  • ORNL
  • Temperature Control
  • Communication

Uploaded on Feb 15, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. EPICS Stream Device Support Klemen Vodopivec Kay Kasemir Feb 2022 ORNL is managed by UT-Battelle, LLC for the US Department of Energy

  2. What is a streaming device? Text (ASCII) bi-directional protocol (Usually) one connection per device Command & response What is the current temperature on channel A? KRDG A? Reply +077.350E+0\n Serial (RS-232, RS485), Networked (TCP), GPIB (IEEE-488) Handled by EPICS StreamDevice Open slide master to edit 2 2

  3. Examples Temperature controllers Lakeshore Omega Vacuum pumps Varian Power supplies Agilent Spellman Moxa (modbus, profinet, serial, etc.) Open slide master to edit 3 3

  4. Pro/Cons Seems easy Human-readable Testable with minicom, telnet, nc, HyperTerm, Putty, Create Visual Basic, LabVIEW, Python demo in no time But beware! Speed and Terminators (CR, LF, CR/LF, ) can magically change Was set to something, then device power-cycled Must handle timeouts Don t just hang! Must handle errors Don t read MODEL 340 as 340 Kelvin Open slide master to edit 4 4

  5. EPICS StreamDevice Idea Protocol File demo.proto Record record(ai, "Temp:A") { field(DTYP,"stream") field(INP, "@demo.proto getTempA TC1") field(SCAN,"5 second") } Terminator = CR; getTempA { out "KRDG A?"; in "%f"; } IOC st.cmd drvAsynIPPortConfigure ("TC1", "192.168.164.10:23") Open slide master to edit 5 5

  6. EPICS StreamDevice features Connection management through asyn Automatically connect Re-connect after disconnects Allow many records to communicate via one connection Threading, queuing, Handle timeouts, errors Put records into alarm state Debug options Log every byte sent/received (as part of asyn) Open slide master to edit 6 6

  7. Adding StreamDevice support to IOC configure/RELEASE or RELEASE.local: ASYN=/path/to/asyn STREAM=/path/to/StreamDevice demoApp/src/Makefile demo_DBD += stream.dbd demo_DBD += asyn.dbd demo_DBD += drvAsynIPPort.dbd demo_LIBS += asyn demo_LIBS += stream See /ics/examples/08_streamDemoApp Open slide master to edit 7 7

  8. EPICS Database stream-demo.db record(ai, "B") { field (DTYP, "stream") field (INP, "@demo.protogetBNC") field (SCAN, "5 second") } record(ai, "A") { field (DTYP, "stream") field (INP, "@demo.proto getA NC") field (SCAN, "I/O Intr") } record(ao, "current") { field (DTYP, "stream") field (OUT, "@demo.proto setCurrent NC") field (EGU, "A") field (PREC, "2") field (DRVL, "0") field (DRVH, "60") field (LOPR, "0") field (HOPR, "60 ) } See /ics/examples/08_streamDemoApp/Db Open slide master to edit 8 8

  9. Protocol File stream-demo.proto System variables Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Open slide master to edit 9 9

  10. Protocol File stream-demo.proto Comment Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Open slide master to edit 10 10

  11. Protocol File stream-demo.proto Function definition and implementation in curly brackets Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Open slide master to edit 11 11

  12. Protocol File stream-demo.proto Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } Commands out for send in for receive Other commands: wait event connect disconnect exec # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Open slide master to edit 12 12

  13. Protocol File stream-demo.proto Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } Format converters start with % - similar to printf() syntax # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } %f for floating point number # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Open slide master to edit 13 13

  14. Protocol File stream-demo.proto Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { disconnect; } } # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } Exception handling mismatch writetimeout replytimeout readtimeout Open slide master to edit 14 14

  15. Protocol File stream-demo.proto Terminator = CR LF; InTerminator = LF; ReplyTimeout = 10000; ReadTimeout = 10000; # Used with SCAN, "I/O Intr . # Reacts to "A 5" at any time getA { PollPeriod = 50; in "A %f"; } # Used with SCAN second # triggered from DB record. # Prompts, then expects "B 5" getB { out "B?"; in "B %f ; @mismatch { # Example with initialization, # otherwise only writes when processed setCurrent { out "CURRENT %.2f"; @init { out "CURRENT?"; in "CURRENT %f A"; } } # Commented out for demo #disconnect; } } Open slide master to edit 15 15

  16. IOC Startup File iocBoot/iocdemo/st.cmd epicsEnvSet ("STREAM_PROTOCOL_PATH", "path/to/proto/files") drvAsynIPPortConfigure ("NC", "127.0.0.1:6543") # Log some asyn info and in/out texts # ASYN_TRACE_ERROR 0x0001 # ASYN_TRACEIO_DEVICE 0x0002 # ASYN_TRACEIO_FILTER 0x0004 # ASYN_TRACEIO_DRIVER 0x0008 # ASYN_TRACE_FLOW 0x0010 # ASYN_TRACE_WARNING 0x0020 asynSetTraceMask("NC", 0, 4) asynSetTraceIOMask("NC", 0, 6) dbLoadRecords("db/stream-demo.db","user=training") See /ics/examples/iocBoot/ioc_streamDemo Open slide master to edit 16 16

  17. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a B? Open slide master to edit 17 17

  18. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a B? B 12 Open slide master to edit 18 18

  19. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a B? B 12 B? Open slide master to edit 19 19

  20. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:16.875 NC read A 3.14\n 41 20 33 2e 31 34 0a B? B 12 B? A 3.14 Open slide master to edit 20 20

  21. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:16.875 NC read A 3.14\n 41 20 33 2e 31 34 0a 2018/12/04 16:18:21.519 NC wrote B?\r\n 42 3f 0d 0a B? B 12 B? A 3.14 B? Open slide master to edit 21 21

  22. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:16.875 NC read A 3.14\n 41 20 33 2e 31 34 0a 2018/12/04 16:18:21.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms B? B 12 B? A 3.14 B? Open slide master to edit 22 22

  23. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:16.875 NC read A 3.14\n 41 20 33 2e 31 34 0a 2018/12/04 16:18:21.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms 2018/12/04 16:18:36.519 NC wrote B?\r\n 42 3f 0d 0a B? B 12 B? A 3.14 B? B? Open slide master to edit 23 23

  24. Example Session NetCat interactive demo nc -l 127.0.0.1 6543 IOC console output 2018/12/04 16:18:11.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:11.902 NC read B 12\n 42 20 31 32 0a 2018/12/04 16:18:16.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:16.875 NC read A 3.14\n 41 20 33 2e 31 34 0a 2018/12/04 16:18:21.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:31.529 NC B: No reply from device within 10000 ms 2018/12/04 16:18:36.519 NC wrote B?\r\n 42 3f 0d 0a 2018/12/04 16:18:36.893 NC read 34\n 33 34 0a 2018/12/04 16:18:36.893 NC B: Input "34" mismatch after 0 bytes 2018/12/04 16:18:36.893 NC B: got "34" where "B " was expected B? B 12 B? A 3.14 B? B? 34 Open slide master to edit 24 24

  25. More to try Note how IOC once asks for CURRENT? at startup Later, writing to current record will write that value to device Device might at any time send A {some number} Open slide master to edit 25 25

  26. More in StreamDevice Manual (online) Supports most EPICS records, incl. waveform Can handle tricky protocols Value skipping (ie. ROI %*d %d) Multi-line messages Checksums Format converters https://paulscherrerinstitute.github.io/StreamDevice/ Open slide master to edit 26 26

  27. Check asyn for connection details drvAsynSerialPortConfigure Baud, bits, parity, stop etc. drvAsynIPPortConfigure Hostname and port https://epics.anl.gov/modules/soft/asyn/ https://epics.anl.gov/modules/soft/asyn/R4-38/asynDriver.html Open slide master to edit 27 27

  28. StreamDevice Allows you to concentrate on the protocol, handles the rest Connection Threads Parse results Update record s value and alarm state demo.proto Terminator = CR; getTempA { out "KRDG? A"; in "%f"; } Open slide master to edit 28 28

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#