How can I latch or unlatch a datapoint?
I want to set to true datapoint1 when datapoint2 is true, don't mind datapoint3 value, and set to false only when datapoint3 is false, don't mind datapoint2 value.
Thanks
How to latch or unlatch a datapoint?
- nmnogueira
- Posts:125
- Joined: Thu May 05, 2011 12:59 pm
Re: How to latch or unlatch a datapoint?
Create a script associated with a contol manager.
Do something like:
Do something like:
Code: Select all
main()
{
dpConnect("work2","datapoint2", "datapoint3");
}
work(dp2,val2,dp3,val3)
{
if(val2)
dpSet("datapoint1",1);
if(!val3)
dpSet("datapoint1",0);
}
- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: How to latch or unlatch a datapoint?
I prefer always to not connect to more datapoint elements then needed. So in this case I prefer split the dpConnect into two, since the behavior does not depend on the other datapoint element.
- yosu
- Posts:22
- Joined: Wed Mar 14, 2012 4:14 pm
Re: How to latch or unlatch a datapoint?
Thanks for your answer
- ozangor
- Posts:44
- Joined: Thu Sep 22, 2011 2:57 pm
Re: How to latch or unlatch a datapoint?
You may also use the dp_funct config in order to achieve this.
Code: Select all
first = second || (!second && third);- nmnogueira
- Posts:125
- Joined: Thu May 05, 2011 12:59 pm
Re: How to latch or unlatch a datapoint?
Dear Ozan
I think that solution does not work.
e.g. if third = FALSE
I think it's possible to do it with a DP function, but you would have to use "Initialize global variable" and create a script for it.
I think that solution does not work.
e.g. if third = FALSE
Code: Select all
first = second || (!second && FALSE) = second || FALSE == second