LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI as HMI running slow

Hi,

 

I have a VI which works as an HMI for the code running on a cRIO 9074. The communication between the cRIO and the VI as HMI is thru shared variables.

 

Lately, the communication between the cRIO and the VI as HMI has become pretty sluggish.

 

Some background info on how the VI as HMI works:

 

I have created a subpanel in a VI (mainVI) which calls other VIs (areaVIs) that represent different sections of the application (this is similar to the subpanel example in LV).

I run the mainVI at 100ms. Each of the areaVIs are set to run at 200ms

 

As the requirements in the application increased, we added more code to the existing areaVIs. The code of any areaVI is supposed to exeecute only when

called by the mainVI.

 

After I found that the communication had become sluggish, I tried to measure how slow/fast the loop in the areaVI was running (I tried this by running the areaVIs independent of the mainVI).

 

For this purpose, I used shift registers that would increment value by 1 for every loop iteration. Also I tried running the loop for only 1 iteration an tried to get the milliseconds elapsed using the Tick Count function before and after the loop(difference of the times).

 

For a 200 ms loop I got the value of 5000+ ms from the Tick Count function! And the shift registers incremented only for 2 iterations.

 

My conclusion is that the loop although assigend to run at 200ms is actually running at 5000ms.

 

Should this be happening or is my method of deduction incorrect?

 

Can anyone pls shed any light on this matter?

 

Thanks in advance...

 

Regards.

 

 

 

0 Kudos
Message 1 of 7
(3,535 Views)

Hi,

 

 

Can you please tell where your major part of the code is being executed?.. and is the performance sluggish on the crio or in the HMI VI.

 

The best way to trace VI execution is to use 'Profile Performance and Memory' tool in 'Tools>Profile'

 

There can be several reasons for the program to slow down.

 

Using too many variables is one of them.

 

Again if you are calling same vi multiple times simulatneously can also give sluggish results if the called vi is not configured properly. If this is the case then try chaning it to reenterant vi.

 

I may help you with optimizing the code if you can post it.

 

Hope it helps.

 

Regards,

 

Shreyas

 

 

Shreyas Hebbare
Shreyas Technologies
India
Message 2 of 7
(3,503 Views)

Hi,

     Please clear the following doubts about your application.

 

1) How are you implementing a timing of 200ms in the area VIs?

 

2) Your area VIs are implemented on FPGA or RT or Host computer?

 

3) Is this problem occuring with all the 'Area VIs' or only a particular one ?

 

Please chech that you Tick count is set to 'Ticks' and not 'ms', in case your code is running on FPGA. This is because your VI is running for 5 seconds which can be the case only if the code is very very complicated.

 

Regards

Akshat Jain

Message 3 of 7
(3,502 Views)

Hi.

 

All the VIs I have mentioned are on the Host Computer. These VIs are sluggish, cRIO ones are OK.

 

I am using the "Wait until Next multiple" function for timing of the loop. This problem is with all the areaVIs.

 

Unfortunately I cannot share the VI because of company policies.

 

Today I tried to split one of the areaVI into different parallel loops. Again, the same thing, all loops were each running at 3000+ ms!

 

Then I ran one of the loops independently. Still I am getting 2000+ ms for loop timed to run at 200!!

 

In each of these areaVIs I do have a lot of shared variables that I read and write (these being VIs working as HMI!!). If this is the problem, is there any workaround?

 

I hope this has answered your queries...

 

Regards.

0 Kudos
Message 4 of 7
(3,489 Views)

Hi

When using the Shared Variable interface, ensure that you open and close the connections to your IO Variables as few times as possible. For most applications, you should try to open a connection to the IO Variables once at the beginning of the program, and then close them once at the end of the program, maintaining the open connection throughout the application. This will minimize the time required to access a variable.

 

Regards

Akshat Jain

0 Kudos
Message 5 of 7
(3,482 Views)

Hi,

 

Majority (say close to 90%) of the shared variables I am using are network published variables and none of them are IO variables. I also have the NI 9144 expansion chassis and I do not read/write the IOs from this chassis in the VIs on the Host computer.

 

Most of the shared variables are clusters of different data types. I have used this arrangement since I wanted to reduce then number of shared variables I need to handle on the host VIs and each cluster would carry the data representing one class of field device.

 

As a result, VIs on the host use a lot of instructions like bundle/unbundle, in some cases, boolean array to number and vice versa. So, could this be loading the areaVIs?

 

Within 

 

Regards.

0 Kudos
Message 6 of 7
(3,455 Views)
Hi, Try deploying all the Main and sub VI,s on the Controller's RT OS. You can just use front pannel from host computer.
Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 7 of 7
(3,444 Views)