Record links will do string to number conversions for you automatically. As long as you don’t need to remove leading characters from the string you can just point an ai.INP field at the string and it will convert it to a double automatically.
- Andrew
--
Complicity is easy, Simplexity takes real work
> On Aug 14, 2020, at 3:17 AM, Christian Pauly via Tech-talk <tech-talk at aps.anl.gov> wrote:
>
> Hej Folks
>
> Again i am facing the problem to call an external program (to read out a sensor), but this time i would like to get the stdout output from this program (the sensor value) into a record.
>
>
> I am trying to use the ExecuteDevice module for this, and basically it works. Here is what i do:
>
> record(bo, "$(P)$(R)AirFlowRun")
> {
> field(SCAN, "1 second")
> field(DTYP, "execute")
> field(OUT, "@ReadFlow run")
> field(FLNK, "$(P)$(R)AirFlowStr")
> }
>
>
> record(stringin, "$(P)$(R)AirFlowStr")
> {
> field(DESC, "Measured Air Flow as String")
> field(DTYP, "execute")
> field(INP, "@ReadFlow stdout")
> field(FLNK, "$(P)$(R)AirFlow")
> }
>
> record(scalcout, "$(P)$(R)AirFlow")
> {
> field(INAA, "$(P)$(R)AirFlowStr.VAL")
> field(CALC, "AA")
> }
>
> The first record executes the external program, and once done it forwards to the second record to readout the stdout output. So far it works.
> Problem: The second record has to be a stringin record, so i have the output only as string not as number. record type ai is not supported by the EcecuteDevice module.
>
> In order to convert the string into a usable number i am trying to use the third "scalcout" record. It should retrieve the string via input link, and simply convert it to a float number.
> However: Specifying the input link "INAA" does not work, i get an error
>
> "2020/08/14 10:03:51.229277 _main_ CBM:Lauda:AirFlow: Wrong I/O link type CONSTANT"
>
> Acording to the scalcout documentation, it should be possible to use a link as input, so i dont get why this is not working...
>
> Or is there an even simpler way to achieve the goal ?
>
>
> As always: Any help or suggestionis very welcome !!
>
> Best regards,
> Christian
- References:
- Calling external program and read return value into record Christian Pauly via Tech-talk
- Navigate by Date:
- Prev:
Re: Calling external program and read return value into record Mark Rivers via Tech-talk
- Next:
Re: Calling external program and read return value into record Mooney, Tim M. 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
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Calling external program and read return value into record Mooney, Tim M. via Tech-talk
- Next:
Question about static linking in the EPICS build system Wlodek, Jakub 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
2022
2023
2024
|