Case Study: Power Measurement System with Accurate Timing

. Wednesday, January 21, 2009

In this post, I want to talk about a power measurement test system that tests an electrical device.
Our customer is producing a household appliance which has a boot up sequence.  In this sequence, device drives its internal components in certain time intervals which makes it possible to test if connections are done properly. So, each products have a power consumption graphic as below:


This graphic can be considered as a signature for products, many products have similar graphic with different level of power consumptions in different time intervals.
I can summarize customer requests as below:
Test parameters should be defined by a web page.
Test system should produce a test result code which can define each components test status such as 'heater is under it's low limit and fan is over it's high limit'. And of course, it should be reported on the web.
It is needed to store power consumption graphics for statistical calculations and it should be possible to report on a web page.
It is possible to apply power on the fly without an operator, customer does not want any operator except test parameter management.
Defected products should be diverted automatically to the defected area. 
Project requires web reporting, web reporting requires DB interaction, DB interaction requires PC. 
Project requires measurement with accurate timing, however PC can not do this properly because of its instability. It was necessary to take samples in each 100 milliseconds. Sure PC can handle this speed but it may not be possible to this in exactly 100 milliseconds. Well, sure it is possible but it is just a little bit difficult to do it, not easy for a formerly PLC programmer.  It can be done with multimedia programming techniques, recording a voice in 44 kHz is a similar but much more difficult task.
If you only have a hammer, you always consider that all problems are nail, so we decided to do it with PLC.  
We decided to measure with PLC and buffer the results in PLC memory.  
Of course we could do it without wasting PLC data memory, PLC could send data to PC in every 100 milliseconds, and it is very easy to handle it in PC, you can do it by RS232 or Ethernet, does not matter. Both of them triggers an event in PC which breaks existing program flow.  However, we  should also make a handshake between PC and PLC, because customer wanted products to be automatically diverted defected products, and PC has the answer. 
How did we manage the buffer in PLC? 
We continuously copied analog data to the beginning of memory buffer. We only copied 'FFFF' value once as the test started.  Then used 'SHIFT' command in PLC. 
So the result was as follows:
In PC, we have polled the memory buffer continuously and searched for the first 'FFFF'. When found, copied them in another array in reverse order. 

So we were sure that analog sampling was done in 100 milliseconds.

Another alternative for using 'FFFF' was incrementing one counter in every shift to determine the starting point of the shift, but using 'FFFF' technique required less coding in PLC. 

0 comments:

Post a Comment

Followers

Search This Blog

Comments

About Me

My photo
Automation engineer especially working on PC software development. Formerly I was coding on PLC, but now I am using mostly Visual Basic on PC.