EPICS Home

Experimental Physics and Industrial Control System


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

Subject: Re: How to implement simple control algorithm (one more question)
From: Andrew Johnson <[email protected]>
To: [email protected]
Cc: "Ilya V. Kitaev" <[email protected]>
Date: Mon, 5 Jan 2009 11:13:35 -0600
On Sunday 28 December 2008 09:02:47 Dalesio, Leo wrote:
> YOu can make the strings as long as you like. You just can't set or get
> them through channel access then - a 40 character limit. I'm not sure that
> it handles this properly. Jeff or someone else should comment on that. Bob

The 40 character length of the dbr_string_t type that CA uses causes that 
limitation.

As to modifying the length of the CALC/OCAL fields of a calc or calcout 
record, if you do that make sure that you also modify the corresponding 
RPCL/ORPC fields to match, or when an expression longer than 40 characters 
gets coverted to postfix tokens it could overwrite memory belonging to some 
other field or record.  In recent versions of Base the size needed is 
calculated by the macro INFIX_TO_POSTFIX_SIZE() so all you have to give it is 
the size of the infix string.

- Andrew

> -----Original Message-----
> From: [email protected] on behalf of Ilya V. Kitaev
> Sent: Fri 12/5/2008 3:29 AM
> To: Kalantari Babak
> Cc: [email protected]
> Subject: Re: How to implement simple control algorithm (one more question)
>
> Hi,
> Thank you for your answer.
> I'd like to ask one more question:
> Is it ok to break 40 chars limit in CALC field( or another text fields
> like DESC) ?
> I've changed this limit  to 200 in calcoutRecord.dbd, db_access.c and
> epicsTypes.h (MAX_STRING_SIZE define) and it works ok.
>
> 2008/12/3, Kalantari Babak <[email protected]>:
> > Hi,
> >
> > You do not need to write your own CA application for that.
> >
> > Monitor alarm status of your "ai" with a "calcout" record and write to
> > your "bo" upon occurrence of the conditions.
> > This can be done for example as the following:
> >
> > record(calcout, "$(ALGORITHM)")
> > {
> >         field(INPA,"$(YOUR_AI_REC).STAT CP") # monitoring
> >         field(INPB,"$(YOUR_BO_REC).VAL NPP")
> >         field(CALC, "A=3?1:A=5?0:B")
> >         field(OOPT, "On Change")
> >         field(OUT,"$(YOUR_BO_REC) PP")
> > }
> >
> > Alarm status value for HIHI is 3 and for LOLO is 5.
> >
> > HTH,
> > Babak



-- 
The best FOSS code is written to be read by other humans -- Harold Welte

Navigate by Date:
Prev: Re: RE: Timezone setting with R3.14.10 Dehong Zhang
Next: Re: Problems with Base 3.14.10. and Sequencer 2.0.12 on Cygwin? Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: EDM Horizontal Bar Szalata, Zenon M.
Next: RE: How to implement simple control algorithm (one more question) Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024