Reset Variable


#1

So, a customer has an S1 and several EB2 racks in different panels. Each panel has its own HMI and there is a control room PC running a different HMI.This morning the program got stuck at a particular place in the opto script (below). I’m trying to figure out why it’s getting stuck but I can’t figure how it works in the first place. It looks like it’s setting a variable then waiting for that variable to reset. I’ve searched the S1 application and can not find that variable anywhere else. I’ve tried searching the PACisplay HMI and can’t find it there either. What’s going on? If I can figure out how this is working, maybe I can figure out how to prevent it from getting stuck (variable not resetting).// send record for current batch to databases_cp_hmi_message = “Downloading Batch Information”;i_cp_download_batch_to_db = 1;DelayMsec(500);while(i_cp_download_batch_to_db) DelayMsec(100);wendP.S. The customer reports that the problem can be resolved by restarting the control room PC. How does make sense?


#2

Sorry for the formatting. I wrote it in notepad first. Here’s the code.

// send record for current batch to database
s_cp_hmi_message = “Downloading Batch Information”;
i_cp_download_batch_to_db = 1;
DelayMsec(500);
while(i_cp_download_batch_to_db)
DelayMsec(100);
wend


#3

I found it. It’s OptoDataLink. It seems to be configured correctly but occasionally won’t reset the integer flag that allows the program to continue. Restarting the service seems to get it working again. There are error messages in the log that I can’t figure out. “Attempted to read or write protected memory”.


#4

Was this “Attempted to read or write protected memory” error something you saw in OptoDataLink? Sounds like you might want to contact support on this one (always best via email: support @ opto22.com).

However, looking at your OptoScript, perhaps that logic could be a little more forgiving. For example, given there are a number of reasons why that flag might miss getting cleared, perhaps the loop should have a timer in it too? And clear out, log and error, and move on if that timer runs too long? I’m hoping you get the idea here…