Hi Donny,
> It seems like the PP and NPP are both returning the same value even though the actual charge is changing.
> Any ideas on why this would be happening or suggestions would be greatly appreciated.
I suspect that what is happening is that it first evaluates INPA, processing Charge record. It then evaluates INPB which reads the Charge record, obtaining the same value that was just read when INPA was evaluated.
I think this will fix the problem. It just assigns the value of A to B after doing the subtraction.
record(calc, "$(KEIT):CalcCurrent")
{
field(SCAN, "1 second")
field(INPA, "$(KEIT):Charge PP")
field(CALC, "B-A;B:=A")
}
Mark
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Donny Domagoj Cosic via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, March 29, 2021 6:35 AM
To: Tech-talk
Subject: Rate of change calculation
Hello,
I am trying to calculate the rate of change of a record using a calc
record as follows:
record(ai, "$(KEIT):Charge")
{
field(DESC, "Measure Charge")
field(DTYP, "steam")
field("@devKeithley6514.proto measureCharge() $(PORT)")
field(SCAN, "Passive")
}
record(calc, "$(KEIT):CalcCurrent")
{
field(SCAN, "1 second")
field(INPA, "$(KEIT):Charge PP")
field(INPB, "$(KEIT):Charge NPP")
field(CALC, "B-A")
}
The calc record always returns 0. If I change the calc to B+A, to check
what is going on, I always get double the charge. It seems like the PP
and NPP are both returning the same value even though the actual charge
is changing. Any ideas on why this would be happening or suggestions
would be greatly appreciated.
Thank you in advance,
Donny
--
Donny Domagoj Cosic
Institut Ruđer Bošković, Bijenička cesta 54, 10000 Zagreb, Croatia
- References:
- Rate of change calculation Donny Domagoj Cosic via Tech-talk
- Navigate by Date:
- Prev:
Re: Rate of change calculation Smith, Martin via Tech-talk
- Next:
Re: Rate of change calculation Donny Domagoj Cosic 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: Rate of change calculation Donny Domagoj Cosic via Tech-talk
- Next:
modbus read error Дмитрий Прощенко 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
|