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 September 10th, 2017, 02:41 PM   #1
one2go
Member
Croatia

one2go is offline
 
Join Date: May 2016
Location: Cakovec
Posts: 47
DB work orders to PLC

Hello everyone,

I would like to hear how should I start doing my project, step by step instructions if possible. This is my 1st project like this.

Project: PLC recieves work order (recipe or something with attributes(work order number, pallet size, number of lvls that can be filled on pallet, number of pallets...) from customers SQL database program. After that I have to procces those informations and based on that make program that will control robot.
PLC has to reply back to server when task is done.

Is this possible to do?

How to communicate with database and get those informations in PLC program?

How to return answer with filled informations back to database so customer will be informed that task is done?


Im not looking for any kind of code, just need someone to put me in right direction with this project. What to do 1st, what do I have to care about and stuff like that.

Thanks forward.
  Reply With Quote
Old September 10th, 2017, 03:14 PM   #2
labeledas
Member
Canada

labeledas is offline
 
labeledas's Avatar
 
Join Date: Apr 2010
Location: Peace River Alberta
Posts: 527
what type of plc and is there an hmi?

I have done something similar with a AB controllogix and factorytalk SE.

basically factorytalk would poll a database get setup data and push it to the plc
  Reply With Quote
Old September 10th, 2017, 05:23 PM   #3
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,374
There are a few threads on this forum to do with interfacing PLC's and SQL databases. One recommendation that comes up regularly - though I've not used it myself - is Ignition SCADA. It has an SQL bridge module.

I have also used the Oldi eATM ControlLogix hardware module, which was extremely easy to set up - I had data to and from the SQL database in under an hour. Not cheap though!

There are plenty of other ways to do it, but in most cases you're better off going with a more expensive tried and proven method than trying to put something together yourself from scratch - your sanity will thank you for it!
  Reply With Quote
Old September 10th, 2017, 05:34 PM   #4
curlyandshemp
Lifetime Supporting Member
Canada

curlyandshemp is offline
 
curlyandshemp's Avatar
 
Join Date: Jul 2005
Location: Toronto
Posts: 1,870
I beleive Inductive Automation's Ignition Transaction Groups are the easiest way to get SQL data to/from a PLC
__________________
Work to Ride,
Then Ride to Work

I would rather have a bottle in front of me..
than have a frontal lobotomy
  Reply With Quote
Old September 10th, 2017, 06:12 PM   #5
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 307
Ignition "Inductive Automation"
__________________
David M. Camp
Automation Engineer
Marshall Electric / www.mei-tech.com

PLEASE READ: https://www.prlog.org/12642091-marsh...-industry.html

PLEASE READ: https://www.prlog.org/12680572-marij...hold-word.html
  Reply With Quote
Old September 10th, 2017, 08:40 PM   #6
Phrog30
Member
United States

Phrog30 is offline
 
Join Date: Dec 2006
Location: Montgomery, Alabama
Posts: 323
I agree with ignition, but also think advancedhmi is an option.
  Reply With Quote
Old September 10th, 2017, 11:03 PM   #7
one2go
Member
Croatia

one2go is offline
 
Join Date: May 2016
Location: Cakovec
Posts: 47
Quote:
Originally Posted by labeledas View Post
what type of plc and is there an hmi?

I have done something similar with a AB controllogix and factorytalk SE.

basically factorytalk would poll a database get setup data and push it to the plc
it would be siemens s7 1200 and yes some hmi too
  Reply With Quote
Old September 10th, 2017, 11:25 PM   #8
sigmadelta
Member
Canada

sigmadelta is offline
 
Join Date: Apr 2016
Location: From Canada - Living in Bulgaria
Posts: 621
WinCC Advanced RT

https://support.industry.siemens.com...dti=0&lc=en-WW
__________________
Freelance Automation Programmer
  Reply With Quote
Old September 11th, 2017, 02:09 AM   #9
Manglemender
Member
United Kingdom

Manglemender is offline
 
Join Date: Jul 2007
Location: Lancashire
Posts: 1,083
I've done this sort of thing before with a SAP system. The SAP system exported orders to a text file in a defined format. Using the SCADA, (RSView32) The operator could then select an order to process (directory listing in orders folder). The text file would be read in via VBA and built into a work order list for the PLC. I have done similar things in WinCC too.

Nick
  Reply With Quote
Old September 11th, 2017, 03:38 AM   #10
one2go
Member
Croatia

one2go is offline
 
Join Date: May 2016
Location: Cakovec
Posts: 47
Quote:
Originally Posted by Manglemender View Post
I've done this sort of thing before with a SAP system. The SAP system exported orders to a text file in a defined format. Using the SCADA, (RSView32) The operator could then select an order to process (directory listing in orders folder). The text file would be read in via VBA and built into a work order list for the PLC. I have done similar things in WinCC too.

Nick
Can you describe how you done that in winCC?

I cant imagine how do I get exact table from database to database in PLC program. (field to int variable in PLC)

Lets suppose that work order are being added from user side on server PC, then PLC has to scan every xx time and check if there is new, or next order that has to be executed...

Local operator will choose which work order will be executed from HMI.

If im saying something wrong please correct me.

thanks.
  Reply With Quote
Old September 11th, 2017, 04:39 AM   #11
Manglemender
Member
United Kingdom

Manglemender is offline
 
Join Date: Jul 2007
Location: Lancashire
Posts: 1,083
Hi, I used VBS to read a text file but I understand you can query a DB directly. I've queried DBs directly from Excel but never from a SCADA but the process must be similar.

The text files must be in a defined format for example the first 8 characters on a line might be a product code, the next 5 characters might be height, the next 3 chars quantity and so on.

When a line is read from the file, the string is chopped up and the data converted to tag data or added to an array of data in memory.

The VBA routine below reads a sequential file into an array:

Code:
Public Sub ReadPunchlist()
Dim fName As String, PathName As String, Mark As String
Dim Result, Dist, Punch
On Error GoTo ErrHandler
  
  If (PathPunchlist = "") Then Call UpdateFilesPathConstVB
  
   PathName = PathPunchlist & "Punchlist.txt"
  fName = Dir(PathName)                   'Read first file name (if exist)
  
If (fName <> nullstring) Then
'Read file
Open PathName For Input Access Read Lock Write As #1   'Open Text file in Sequential mode for Reading, Locking write
    'read the data
    ReDim Punchlist(0)
    i = 0 'UBound(PunchList)
    
    Do While Not EOF(1)
            i = i + 1
            ReDim Preserve Punchlist(i)
            Input #1, Dist, Punch, Mark
            Punchlist(i - 1).Distance = CInt(Dist)
            Punchlist(i - 1).Punch = CInt(Punch)
            Punchlist(i - 1).strPrint = Mark
    Loop
   
Close #1
End If
Exit Sub
  
ErrHandler:
  Close #1
  gActivity.Log "VBSub:WkList.ReadPunchlist error: " & Err.Number & Err.Description, roActivityError
  Err.Clear
End Sub
The example above is taken from an RSview project but you can do the same sort of thing with VBS in WinCC. Using scripting, you can also read and write tag values.
Attached Files
File Type: txt Punchlist.txt (679 Bytes, 3 views)
  Reply With Quote
Old September 11th, 2017, 05:00 AM   #12
one2go
Member
Croatia

one2go is offline
 
Join Date: May 2016
Location: Cakovec
Posts: 47
Quote:
Originally Posted by Manglemender View Post
Hi, I used VBS to read a text file but I understand you can query a DB directly. I've queried DBs directly from Excel but never from a SCADA but the process must be similar.

The text files must be in a defined format for example the first 8 characters on a line might be a product code, the next 5 characters might be height, the next 3 chars quantity and so on.

When a line is read from the file, the string is chopped up and the data converted to tag data or added to an array of data in memory.

The VBA routine below reads a sequential file into an array:

Code:
Public Sub ReadPunchlist()
Dim fName As String, PathName As String, Mark As String
Dim Result, Dist, Punch
On Error GoTo ErrHandler
  
  If (PathPunchlist = "") Then Call UpdateFilesPathConstVB
  
   PathName = PathPunchlist & "Punchlist.txt"
  fName = Dir(PathName)                   'Read first file name (if exist)
  
If (fName <> nullstring) Then
'Read file
Open PathName For Input Access Read Lock Write As #1   'Open Text file in Sequential mode for Reading, Locking write
    'read the data
    ReDim Punchlist(0)
    i = 0 'UBound(PunchList)
    
    Do While Not EOF(1)
            i = i + 1
            ReDim Preserve Punchlist(i)
            Input #1, Dist, Punch, Mark
            Punchlist(i - 1).Distance = CInt(Dist)
            Punchlist(i - 1).Punch = CInt(Punch)
            Punchlist(i - 1).strPrint = Mark
    Loop
   
Close #1
End If
Exit Sub
  
ErrHandler:
  Close #1
  gActivity.Log "VBSub:WkList.ReadPunchlist error: " & Err.Number & Err.Description, roActivityError
  Err.Clear
End Sub
The example above is taken from an RSview project but you can do the same sort of thing with VBS in WinCC. Using scripting, you can also read and write tag values.
okay thanks, its a bit brighter to me now.

Is it possible to read DB data with GET instruction? and write with PUT? or thats only for communication between M/S PLC?

thanks
  Reply With Quote
Old September 11th, 2017, 12:19 PM   #13
gclshortt
Member
Canada

gclshortt is offline
 
gclshortt's Avatar
 
Join Date: Dec 2014
Location: Cobourg
Posts: 2,227
http://accautomation.ca/now-you-can-...r-free-part-1/

The above is part 1 of a series called robust data logging for free.
Now You Can Have Robust Data Logging for Free
(PLC Program – Modbus TCP (VB6) – Access Database – Web Server)
Part 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 /12

The actual reading/writing from the database to the PLC can also be done by AdvancedHMI.
https://sourceforge.net/projects/advancedhmi/

There may be some information in this that can help you.
Regards,
__________________
Garry
http://www.accautomation.ca
Connect with us on Facebook: facebook.com/accautomation/
  Reply With Quote
Old September 11th, 2017, 12:48 PM   #14
keithkyll
Member
United States

keithkyll is offline
 
Join Date: Jul 2005
Location: Heath, TX
Posts: 1,898
Quote:
Originally Posted by one2go View Post
Can you describe how you done that in winCC?
I cant imagine how do I get exact table from database to database in PLC program. (field to int variable in PLC).
Lets suppose that work order are being added from user side on server PC, then PLC has to scan every xx time and check if there is new, or next order that has to be executed...
Local operator will choose which work order will be executed from HMI...
Take a look at the "Recipe" function in Win CC. Look at some examples on the Siemens website. Most of the stuff you want to do will be automatic. Use VBS if you need to customize anything. I used VBS to do the datalogging, because the built-in functions were lacking. That was with V12.
  Reply With Quote
Old September 11th, 2017, 02:16 PM   #15
one2go
Member
Croatia

one2go is offline
 
Join Date: May 2016
Location: Cakovec
Posts: 47
Quote:
Originally Posted by gclshortt View Post
http://accautomation.ca/now-you-can-...r-free-part-1/

The above is part 1 of a series called robust data logging for free.
Now You Can Have Robust Data Logging for Free
(PLC Program Modbus TCP (VB6) Access Database Web Server)
Part 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 /12

The actual reading/writing from the database to the PLC can also be done by AdvancedHMI.
https://sourceforge.net/projects/advancedhmi/

There may be some information in this that can help you.
Regards,
thanks, will take a look
  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
Dynamic choosing DB in PLC STEP7 Sergihno LIVE PLC Questions And Answers 31 December 16th, 2016 08:53 AM
How does an PLC interrupt actually work? sommers9 LIVE PLC Questions And Answers 5 April 5th, 2016 02:10 AM
Store orders in PLC with HMI DhoTjai LIVE PLC Questions And Answers 3 March 19th, 2015 10:27 AM
PLC with GSM modem how to work together ? Robustel LIVE PLC Questions And Answers 4 January 24th, 2013 12:45 AM
Log DB data from a S7 PLC with MPI bibistick LIVE PLC Questions And Answers 5 June 17th, 2008 07:32 AM


All times are GMT -5. The time now is 10:46 AM.


.