You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old June 5th, 2008, 02:09 PM   #1
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,614
WinCC Flexible scripting

When are scripts needed in WinCC Flexible ? I never needed them...

I'm asking myself when I ever will need them...
  Reply With Quote
Old June 5th, 2008, 03:07 PM   #2
CharlesM
Member
United States

CharlesM is offline
 
Join Date: Aug 2005
Location: Arkansas
Posts: 1,129
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.
  Reply With Quote
Old June 5th, 2008, 04:07 PM   #3
Nick B
Member
Canada

Nick B is offline
 
Nick B's Avatar
 
Join Date: Mar 2007
Location: Vancouver
Posts: 302
1. Nice way to do math functions and calcs

2. Calculating pointers of multiple points

3. Better than layering on a dozen functions
Nick
  Reply With Quote
Old June 6th, 2008, 03:39 AM   #4
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,614
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..




Quote:
Originally Posted by CharlesM
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.
  Reply With Quote
Old June 6th, 2008, 04:29 AM   #5
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
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" ?
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old June 6th, 2008, 06:36 AM   #6
Jeebs
Member
Belgium

Jeebs is offline
 
Join Date: Feb 2007
Location: Leuven
Posts: 1,000
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.
  Reply With Quote
Old June 6th, 2008, 06:42 AM   #7
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
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.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old June 6th, 2008, 07:35 AM   #8
CharlesM
Member
United States

CharlesM is offline
 
Join Date: Aug 2005
Location: Arkansas
Posts: 1,129
Quote:
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..
Take a look at this old post. It should get you started.


http://www.plctalk.net/qanda/showthr...9&page=2&pp=15
  Reply With Quote
Old June 6th, 2008, 08:09 AM   #9
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
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.co...ew/en/26107212
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old June 7th, 2008, 02:56 AM   #10
Jeebs
Member
Belgium

Jeebs is offline
 
Join Date: Feb 2007
Location: Leuven
Posts: 1,000
Quote:
Originally Posted by JesperMP
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.co...ew/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..
  Reply With Quote
Old June 7th, 2008, 03:08 AM   #11
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
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.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old June 7th, 2008, 04:07 AM   #12
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,614
:)

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.

:-)


Quote:
Originally Posted by Jeebs
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..
  Reply With Quote
Old June 7th, 2008, 04:12 AM   #13
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,614
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.

Quote:
Originally Posted by JesperMP
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.
  Reply With Quote
Old June 7th, 2008, 05:06 PM   #14
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
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.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old June 8th, 2008, 05:04 AM   #15
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,201
I have now made a downloadable file with the VBScript code for saving and restoring complete DBs to and from text files on a PC:
http://www.plcs.net/downloads/index....ectory=Siemens&
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Citect Vs WinCC - Long Doug_Adam LIVE PLC Questions And Answers 22 October 3rd, 2014 12:56 PM
Anyone tried WinCC Flexible and OPC ? JesperMP LIVE PLC Questions And Answers 4 July 20th, 2007 10:40 AM
WinCC Flexible Quirks tvey LIVE PLC Questions And Answers 5 May 3rd, 2007 05:57 AM
WinCC Flexible and Data logging Prince LIVE PLC Questions And Answers 5 January 2nd, 2007 05:18 AM
Simatic Wincc Flexible 2004 -->2005 STL??? LIVE PLC Questions And Answers 8 August 29th, 2006 05:42 AM


All times are GMT -5. The time now is 06:29 PM.


.