Sign in to follow this  
Followers 0
RFurey

PLC recipe options

26 posts in this topic

I have three SLC500s on a DH485 network. I am looking for the most cost effective way to store and retrieve 900 integer values from each PLC to a PC. The intent would be to be able to save a near unlimited number of 900 integer recipe files. (There is no room on the PLCs to store recipes) 1) My first approach would be to get an RSView32 package with RecipePro. 900 tags x 3 PLCs = 2700 tags. That would mean I'd need the 5000 tag RSView32 Works (w/Linx) which runs around $6900. The downside to this approach is cost. 2) Another approach would be to use RSLogix 500 ($1200) and upload and download the entire project (program and data files). Essentially, each recipe would be a different project file name on the PC. The downside to this approach is user friendliness and the potential for big problems if the logic ever needed to be changed. 3) I've also been fooling around with the idea of moving just a small group of integers into holding addresses, transferring them to the RSView project as a small group of (holding) tags and then populating 900 derived tags by using an event to turn on the appropriate derived tag file that would direct the holding tags to the proper derived tag location. I could then save the 900 derived tags to a recipe file. The problem is that the PLC and the RSView project must be looking at the same group of tag/integers at the same time. If they don't, the wrong group of integer/tag values can get sent to the wrong derived tag addresses. I have RSView32 Works with 300 tags so I would just have to get a 300 tag Runtime ($2400). The downside is that after a day or so of screwing around with this, it's getting sort of messy and I'm beginning to wonder if I can make it work 100% reliably. a) Is #1 the only reasonable option? b) I know #2 is a bogus approach, but it's on the table. c) Has anyone ever done something similar to #3 and made it work? (Hopefully I was able to clearly describe what I was doing.) d) Is there a fourth option?

Share this post


Link to post
Share on other sites
You could do it with a non-Lite version of RSLinx and Excel spread sheets.

Share this post


Link to post
Share on other sites
Please tell me more! Is there a tech paper (or something similar) to read?

Share this post


Link to post
Share on other sites
Goto RsLinx help(lite will work) and search for DDE

Share this post


Link to post
Share on other sites
Ok, I am able to create hotlinks in the Excel cells of the integer addresses in the PLC. I change the value of an integer in the PLC data table (via RSLogix) and it changes in Excel. I save the Excel file and I have a record of all the variables. Excellent. Two questions 1) If I have an Excel "recipe" file that contains different values than what is in the PLC, how do I prevent the Excel values from being overwritten to moment I open the Excel file? 2) How would I move the values in Excel back into the PLC? Can I do it without diving into VB? (of which I know nothing about) I think this is the right track. I appreciate the tip.

Share this post


Link to post
Share on other sites
You use your linkmode to control the link. Going off of memory 2 is a manual link, 1 is an automatic link, and 0 closes a link. So you could have a button in excel that starts your DDE link

Share this post


Link to post
Share on other sites
There are example's in the download section, I recommend you down load these and take a look, while the examples may not be exactly what you want, they should give you a boost in the right direction.

Share this post


Link to post
Share on other sites
Not to toot my own horn, but this example, uploads the current clock value from several plcs and then compares it to the current pc clock. It then allows you to download the current pc clock to each plc. A few simple tweaks should do what you want. I'd recommend a sheet for each recipie and a sheet for current values.

Share this post


Link to post
Share on other sites
One thing, the maximum you can read and write is around 100 integers per request. This is not an issue. Make one request, then the next, then...

Share this post


Link to post
Share on other sites
From what I've been able to determine, I think you guys are talking about cold links, which I think moves me into VB territory. I can't make heads or tail from any of the download examples. They all appear to us VB in one way or another. It's looking like there may not be a non-VB way to read and write 900 variables in Excel. This Excel approach may be over my head.

Share this post


Link to post
Share on other sites
The Excel approach does require VB macros but is not over your head. You will have a little learning curve but I guaruntee you that the users here will help you through it. But the big thing is you must get a non Lite version of RsLinx first. I would suggest OEM.

Share this post


Link to post
Share on other sites
I have RSLinx Classic Professional (2.50.00.20) on my laptop. I appreciate the encouragement. I want to avoid being a pest and appearing like I'm trying to get others to do my work for me. I'm not quite sure where to start with this VB thing to keep the learning curve to a minimum. Any suggestions?

Share this post


Link to post
Share on other sites
I can't seem to find the link but maybe someone else can help on that. MICKEY!!! There is an example that goes step by step browsing the tags in RsLinx, copying them, and how to use the "paste special" in Excel to put the values in Excel. This is not exactly what RFurey needs but it would be a good way for him to begin understanding the DDE. Seems like along with it was a write example that he could move on to. Anyone know where that is?

Share this post


Link to post
Share on other sites
Have you read the RSlinx Help file example about DDE and looked at the macro which was in the example file i referred to earlier? I know i am a seasoned programmer, but I've had several beginners say it is fairly well commented from a learners standpoint. And I can help with the rough areas if you ask.

Share this post


Link to post
Share on other sites
I've read the RSLinx Help file and I've just finished a question breakdown of the file SampleDDE.xls which I've added as an .doc attachement to this post. Please remember that I have no VB experience (Though it looks like it may be to my benefit to get some....quickly). If you could respond to a few of my questions and requests for clarification, I' be much grateful. SampleDDE_breakdown.doc

Share this post


Link to post
Share on other sites
Not a problem and I'll try and address them. Keep in mind that a quote {'} infront of somehting makes it a comment not an executable instruction. This can be an aid. A. You will not need 900 variables especially if your integer addresses are sequential. B. The Dim Statements grew as the program grew in complexity. It was simply to reduce line count that I DIM several on a single line. C. Yes Dim DDETOpic(ProcessorNumMax) and DDETopic(4) achieve the same thing {when ProcessorNumMax = 4}. Since all three arrays DDETOPIC, TopicDesc and ProcType need to be the same size to work using the constant ProcessorNumMax comes in handy and reduces the places that have to edited if a processor is added or removed. D. The VB variable Type LONG refers to long integer and supports bigger numbers than type Integer. My rustyness prevents from giving you the exact limits. I think Integer stops at like 65536 or so. E. The establish error handling statement and resume next simply keeps the program running when it hits an error rather than GPF or Fatal crash. Not always useful but a place to start. F. This set of isntructions Clears the Worksheet Sheet6 so you can use it for temporary storage and calucalations. G. The filename statement remains from situations where I've had macros stored in a file called macros.xls and run them on other files containing only data. I developed this approach so that "proprietary" macros did not accidentally ship out to customers with their data after it was crunched. You're right it is mostly overhead in this situation. H. Yes this is an example of looping. It establishes a value of RSIChan which is used later to send and receive data. The DDEInitiate is executed. This loop establishes the link between excel and PLC. I. yes, Time is a special VB command. J. There is no significance to the Case Statement and If/Then/Else would work, but the Case is more my style. K. 'Post Machine Name Column = 66 ColumnName = Chr(Column) Source = FileName & SheetName & ColumnName & Row Range(Source).Value = DDETopic(ProcessorNum) The Post Machine Name is a comment as indicated by the ' leader. The CHR command converts a number to its ASCII Character. B = ASCII 66 so ColumnName = B The & statement concatentates the variables so Source = "[sampleDDE.XLS]Clock!B3" The Range.Value instruction loads the value from the array DDETopic into the cell indicated by range. In this case cell B3. L. You deciphered the concatatenate command correctly DDETarget = S:40 M. You are correct DDE Initiate opens the channel for communication. DDEREquest get the data and can read a block of integers not just a single as is shown here. Keep in mind you do have a limitation to request size. Technically 128 bytes. Which after you subtract overhead allow about 100 integers to be read at a time. I alternately read in groups of 100 and or groups of 64. Yes DDEterminate closes the initiated channel. ALso DDEPoke writes data on the same connection. The other unsaid fact is that you must use RSLinx and perform a topic configuration with each processor name pointed at that processor.

Share this post


Link to post
Share on other sites
So much to digest, so little time. Hopefully this will be the last iteration (...well, maybe the next to last ) and I can stop pestering you and see if I've absorbed enough to be dangerous. Thanks! SampleDDE_breakdown_2.doc

Share this post


Link to post
Share on other sites
Not a Problem - WHen you write some fancy code just share it with us as well. The section Establish Initial Values loads values into the DDETopic array. If the array is not loaded or is empty them the DDEinitiate is not done. Your Construct for the DDEinitiate command looks good. The macro knows where rslinx is because it is already running. If you look at the visual baci editor and the this workbook module you'll see code in the workbook open macro which searches for and launches RSLinx. I've renamed it FINDLINX and posted it here. Sub FINDLINX 'This routine runs whenever the workbook opens and attempts to locate and launch RSLinx.exe 'on any mapped drive available 'Declare Temporary Variable for use with Shell Commands Dim ShellResponse 'Establish a File Object Variable to get a handle to RSLinx.exe Dim FileObject 'Declare Variables to Locate RSlinx.exe Dim LinxName As String Dim DriveLetter As String Dim DriveNumber As Integer 'Declare Variables for Looped Search Dim Iteration As Integer Dim LoopTest As Boolean 'Set Initial Values DriveNumber = 67 'Ascii 67 = C DriveLetter = Chr$(DriveNumber) LoopTest = False 'Create the File Object Set FileObject = CreateObject("Scripting.FileSystemObject") 'Search for RSLinx Do LinxName = DriveLetter & ":\Program Files\Rockwell Software\RSLinx" If FileObject.folderexists(LinxName) Then ShellResponse = Shell(LinxName & "\RSLINX.EXE", vbMinimizedNoFocus) LoopTest = True GoTo LoopExit End If DriveNumber = DriveNumber + 1 DriveLetter = Chr$(DriveNumber) If DriveNumber > 90 Then MsgBox "Warning -- RSLinx was not Automatically Launched" & vbCrLf & "Please Open RSLinx Before Proceeding", vbOKOnly, "Warning" LoopTest = True GoTo LoopExit End If 'Check for Other Processes Running DoEvents LoopExit: Loop While LoopTest = False 'Move to Home Position Sheet7.Select Range("A1").Select End SUB Does & just put together a group of variables (regardless if they’re numbers or letters) with no spaces in between? Yes Letters and Numbers all go together as a new string. Column = 66 ColumnName = Chr(Column) Is there any reason why this can’t be written as ColumnName = B? Yes the reason it is not written as ColumnName = "B" is that when I want to go to C or D for successive columns I can increment Column and recalcualte Columname. You definitely undestand the range instruction it appears. The quickest example I can give right now is to have you browse with RSlinx and using the Data Monitor create a DDE link. If you do hotlinks you'll see the L1C1 or L4C4 or L9C9 for 1 , 4 and 9 integers respectively. All you'll need is a modified DDETarget variable that includes the length L and Column C variables on the end of it. you'll also need a range source of several cells not a single cell. I'll try and create a simple example later.

Share this post


Link to post
Share on other sites
Try Looking at this scaled down version. It reads 1024 integers from N24 and then writees them to N24. SampleDDE_2.zip

Share this post


Link to post
Share on other sites
That last example did the trick. I've modified it to match my application and it looks pretty darn good. I've got to say that I've found this forum to be really invaluable on a number of occasions. Thankyou very much! Unfortunately I can't say the same for my local AB supplier. Before I posted here I had consulted with their tech support people a couple times and their 'solution' to my recipe storage requirement was the $7000 RSView32 package. Now that I'm near the tail end of this project, it seems to me that someone well versed in this sort of stuff should have been aware of the Excel/DDE/RSLinx approach. Did they know about it and withhold the info for the sake of making a sale? Or were they truly unaware? Either way, I guess this experience has revealed the limits of their technical aptitude and/or their ethics. I wonder if $7k is worth the loss of customer confidence. ....sorry for the rant. Anyways, thanks again.

Share this post


Link to post
Share on other sites
Glad MRPLC could be of service. In defense of your AB Rep the Excel/DDE/Linx approach is not "top shelf" solution that you would want to use for a customer as an oem. But for an end user with the need to change an occaisional recipie it works well. Although untested the following sample should allow you to hold ten recipies in reserve. SampleDDE_3.zip

Share this post


Link to post
Share on other sites
Also DDE is no longer supported by Microsoft which would could be part of why your rep didn't wish to offer that solution. I would bet that they have gotten many complaints that user are unable to upgrade their VB6 applications to VB.NET because the software giant removed the DDE support from VB.NET. I wonder how much longer the Office package will support it?!?

Share this post


Link to post
Share on other sites
Guess I better "bite the bullet" and learn the overhead of OPC the eh?

Share this post


Link to post
Share on other sites
Well let's not get too excited. I'm not looking forward to learning it either. But yes at some point I will have to learn it too

Share this post


Link to post
Share on other sites
Since the original poster got the help he needed and I don't want to hijack this thread I'm creating a new thread which covers the "Perils of Pauline" adventure of me learning OPC.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0