FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
01-25-2024 12:40 PM
Hello,
I have a question of clients in WebVisu. We have a project with 1 core and 9 WR21 screens.
Is it possible only make one visualization for the 9 different screens? The variables should be different in all the screens
And, Is there a way to know which client is connected to the webvisu?
Thanks.
Solved! Go to Solution.
01-25-2024 07:53 PM - edited 01-25-2024 07:54 PM
Hi @joelfernandez ,
Is it possible only make one visualization for the 9 different screens?
Yes, however you have to manage the session dependent behavior yourself. I attached an example of how you might read/write from a different variable, within an array, depending on a selected index. In your case, you'd set the index to the current client index. The array of values would be sized to your number of clients.
For example, on element click: write variable iArrayInt[CURRENTCLIENTID] = value
And, Is there a way to know which client is connected to the webvisu?
Yes. Within a visualization, CURRENTCLIENTID will return the client index.
You'll also want to make sure the option "Use CurrentVisu variable" is unchecked in your Visualization Manager.
Alternatively, you could have custom visualizations per client and switch them in a frame element. See documentation.
01-26-2024 08:36 AM
Hi @Sgilk,
We probe your code but it isn't a solution for us because if you change the value of current index in client nº1, this value change in the others clients. The idea is that the screens are independent of each other because the screens will go in different places and each one should have different variables.
Another problem is the ID, because we have 9 screens. If you turn it off and on again, the probability that all the screens will continue with the same ID is very small...
Thanks.
01-26-2024 03:41 PM
Sorry to confuse, the current index was meant to demonstrate that behavior. You'd want to access variables in an array the size of the number of clients by the CURRENTCLIENTID.
Since it is important that the clients maintain their ID across restart, the client will have to ID itself to the server. I think the best option for you is to target a different visualization from the client side by URL.
For example: [https://IP_ADDRESS:PORT/webvisu1.htm, https://IP_ADDRESS:PORT/webvisu2.htm, https://IP_ADDRESS:PORT/webvisu3.htm...]
Here is another example with multiple visualizations. It may be possible to automate this further using a template type feature, but I'm not familiar. In this case, I just copied the visualization and updated the element "Array value at visualization index" to target the array value associated with the index.
01-29-2024 11:57 AM - edited 01-29-2024 12:01 PM
I understood your question like this:
I found the following in the CoDeSys Docu: Chapter: Configuring and starting a display variant
You just add multiple "WebVisu" objects to the PLC project, where you can define different start pages. I attache a example project with 2 "WebVisu" objects. URL's of example project.
01-29-2024 04:41 PM
Hello,
The idea is to have 9 WR21 but with only one visualization page. Depending on the screen we want to write or read values without affecting the rest of WR.
Thanks.
01-30-2024 09:19 AM
Exactly. Just copy the page and change the variable indices. That's it.