SQL Query From Rockwell Control / CompactLogix CPU

Good Evening,

I'm loading a recipe into a Rockwell ControlLogix or CompactLogix CPU via Excel, this is all working fine. Is there anyway I can check the "Batch_Number" tag against a SQL database to see if its been used previously?
So, in summary, can I query a SQL database direct from my CPU? and if so please can you assist me.

Thanks in advance,
AF52.
 
I don't know of a way to use a compact logix to query a DB, not unless it has some form of PC card with one of the most popular laguages on it.
Can you not use Excel to do the query, for example if you are sending a recipe via Excel is the batch number in Excel before you send it. Excel VBa can query SQL databases.
 
Thanks for the quick reply.
Yes I can do that with the initial query in Excel. The only drawback to that is if the same recipe is selected to run again at the end of the batch. I have code in place to increment the batch number, but I want to check it against the database for a secondary check.
 
I see your problem, all our batch numbers were uniqueue for example we took the recipe name then the date & then an incremental number i.e. BSB22C
050922 001 (without spaces) so until 050922 (Year 2122) it would not repeat, midnight every day the incremental number was zeroed so would never repeat.
 
What type of SQL (MSSQL, MySQL, Postgres, etc.).

It would be involved, but fairly straightforward, to set up an API to wrap the details of the SQL call, so the CompactLogix would use a very simple and limited query/response interface (e.g. Modbus, for which there is an existing Logix AOI, IIRC, or a web API, or OPC, or even E/IP).

The details would depend on your network configuration, but someone with experience could gin up a Python prototype in a couple of hours or so.

But I would wait for more members to see this thread before generating a bespoke solution; this sounds like a problem that has been solved before.
 
ignition & transaction manager can do this. don't do it on plc. you're already assuming the existence of a database which means there also exists a PC. so run the query on PC.

the PLC sets up it's parameters then sets a trigger bit the software is looking for. software pulls the parameters, runs the query, puts results in tags then sets a bit/status.

or, if you insist, omron makes a PLC with SQL query capabilities and can essentially do the exact same thing PC software would do: read parameters over EtherNet/IP, execute a query, and return results over EtherNet/IP. I forget the model, but you can get a minimal version that costs less than either Ignition or transaction manager software.

fyi: if you're the daring sort, FTOptix is comically cheap right now, for about $500 you can get a configuration that would perform similarly.
 
Good Evening,

I'm loading a recipe into a Rockwell ControlLogix or CompactLogix CPU via Excel, this is all working fine. Is there anyway I can check the "Batch_Number" tag against a SQL database to see if its been used previously?
So, in summary, can I query a SQL database direct from my CPU? and if so please can you assist me.

Thanks in advance,
AF52.
Check this it will do exactly what you are looking for no middle software or hardware between your plc and your ms-sql database
 
This software operates on a pay-to-play model, and you have to request pricing via email—likely because it's expensive. Personally, I’d prefer setting up a Raspberry Pi to handle the query instead!
 

Similar Topics

Hi, I have a question about SQL. This question is a little to much on the IT side I suppose, but I will give it a try anyway as I do not have an...
6
Replies
4,262
Views
Hi there, I use Indusoft IWS8.0 & I have created a sample Production data Date&time, MachineNo,Production Data with SQL Server 2008 DB. Need to...
1
Replies
2,656
Views
Hello, For my general information and knowledge, how is querying and storing data from a AB PLC (Compact or Control Logix) typically...
15
Replies
10,037
Views
Goodevening all... I have a Redlion PTV and Graphite with built in webserver... I can create the simple default.htm page... drag in tags to...
1
Replies
2,746
Views
Hi all, Having a little trouble getting the result I require, I'm close but no cigar. Basically, I am wanting to display a table within the...
2
Replies
5,028
Views
Top