9/21/2023 8:09 PM | |
Joined: 7/7/2010 Last visit: 9/12/2025 Posts: 16094 Rating:
|
https://www.youtube.com/watch?v=wFXAXEadgzM
|
Last edited by: Jen_Moderator at: 09/22/2023 07:00:05Video embedded. science guy |
|
This contribution was helpful to
1 thankful Users |
9/22/2023 12:41 PM | |
Joined: 8/3/2009 Last visit: 9/12/2025 Posts: 16409 Rating:
|
Hello AutoGen_5985376 for general help in JAvascripting you should have a look at this FAQ Chapter 5.8: https://support.industry.siemens.com/cs/de/en/view/109758536 Bye Murof |
If this Information really helps, you could use the Rate function |
|
This contribution was helpful to
1 thankful Users |
9/25/2023 8:43 AM | |
Joined: 9/18/2023 Last visit: 8/1/2025 Posts: 6 Rating:
|
Thank you for the link. I am trying to make it work, but so far the biggest problem for me is the part where you say: Now, drag it off screen so it is not visible (this may generate awarningduring compile, but you can ignore it)." Other than this, I tried making CSV file with JS function write and I was sucesfull, so I hope once I get this going, it will be working. Thank you for your help once again.
|
Last edited by: AutoGen_5985376 at: 09/25/2023 19:59:35 |
|
9/27/2023 1:56 PM | |
Joined: 8/3/2009 Last visit: 9/12/2025 Posts: 16409 Rating:
|
Hello AutoGen_5985376 you cannot do this like you try. Just use the tagname of the multiplex tag in the script. then set the index tag of your multiplextag to change theindex. (use an interal Tag for the index no PLC tag!). If you have a busy system or you use big datatypes (I have done this a lot of time with big UDTs) then it could be that you have to insert a little wait time in the script (only a few ms) to give the sysem time that the value of the multiplex tag can change. But with an array of only 100 single tags you can also use an "array of" datatype in HMI here you can access thevalues with index in script also and you can read and write the whole array, so you would not have to care about value change (all aray items will be readed or written on block) And here are some informtion to trace and debug: https://support.industry.siemens.com/cs/de/en/view/109777593 https://support.industry.siemens.com/cs/de/en/view/109779192 Bye Murof |
Last edited by: Murof at: 09/27/2023 13:57:37If this Information really helps, you could use the Rate function |
|
9/28/2023 12:04 PM | |
Joined: 9/18/2023 Last visit: 8/1/2025 Posts: 6 Rating:
|
Hello, so I tried making it like you said. I made internal tag called Index_dat, which i used as index for the multiplextag. However, when I use the write() function to change the value of this tag, it does change the index tag, but I still read the same data in my for loop, where I am trying to read all 100 values one by one. Its like if the index tag changed, but the system still thinks it didn't change, because when I try to read all 100 values, they are all the same, which they should not be.. :( I am using easy for loop: for (let i = 0; i < 100; i++) { Tags("Index_dat").Write(i); // this changes the index so that I can read data from whole PLC array akt_rychl_array[i] = Tags("Akt_rychl_Data").Read(); // this saves actual speed into internal hmi array setpoint_array[i] = Tags("Setpoint_Data").Read(); // this saves setpoint into internal hmi array cas_osa_array[i] = Tags("Casova_osa_Data").Read().toString(); //// this saves time of measurement into internal hmi array } Later I just use function WriteFile to export these 3 internal arrays into CSV to USB stick. All 3 of these multiplexed tags have the same Index tag called Index_dat. It is weird, because when the tag Index was in connection with PLC tag and not internal tag, it did change from where it was reading the values, its just that since acquision time is 100ms, it usually wrote 5 same values into array[0] to [4] then changed and wrote same value to array[5] - [9] and so on. Now there is same value from [0-100] like it didnt change the place, from which the value is read. However I see that the index is changing, because I have IO field which shows value of Index, and I clearly see, that when I run my script, that the Index goes from start value 0 to finish value 100...
In zip file there are pictures of the tags that are set. Thank you for your responses, they keep my hopes alive.
Attachmentforum.zip (558 Downloads) |
Follow us on