Regarding your first question:
On 16.08.2016 15:32, [email protected] wrote:
> 1.) I have a calcout-record which can increase or decrease a value
> Now I am want to implement a simple variable SCAN-intervall to increase
> every 60 seconds or every hour . But I don't know which is the best way
> to do this and how to implement this in my application. There is a
> solution with the OROC-field but I don't know how to implement.
A variable SCAN interval can be achieved, for instance, with an mbbo
record that targets the UPDOWN_ record's ODLY field:
record(mbbo,"SCANPERIOD") {
field(ZRST,"1 minute")
field(ZRVL,60)
field(ONST,"1 hour")
field(ONVL,3600)
field(NOBT,2)
field(DTYP,"Raw Soft Channel")
field(OUT,"UPDOWN_.ODLY")
}
You should then set UPDOWN_.SCAN to Passive and let it (re-)process
itself via an FLNK that points to itself via CA:
record(calcout, "UPDOWN_" ) {
...
field(FLNK,"UPDOWN_.PROC CA")
}
Be careful not to have ODLY become zero, since this would cause the
record to process in an endless loop eating up all you CPU.
You should also make sure you read the Chapter of the Developer's Guide
about record linking and processing since it seems you misunderstood
what the PP flag does for input links (it looks to me as if you wanted
CPP input links, rather than PP).
BTW, your CALC expression uses assignment and sequencing without need.
Instead of
field(CALC, "A:=
((D=0)?(A=0?0:(A-B))):((C<(A-B))?(A-B):((A+B)>C?C:(A+B)));A")
you should write:
field(CALC, "((D=0)?(A=0?0:(A-B))):((C<(A-B))?(A-B):((A+B)>C?C:(A+B)))")
The expression looks as if it should implement a ramp toward the target
value C with an increment of B every time the record processes. This can
indeed be achieved with the ao record's OROC field, which limits the
output rate of change: each time the record is processed, the OVAL is
incremented or decremented towards VAL but no more than OROC. You can
combine this with the variabe SCAN rate trick above, but you'll have to
intersperse a seq record into the processing loop since ao has no ODLY
(or equivalent).
Another way to implement what you want is to write an SNL program (see
http://www-csr.bessy.de/control/SoftDist/sequencer/).
Cheers
Ben
--
"Make it so they have to reboot after every typo." ― Scott Adams
Attachment:
signature.asc
Description: OpenPGP digital signature
- References:
- Variable SCAN Intervall and Roundoff function info22
- Navigate by Date:
- Prev:
Re: Variable SCAN Intervall and Roundoff function Andrew Johnson
- Next:
Alias Stefen Paul
- 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: Variable SCAN Intervall and Roundoff function Andrew Johnson
- Next:
Re: Variable SCAN Intervall and Roundoff function 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
2018
2019
2020
2021
2022
2023
2024
|