VB Scripting for empty cells

Hi there,
I was wondering if there is a way for my system to know when there are no more tests to run. I was planning on making the user input a "#" to indicate no more tests and for the system to alert the user when it reaches this point? Instead of a null value a blank cell is fine but I need it to display this to the user on the HMI before they confirm the tests to start. The user may have only 3 out of 5 runs they want to run and I'm not sure how to write this in the "read data" code I have so far (see attachment)

Steps:
1. User inputs up to 5 test runs in excel
2. HMI reads excel sheet, displays it on screen and stores the data for the PLC to use
3. Runs are done one by one
4. When a run is done write that data to an excel file (temperature reached & torque applied)
5. When the system gets the null value "#" (or blank cell) then let the user know that all tests are complete


Thank you for any help!
 

Attachments

  • read cells code.png
    read cells code.png
    104.2 KB · Views: 39
  • image_2024-05-14_125725923.png
    image_2024-05-14_125725923.png
    35.7 KB · Views: 37
  • image_2024-05-14_130201236.png
    image_2024-05-14_130201236.png
    22.9 KB · Views: 37
I think you can compare those temp_n variants to an empty string, e.g.
Code:
IF temp_5 = "" THEN
...
but that still leaves open the question of how the PLC knows that, e.g., there is no test 5. You could put a nonsensical value as the temperature or the torque e.g. -999.0, and then the PLC would stop when it finds such a value; there could even be a hidden, elephant-in-Cairo, "torque_6" equivalent in the PLC that always contains the value -999.0, so the PLC always finds a -999.0 eventually, even if all five tests are populated with valid test values.
 
In the 5 cells, if there is a blank text or a '#', then that indicates the end of the test sequence ?
I would go by the zero value, and then use limits on the tag, and color animation in the cell based on the limit.
And you can make a more explicit message, in the PLC monitor the cell values and use that to control a tag that in turn controls a dynamic text list.
I.e. '5 tests are pending', '4 tests are pending', .. '1 test is pending', 'no more tests are pending'. Much better than an implicit meaning if there is a zero value in a cell, it means no test.

If it is important that instead of the '0', the operator sees a blank field, then there are many ways to skin that cat.
Simplest is visibility animation, 0 = visibility is off.
Another is color animation, i.e. 0 = background same as foreground.
No need for scripts.
 
I suppose there are a number of ways, assume the cell is blank then you should be able to test the tags in the HMI (Or PLC) for an empty cell (again not sure what the HMI/PLC will see as a blank cell) or perhaps a better way is to itterate through the cells in excel & use the ISBLANK function you could then populate a certain cell (perhaps with some check char or perhaps the number of tests & use that in the HMI or PLC. for example Cell A7 comtains the number of tests.
 
Hi,
Thanks for your replies!
I've taken a mixture of what @parky and @drbitboy said and re-wrote the code as such but am unable to run due to a syntax error? I'm not too familiar with VB scripting (last used about 10 yrs ago in school?) but I can't seem to understand where the error is here?
 

Attachments

  • image_2024-05-14_155642026.png
    image_2024-05-14_155642026.png
    114.9 KB · Views: 17
Thanks for your help everyone!
I was wondering if this would be possible to do without the comfort panel? I know scripting isn't possible on the basic panels but @JesperMP 's reply was interesting and got me thinking about ways that costs could be reduced. One of the reasons I wanted to used something with scripts is to have the ability to save and write the data of the plc to an excel file and was under the impression that scripts is the only way to do this
 
The bit about reading a CSV with a script is fine. I was thinking using a recipe instead, but that is probably overkill.
But scripts should be kept to a minimum.
The actual functionality that does something should be handled by the PLC, not the HMI.
It is the PLC that looks at the tags, and decides if a test has to be run if a tag is is zero or not.

Hiding the '0' when a cell is empty can be done easily without scripting.
I think that making an input field go blank or '#" may be a little bit too discrete way to inform the operator what is going on. It is OK to hide the '0', but something more should inform the operator. Hence my suggestion with a symbolic output field with a describing text.
 
Thinking again.
If I would do it, I would not remove the value in the cell when a test is finished. I would next to each line have a text indicator showing "not selected" (when the cell value is zero), "pending", "in progress", "done successfully" or "done with error".
That will give the operator a much better view of what will happen, what is happening, and what has already happened.
And it will be the PLC that handles all this. The HMI is only for entry of values, for importing the CSV, and for status display.
 
Hi there,
I was wondering if there is a way for my system to know when there are no more tests to run. I was planning on making the user input a "#" to indicate no more tests and for the system to alert the user when it reaches this point? Instead of a null value a blank cell is fine but I need it to display this to the user on the HMI before they confirm the tests to start. The user may have only 3 out of 5 runs they want to run and I'm not sure how to write this in the "read data" code I have so far (see attachment)

Steps:
1. User inputs up to 5 test runs in excel
2. HMI reads excel sheet, displays it on screen and stores the data for the PLC to use
3. Runs are done one by one
4. When a run is done write that data to an excel file (temperature reached & torque applied)
5. When the system gets the null value "#" (or blank cell) then let the user know that all tests are complete


Thank you for any help!
Thanks! tagnames(10) worked (y)
Hi sir, how you sent the csv file to hmi (when exit from runtime) or are you sent it to local network with ip address????,can you explain me your method and file path way
i'm stucked in this point
 
Hi sir, how you sent the csv file to hmi (when exit from runtime) or are you sent it to local network with ip address????,can you explain me your method and file path way
i'm stucked in this point
Hi,
I ended up creating a script as seen above to transfer the data when the "import scripts" button is pressed. The HMI, PLC and PC are all connected on the same local network so they have the same IP (except for the last bit field).
The sequence then goes:
- Import data pressed on HMI
- Script is run
- Cell data is assigned to tags set on the HMI
- Those tags are connected to PLC tags and called are on when needed
 

Similar Topics

Hey guys, Hope youre all doing good! Im playing with my new lab trainer i put together and wanted to start learning some hmi scripting. I have a...
2
Replies
634
Views
Hello everyone, I’m currently working on a project using GE Cimplicity 9.0, and I need to implement some functionalities using VB scripting...
0
Replies
1,247
Views
Hi all, looking for someone to help point me in the correct direction. IAS 2017 SP1, but have a feeling this could carry over from when Archestra...
1
Replies
1,110
Views
I work for an OEM. I am trying to develop a generic HMI program that will display an overview screen displaying between 2 and 6 "widgets"...
1
Replies
3,681
Views
Hey guys, I am new to vb scripting in TIA and had a small query. I need to view certain data from HMI in excel. After running a certain script I...
13
Replies
4,436
Views
Top