DB work orders to PLC

one2go

Member
Join Date
May 2016
Location
Cakovec
Posts
51
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.
 
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
 
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!
 
I beleive Inductive Automation's Ignition Transaction Groups are the easiest way to get SQL data to/from a PLC
 
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
 
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
 
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.
 
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.
 
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
 
http://accautomation.ca/now-you-can-have-robust-data-logging-for-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,
 
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.
 
http://accautomation.ca/now-you-can-have-robust-data-logging-for-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
 

Similar Topics

Question: How can I store order data in PLC (Siemens S7-300) from HMI (Siemens TP177B)? What is the best way to do this? I am stuck at inserting...
Replies
3
Views
1,985
Hi! Is it possible to have a hardware list with the order numbers of a TIA v12 project? I would like to receive a quotation for a list of...
Replies
0
Views
1,295
I have been asked by a company to look into electronic data recorders. I have done some research, but it is hard to find the combination they are...
Replies
7
Views
3,026
Hello, I'm trying to delve a little into rs-485 communications for a couple projects of mine. Until now I've been using a delta vfd and a delta...
Replies
2
Views
29
Greetings All, I recently decided to start freelancing in Controls and Automation part time, most of my experience has been with Rockwell...
Replies
2
Views
75
Back
Top Bottom