VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

A strange phenomenon about "Set Variable" step of a "Procedure"

Hi, 
I am new to VeriStand. Here, I find something that I can not realize about  "Set Variable" step of a "Procedure". I describe in the followings. 

 

I use NI VeriStand 2019R3, PXIe-1078, PXIe-8840, and PXIe-8510 (With two CAN ports). 

 

UI: 
There is one nemeric control (A) and one nemeric indicator (B).  


System Definition: 

1. CAN1 is responsible for outputing a frame signal; 
2. CAN2 is responsibe for receiving the same frame signal; 
3. A simple model (.lvmodel) which just add a constant to the import and send the result to outport ; 

System Mapping: 

1. Control A is connected to model inport; 

2. Model outport is connected to CAN1; 
3. CAN2 is connected to indicator B; 

To make sure that CAN1 output value is in the desired range (0 to 10), I set an alarm on CAN1 to check whether ouput is in range. If it is not in range, the alarm will invoke a "Procedure". And
the job of the procedure is a. set CAN1 channel to zero (Set Variable) b. reset this alarm c. end step. 

I expect that I will see zero value on indicator B if  CAN1 output value is not in the range. But I always see the uncorrected vlue on indicator B. 

From the phenomenon, I want to raise a discussion about the mechanisn of the "Data Processing Loop" (DPL) on VeriStand engine. 

From the help, we know that the DPL has a copy of channel value table and DPL is responsible for alarms and procedues. My first guess is that the procedures of DPL take to handle the above are: 
a.  PCL (Primary Control Loop
) updates the CAN1 value on the copy of channel value table; 
b. Alarm checks the vlaue (out of range), and invokes the "Procedure"; 
c. The "Procedure" sets value to zero; 
d. DPL sends the value to "XNET Loop"; 

If the above procedures run sequentially, I will never see the uncorrected value. So it means that c. and d. run asynchronously and the data integrity is not prom

Does anyone know more details about the mechanisn of the "Data Processing Loop"? 

Thanks for you help

 

Godel

0 Kudos
Message 1 of 4
(2,019 Views)

is the variable that you are trying to set within your procedure being overwritten by something else? 

 

is it a mapping destination or is there something on UI that overwrites your procedure set variable? the behaviour you describe would suggest so

0 Kudos
Message 2 of 4
(1,983 Views)

Hi Ecleary, 

Thanks for your kind reply. 


The system I found this phenomenon is as simple as I described above. 


And I also did an additional test to make sure the "Set Variable" step of a "Procedure" is executed. 
I created an user channel "testChannel" and an indiactor "testIndicator" and mapped the "testIndicator" to the "testChannel". In the "Set Variable" step of a "Procedure", I set the "testChannel" to "two" instead and I could see that the "testIndicator" showed "two" as CAN1 output was not in the range.  

 

Godel

0 Kudos
Message 3 of 4
(1,950 Views)

System Mapping: 

1. Control A is connected to model inport; 

2. Model outport is connected to CAN1; 
3. CAN2 is connected to indicator B; 

 

the alarm will invoke a "Procedure". And the job of the procedure is a. set CAN1 channel to zero 

 

the model outport is mapped to can 1 

 

when the procedure writes to can 1 it is overwritten by the mapping from the model outport

 

update your model to recieve an input from your procdure that is then mapped to CAN 1 from your model outport, you could write to the same input as control A does but then control A would be able to overwrite that value and in an alarm condition this would be undesireable.  

 

in your procedur use set multiple variables, set Proc? true and the set Proc In to whatever value needed, this value is then mapped to CAN1 from the model outport, at the end of your procedure set Proc? false to go to normal model behaviour 

0 Kudos
Message 4 of 4
(1,921 Views)