WinCC Flexible scripting

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
When are scripts needed in WinCC Flexible ? I never needed them...

I'm asking myself when I ever will need them...
 
I use a few.
  • I used one for the recipe search that I was talking about the other day.
  • I also store a bunch of data in a DB in the PLC. I have a save to file button that reads all this data in and puts it in a text file.
  • I did a robot project a while back where the operator entered a pattern for stacking parts. I took in the parts size and spacing and used a script to cal all the points the robot needed to know where to place the parts.
  • I have in testing used them to talk to active X controls. I did a test with this on one of Peter's RMC controllers. I have seen some post on here where people were talking to a camera the same way.
  • I know you can do some database work this way as well though I have never done it.
Just a few ideas.
 
1. Nice way to do math functions and calcs

2. Calculating pointers of multiple points

3. Better than layering on a dozen functions
Nick
 
Heyhey

This is something I can use:

I also store a bunch of data in a DB in the PLC. I have a save to file button that reads all this data in and puts it in a text file

hmm, I have a lot of positions in a certain project. It would be useful If I write this data in a textfile and store it on the MMC card.

Can you explain how to do this, I know a little VB..




CharlesM said:
I use a few.
  • I used one for the recipe search that I was talking about the other day.
  • I also store a bunch of data in a DB in the PLC. I have a save to file button that reads all this data in and puts it in a text file.
  • I did a robot project a while back where the operator entered a pattern for stacking parts. I took in the parts size and spacing and used a script to cal all the points the robot needed to know where to place the parts.
  • I have in testing used them to talk to active X controls. I did a test with this on one of Peter's RMC controllers. I have seen some post on here where people were talking to a camera the same way.
  • I know you can do some database work this way as well though I have never done it.
Just a few ideas.
 
One idea that could be very useful, would be to save the actual values in a text file, and then be able to restore the data to the PLC again !

However, I think it is not so simple, as I can foresee a number of potential problems:

How to test that the data is valid ? There can be many reasons that the data in the text file can get corrupted.

If for any reason, the adresses in the PLC and the text file do not match, how to trap this and stop with a meaningful error message ?

It is the error-handling that is the real challenge.

Anyone want to participate in making such a VBS "utility" ?
 
Just thinking here, but isn't this possible without scripting? Not in text format, but .csv though.

Create log, link log to tags from which you want the data, set logging to cyclic continuous. Set log not to start at runtime. Create button to start logging when pressed and stop logging when released.

Not tested this, might work, might not. But I like to find solutions without the use of scripts.

I use scripts only when I don't find away to do it with the built in functions or using the script will be much simpler to do it.
 
No that is not what I mean.
I want to make a snapshot of a complete DB to a text file on the click of a button.
And I want to restore the the data from the text file to the PLC on the click of another button.

What you describe will be something completely different.
 
JesperMP said:
Charles, your script is OK on a PC, but Jeebs wants to log the data on a CE panel, so the script code is quite different.

Here is a sample project where data is store to a flash card on a Windows CE panel:
http://support.automation.siemens.com/WW/view/en/26107212

Naha, not me wanting to do anything. Combo asked when he should start using scripts. There was one thing mentioned, DB back-up, that was done with scripts.
As I generally try to avoid using scripts I simply offered another point of view.
And we don't log the data on the Panel itself, we usually log data to a server..:D
 
My bad, I mistook the two of you. Sorry about that.
Maybe it is because you have the same flag ?

Anyway Combo did say "It would be useful If I write this data in a textfile and store it on the MMC card". "MMC card" indirectly tells us that it is a CE panel that he talks about.

I too try to avoid scripts unless it cannot be done otherwise.
 
:)

If other ways are possible, then I don't need scripts. But, saving to a server is something we don't have in our own hands, because we sell machines.

So Saving to an MMC or CF would be for our own protection, when we start the machine up in our company, then we have a lot of precise positions that we change a lot when starting the machine up. When we start the machine up in the company of the customer, then we need to make little changes, this is normal, I'm talking about millimeters and even smaller changes. These data has to be stored...

Why ? Because, when some idiot (like I allready did) download over the DB's, then all the data is gone. Ok, I know that I can upload DB's and have the data in that way. But, we want the data secured at some location like an MMC or CF.

:)


Jeebs said:
Naha, not me wanting to do anything. Combo asked when he should start using scripts. There was one thing mentioned, DB back-up, that was done with scripts.
As I generally try to avoid using scripts I simply offered another point of view.
And we don't log the data on the Panel itself, we usually log data to a server..:D
 
script

The Script for storing it in a CSV file is very nice !! This is something I will use for sure.

If I understand this right, then this is something that is possible over a network also ? I cannot use this for machines that we sell, but maybe for our own..., we also have machines internally.

JesperMP said:
My bad, I mistook the two of you. Sorry about that.
Maybe it is because you have the same flag ?

Anyway Combo did say "It would be useful If I write this data in a textfile and store it on the MMC card". "MMC card" indirectly tells us that it is a CE panel that he talks about.

I too try to avoid scripts unless it cannot be done otherwise.
 
It took me a couple of hours this evening, but now I have got it working !

It is based on the sample projects from Siemens, but with a few significant differences.
In stead of saving/restoring individual tags, I save/restore complete DBs.
I use array tags, so one complete DB costs only one powertag.
I have added checks so that as far as it is possible invalid values in the file will abort the restoring part.
A disadvantage is that by saving a complete DB in this way, the data in the file is not in a readable format. To review the saved data, you would have to import it into the same STEP7 project, so that the data can be viewed with the correct DB declaration format.

I tried to post it in the downloads section, but appearantly 3MB is too much.
So if anyone is interested then send me a PM.
The script code has to be converted a bit to work on a CE panel, but it is not too much to worry about.
 

Similar Topics

I currently have a script that load on startup that reads maybe 16 values off a DB on my PLC. I take those values and then store them on another...
Replies
15
Views
4,448
Hello everyone I Have an Issue with the usage of recipes in Wincc Flexible 2008, I create the recipe to change the values in a fast way The...
Replies
0
Views
69
Hi colleagues.We do data logging system.We want to record three temperatures under a certain condition. We prepared the project as follows. We do...
Replies
1
Views
735
Hello to everyone. I change the value of a "PQW" with a button in Wincc flexible. The code of the button is defined as M102.0. Value reset...
Replies
10
Views
4,523
Hello Friends I have installed WinCC Flexible 2008 SP5 Update 2. I have open the software, but the Transfer option does not appear. Is It...
Replies
2
Views
1,410
Back
Top Bottom