EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: AW: pv invalid using stream
From: "Zimoch Dirk \(PSI\) via Tech-talk" <tech-talk at aps.anl.gov>
To: 网易邮件中心 <l123173 at 163.com>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 9 May 2022 09:17:57 +0000

Hello Liang,

 

It looks like your protocol is binary. That means it can contain any bytes as values. That does not mix well with Terminator=LF because LF (\x010) may be part of your data. The result would be a too short message.

 

If your messages have all the same length (11 bytes including a terminating LF?), I suggest to use MaxInput=11 instead of Terminator=LF.

 

Using ExtraInput=Ignore and data ignoring formats like %*2r you disable much error checking. It is better to make sure that you get the correct data.

 

A more detailed description of your format (what are those bytes?) and c copy of your python program would help to answer the question if your protocol is right and if streamDevice is suitable or not. It is suitable for a lot of things.

 

StreamDevice sets the record to INVALID severity when something goes wrong. It prints an error message when that happens which may help to understand the problem. Make sure that 'var streamError' is 1. Do you see any error messages?

 

StreamDevice does sets status UDF only if something does very wrong, e.g. the protocol has a syntax error or the asyn port does not exist. If the device only sends something that the protocol cannot parse, the status would be CALC, not UDF. Check if there are error messages when the IOC starts.

 

Dirk

 

 

Von: Tech-talk <tech-talk-bounces at aps.anl.gov> Im Auftrag von ?????? via Tech-talk
Gesendet: Montag, 9. Mai 2022 10:46
An: tech-talk at aps.anl.gov
Betreff: pv invalid using stream

 

Hi all,

     I have a python program( xxx.py ), which simulate a hardware( actually it was prepared for a can bus device ). The xxx.py uses TCP protocols.

     The xxx.py would produce data, I intend to do the comunication with PC-linux and epics using xxx.py. 

     I means ask IOC get the value produced by xxx.py.

 

the xxx.py send and receive message like these:

 

sending msg: b'\x05\x03\x01\x04A\x00\x00\x00W\x19'

receiving msg: b'\x05\x03\x02\x04@\xe0\x00\x00W '       # 7 byte?

sending msg: b'\x05\x03\x02\x04A\x10\x00\x00V\xef'

receiving msg: b'\x05\x03\x01\x04A\x00\x00\x00W\x19'   # 8 byte?

sending msg: b'\x05\x03\x01\x04A \x00\x00V\xd3'

receiving msg: b'\x05\x03\x02\x04A\x10\x00\x00V\xef'

sending msg: b'\x05\x03\x02\x04?\x80\x00\x00N\xea'

receiving msg: b'\x05\x03\x01\x04A \x00\x00V\xd3'

sending msg: b'\x05\x03\x01\x04@\x00\x00\x00V\xe5'

receiving msg: b'\x05\x03\x02\x04?\x80\x00\x00N\xea'

sending msg: b'\x05\x03\x02\x04@@\x00\x00W\x02'

receiving msg: b'\x05\x03\x01\x04@\x00\x00\x00V\xe5'   # has some strange character?

sending msg: b'\x05\x03\x01\x04@\x80\x00\x00W\r'

receiving msg: b'\x05\x03\x02\x04@@\x00\x00W\x02'

sending msg: b'\x05\x03\x02\x04@\xa0\x00\x00V\xf4'

receiving msg: b'\x05\x03\x01\x04@\x80\x00\x00W\r'

sending msg: b'\x05\x03\x01\x04@\xc0\x00\x00V\xd9'

receiving msg: b'\x05\x03\x02\x04@\xa0\x00\x00V\xf4'

 

 

Question:

I created an example ioc, added the db and proto, added " drvAsynIPPortConfigure("PS1","127.0.0.1:9011") " and STREAM_PROTOCOL_PATH in st.cmd.

--db file:

record(ai, "temperature")

{

 field(DESC, "temperature in tank")

 field(DTYP, "stream")

 field(INP, "@HSPY.proto GetTem PS1")

 field(EGU, "degree")

 field(SCAN, "1 second")

}

--proto file:

Terminator = LF;

GetTem {

        in "%*2r%r%*4r";

        ExtraInput = Ignore;

}

 

Then I got in IOC:

---epics> dbpr temperature

ASG:                DESC: temperature in tank               DISA: 0

DISP: 0             DISV: 1             NAME: temperature   RVAL: 0

SEVR: INVALID       STAT: UDF           SVAL: 0             TPRO: 0

VAL: 0

 

---epics> dbtr temperature

record active

 

Question

1) Another better tool than stream device?

2) Does the proto I the right?

3) why my temperatre pv was invalid undefined? 

     4) the received message was not so regular, stream device suitable?

Could someone do me a favor. ioc was run in unbuntu PC, epics was 7.0.x.

 

Thanks,

Liang

 

 


Replies:
Re:AW: pv invalid using stream 网易邮件中心 via Tech-talk
References:
pv invalid using stream 网易邮件中心 via Tech-talk

Navigate by Date:
Prev: pv invalid using stream 网易邮件中心 via Tech-talk
Next: Device support of asyn port driver for system commands. Phillip A. Sorensen via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: pv invalid using stream 网易邮件中心 via Tech-talk
Next: Re:AW: pv invalid using stream 网易邮件中心 via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·