Sign in to follow this  
Followers 0
FET_Destroyer

Data Buffer

20 posts in this topic

Hello Guys, I'm a newbie doing a project and I need some ideas from PLC experts :) In short, what I want to do is some kind of temporary buffer. in the PLC to prevent data loss when network is down. For example, I will have cx-supervisor reading data from PLC and save it in a DB, but imagine that the PLC-Supervisor network is off for some time. The data that the PLC collected during that time will be lost so I was thinking on a data buffer on the PLC. It could be something like this: I will have N arrays, in each cycle I will move the data that I want to the next array. When the connection return, the supervisor will read all the arrays or the arrays with data. This is my idea, I attached an image below, but for sure someone have implemented a better idea. I'd like to have feedback so I can choose a good solution to start this project. Regards

Share this post


Link to post
Share on other sites
A FIFO buffer?

Share this post


Link to post
Share on other sites
I think the big question is: How much data do you need to store and do you have enough PLC memory to do it? you need to tell us which PLC you are using, how many registers you need to save, and how often you want to save them. That will determine how much memory area is needed to do this. I am doing something similar by saving 10 floating point registers to EM_0 using an index pointer once per minute. I use the system clock to calculate the index pointer. It will automatically overwrite the old data every 24 hours so that I can keep a running 24 hour total and average for each data point. Edited by Mendon Systems

Share this post


Link to post
Share on other sites
@BobB. Yes a FIFO buffer is what I need. @Mendon Systems. I'm using CJ2M-CPU33 I don't have a exact quantity of it will be something like 40 words, saved at each 30s or 1min. Are you doing that in structured text language? Because I tried to do that, but this language doesn't let you create 3D data array (like in C), which is kind of boring, because if it does this will be simpler. Can you help me with this? Edited by FET_Destroyer

Share this post


Link to post
Share on other sites
I use this for logging to CF-card, and the comments are in Norwegian, but I think there are some bits that you can use. I seem to remember that I found the original setup somewhere on MyOmron... Geir Logging.zip

Share this post


Link to post
Share on other sites
I did mine all in ladder logic. I do not use ST for anything except an occasional function block because the maintenance people don't understand it. The problem you will have is that you need 115,200 registers to save that much data for 24 hours. To do that in a CJ2M-CPU33 you will need to add more extended memory. EM_0 could store about 6.8 hours of data if you were very careful about structuring your data. Here are the basics of what I am doing: 1) The index pointer is calculated every second from the PLC clock (A351 & A352). The value will range from 0 (mdinight) to 1439 (11:59pm). 2) The data is stored in EM_0 in blocks that are 1500 registers long (for convenience in numbering). Each data point has a unique block. 3) A scheduled task is triggered for 1 scan once per minute to calculate the data and write it to EM_0. 4) The data is written to DRn,IRn. DRn is set to the index pointer and IRn is set to the data block. 5) I do not clear the data blocks because I am only interested in the last 24 hours of history. Edited by Mendon Systems

Share this post


Link to post
Share on other sites
@Geir, I cant open your file is in cxr extension, don't know what that is. @Mendon Systems Yes, I said cpu33 but in fact im using cpu34 with 4 banks in EM, which by my math if I store 50 words per minute will give to almost 2 days logging, which is good (but I do not intend to use so much memory). About EM memory on my tests I cannot exceed E32767, above that give me an error, If I try to choose a bank, E00_00 this give me an error too. I did not understand the IRn and DRn section, I'm newbie in PLC so this is kind of difficult to me :s When you say 1500 registers, each register is an array of data from the PLC right? How about using the FIFO function on the PLC? Will it work? From what I see it does something similar, but I do not have to update the indexes right? Regards

Share this post


Link to post
Share on other sites
The correct way to address EM_0 is E0_0, E0_1, etc. Each EM bank contains 32768 registers from 0 to 32767. You will need to read up on index registers in the CJ2 programming manual. Start with section 5-7 of the W473 manual. To use my addressing scheme you would need to assign 2880 sequential registers to each of your data points then work out a way to get your index pointer to work over two days. That would allow you to store 11*4=44 data points once per minute for two days in the CJ2M-CPU34. The SSET/PUSH/FIFO approach that Bob suggested would certainly work also. You would have to come up with a scheme to configure the memory stacks for your application.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
Hi Guys, Thanks for all the tips. I started today my buffer algorithm but I'm with some basic problems just right in the begin to calculate the index :s All I want to do is each second (for testing purposes, in the future will be minutes) I will increment a counter, and multiply that counter by the size of my buffer in words, in this case 50 words. After 1440 counts the counter will be reset, just simple as this. But I cannot even increment the E0_32767 memory area. I read the section in the manual but what am I doing wrong? I change the area to D32767 and it works :s Regards Edited by FET_Destroyer

Share this post


Link to post
Share on other sites
Hi Guys, I've finished the array buffer, kind of 3D array in C. I tried to use the Mendon Systems approach. The Geir program seems a good solution but I don't have a CF card and do not need so much logging time. It does something like this: Each minute a counter is incremented ( and it reset at 600 counts , max log time aprox. 10 hours ) Then I multiply the counter value by a constant that is the size of my array, this case is 50 words. This will give me the index position. counter 0 - index 0 counter 1 - index 50 counter 2 - index 100 ... With this I just make an indirect mov from an array that I have on DM to that index. I could use the IR and DR for the index and offset, probably is the rightest solution, but for now this will do the job. Thanks for the support. offtopic: Yhat you guys recommend for collecting data from plc? I never used cx-supervisor, and I've done a quick C# application using FINS, with that app I can collect 50 words quickly. But what are the cons and pros? I don't what to use the fancy graphical environment, is just to grab the plc data to a database. Edited by FET_Destroyer

Share this post


Link to post
Share on other sites
I normally use the data sampling function in a Maple Systems (Weintek) HMI and save the data on an SD memory card. I have the HMI prompt the operator run a backup of the data periodically (30-90 days) to a USB flash drive and save the backup in .csv file format. Those HMI's can also be set up to transfer data to a host PC on demand, but I usually don't implement that. Pros .... relatively cheap, easy to implement, and can replace a LOT of pushbuttons. Cons .... the HMI can be damaged by an operator and the touchscreen will eventually wear out. ???? .... those HMI's create a new data log file for each day whether you want it or not.

Share this post


Link to post
Share on other sites
Hi Mendon, I searched the Maple Systems HMI and they seems very good, not just in the specs but also in the price. Is it easy to interface it with omron plcs? The EZware is easy to start like the cx-designer?

Share this post


Link to post
Share on other sites
I have used them with both RS-232 and Ethernet connections to Omron PLCs with no problems. You just have to select the correct protocol (use Omron CS1/CJ1 Ethernet for the CJ2M-CPU3x). EZware is similar to CX Designer in many respects. I like EZware better, but that's just my personal preference. Others Like CX Designer better. Tip: If you decide to go that route, use the newer "P" versions and EZware Plus software. There isn't a lot of difference, but it appears that the older ones may eventually become obsolete. My current project uses both.

Share this post


Link to post
Share on other sites
Hi Mendon Systems, The P model doest exist in the 10 inch size lcd. And the Ezware software? I need to buy a licence right? I cannot find the price on the website. Because right now my company has a licence for omron software. So buying licence for ezware software only if is a cheap licence otherwise the money saved by the HMI it will be spent on the licence software, libraries, etc.

Share this post


Link to post
Share on other sites
You are correct about the 10" model. The P series currently exists in 7", 12" and 15" sizes. The software is $75 for a CD that includes both the Ezware 5000 (old) and Ezware Plus (new) versions. Note that Maple Systems is the US distributor for Weintek who private labels the product line. You might be able to get a better deal by going to Weintek directly. They list a distributor in Portugal.

Share this post


Link to post
Share on other sites
Hi Mendon, So from what I understand Maple Systems is just a re-brand of weintek HMI for the US? The website in the Weintek is much more confusing than the Maple Systems but I will take a look on this HMIs. What is your opinion about the durabitity/processing_power/speed/quality of these HMIs versus the omron HMIs? Regards

Share this post


Link to post
Share on other sites
In all fairness, this is strictly from my personal experience. Others have probably had different results. I started using the Maple Systems (Weintek) HMI about 5 years ago for two reasons: 1) I experienced several failures of the Omron NS series when data logging to their CF memory card. 2) I needed an HMI that would work with mixed PLC networks. Since I started using Maple Systems about 5 years ago, I have never had one of their HMI's fail. In that time period I have had to replace three NS series HMI's with Maple Systems 5070's, two because of problems with data logging and a 3rd because of communication problems. I have two regular customers who do heavy data logging. The CF memory cards that the Omron NS uses seem to be prone to failures and are much more limited in size than the SD memory cards that Maple Systems uses. I normally use Omron PLC's with Maple Systems touchscreens, but a lot of my work is retrofitting existing systems so some of them end up with really strange mixtures of new and old hardware. The factory HMI's tend to work well with their own PLC's but not so well with other brands of hardware. I do agree that Weintek's website leaves a bit to be desired. The only reason I suggested looking at them is the logistics. If you have a (somewhat) local distributor in Portugal it may be easier for you than dealing with someone on the West Coast of the US.

Share this post


Link to post
Share on other sites
Hi Mendon Systems, I just contact today the distributor to check the HMI availability and prices. About Weintek graphical resources? They are almost the same as omron? Alarm/Event,History/Display,Charts,Gauges,etc. Right now in my current project I will use an NS10, but I think in my next project I will try to use Weintek HMI. Regards

Share this post


Link to post
Share on other sites
I use both Omron and Maple. I prefer Maple mainly because you get 3 for the price of 1 NS. At the same price, I dont know now wich one i would choose, even if the NS has better general quality. Both of them can do things that the other can't. It would be long to list them here, but if you ask for specific items about your need I will answer you. Maple have resistive touchscreen and on the Omron the screen is divided by cells. Again, each one have their advantage. Resistive, you have near infinite position / size possibility. Cells, you have the possibility of 2 simultaneous buttons. If you need recipe you will prefer the NS. Maple will make you work more, and make you work with indirect adressing. One big advantage of Maple over Omron is their technical support. For availability and short time to get an answer if contacted by email. If you consider other than NS in Omron HMI, forget it and go with Maple. Edited by pfort

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