AVEVA Plant SCADA Forum
A support forum for AVEVA Plant SCADA (formerly Citect SCADA). Share new and exciting product information, connect, learn, and collaborate with the ecosystem of Plant SCADA Users. AVEVA Plant SCADA a reliable, flexible and high-performance Supervisory Control and Data Acquisition software solution for industrial process customers. This forum is to connect, share, learn and collaborate new and exciting product information. Feel free to join and share to your Ecosystem of Plant SCADA Users.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-14 06:57 AM
Hi Friends!
Can someone explain to me?
Why this is not possible in a button script or Cicode script function?
TL_SVCountHlp = TL_SVCount;
TL_SVCountHlp is a Local Variable type INT.
TL_SVCount is a IO variable type INT.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-14 07:24 PM
Hello,
What makes you think it is not possible? All things being equal, it should be possible. Are you getting some sort of error, or is it simply not working?
Stuart
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-14 11:43 PM
Simply not working.
I can assign a constant to the local variable, but not a IO variable value.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-15 06:13 AM
Hi,
Displays the two variables on the screen and presses the button, checks if the value of the local variable is updated with the IO variable.
You may have some problems:
1- That the IO variable is not being read due to communication problems.
2- That the value of IO is cache and not the current one.
If this test works, remove the variables from the screen and create a cicode function something like this:
INT
Function ReturnValue( INT vIO)
return vIO;
END
call it from the button:
vLocal = ReturnValue( vIO);
If it doesn't work, you should use the tag subscriptions functions.
Regards,
Juan
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-15 06:22 AM
You could also trace the values of the tags out to the syslog and ensure they are working
for example, put this in a function:
DebugMsgSet(1); // turns on debug logging
DebugMsg("Before " + TL_SVCountHlp:#.# + "," + TL_SVCount:#.#); // sends the current values to the syslog
TL_SVCountHlp = TL_SVCount;
DebugMsg("After " + TL_SVCountHlp:#.# + "," + TL_SVCount:#.#); // sends the current values to the syslog
You could try doing a tagread:
Real rTagValue;
rTagValue = TagRead(TL_SVCount);
DebugMsgSet(1); // turns on debug logging
DebugMsg("rTagValue " + rTagValue:#.#); // sends the current values to the syslog
And see what pops out.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-15 06:27 AM
Hi!
I have both values on display, IO-variable is updating, the local variable not.
A cyclic event calls my Cicode function with the assignment.
I have verified that that the function is executed.
I'am not on site. I will try your strange funcion 🙂 and read about "subscriptions" later.
/Stefan
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-15 10:26 AM
Are you using Multiprocess?
Local variables have the scope in the process instance and will be not shared across processes.
If you use single process the behavior that you are experiencing may change.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-16 07:44 AM
This crazy function solved my problem:
INT
Function ReturnValue( INT vIO)
return vIO;
END
/Thanks!
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-03-22 09:44 AM
I quickly tried this on a test project that I have and seems to work fine, I dont see any issue.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.