Sign in to follow this  
Followers 0
kckku

NA5 HMI Popup

5 posts in this topic

Is there a system variable from the HMI that lets me know if a popup is active?

Share this post


Link to post
Share on other sites

System popups not really.

Your created popup pages, not directly but you can create a means of knowing what page is currently active using an Event in the HMI.

In all my projects i create an HMI structure in my PLC that i pass certain information from the HMI.

Along with other variables this structure contains variables for passing _HMI_CurrentPage (Page Name as a String) as well as _HMI_CurrentPageIndex (Page Number)

These values are updated even when a popup is active. IF A POPUP PAGE YOU CREATED. Then your PLC will know either by page name or number that your popup is active.

 

Attached example of how to add the event and what variables it pulls from each page property. Also attached partial snip of part of the HMI structure I create in the PLC

 

Screenshot 2023-11-21 155006.png

Screenshot 2023-11-21 155607.png

Screenshot 2023-11-21 160414.png

Edited by Str8jCkt
1 person likes this

Share this post


Link to post
Share on other sites

I don't mean to hijack the thread, but couldn't help noticing that @Str8jCkt had a heartbeat setup for the HMI. Would you mind sharing how you do that? I had something a while back that could have used something similar, but never actually managed to make anything work (I was trying to use an incrementing counter system with VBA, but didn't have any success, mainly because the VBA code had to finish before the HMI could do anything else, it couldn't just run in the background).

Share this post


Link to post
Share on other sites

@BE, bit of a long response but wanted to give you some things i learned by experience. There may be others in this Forum with far more experience than me but hope this helps.

Here is the method i use to create HeartBeat from the PLC to the HMI so HMI can run conditions based on the HeartBeat.

PLC_HeartBeat.thumb.png.df8ffbea5b8b46de

Time_Diagram.png.546c173b5e5b71651d58f75

I noticed in my previous post that my comment on HeartBeat variable was (HeartBeat - 10ms). Sadly the comment is from my early development and with much testing i found a 10ms HeartBeat to HMI is not practical. The reason for that is Sysmac variable setup on the NAs only allows a minimum update rate of 100ms. Since that is the case lately i have set my PLC Heartbeat to toggle 100ms low and 100ms high (actually 95/105) as the attached code demonstrates.

HMI_Update.png.788f851a21291a251617a40d7

 

You can then use the HeartBeat in Events to perform a number of actions - update variables, run a subroutine, etc.

HeartBeat_Event0.thumb.png.282ec44e183f5

 

HeartBeat_Event10.thumb.png.97f37a10206f

 

From experience be careful how often you are calling subroutines via this method. If you are calling too many to "run in the background" or repeating one before it has finished it is possible your HMI will start to feel sluggish and unresponsive - have been there many times. As you stated, if your VB code is heavy, it can take a lot of HMI resources. The longer i have used Sysmac the more i have limited the amount of code I have the HMI running and handle as much as possible in the PLC.

 A couple other points i will make is you will notice in the post to @kckku i have my HMI page info Event running as an interval instead of via HeartBeat. I used to use HeartBeat a long time ago to catch HMI connection state but got away from it for interval instead. In that case i found it best not to check AsyncExecution but when i use a HeartBeat to run code i usually check the AsyncExecution.
 
Rather than HeartBeat to run your Subroutine on set intervals you can just use two variables between HMI and PLC. One that PLC sets to call an Event to run the Subroutine and then one that returns complete at the end of the subroutine to tell PLC it is finished.  PLC can then detect the complete variable, reset it and call to run again if needed. IT is important to note depending on how much you are doing in the VB code; the complete response may come thru before the refresh rate of the variables the code may be changing. I have found it is best to add sufficient delay in the PLC even after the complete signal to ensure all variables have truly been updated.


Not sure of your application but here is an example of how i have a machine self-changing product configs during run using Omron HMI RecipeViewer. HMI does not need to be on the page with the viewer for this changeover code to work. This demonstrates not using a HeartBeat but two variables, Change and Complete that PLC will command HMI to run code and then receive a response.

 

655d7c5827c72_RunEvent.png.5006b8543b5c9

 

 

Edited by Str8jCkt
2 people like this

Share this post


Link to post
Share on other sites
16 hours ago, Str8jCkt said:

others in this Forum with far more experience than me

You and I both :-). For me PLC programming is probably only about 5% of my job, so my experience is also rather limited.

Thank you for taking the time to type all that up and explain it, it makes sense and I will definitely be referring back to it next time I have a programming job to do, it has given me a few ideas.

The main reason I was asking actually relates to a problem I had some time ago, detailed here: https://forums.mrplc.com/index.php?/topic/42220-booleans-getting-stuck-on/

You explanation and description of how you have done things has given me a couple more ideas to try with that old problem for future projects. Don't know if they will work, but that's why we have simulators :-2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0