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  <20182019  2020  2021  2022  2023  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  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: StreamDevice with Telnet port
From: "Abdalla Ahmad" <[email protected]>
To: Dirk Zimoch <[email protected]>
Cc: EPICS <[email protected]>
Date: Mon, 19 Mar 2018 10:42:30 +0000
Hello Dirk

Thank you for your email, I will test your suggestion and the protocol and provide you with feedback.

The '~' is used if you connect the controllers through RS485, that's why we have device address and checksum part of the packet. But since the interface and the infrastructure is Ethernet, telnet is used with the "cmd" interface. ModBus is available but through the serial port only (Although port 502 is open for some reason).

Abdalla.

-----Original Message-----
From: Dirk Zimoch [mailto:[email protected]] 
Sent: Monday, March 19, 2018 12:29 PM
To: Abdalla Ahmad <[email protected]>
Cc: EPICS <[email protected]>
Subject: Re: StreamDevice with Telnet port

Hello Abdalla,

Indeed I had not received a previous email.

The manual mentions RS232, '~'. Your mail talks about telnet, the ~ lines are commented out (instead "cmd" is used). Is there another interface that is not in the manual? To quickly switch between "~" and "cmd" if necessary I suggest using a variable.

I see that your enable and disable commands do not parse any input. 
Please check if it send any reply. Even something like simply "00 OK". 
If it does send something, then parse it!

Also check every input that you receive! "%*6c" simply ignores the fist
6 bytes. Better check for "00 OK " if you expect it. Do not use ExtraInput = Ignore. There is no good reason to do so. Read and check the checksum. It seems to be compatible with  "%0<sum>".


Here is my attempt to a protocol (not tested in any way):

# cmd = "~ 00";
cmd = "cmd"

Terminator = CR;

@mismatch {
	# handle errors: Put error code in another record "xxx-n:ERROR"
	# with n = \$1 (1 or 2, pump number) and device name xxx = \$2.
	in "00 ER %($\2-$\1:ERROR)x %0<sum>";
}

getCurrent
{
	out $cmd " 0A \$1 %0<sum>";
	in "00 OK %E AMPS %0<sum>";
}

getPressure
{
	out $cmd " 0B \$1 %0<sum>";
	in "00 OK %E %(EGU)s %0<sum>";  # put units in EGU field }

getVoltage
{
	out $cmd " 0C \$1 %0<sum>";
	in "00 OK %d %0<sum>";
}

getStatus
{
	# This one is tricky:
	# get strings with spaces and optional error code.
	# The strings are translated into index 0-8 for an mbbi.
	# The error code is passed to another record "xxx-n:ERROR"
	# with n=1 or 2 and basename xxx passed as argument 2.

	out $cmd " 0D \$1 %0<sum>";
	in "00 OK %{WAITING TO START|STANDBY|SAFE-CONN|RUNNING|COOL DOWN|PUMP 
ERROR|INTERLOCK|SHUT DOWN|CALIBRATION}%?($\2-$\1:ERROR)x %0<sum>";
}

isEnabled
{
	out $cmd " 61 \$1 %0<sum>";
	in "00 OK ${NO|YES} %0<sum>";  # 0 or 1 for mbbi or bi record }

enable
{
	out $cmd " 37 \$1 %0<sum>";
	in "00 OK %0<sum>";
}

disable
{
	out $cmd " 38 \$1 %0<sum>";
	in "00 OK %0<sum>";
}

Use the protocols with 2 arguments: pump number and record basename. Do not have spaces between the 2 arguments, only a comma.
Not that I have changed the data types from string %s to enum %{} in some protocols. Thus change the records to mbbi or bi.

Have an error record which is passive and without DTYP. It will receive the error code if the device replies with "ER" instead of "OK" and also if getStatus reports an error.

Dirk

On 19.03.2018 08:50, Abdalla  Ahmad wrote:
> Hi Dirk
> 
> I just received an email from the mailing list that the email was rejected. So I resent the email with the attachments in case you did not receive.
> 
> Abdalla.
> 
> -----Original Message-----
> From: Abdalla Ahmad
> Sent: Sunday, March 18, 2018 3:17 PM
> To: 'Dirk Zimoch' <[email protected]>; [email protected]
> Subject: RE: StreamDevice with Telnet port
> 
> Hi Dirk
> 
> Please find attached the manual for the controllers along with the protocol files we are using.
> 
> Best Regards,
> Abdalla.
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Dirk Zimoch
> Sent: Tuesday, March 13, 2018 5:43 PM
> To: [email protected]
> Subject: Re: StreamDevice with Telnet port
> 
> Hi Abdalla,
> 
> In most cases ExtraInput = Ignore does more bad than good because it switches off part of the input checking.
> 
> If you get wrong inputs (e.g. "Running" instead of a number) this almost always related to protocols that do not consume all input that a command produces.
> 
> If for example a command sends a long, maybe multi-line string and you only parse the beginning until you find an "interesting" value, the remainder of the string is still somewhere.
> 
> StreamDevice tries to discard such "old input" at the beginning of every 'out' command, but it is a race condition. If the device sends more input as a result of the previous command after the flush, it will be received instead of the real reply of the next command. This is also true for replies on set commands. If the device sends a reply after your sent a set command, you should read it and not "fire and forget" the set value. Otherwise the replay may mix with the data of the next command.
> 
> Thus first you should remove all the ExtraInput = Ignore.
> Then find out which command replies something with "Running" which you may not have read. Try to connect with telnet and type the commands manually. In the protocol consume *everything* the device sends back.
> 
> For more details I need to know more about the device and what commands it knows. If possible send a link to the manual. Also your full protocol file would be helpful.
> 
> Dirk
> 
> 
> On 11.03.2018 13:54, Abdalla  Ahmad wrote:
>> Hi
>>
>> We have the Gamma QPC ion-pump controllers controlled via 
>> StreamDevice through telnet, port 23. We have 4 parameters 
>> implemented, pressure, voltage, current, and channel status. The 
>> problem is that the IOC gives an error that the value received for the pressure PV is "Running", i.e.
>> "Input Running does not match format %E". Seems like at some point 
>> the controller is not finishing a previous parameter and the IOC 
>> receives something different than the current parameter requested.
>>
>> We have the following in the protocol file:
>>
>> OutTerminator = CR;
>>
>> InTerminator = CR;
>>
>> ReadTimeout = 2000;
>>
>> ReplyTimeout = 2000;
>>
>> And each parameter in the protocol file has ExtraInput = Ignore at 
>> the end. Any help resolving this mismatching issue?
>>
>> Best Regards,
>>
>> Abdalla Ahmad
>>
>> Control Engineer
>>
>> SESAME
>>
>> Allan, Jordan.
>>
>> Tel: (+962-5) 3511348 , ext. 265
>>
>> Fax: (+962-5) 3511423
>>
>> Mob: (+962-7)88183296
>>
>> www.sesame.org.jo <http://www.sesame.org.jo/>
>>

References:
StreamDevice with Telnet port Abdalla Ahmad
Re: StreamDevice with Telnet port Dirk Zimoch
Re: StreamDevice with Telnet port Dirk Zimoch

Navigate by Date:
Prev: Re: StreamDevice with Telnet port Dirk Zimoch
Next: Asyn getting DTYP field in drvUserCreate() Konrad, Martin
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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: StreamDevice with Telnet port Dirk Zimoch
Next: RE: StreamDevice with Telnet port Abdalla Ahmad
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  <20182019  2020  2021  2022  2023  2024 
ANJ, 28 Mar 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·