<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6984106770834733517</id><updated>2012-01-19T09:18:01.114+02:00</updated><category term='WinCC Flexible'/><category term='GetTickCount'/><category term='FAQ'/><category term='First post'/><category term='SQL'/><category term='customers'/><category term='time measurement'/><category term='INDAFINS'/><category term='Windows'/><category term='timing accuracy'/><category term='packet length limit'/><category term='presentation'/><category term='Finite state machine'/><category term='inheritance'/><category term='download'/><category term='ActiveX'/><category term='UDP'/><category term='tips'/><category term='start'/><category term='animation'/><category term='serial communications'/><category term='class'/><category term='OMRON FINS Ethernet'/><category term='web based reporting'/><category term='productivity'/><category term='Assembly line balancing'/><category term='code'/><category term='SCADA'/><category term='customer relationships'/><category term='State analysis'/><category term='encapsulation'/><category term='PC PLC Communication'/><category term='time intervals'/><category term='database'/><category term='reporting'/><category term='Histogram'/><category term='reset button'/><category term='basic'/><category term='Ethernet'/><category term='unexpected'/><category term='programming'/><category term='industrial engineering'/><category term='example'/><category term='reset'/><category term='property'/><category term='Barcode'/><category term='How to'/><category term='experience'/><category term='simple'/><category term='rules of thumb'/><category term='OMRON'/><category term='algorithm'/><category term='VB'/><category term='signals'/><category term='WinCC'/><category term='PC Stability'/><category term='Power measurement'/><category term='operation time reporting'/><category term='I/O'/><category term='property let and get methods'/><category term='what is &apos;In da notes&apos;'/><category term='RS 232'/><category term='Object Oriented Design in Industrial Automation'/><category term='FINS'/><category term='Linux'/><category term='Product Traceability'/><category term='design'/><category term='project management'/><category term='Case Study'/><category term='Windows vs Linux'/><category term='Object Oriented Design'/><category term='deadlock'/><category term='SIEMENS'/><title type='text'>IN DA NOTES</title><subtitle type='html'>Industrial automation notes for sharing experiences on industrial automation. Includes information about programming, Visual Basic, PLC, SCADA, ActiveX, automation, identification systems, RFID, barcodes and programming</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-813345916387483496</id><published>2009-10-23T15:42:00.001+03:00</published><updated>2009-10-23T15:43:29.465+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='VB'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='serial communications'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><category scheme='http://www.blogger.com/atom/ns#' term='RS 232'/><title type='text'>How to Code for RS232 in Visual Basic? Part 3 – Example</title><content type='html'>You can download the example program written in Visual Basic 6.0 from the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/indanotes/web/MsCommSample.zip"&gt;MsCommSample.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sample includes detailed explanations as comment lines, so I am not going to explaing details of coding in this post.&lt;br /&gt;&lt;br /&gt;To test the software you need to have a&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Null_modem"&gt;null modem cable&lt;/a&gt;&amp;nbsp;if you want to communicate two computers.&lt;br /&gt;&lt;br /&gt;You can make your own cable by soldering pins of two female DB9 connectors as follows.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Connector 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Connector 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Pin 2 &amp;lt;---------------------&amp;gt; Pin 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Pin 3 &amp;lt;---------------------&amp;gt; Pin 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Pin 5 &amp;lt;---------------------&amp;gt; Pin 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you just want to test how data is sent and received on your computer, you just need one connector; short circuit pin 2 and pin 3:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Connector 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Pin 2 &amp;lt;--&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Pin 3 &amp;lt;--&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make the cables at your own risk, short circuiting any pins other than 2 and 3 may damage serial port of your computer.&lt;br /&gt;&lt;br /&gt;By default, software opens the Com1 port in 9600 bauds, no parity, 8 data bits and one stop bit without handshaking protocol. You can change it in source codes.&lt;br /&gt;&lt;br /&gt;You also need to have Visual Basic 6.0 software to edit, debug and recompile program.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-813345916387483496?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/813345916387483496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/10/how-to-code-for-rs232-in-visual-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/813345916387483496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/813345916387483496'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/10/how-to-code-for-rs232-in-visual-basic.html' title='How to Code for RS232 in Visual Basic? Part 3 – Example'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-1705863001429776226</id><published>2009-08-07T16:14:00.000+03:00</published><updated>2009-08-07T16:14:57.206+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='VB'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='serial communications'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><category scheme='http://www.blogger.com/atom/ns#' term='RS 232'/><title type='text'>How to Code for RS232 in Visual Basic? Part 2 – Getting Data From Serial Port</title><content type='html'>&lt;span class="Apple-style-span" style="color: #333333; font-family: Tahoma; font-size: 13px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;In this post, we are going to focus on OnComm event of serial port programming components. The most widely used serial port component is the MSComm.ocx of Microsoft, however it has some limited properties such as working up to COM16, you may also find more sophisticated components such as SAX Comm.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Also there was a TCommPort component for Delphi, also .Net has serial port support for 2005 and after. There are several alternatives to get data from serial port but the methods used for getting data is similar. So I want to explain this method in pseudo code in this post, and for the next post I want to give a real example with MsComm32.ocx and Visual Basic 6.0&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;There are two major methods to get data from serial port; polling method and event driven method. Polling method is the simplest, just place a timer on your form and continuously read the data from port. However with polling method you may get your data in partly, and you may need to write extra code to comb out different data packets received consecutively.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;I want to focus on event driven method, which is more convenient, fast and less CPU consuming.&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Whatever the method used for reading, the first step is opening the port with proper communication parameters. Generally, I open the port on start up procedure of program, and do not close it until the end of program. You can't communicate with a closed port, so prefer to keep it always open.&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Some applications close the port when they do not need it, it may be useful especially in mobile devices to save power, but in desktop computers, it is better to keep always open, especially if your software is about industrial automation.&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;I also get communication port settings from an ini file, because communication port parameters may depend on the device that you are communicating or the communication port limitations of the host computer, so remember to get the settings from an ini file, but this is optional, so say that it is the step zero of our pseudo code.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Setting up the port is easy, you must give following parameters:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;- Communication speed&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;- Number of data bits; 7 or 8&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;- Type of parity; even, odd or none&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;- Handshake: Hardware handshake (RTS/CTS), software handshake (XON/XOFF) or none.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;And if you prefer to use event driven method, you should also enable event triggering on data receive. For MSComm32.ocx it is set up by receive threshold value, you should set the number of bytes to trigger data received event.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Normally, I use 1 for receive threshold to get informed even a single byte received by comm port. &amp;nbsp;It should be better to set it to 1 if you receive variable length of data. In our examples, I am going to set it to 1.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;With MSComm32.ocx, it is set up as follows:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;MSComm&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;1.&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;RThreshold&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;= 1&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Then you can open the comm port. For MSComm32, it is opened as follows:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;MSComm&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;1.&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;PortOpen&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;= True&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Sometimes, you may not be successful for opening the port, so it is strictly advised to code some error handling routines to catch any possible errors, otherwise your program may rise run time error and shutdown. &amp;nbsp;Most common errors are 'port already open / port already in use' &amp;nbsp;error and 'invalid port number'. There may be another software using your comm port, also another copy of your own software may block your port. To avoid blocking the comm port by the ghost of your software, it is better to check if another copy is already running on computer.&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;We already have three steps of pseudo code including the optional one:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 0: Get communication port settings from&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;ini&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;file (Optional)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 1: Setup the port&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 2: Open the port&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Sending data is the simplest part, let's send 'Hello World' through comm port:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;MSComm&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;1.Output = "Hello World!"&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;If port is not open, you will probably get 'port not open / operation valid only when the port is open' error. So it is better to check if port is really open before sending data.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;When data is received from a serial port, it is kept in a buffer until you read it. For MSComm32.ocx, you can get your data as follows:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Data = MSComm1.Input&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;If you put a timer on your form and continiously read the buffer, you get the data collected in buffer. This is called polling.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;For event driven programming, you use the event triggered on receiving data. Here is the pseudo code for receiving a data by event driven programming:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 1: Continue if event is really triggered by received data.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 2: Disable event generation&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 3: Wait for a while to get possible remaining bytes.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 4: Read and&amp;nbsp;&lt;span style="font-family: Arial;"&gt;&lt;span style="font-family: 'Courier New';"&gt;concatenate the data into a dummy&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;static variable&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 5: If expected data received completely (eg. received a terminator character), use it and clear the dummy static variable.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Step 6: Enable event generation&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Now let's have a closer look into steps.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step1: Some serial communication libraries use a single event for receiving. If you are using such kind of library, you don't need to check if event is triggered by received data. MSComm32 uses the same event for all communication port related events such as buffer owerflow, cts received etc. So it is necessary to check if event is triggered by received data:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Private Sub MSComm1_OnComm()&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;If MSComm1.CommEvent = comEvReceive Then&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;' Do whatever you need&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;End If&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step2: If you don't disable event generation on data receiving, received byte(s) can break your already running flow, and if it happens before you flush the reading buffer, breaking events may flush them and you may get mis-ordered data. Altough its low probability, never forget that CPU can do millions of operations in a second and one in a million chance may hit in every seconds. So, disable event generation. For MSComm object, just assign a zero to receive threshold:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;MSComm&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;1.&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;RThreshold&lt;/span&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;= 0&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step3: Modern computers are faster than serial communication speeds. Taking a little breath in codes is adviced if you are using MSComm. There is a little bug I have noticed, if you poll MSComm objects buffer so frequently, it may not have a chance to flush its buffer and you may randomly get same bytes in your data. So, it is better to put some NOP code before reading buffer. There is a sleep API of Windows, however I am not satisfied with this API because I realised that it waits several lines of code after it has called, I know it sounds weird but I guess that sleep API is slowing down the Visual Basic interpreter, not the code interpreted. May be it works in compiled code but I am not happy to use it while debugging my source code. So I have my own subroutine which executes DoEvents in a loop.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step 4: If your communication speed is so low, you may not receive it completely in a single event handler. If you see that you don't have the terminator character of your data package, you should keep your previously received data in a static variable. Example for MSComm:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;Static DummyData As String&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;DummyData = DummyData &amp;amp; MSComm1.Input&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step 5: If you receive the terminator character, use your data and clear static variable.Assuming that terminator character is carriage return:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;If Right(DummyData,1= vbCrLf Then&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;' Data received completely&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;' Do some code to use for received data&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DummyData = vbNullString&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;End If&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Step 6: If you don't re-enable the event generation, you can't get more data.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;In our next post, we are going to have some practice, we are going to code a sample application in Visual Basic 6.0&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-1705863001429776226?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/1705863001429776226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/08/how-to-code-for-rs232-in-visual-basic_07.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/1705863001429776226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/1705863001429776226'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/08/how-to-code-for-rs232-in-visual-basic_07.html' title='How to Code for RS232 in Visual Basic? Part 2 – Getting Data From Serial Port'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-8048733095771250470</id><published>2009-08-06T17:18:00.000+03:00</published><updated>2009-08-06T17:18:40.183+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='VB'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='experience'/><category scheme='http://www.blogger.com/atom/ns#' term='serial communications'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><category scheme='http://www.blogger.com/atom/ns#' term='RS 232'/><title type='text'>How to Code for RS232 in Visual Basic? Part 1 – Serial Communication Basics</title><content type='html'>&lt;span style="font-family: inherit;"&gt;In this post series, I would like to talk about receiving data from serial port. It is one of the FAQ of industrial automation forums, but it is difficult to find a proper code or advice.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;I am not going to talk about in details of a specific communication protocol, it may be a subject for another series of post.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;I only want to describe a sample method, and give an example by Visual Basic 6.0. &amp;nbsp;As I will talk about the method, you can apply it for .Net languages or any other programming languages such as Delphi.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;We can choose a sample problem; I think reading data from a barcode scanner may be a right and simple example.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Now, let’s have a little bit theory about RS232 communications, it is designed to communicate for long distances without using many cables. RS232 defines the electrical signal levels, and those signals may be converted into other defined standards such as RS485 or RS422, so I am going to describe it with logical signal levels.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Serial communication is just like a dialog between two people. Both of them have ears and mouths to listen and speak.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;When Alice talks, Bob hears with his ears.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;The RS232 port has a transmitting pin and a receiving pin. If you want to establish a communication between two RS232 devices, you must connect one device’s transmitting pin to other device’s receiving pin. Just as talking and listening.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;There is also one more pin which is used as a voltage reference, it is called ground. So only three cables are enough to make a serial communication. If communication should be done for one way only, two cables are enough, one for data and one for voltage reference.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;When sending a byte, transmitting pin sends a single start bit signal to inform that a new byte is coming.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Data bits sent after start bit, number of data bits can be 7 or 8 and it depends on the settings that you decide for communication.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;It has information about number of logic 1 signals, even or odd numbers.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;And finally stop bits come; number of stop bits can be 1 or 2. It can be considered as a guard time between data packages.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Most important parameter in serial communications is the baud rate, which is the number of bits per second. If you set your communication parameters as &amp;nbsp;8 data bits and 1 stop bit, you should use 11 bits for each byte packet (1 start + 8 data + 1 parity + 1 stop) and with the speed of 9600 baud, you can send up to 872 bytes per second.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;In serial devices, an IC named UART makes the communication and buffers some amount of data inside.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;In next post, I am planning to tell a pseudo code for receiving data from serial port.&amp;nbsp;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-8048733095771250470?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/8048733095771250470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/08/how-to-code-for-rs232-in-visual-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8048733095771250470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8048733095771250470'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/08/how-to-code-for-rs232-in-visual-basic.html' title='How to Code for RS232 in Visual Basic? Part 1 – Serial Communication Basics'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-3004823994566055810</id><published>2009-08-04T11:22:00.004+03:00</published><updated>2009-08-06T17:23:53.715+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='WinCC Flexible'/><category scheme='http://www.blogger.com/atom/ns#' term='Product Traceability'/><category scheme='http://www.blogger.com/atom/ns#' term='SIEMENS'/><category scheme='http://www.blogger.com/atom/ns#' term='ActiveX'/><category scheme='http://www.blogger.com/atom/ns#' term='WinCC'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>Developing An ActiveX for WinCC Flexible</title><content type='html'>&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Se&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;vera&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l months ago, a customer requested a product tracing system which should work with SIEMENS PLC.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;They already had a WinCC flexible licence and requested the project in WinCC.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;First of all, I could not find a way to use RS232 comm ports with WinCC, so I decided to use SAX Comm library for RS232 communication.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;It was not possible because I could never be able to compile the software even without any script code in it. Just adding SAX Comm object was enough to crash WinCC development environment. WinCC was raising the following error:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;“Fatal ERROR: screen item Screen_1 in screen Screen_1 contains inconsistent data and should be deleted.”&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;i&gt;&lt;/i&gt;&lt;br /&gt;&lt;/span&gt;&lt;i&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Then I tried to code my own ActiveX, embedded SAX Comm object and mapped some properties and events, however result did not changed, WinCC was still crashing.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I decided to walk step by step, I realised that WinCC had a really pain about ActiveX, so I have started with a totally empty ActiveX and successfully compiled the WinCC project.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Then I started to add properties one by one, and with the first property of ActiveX caused a crash again.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;In WinCC programming manual, it says that it is possible to read and write a property of an ActiveX within a script, but it was not true.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Reading or writing a property inside a script directly causes a crash.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I have found that the only way to use properties of An ActiveX is using ‘Internal Tags’ of WinCC. If you want to send data inside of an ActiveX, you create an internal tag and assign it to the one of the properties of ActiveX.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;With Internal tags, I was successful to get data from PLC to my ActiveX, however I realised the major problem when I finished developing my ActiveX, and it was not possible to send data from ActiveX to WinCC (so PLC)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;It was not possible to send by properties, because assigning ActiveX property to an internal tag was working one way only. There was not any ‘direction’ option.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Then I tried to send data by triggering ActiveX events, it was possible to trigger events of ActiveX but it was not possible to send some data by parameters of event. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;So I decided to use ActiveX events as digital outputs, I have used them without sending any parameters.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;For Boolean data, triggering was not a problem; I have created 2 events for each Boolean output and altered a Boolean internal tag on those events.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;My final challenge was sending an integer code to a test device. Boolean outputs were easy but of course it is not convenient to create 255 events for a byte value.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;So I created following events for sending byte information to WinCC:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;ResetByte()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_0()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_1()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_2()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_3()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_4()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_5()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_6()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;SetBit_7()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:'courier new';"&gt;ByteReady()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;Created a dummy internal tag and wrote single line scripts for each event:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal;"&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub ResetDummy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 8&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 16&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_5&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 32&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 64&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetDummy_7&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgDummy = tgDummy + 128&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size:medium;"&gt;And finally, for ByteReady() event I have write the following code for sending output to PLC:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-style: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal;"&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;Sub SetByteOutput()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'courier new';"&gt;tgByteOutput = tgDummy&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:'courier new';"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=" ;font-family:'Courier New';font-size:small;"&gt;&lt;span style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=" ;font-family:'Courier New';font-size:small;"&gt;&lt;span style="font-size:13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-family:'Courier New';font-size:small;"&gt;&lt;span style="font-size:13px;"&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;As an example, if I want to send code 120 to the test device, I convert its value to binary:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;120 decimal = 0111 1000 Binary.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;And triggered following events consequently:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Arial;"&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ResetByte()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;SetBit_3()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;SetBit_4()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;SetBit_5()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;SetBit_6()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;ByteReady()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Courier New';"&gt;&lt;div&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;C&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;onclusions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;: In my opinion, WinCC Flexible is giant software, occupies gigabytes o&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;f space in hard disk but does not worth its price. Its tools are a little bit limited and it is difficult to do following tasks:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Query some value from database and make decisions according to records from database.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Serial or Ethernet communications wit&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;h any devices other than SIEMENS.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Third party ActiveX, WinCC does not have any guarantee for third party ActiveX.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;And WinCC Flexible is only convenient if you:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Don’t have experience on programming&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Use WinCC as only HMI&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Don’t need complex operations controlled by PC&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="white-space: pre;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Have patience and high budget at the same time.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-3004823994566055810?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/3004823994566055810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/08/developing-activex-for-wincc-flexible.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3004823994566055810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3004823994566055810'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/08/developing-activex-for-wincc-flexible.html' title='Developing An ActiveX for WinCC Flexible'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-5056779250914665756</id><published>2009-05-16T16:15:00.002+03:00</published><updated>2009-05-16T16:24:33.605+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='State analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='PC PLC Communication'/><title type='text'>Importance of State Analysis In Automation Systems -  - Part 2</title><content type='html'>Here is the second part of state analysis. In this post, we are making a state analysis for a simple single station for both PC and PLC. &lt;div style="width:425px;text-align:left" id="__ss_1442598"&gt;&lt;a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/moosty/importance-of-sa-p2?type=presentation" title="Importance Of Sa P2"&gt;Importance Of Sa P2&lt;/a&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=importanceofsap2-090515173321-phpapp01&amp;amp;stripped_title=importance-of-sa-p2"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=importanceofsap2-090515173321-phpapp01&amp;amp;stripped_title=importance-of-sa-p2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;View more &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/moosty"&gt;moosty&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-5056779250914665756?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/5056779250914665756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/05/importance-of-state-analysis-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/5056779250914665756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/5056779250914665756'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/05/importance-of-state-analysis-part-2.html' title='Importance of State Analysis In Automation Systems -  - Part 2'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-7511076919107618206</id><published>2009-03-15T00:43:00.002+02:00</published><updated>2009-03-15T00:47:15.311+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='State analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='deadlock'/><category scheme='http://www.blogger.com/atom/ns#' term='Finite state machine'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Importance of State Analysis In Automation Systems - Part 1</title><content type='html'>One of the major problems in PC supported automation systems is deadlock problem.&lt;br /&gt;&lt;br /&gt;Sometimes, systems fall into a deadlock, making it impossible to free up without intervention or you can miss your products without recording their information into database.&lt;br /&gt;&lt;br /&gt;In this post, I want to give a poor design sample which may cause a deadlock with a presentation.&lt;br /&gt;&lt;br /&gt;Next post, we will make a state analysis for a single task station.&lt;br /&gt;&lt;div id="__ss_1146279" style="text-align: left; width: 425px;"&gt;&lt;a href="http://www.slideshare.net/moosty/deadlock-situation-and-missed-products?type=presentation" style="display: block; font: 14px Helvetica,Arial,Sans-serif; margin: 12px 0 3px 0; text-decoration: underline;" title="Deadlock situation and missed products"&gt;Deadlock situation and missed products&lt;/a&gt;&lt;object height="355" style="margin: 0px;" width="425"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=deadlock-090314173346-phpapp01&amp;stripped_title=deadlock-situation-and-missed-products" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=deadlock-090314173346-phpapp01&amp;stripped_title=deadlock-situation-and-missed-products" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;div style="font-family: tahoma,arial; font-size: 11px; height: 26px; padding-top: 2px;"&gt;View more &lt;a href="http://www.slideshare.net/" style="text-decoration: underline;"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/moosty" style="text-decoration: underline;"&gt;moosty&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-7511076919107618206?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/7511076919107618206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/03/importance-of-state-analysis-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/7511076919107618206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/7511076919107618206'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/03/importance-of-state-analysis-in.html' title='Importance of State Analysis In Automation Systems - Part 1'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-5395451840283769262</id><published>2009-01-21T21:11:00.000+02:00</published><updated>2009-01-21T21:15:57.112+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Power measurement'/><category scheme='http://www.blogger.com/atom/ns#' term='timing accuracy'/><category scheme='http://www.blogger.com/atom/ns#' term='PC Stability'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><title type='text'>Case Study: Power Measurement System with Accurate Timing</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;In this post, I want to talk about a power measurement test system that tests an electrical device.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Our customer is producing a household appliance which has a boot up sequence. &amp;nbsp;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:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SXdzarA99rI/AAAAAAAAAPM/JwjstQSy1II/s1600-h/PowerConsumption.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SXdzarA99rI/AAAAAAAAAPM/JwjstQSy1II/s400/PowerConsumption.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;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.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I can summarize customer requests as below:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Test parameters should be defined by a web page.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;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.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;It is needed to store power consumption graphics for statistical calculations and it should be possible to report on a web page.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;It is possible to apply power on the fly without an operator, customer does not want any operator except test parameter management.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Defected products should be diverted automatically to the defected area.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Project requires web reporting, web reporting requires DB interaction, DB interaction requires PC.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;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. &amp;nbsp;It can be done with multimedia programming techniques, recording a voice in 44 kHz is a similar but much more difficult task.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;If you only have a hammer, you always consider that all problems are nail, so we decided to do it with PLC. &amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;We decided to measure with PLC and buffer the results in PLC memory. &amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;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. &amp;nbsp;However, we &amp;nbsp;should also make a handshake between PC and PLC, because customer wanted products to be automatically diverted defected products, and PC has the answer.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;How did we manage the buffer in PLC?&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;We continuously copied analog data to the beginning of memory buffer. We only copied 'FFFF' value once as the test started. &amp;nbsp;Then used 'SHIFT' command in PLC.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;So the result was as follows:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_MxqeMEi5UJM/SXdzyb0sr0I/AAAAAAAAAPU/dXRBxfC8rbE/s1600-h/MemoryBuffer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_MxqeMEi5UJM/SXdzyb0sr0I/AAAAAAAAAPU/dXRBxfC8rbE/s400/MemoryBuffer.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;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.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So we were sure that analog sampling was done in 100 milliseconds.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;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.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-5395451840283769262?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/5395451840283769262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2009/01/case-study-power-measurement-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/5395451840283769262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/5395451840283769262'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2009/01/case-study-power-measurement-system.html' title='Case Study: Power Measurement System with Accurate Timing'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MxqeMEi5UJM/SXdzarA99rI/AAAAAAAAAPM/JwjstQSy1II/s72-c/PowerConsumption.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-6933534567693421996</id><published>2008-12-20T00:34:00.000+02:00</published><updated>2008-12-20T00:51:41.683+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows vs Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='GetTickCount'/><category scheme='http://www.blogger.com/atom/ns#' term='PC Stability'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='Histogram'/><title type='text'>PC Stability</title><content type='html'>My graduation thesis was about designing a smart card reader / writer circuit and making necessary software development for it. I have tried to design a low cost reader, so I decided to use parallel port of PC instead of using a micro controller. &lt;br /&gt;&lt;br /&gt;My advisor encouraged me to develop the software in Linux, that is the story of 'How I met your Linux'. My first experience on linux was on Mandrake Linux 8.&lt;br /&gt;&lt;br /&gt;One day, I have wondered how stable was the PC, and decided to make a little test.&amp;nbsp;I have wrote a small software in C and compiled with GCC to produce square wave with the highest frequency that PC can handle.&lt;br /&gt;&lt;br /&gt;I have visualised the wave in oscilloscope. PC was able to produce square wave approximately at 200 kHz. Frequency was decreasing as the CPU was loaded, as I expected.&lt;br /&gt;&lt;br /&gt;Then I wondered the result in Windows. Rebooted the PC with Windows 98, wrote an equivalent code in assembly and executed.&amp;nbsp;I was expecting to have a little bit higher frequency because code was written in assembly.&lt;br /&gt;&lt;br /&gt;Result &amp;nbsp;was surprising for me, it was impossible to lock to the signal to display it on oscilloscope. Frequency was so unsteady that it was impossible to see with auto trigger or manual trigger.&lt;br /&gt;&lt;br /&gt;Then I have tried to close some windows and terminated some background processes such as anti-virus. Frequency become more stable but it was still difficult to catch complete cycles more than five seconds. Finally, screen saver disturbed all the frequency.&lt;br /&gt;&lt;br /&gt;I have measured the frequency with a frequency counter and it was nearly same as in Linux version, maximum 200 kHz.&lt;br /&gt;&lt;br /&gt;Today, we are developing most of the automation projects on Windows operating system, so I wanted to make a small test before sending this post.&lt;br /&gt;&lt;br /&gt;I wrote the following code:&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New';"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;---&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Private Declare Function GetTickCount Lib "kernel32" () As Long&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Private Sub Form_Load()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Dim i As Long&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Dim j As Long&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Dim StartTime As Long&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Dim StartCount As Long&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Open App.Path &amp;amp; "\Tick.csv" For Output As #1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i = 1 To 1000&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;StartCount = GetTickCount&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Do While GetTickCount - StartCount &amp;lt; 20&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j = j + 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DoEvents&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Loop&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Print #1, j&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Next i&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&amp;nbsp;Close&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;---&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 13px;"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Executed the code with and without DoEvents line. DoEvents function gives a breath to CPU for executing other processes.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Results are as follows, I have also calculated the histograms. The first one is with 'DoEvents':&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SUwjaJpWRAI/AAAAAAAAAOg/D66y0PrmQMQ/s1600-h/ConstantTimeWithDoEventsLine.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SUwjaJpWRAI/AAAAAAAAAOg/D66y0PrmQMQ/s400/ConstantTimeWithDoEventsLine.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;And the histogram is:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SUwjymdE3QI/AAAAAAAAAOo/55AI2V_JC9c/s1600-h/ConstantTimeWithDoEvents.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SUwjymdE3QI/AAAAAAAAAOo/55AI2V_JC9c/s400/ConstantTimeWithDoEvents.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;And without 'DoEvents':&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SUwkCS0Kg1I/AAAAAAAAAOw/dGXQanYVUAs/s1600-h/ConstantTimeWithoutDoEvents.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SUwkCS0Kg1I/AAAAAAAAAOw/dGXQanYVUAs/s1600-h/ConstantTimeWithoutDoEvents.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_MxqeMEi5UJM/SUwkCS0Kg1I/AAAAAAAAAOw/dGXQanYVUAs/s400/ConstantTimeWithoutDoEvents.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;And histogram:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MxqeMEi5UJM/SUwkZsuny-I/AAAAAAAAAO4/5Fw7QJ4tLVg/s1600-h/ConstantTimeWithoutDoEventsHistogram.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_MxqeMEi5UJM/SUwkZsuny-I/AAAAAAAAAO4/5Fw7QJ4tLVg/s400/ConstantTimeWithoutDoEventsHistogram.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="text-decoration: underline;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Adding 'DoEvents' decreases the execution speed but increases the stability.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;Graphics shows that you may not execute your code on time when you need it.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;Windows XP is more stable than I expected. However it seems that timing is still a problem if you don't use multimedia programming techniques for precise timing.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;In this test, you may realise one absence. I have intended to execute some amount of code in a certain time. But I have realised that time was not certain at all. I also intended to make one more test, I also have planned to measure the time to execute certain amount of code, however I have realised that GetTickCount functions resolution is not enough at all. I have realised that it returns multiple times of 16, not 1. I decied not to try to make the second experiment.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;So I have suspections about the code above, I may have inaccurate measurements but it does not change the reality. PC is not stable enough if you are dealing with miliseconds.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;Perhaps, many people think the 'mean time between failures' when I talk about stability, blue screen of death (http://en.wikipedia.org/wiki/Blue_Screen_of_Death) is another problem in PC based automation systems. I think the maximum up time of PC is the matter of sustainability, not stability.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;Sustainability is another problem, I have searched a little about the GetTickCount function (http://en.wikipedia.org/wiki/GetTickCount). It gives the uptime of computer in miliseconds. It can work up to 2^32 milliseconds=49.71 days. &amp;nbsp;I have never had a time to wait for, but possibly it will rise an 'overflow run time error' if not handled properly. This means that if you use GetTickCount function in your applications, you may need to restart your computer at most 49 days. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;In next post, I am going to tell about a power measurement system as a case study. Our customer was producing electrical devices which have a boot up sequence. During boot up, devices were driving their internal electrical components one by one in certain amounts of time, which makes it possible to test some components by measuring the power consumption.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;Customer requested to manage all test parameters over a web page, and also wanted to see reports of test results in web pages, &amp;nbsp;making us to use PC. We were going to handle miliseconds with a PC.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-6933534567693421996?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/6933534567693421996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/12/pc-stability.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/6933534567693421996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/6933534567693421996'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/12/pc-stability.html' title='PC Stability'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MxqeMEi5UJM/SUwjaJpWRAI/AAAAAAAAAOg/D66y0PrmQMQ/s72-c/ConstantTimeWithDoEventsLine.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-835270813215293875</id><published>2008-12-01T03:11:00.002+02:00</published><updated>2008-12-02T15:59:03.238+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='inheritance'/><category scheme='http://www.blogger.com/atom/ns#' term='class'/><category scheme='http://www.blogger.com/atom/ns#' term='encapsulation'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='Object Oriented Design in Industrial Automation'/><category scheme='http://www.blogger.com/atom/ns#' term='Object Oriented Design'/><title type='text'>Object Oriented Design in Industrial Automation - Example</title><content type='html'>When I was a PLC programmer, object oriented programming was an unknown concept for me. &amp;nbsp;I did not mind about it since I have become a PC programmer.&lt;br /&gt;&lt;br /&gt;In this post, I would like to talk about some benefits of object oriented programming with a simple case study.&lt;br /&gt;&lt;br /&gt;An object is described as a computer representation of an existing real world thing or event. Object orinted programming languages gives the opportunity of dealing with these virtual objects, however if you don't design your system as 'object oriented', you can't use the benefits of object oriented approach.&lt;br /&gt;&lt;br /&gt;Many PLC programmers have their programming library, most of the times they 'copy and paste' their rungs from previous or existing projects in to the new projects.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself"&gt;"DRY - &amp;nbsp;Don't repeat yourself" philosophy&lt;/a&gt;&amp;nbsp;&amp;nbsp;is against for information duplication because duplication may increase the difficulty of change and decrease inconsistency. So, DRY philosophy should be agains 'copy and paste'.&lt;br /&gt;&lt;br /&gt;Object oriented design helps you to not to repeat yourself.&lt;br /&gt;&lt;br /&gt;Before giving an example, I would like to tell some concepts in object oriented programming, first concept is 'class'.&lt;br /&gt;&lt;br /&gt;Class can be considered as a set of objects, and classes are also objects too. For example, a book can be considered as a class made up of multiple page objects. There are some properties of the book such as page count or colour. Also, there are some possible actions can be done with a book, such as reading, or placing on a shelf.&lt;br /&gt;However, in programming classes are not object at all. They are definitons of object and its properties. With this point of view, a class can be considered just as a cookie cutter.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/d/d0/CookieCuttersAl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="145" src="http://upload.wikimedia.org/wikipedia/commons/d/d0/CookieCuttersAl.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Once you design a cookie cutter, and you produce many cookies with it. The disadvantage of object oriented design can be seen here, if you are going to make only one or two cookies, building a cookie cutter is not convenient. But if you want to make dozens of cookies, a cookie cutter may be a good idea.&lt;br /&gt;&lt;br /&gt;It is also possible to extend capabilities or properties of a class and make a superior class. For example, a dictionary is a special book that you can search words in it. So we can talk about the class 'dictionary' which can be derrived from class 'book'. All the actions can be done with a book is still valid with a dictionary, we can read it or place it on a shelf. This is inheritance, which aids reuse of code.&lt;br /&gt;&lt;br /&gt;When you read a book, you don't mind how that book was written or how that book was published. You only see the pages of the book which can be considered as 'interface'. This is the principal of information hiding and mostly named as encapsulation.&lt;br /&gt;Information hiding principle has two advantages:&lt;br /&gt;- Programmer does not need to be so experienced&lt;br /&gt;- It is difficult to corrupt the object, because its internal structure is protected&lt;br /&gt;&lt;br /&gt;Let's back to our 'book' object. We are able to read books including dictionaries, almanacs, novels etc. Reading action can work on many different types of books. This is called polymorphism. You can ask many different objects to perform the same action.&lt;br /&gt;&lt;br /&gt;Before starting to an example on real world of automation, let's revise the concepts we told about:&lt;br /&gt;- Object&lt;br /&gt;- Class&lt;br /&gt;- Inheritance&lt;br /&gt;- Encapsulation&lt;br /&gt;- Polymorphism&lt;br /&gt;&lt;br /&gt;Because we are going to check if it is possible to apply them in automation systems design.&lt;br /&gt;&lt;br /&gt;A multiple rack store system is a common structure. Mostly, two or more shuttles are used to put or take goods. FIFO can be achieved by this system, and sometimes one of the racks runs in reverse direction to make it possible to take out a good in the middle of the rack.&lt;br /&gt;Well, I think this system is common, becase I have seen at least five and they were used for different purposes such as automatic storage and retrieval system or quality assurance test system.&lt;br /&gt;Anyway, we are going to model such a system below:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MxqeMEi5UJM/STM63e5VmsI/AAAAAAAAAOQ/Wkf4EDk4BHM/s1600-h/storage.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_MxqeMEi5UJM/STM63e5VmsI/AAAAAAAAAOQ/Wkf4EDk4BHM/s400/storage.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Eight racks with two shuttles, one rack is working in reverse direction. The shuttle on the right is used for loading, and the other is used for unloading.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;It is possible to store up to 128 boxes in this storage area.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;We want to built a virtual model of the real world, we are going to start by finding out the objects in this system.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;It is not too difficult, the first object is conveyor. Our conveyors are driven by a motor, and a conveyor can store two boxes. Each conveyor conducts the boxes forward if next conveyor is available:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/_MxqeMEi5UJM/STM7f97jgaI/AAAAAAAAAOY/Xtjjwo332dU/s1600-h/conveyorII.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_MxqeMEi5UJM/STM7f97jgaI/AAAAAAAAAOY/Xtjjwo332dU/s320/conveyorII.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Our second object is shuttle. There are two shuttles and each shuttle can give and take boxes in reverse or forward direction.&lt;br /&gt;&lt;br /&gt;Our third object is a little bit hidden. Racks are also objects, and they consist of conveyors.&lt;br /&gt;&lt;br /&gt;Now, let's focus on our objects capabilities. For example, each conveyor can conduct a box from one conveyor to the next one. Also, each conveyor take boxes.&lt;br /&gt;Many PLC programmers use at least two output flags to give information to the next conveyors code:&lt;br /&gt;1 - I am ready to give&lt;br /&gt;2 - I am giving&lt;br /&gt;&lt;br /&gt;and use at least two input flags to give information from previous conveyors code:&lt;br /&gt;1 - I am ready to take&lt;br /&gt;2 - I am taking&lt;br /&gt;&lt;br /&gt;Logic is easy, if target conveyor is ready to take and source conveyor is ready to give, box should move to the next conveyor.&lt;br /&gt;&lt;br /&gt;We can think about two more objects on the basic conveyor object: a transmitter and a receiver. Of course, these are not real objects, just functionalities but thinking them as seperate objects will be convenient for us.&lt;br /&gt;It is obvious that, transmitter object has 'Transmit' method, and receiver object has 'Receive' method. By designing them as methods, we won't involve in handshaking between two conveyors, remember the encapsulation.&lt;br /&gt;&lt;br /&gt;Most object oriented PC programming languages present a notation for objects and methods as follows:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Transmitter.Transmit()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Receiver.Receive()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And these two objects are belong to a conveyor object, so in programming notation, it also can be presented as:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Rack.Transmitter.Transmit()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Rack.Receiver.Receive()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you realise an inconsistency or a bug in your logic, you do not need to code for all conveyors, just change the transmit or receive method and all objects using these methods will be get changed. Maintenance of object oriented code is easy.&lt;br /&gt;&lt;br /&gt;And what about shuttles? Shuttles are also conveyors and also should have transmitter and receiver. So, to transfer a box from shuttle to a conveyor, we should be able to write as:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Shuttle.Transmitter.Transmit()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Rack.Receiver.Receive()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However, shutles have one more fuınctionality, they can move in Y direction to travel between racks, so we can think for a move method for shuttle:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Shuttle.MoveY()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Our another object is rack. A rack is made up of 8 conveyors. Rack can take boxes from shuttle and give boxes to another shuttle. It seems hat we can directly map the rearmost conveyors receive method as racks receive methods and map the farthermost conveyors transmit method as racks transmit method. Mapping is done once, and programmer can use it as:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Rack.Transmit()&lt;/span&gt;&lt;br /&gt;without minding that it is actually:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;FarthermostConveyor.Transmit()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Many experienced programmers realise one more object: Eight racks form another big object, the 'layer'. Programmers must anticipate that system may be upgraded to a multilayer stock system in next years.&lt;br /&gt;&lt;br /&gt;And the final object is the system itself, having several methods such as:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;System.Store()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;System.Retrieve()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It would be nice to retrieve a box of chocolates just by executing a single command:&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;System.Retrieve("The yummy one")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: medium;"&gt;Conclusions:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;PLC programmers are working with objects for many years, each conveyor, machine, system is an object. Object oriented design and object oriented programming are different concepts.&lt;br /&gt;In our example, we designed our system in object oriented approach but could not give example with rungs. Actually, object oriented PC programming languages present tools and facilities to implement an object oriented system as a code, however the code running at the back is not so &lt;a href="http://en.wikipedia.org/wiki/Procedural_programming"&gt;different from procedural programming&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For example, in object oriented way, you create a Shuttle class. Then you create a specific shuttle object, such as 'InputShuttle'.&lt;br /&gt;&lt;br /&gt;You do it as:&lt;br /&gt;____________&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Class Shuttle&lt;/span&gt;&lt;br /&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Method MoveY()&lt;/span&gt;&lt;br /&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="white-space: pre;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;End Class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Dim InputShuttle As Shuttle&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;InputShuttle.MoveY&lt;/span&gt;&lt;br /&gt;__________&lt;br /&gt;&lt;br /&gt;And in procedural way, you write a function for moving any shuttle, and state the shuttle to be moved as a function parameter:&lt;br /&gt;__________&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Function MoveY(Shuttle As TShuttle)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;End Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;Dim InputShuttle As Shuttle&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;MoveY(InputShuttle)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;...&lt;/span&gt;&lt;br /&gt;_____________&lt;br /&gt;&lt;br /&gt;With this point of view, function blocks can be used in procedural way.&lt;br /&gt;&lt;br /&gt;PLC software development environments and languages does not supply neccessary support for object oriented programming, however you can still design your system in abject oriented approach to recude the amount of code you wrote.&lt;br /&gt;&lt;br /&gt;I hope, PLC vendors intruduce new functionalities to their development tools for supporting object oriented programming.&lt;br /&gt;&lt;br /&gt;For the next post, I am planning to post something about PC stability. Then I am planning to post a case study, 'Power measurement test system - Beating the speed limits'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-835270813215293875?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/835270813215293875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/12/object-oriented-design-in-industrial.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/835270813215293875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/835270813215293875'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/12/object-oriented-design-in-industrial.html' title='Object Oriented Design in Industrial Automation - Example'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_MxqeMEi5UJM/STM63e5VmsI/AAAAAAAAAOQ/Wkf4EDk4BHM/s72-c/storage.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-617257475782857973</id><published>2008-11-23T14:29:00.000+02:00</published><updated>2008-11-23T14:41:40.030+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Object Oriented Design in Industrial Automation'/><category scheme='http://www.blogger.com/atom/ns#' term='Object Oriented Design'/><title type='text'>Object Oriented Design in Industrial Automation</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Object-oriented_programming"&gt;Object Oriented Programming (OOP) &lt;/a&gt;&amp;nbsp;is supported by many PC programming languages.&lt;br /&gt;&lt;br /&gt;How about PLC programming systems? Do you think that object oriented programming is possible for industrial automation systems?&lt;br /&gt;&lt;br /&gt;Some automation gurus say that 'object oriented programming is for only programs, an automation system is not a program; may have a program but it is not a program, it is not a desktop application. So automation systems can not be object oriented'&lt;br /&gt;&lt;br /&gt;And some gurus say that 'we are already designing in object oriented for many years, before it applied to PC programming'&lt;br /&gt;&lt;br /&gt;What do you think?&lt;br /&gt;&lt;br /&gt;I will be glad if you write some comments before starting a new post series. Should I define and describe the basics of object oriented design? Or directly run in to a case study of 'object oriented design in an automation system?'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-617257475782857973?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/617257475782857973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/object-oriented-design-in-industrial.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/617257475782857973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/617257475782857973'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/object-oriented-design-in-industrial.html' title='Object Oriented Design in Industrial Automation'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-6414622067319858414</id><published>2008-11-18T21:32:00.004+02:00</published><updated>2009-12-05T21:15:05.756+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='INDAFINS'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='FINS'/><category scheme='http://www.blogger.com/atom/ns#' term='UDP'/><category scheme='http://www.blogger.com/atom/ns#' term='OMRON FINS Ethernet'/><category scheme='http://www.blogger.com/atom/ns#' term='OMRON'/><category scheme='http://www.blogger.com/atom/ns#' term='RS 232'/><title type='text'>INDAFINS - OMRON Fins OCX</title><content type='html'>--------------------------------------------------------&lt;br /&gt;05.12.2009 21:05&lt;br /&gt;&lt;br /&gt;INDAFINS sources are uploaded to&lt;br /&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/indanotes/web/OCX.zip"&gt;http://groups.google.com/group/indanotes/web/OCX.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I was planning to publish all source codes by releasing beta version. (INDAFINS is still alpha version).&lt;br /&gt;&lt;br /&gt;Unfortunately I don't have too much time to upgrade it. So I have decied to publish source codes of alpha version.&lt;br /&gt;&lt;br /&gt;And also I was planning to upgrade INDAFINS as INDAFINS.Net for .Net environment after adding several more functionalities:&lt;br /&gt;- Serial port support&lt;br /&gt;- Read / Write I/O and timers, etc.&lt;br /&gt;&lt;br /&gt;Please feel free to modify it,but I have several petitions:&lt;br /&gt;- Please do not remove any links and information about indanotes.blogspot.com and this post.&lt;br /&gt;- Please keep existing comments.&lt;br /&gt;- Please add your name to source code as a comment if you modify it, and send to me to publish new versions here. I promise, I will keep your name also in this historical post.&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;26.11.2008 00:35&lt;br /&gt;&lt;br /&gt;I have released the documentation. I also realized that bad naming on source codes and fixed them.&lt;br /&gt;&lt;br /&gt;You can download them from&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/indafins/downloads/list"&gt;http://code.google.com/p/indafins/downloads/list&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;19.11.2008 &amp;nbsp;13:32&lt;br /&gt;&lt;br /&gt;Google rocks! I decided to host the project at google code instead of sourceforge.&lt;br /&gt;&lt;br /&gt;You can download the setup files from&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/indafins/downloads/list"&gt;http://code.google.com/p/indafins/downloads/list&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Setup file contains the ActiveX and a tester. I am going to publish the source codes soon.&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------&lt;br /&gt;18.11.2008&lt;br /&gt;&lt;br /&gt;An ActiveX controller 'INDAFINS' for OMRON FINS protocol is going to be published.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SSMcENtMlHI/AAAAAAAAAOI/BKOVBCIir0k/s1600-h/indafins.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_MxqeMEi5UJM/SSMcENtMlHI/AAAAAAAAAOI/BKOVBCIir0k/s400/indafins.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This posts address will be a permanent link, I am planning to edit this post on each version release.&lt;br /&gt;&lt;br /&gt;It is still in alpha version and supporting only read &amp;amp; write data memories and extended memory banks over ethernet UDP.&lt;br /&gt;&lt;br /&gt;I am planning to cover at least %90 of FINS protocol. Also I am planning to give FINS over RS 232 in the same ActiveX, so it should be very easy to change an applications communication method just only chancing one &amp;nbsp; single line in a project.&lt;br /&gt;&lt;br /&gt;Unfortunately, there is no documentation yet, I am planning to write a draft document as soon as possible.&lt;br /&gt;&lt;br /&gt;However, when you are using this ActiveX, please:&lt;br /&gt;- Use it by your own risk, it is not a commertial product. Just a freeware.&lt;br /&gt;- Never place an emergency stop function on your PC applications, PC devices and communications are not stable, you may not stop the system in case of emergency.&lt;br /&gt;- New warnings about INDAFINS can be added to this blog, it would be better to subscribe to RSS feed of this blog to be get informed.&lt;br /&gt;&lt;br /&gt;I was planing to publish this ActiveX controller as an open source project in www.sourceforge.net, however I need to study more on CVS to publish on SourceForge.&lt;br /&gt;&lt;br /&gt;I am going to find a reliable download host other than rapidshare, I would be glad if someone can offer me a good link.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-6414622067319858414?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/6414622067319858414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/indafins-omron-fins-ocx.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/6414622067319858414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/6414622067319858414'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/indafins-omron-fins-ocx.html' title='INDAFINS - OMRON Fins OCX'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MxqeMEi5UJM/SSMcENtMlHI/AAAAAAAAAOI/BKOVBCIir0k/s72-c/indafins.gif' height='72' width='72'/><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-3990119535805835236</id><published>2008-11-15T14:09:00.001+02:00</published><updated>2008-11-15T14:38:44.062+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web based reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='productivity'/><category scheme='http://www.blogger.com/atom/ns#' term='operation time reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='industrial engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Assembly line balancing'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='time measurement'/><title type='text'>Operation Times Reporting In an Assembly Line  - DB Application</title><content type='html'>Operation Times Reporting In an Assembly Line  - DB Application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In our previous post, we have studied on data collection. In this post, we are going to study on database design.&lt;br /&gt;&lt;br /&gt;Let's remember, we were going to deal with more than 30 million records annually in a database, and we were seeking a way to handle it without throttling the database server.&lt;br /&gt;&lt;br /&gt;Let's remember what our customer needed:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Operation times distribution as an histogram&lt;/span&gt; : Calculating an histogram may be a little bit difficult. We should prefer to display reports which are easily derived with SQL sentences. And displaying 70 stations histogram in a single page may not help to understand bottlenecks.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Box_plot"&gt;The box plot graphics &lt;/a&gt; seemed the best alternative for histogram. It includes basic information from histogram:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/en/8/89/Boxplot_vs_PDF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="420" src="http://upload.wikimedia.org/wikipedia/en/8/89/Boxplot_vs_PDF.png" width="403" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;and can present all stations graph in a single page:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/f/fa/Michelsonmorley-boxplot.svg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="420" src="http://upload.wikimedia.org/wikipedia/commons/f/fa/Michelsonmorley-boxplot.svg" width="420" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Pictures are taken from wiki pages, unfortunately I can't publish samples from customers reports.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Idle time to find out bottle necks: &lt;/span&gt;For idle time, less is better. So, what about displaying them with a colourful background? Report data is simple, will just include two rows, 'Station name' for first row and average idle time for the second row. It would be nice to change proportionally the background of the cell for idle time according to idle time. If smaller values are better, we can display minimum idle time in totally green, and maximum idle time in totally red. And the others may be proportionally colourized in a gradient:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_MxqeMEi5UJM/SR7BRMJGMtI/AAAAAAAAAN4/sGcMu4a7h8M/s1600-h/Gradient.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_MxqeMEi5UJM/SR7BRMJGMtI/AAAAAAAAAN4/sGcMu4a7h8M/s400/Gradient.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Station 3 is totally red, so customer can easily understand the most unbalanced station is the third one and can give more operations to station 3.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also a box plot report should be fine for idle times to see more details.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Efficiency of stations :&lt;/span&gt; There are loops in the assembly line and those loops are used for fine tuning of some products if necessary. Because of those fine tuning operations, some products visits same stations more than once and this decreases efficiency of course. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, customer wanted an efficiency calculation of station x as follows:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Efficiency of x =  100 x (Total products produced by last station / products produced by station x)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A gradient colourized report fits for this need.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Transfer times:  Customer wants to see how mechanical movements between stations limit the productivity. Box plot fits better. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, lets see the structure that we can get by PLC:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SR7B0FxYtkI/AAAAAAAAAOA/SU1CYO-LH7E/s1600-h/PLCDAta.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SR7B0FxYtkI/AAAAAAAAAOA/SU1CYO-LH7E/s400/PLCDAta.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Nearly, 2 or 3 records in a second. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We decided to store them in database in two steps. At first step, we appended all records in to a text file and gave a name ending with date and hour, e.g.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;LogFile08_11_15_13.dat&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;which includes all detailed information between 13:00:00 and 13:59:59&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next file name should be &lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;LogFile08_11_15_14.dat.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then we developed an application for summarising the detailed data file for database, and inserting them into database. It was a scheduled task to run for every hour, summarising the data, inserting the summary records into database and finally copying the detailed data file into a zipped archive file.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And the summary included following fields:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Station number&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Date&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Hour&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Number of products&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Minimum of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Maximum of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Q1 of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Q3 of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Median of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Average of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Standard deviation of T1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;And same calculations same as T1 for T2 and T3 time intervals.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our database transaction seriously decreased from approximately 8500 records to 70 records hourly.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And overall cost of the project was not too much:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Half a day for PLC software modification&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Quarter of a day for PC software development&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Quarter of a day for PC summarising task application&lt;br /&gt;&lt;/li&gt;&lt;li&gt;One day for report web pages&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, customer was angry with us because the project was too easy and cheap to be as a default feature of the assembly line. What can I say, customer is always right. I am planning to add this system as a default feature if someone orders us an assembly line again.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-3990119535805835236?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/3990119535805835236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/operation-times-reporting-in-assembly_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3990119535805835236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3990119535805835236'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/operation-times-reporting-in-assembly_15.html' title='Operation Times Reporting In an Assembly Line  - DB Application'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MxqeMEi5UJM/SR7BRMJGMtI/AAAAAAAAAN4/sGcMu4a7h8M/s72-c/Gradient.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-3449287067230621576</id><published>2008-11-12T12:11:00.001+02:00</published><updated>2008-11-15T12:22:13.670+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web based reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='productivity'/><category scheme='http://www.blogger.com/atom/ns#' term='operation time reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='industrial engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Assembly line balancing'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='time measurement'/><title type='text'>Operation Times Reporting In an Assembly Line</title><content type='html'>In our previous post, I have told about a customers request for reporting operation times of stations in their assembly line.&lt;br /&gt;&lt;br /&gt;They were going to use it for &lt;a href="http://www.answers.com/topic/assembly-line-balancing%20"&gt;assembly line balancing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Many readers may think that 'well, assembly line balancing should be done before establishing the assembly line', you are right.&lt;br /&gt;&lt;br /&gt;But our customers assembly line was producing mixed products, I mean there could be several types of product at the same time. In the other hand they had too many types of product, and new types of products were being developed by their R&amp;amp;D department.&lt;br /&gt;&lt;br /&gt;If you want to see the performance of stations in your assembly line, what would you like to have in your reports?&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I would like to see the operation times distribution as an histogram.&lt;/li&gt;&lt;li&gt;I would like to see the idle time to find out bottle necks.&lt;/li&gt;&lt;li&gt;I would like to see the efficiency of stations.&lt;/li&gt;&lt;li&gt;I would like to see how mechanical movements limit my productivity&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;We had a budget limited with only software change, customer did not wanted to add any extra devices or operations on assembly line.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Let's consider our scenario with a single station:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Station is free.&lt;/li&gt;&lt;li&gt;New product comes from previous station&lt;/li&gt;&lt;li&gt;Operator starts working on product.&lt;/li&gt;&lt;li&gt;Operator pushes the 'operation complete' button to send the product.&lt;/li&gt;&lt;li&gt;Product waits if the next station is busy.&lt;/li&gt;&lt;li&gt;Product moves to the next station when the next station is free.&lt;/li&gt;&lt;li&gt;Station becomes free. &lt;/li&gt;&lt;/ul&gt;What we have as hardware:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Product complete button&lt;/li&gt;&lt;li&gt; Product presence sensor&lt;/li&gt;&lt;li&gt; A buzzer to warn the operator on exceeding the cycle time&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SRquU5KtrXI/AAAAAAAAANo/gzH6SUPmxKo/s1600-h/stationarray.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SRquU5KtrXI/AAAAAAAAANo/gzH6SUPmxKo/s400/stationarray.jpg" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Customer has approximately 70 stations, designed system should be flexible to add new stations.&lt;br /&gt;&lt;br /&gt;We had to design the system for both convenient for PC and PLC software development.&lt;br /&gt;&lt;br /&gt;First we discussed about storing the measured operation times in PLC, then transfer to PC. Not so convenient. There were more than 70 stations, meaning 70 more timers or counters in PLC.  For our project it was impossible without PLC upgrade.&lt;br /&gt;&lt;br /&gt;And not only operation times of course, we had to think about transfer times and idle times also. It was impossible with customers existing PLC system.&lt;br /&gt;&lt;br /&gt;And making necessary software changes in PLC should take at least one week.&lt;br /&gt;&lt;br /&gt;So we decided to copy only hardware inputs from PLC to PC. Solving the problem in PC was more convenient.&lt;br /&gt;&lt;br /&gt;In PLC, we made two flags:&lt;br /&gt;&lt;br /&gt;Product presence flag, which is directly connected to product presence sensor, set to “1” if station is occupied with a product and reset to “0” when station is free.&lt;br /&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Operation complete flag, which is set to “1” when operator pushes to the operation complete button and resets to “0” when product leaves the station.&lt;br /&gt;&lt;br /&gt;Let's draw a timing diagram, this is not an handshake, just a timing diagram for two flags:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SRqulCKo_yI/AAAAAAAAANw/u6vq0fVL_Ok/s1600-h/operationtimes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SRqulCKo_yI/AAAAAAAAANw/u6vq0fVL_Ok/s400/operationtimes.jpg" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;br /&gt;T1,T2 and T3 shows only one products timing. TA,TB and TC is the next products timing.&lt;br /&gt;Normally  T1, T2 and T3 corresponds with TA, TB and TC respectively.&lt;br /&gt;&lt;br /&gt;T1 is the time interval that the station is free, however a new product may be on the way.&lt;br /&gt;T2 is exactly the operation time which spend for assembly operations.&lt;br /&gt;T3 is the idle time, where all assembly operations are completed and product is waiting for the next station to become free.&lt;br /&gt;&lt;br /&gt;T2 and T3 were the exactly time intervals we would like to see. But, what about transfer time? We also needed to report transfer times.&lt;br /&gt;&lt;br /&gt;For an exact transfer time calculation, we have to measure the time between our stations product presence flag and next stations product presence flags rising edge.&lt;br /&gt;&lt;br /&gt;However, it is just a little bit difficult because to do this, we also have to consider order of stations to know which station follows which. It was difficult to manage because assembly line was not straight, there were branches and loops.&lt;br /&gt;&lt;br /&gt;So we decided to accept that TA as a transfer time.&lt;br /&gt;&lt;br /&gt;Why not T1?  Also T1 was possible, but we considered that PC is an unstable device, may be frozen or application may hang. So PC software may be restarted anywhere in the cycle and measure time intervals as shorter than it is.  We wanted PC to record clear measurements only.&lt;br /&gt;&lt;br /&gt;In PLC software, we had represented the flags as bits in a byte, so a single byte stored 4 stations information.&lt;br /&gt;&lt;br /&gt;For 70 stations, 18 bytes were enough. PC was going to read 18 bytes from PLC and was going to write 9 bytes for buzzer alarm.&lt;br /&gt;&lt;br /&gt;In PC, we have considered all stations as an array, just wrote few lines of code for one station and applied to all stations in a For..Next loop.&lt;br /&gt;&lt;br /&gt;Overall code except 'Read all inputs' and 'write all inputs' took less than 100 lines of codes.&lt;br /&gt;&lt;br /&gt;Data was collected successfully.&lt;br /&gt;&lt;br /&gt;For our next post, I am planning to tell you about the database structure and web page reporting of this project. We had some limitations in DB.&lt;br /&gt;&lt;br /&gt;I think may people guessed our problem, there were 70 stations meaning that each product will produce at least (at least because there were some loops in assembly line) 70 records in database.&lt;br /&gt;&lt;br /&gt;One shift was producing approximately 600 products.&lt;br /&gt;&lt;br /&gt;There were three shifts daily.&lt;br /&gt;&lt;br /&gt;Working 5 days in a week.&lt;br /&gt;&lt;br /&gt;Working nearly 50 weeks in a year.&lt;br /&gt;&lt;br /&gt;So we were expecting:&lt;br /&gt;&lt;br /&gt;70 x 600 x 3 x 5 x 50 = 31 500 000&lt;br /&gt;&lt;br /&gt;more than 30 million records.&lt;br /&gt;&lt;br /&gt;And customer was planning to apply the project to their second assembly line if project not fails.&lt;br /&gt;&lt;br /&gt;More than 60 million records. So huge that consumes too much CPU in database server and possibly may slow down other applications.&lt;br /&gt;&lt;br /&gt;For the next post, we are going to focus on database design and some statistics. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-3449287067230621576?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/3449287067230621576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/operation-times-reporting-in-assembly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3449287067230621576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3449287067230621576'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/operation-times-reporting-in-assembly.html' title='Operation Times Reporting In an Assembly Line'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MxqeMEi5UJM/SRquU5KtrXI/AAAAAAAAANo/gzH6SUPmxKo/s72-c/stationarray.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-8604987129742419104</id><published>2008-11-10T11:04:00.003+02:00</published><updated>2008-11-10T11:14:00.988+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='customers'/><category scheme='http://www.blogger.com/atom/ns#' term='Assembly line balancing'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='Product Traceability'/><category scheme='http://www.blogger.com/atom/ns#' term='customer relationships'/><title type='text'>Customer is always right and sometimes undefined</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"   style="  ;font-family:Tahoma;color:#333333;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;You may remember the &lt;/span&gt;&lt;a href="http://www.linuxkungfu.org/images/fun/geek/project.jpg"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;cartoon&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"   style="  ;font-family:Tahoma;color:#333333;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; about ‘IT Project Management’&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51); font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"   style="  ;font-family:Tahoma;color:#333333;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;This is a great similitude and fits for most IT projects. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51); font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"   style="  ;font-family:Tahoma;color:#333333;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In this post, I would like to tell you about a project of mine which is different at the beginning.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51); font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"   style="  ;font-family:Tahoma;color:#333333;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Normally customers may request &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;features that are contradictional, those contradictions are eliminated during project design in co ordinance with customer. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;One of our customers requested us a project.&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;It was a modification on an existing assembly line which was developed by our team. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Let’s see how our customer described the request:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“We need to see cycle times of all stations on a web page, and also want to warn the operator on exceeding the cycle time.”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;That’s all? No.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“We have a limited budget and don’t want to spend too much money and don’t want operators to do extra operations for reporting cycle times.”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Yes, that’s all. I just imagined the cartoon below:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SRf5eScD2XI/AAAAAAAAANg/oXp-V5bd5iw/s1600-h/MyCustomer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_MxqeMEi5UJM/SRf5eScD2XI/AAAAAAAAANg/oXp-V5bd5iw/s320/MyCustomer.jpg" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;On the left, how most of the customers explain their request. And on the right, my customer. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;A warning light lit in my mind, it may be risky without handshaking clearly. Something was wrong.&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So I asked:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“What do you want to get by reporting cycle times?”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The answer was:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;“For line balancing of course”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Well, no more information.&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Just all, we had to guess what customer is really requesting. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;First of all, “&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;cycle times of all stations” was cloudily, because assembly lines don’t have distinct cycle times. Assembly lines have an average cycle time during a time interval, and that is calculated as:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Cycle Time = (Total time spent [e.g. in a shift]) / (Total number of products)&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;It’s the average time needed to produce one product, and it is same for all stations because all stations are cascaded to each other. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So, probably the customer was mentioning “operation times” actually. &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Now it was clearer, probably customer wanted to see “how their assembly line balanced, and how efficiently working”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Even customer did not request clearly, they should need the following reports:&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18.0pt;"&gt;&lt;span lang="EN-US"  style="font-family: Tahoma;  mso-fareast-font-family:Tahoma;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;-&lt;/span&gt;&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;          &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Where are bottlenecks? (To consider dividing station or sharing some operations between neighbor stations)&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt; text-indent: -18.0pt;"&gt;&lt;span lang="EN-US"  style="font-family: Tahoma;  mso-fareast-font-family:Tahoma;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;-&lt;/span&gt;&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;          &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Where are the most inefficient stations? (This is different than bottleneck. Some stations may cause scrap and it is possible to detect if any station is producing more products than final stations output. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In most cases, data collecting terminals are placed on assembly lines to collect number of products and operation times, but ,in this project customer did not want to add anything. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Customer also did not wanted the answer of question “why my assembly line stopped in a certain time interval”&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;We had approximately 70 stations with operators. Operators have pushbuttons to send the product to next station. We were going to take necessary information from this buttons and existing sensors. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;As you see, some customers may have contradictional requests, and some have none. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;We are going to start to a new series of a case study, collecting operation times from assembly line. We are going to tell about how to analyze the project and how to design. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span lang="EN-US"  style=" ;font-family:Tahoma;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;I would be glad if you comment on this post, especially what would you like to see in the case study.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-8604987129742419104?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/8604987129742419104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/customer-is-always-right-and-sometimes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8604987129742419104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8604987129742419104'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/customer-is-always-right-and-sometimes.html' title='Customer is always right and sometimes undefined'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_MxqeMEi5UJM/SRf5eScD2XI/AAAAAAAAANg/oXp-V5bd5iw/s72-c/MyCustomer.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-236644092241201538</id><published>2008-11-08T01:20:00.003+02:00</published><updated>2008-11-08T01:45:18.931+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB'/><category scheme='http://www.blogger.com/atom/ns#' term='reset button'/><category scheme='http://www.blogger.com/atom/ns#' term='reset'/><category scheme='http://www.blogger.com/atom/ns#' term='packet length limit'/><category scheme='http://www.blogger.com/atom/ns#' term='property'/><category scheme='http://www.blogger.com/atom/ns#' term='PC PLC Communication'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='property let and get methods'/><category scheme='http://www.blogger.com/atom/ns#' term='unexpected'/><category scheme='http://www.blogger.com/atom/ns#' term='SCADA'/><category scheme='http://www.blogger.com/atom/ns#' term='rules of thumb'/><title type='text'>Simple PC – PLC Communications Part V - Expect The Unexpected</title><content type='html'>The handshake used for PC – PLC communication works well if everything is perfect. But what happens if something happens that violates the handshake?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In some countries power loss is an ordinary part of life. Generally PC is supplied by UPS, but PLC is not. In a power loss, PLC lefts the communication unexpectedly.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Even if you are using an industrial PC, it is not stable as a PLC. PC or the software running on PC may be frozen. In this case, PC or software may need a restart.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the other hand, physical conditions may also violate the handshake. Imagine that boxes crashing on station:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_MxqeMEi5UJM/SRTFZrlGcOI/AAAAAAAAANQ/TY7oLg88yeE/s1600-h/crash2.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://3.bp.blogspot.com/_MxqeMEi5UJM/SRTFZrlGcOI/AAAAAAAAANQ/TY7oLg88yeE/s400/crash2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;It is possible; sensors may be dirty or defected, or any other unexpected reason may cause this.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;So, how can we restore the stable cycle again?&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Most PLC systems use non-volatile memory for holding data permanently. For a PLC system, it is not difficult at all.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;If we are programming the PC, it is obvious that we have to store some information in a file or in database to avoid failure after power loss.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;div style="margin-bottom: 0cm;"&gt;If we say as a rules of thumb: &lt;/div&gt;&lt;/ul&gt;&lt;ol&gt;&lt;li&gt; &lt;i&gt;Store all global variables (handshakes last time interval, all counters etc. and the most important; the last data you wrote in to PLC) in to a text file or database as soon as they changed.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;Restore all global variables on start up. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;Do not execute 'Write all outputs' before restoring all global variables. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="margin-bottom: 0cm;"&gt; For obeying rule 1, you can use 'Property' in addition to a global variable. Think the 'Property' as a global variable, however it is possible to execute defined subroutines when property is read or write.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;VB6.0 example:&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-family:Courier New,monospace;"&gt;Public Property Get Data As Integer&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;         &lt;span style="font-family:Courier New,monospace;"&gt;Data = m_Data&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;b&gt;&lt;span style="font-family:Courier New,monospace;"&gt;End Property&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;b&gt;Public Property Let Data&lt;/b&gt;(ByVal New_Data As Integer)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;         &lt;span style="font-family:Courier New,monospace;"&gt;m_Data = New_Data&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;         &lt;span style="font-family:Courier New,monospace;"&gt;SaveProperty (m_Data,"Data")  'Save routine for recording Data&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-family:Courier New,monospace;"&gt;End Property&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;'Get' routine is executed whenever you attempt to read property 'Data' as&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;" &gt;A = Data&lt;/span&gt;  &lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin-bottom: 0cm;"&gt;MsgBox Data&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;And 'Let' routine is executed whenever you attempt to write property 'Data' as:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; margin-bottom: 0cm;"&gt;Data = 5&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Data = Text1.Text&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Use 'Property' as a global variable, add a record routine inside 'Let' and never mind again.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;br /&gt;For the example above, restoring the 'm_Data' global variable instead of restoring 'Data' is works faster because restoring 'Data' will cause re-recording the 'Data' again and in some cases it may cause a violation error as 'File Already Open'&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;Rule 2 is clear so nothing to explain.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;br /&gt;Rule 3 is also important. Think about the handshake graphics:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SRTGrJxfTvI/AAAAAAAAANY/ZtChovsKwtE/s1600-h/graph2.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://2.bp.blogspot.com/_MxqeMEi5UJM/SRTGrJxfTvI/AAAAAAAAANY/ZtChovsKwtE/s400/graph2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;PC Status = '0000' also means that 'PC has completed operations, so that PLC can send the existing product and bring the new one'.  Visual Basic assigns 0 into variables as they created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C may assign anything in the memory unless variable is initialised.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;Writing uninitialized data into PLC may result unexpected and unwanted results.  So do not execute 'Write All Outputs' routine before loading all global data or properties and the last data written into PLC.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;As the summary of those three rules of thumb, you are free to last time intervals in handshake as long as you want, however do not switch into another time interval or do not cause PLC to switch into another time interval.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;You can consider putting a button on screen for resetting the handshake cycle against deadlocks, you can simply switch to T1 and clear 'PC Status' with this button, but never switch to T1 on start up. Let the operator decide for reset if necessary.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;If it is not possible to control write and reads?&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;If your application writes 'PC_Status' into PLC before restoring it on initial start, it may cause unexpected movements on the assembly line. Some may get injured or you can miss one product.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;br /&gt;Some SCADA systems also uses 'Read All Inputs' and 'Write All Outputs' routines for PC – PLC communications.  However some of them may execute those routines in a separate thread so it may be possible to write a global variables (mostly named as 'Tag' in SCADA systems) value into PLC before initialising or restoring it.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;So, what can you do if you are using a SCADA and not be able to manage 'Read All Inputs + Write All Outputs' process ?&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;One solution is using a cyclic counter in PLC. PLC has an increasing counter and PC echoes it into another data memory of PLC. If counter value is equal to the echo, PLC increases the counter and waits the same value from PC. If PC can not update in a certain time, PLC understands that PC has failed, and the data from PC is untrusted. This method also can be used to understand if PC is still working.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Fragmanted Information&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;Other than power interruptions, communicating with lots of data may cause unexpected results. Most PC – PLC communication protocols have packet length limits. For that reason, if PC wants to write too many information into PLC, it should use many data packets to write information in to PLC.&lt;br /&gt;&lt;br /&gt;This may be dangerous if automation system designers don't take sufficient precautions.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Assume that PC is writing a receipt into PLC data memories, and 'receipt ready' flag is at the beginning of the data memory area.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;PLC may apply the receipt as soon as it realises 'receipt ready' flag is set, however receipt may not be ready on time. This results of this design may be difficult to debug.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;How can we avoid fragmented information?&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt; We can use checksum at the beginning or at the end of data memory area reserved for PC's write operations. However, there is still a probability that something may leak because there are too many possibilities to produce the same checksum value.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;We can use the counter solution stated above. Reserve two data memories in the data memory area which is reserved for PC's write. Let the PC fill two data memories with the echo from PLC. If both data memories are same and fresh, PLC can trust that information is consistent and trustable.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="margin-bottom: 0cm;"&gt;With this post, we completed the 'Simple PC – PLC Communications' series.&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Our next post will be about customers. 'Customer is always right and mostly undefined'. And we will have another series with a case study. We are going to examine a data collection system to use for assembly line balancing and reporting the bottle necks on an assembly line.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-236644092241201538?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/236644092241201538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/handshake-used-for-pc-plc-commu.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/236644092241201538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/236644092241201538'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/handshake-used-for-pc-plc-commu.html' title='Simple PC – PLC Communications Part V - Expect The Unexpected'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_MxqeMEi5UJM/SRTFZrlGcOI/AAAAAAAAANQ/TY7oLg88yeE/s72-c/crash2.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-3113708214318889284</id><published>2008-11-06T03:19:00.004+02:00</published><updated>2008-11-06T20:59:09.094+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PC PLC Communication'/><category scheme='http://www.blogger.com/atom/ns#' term='time intervals'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Product Traceability'/><title type='text'>Simple PC – PLC Communications Part IV - Evaluation Code Sample</title><content type='html'>&lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.4  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--&gt; 	&lt;/style&gt; &lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.4  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--&gt; 	&lt;/style&gt; &lt;p&gt;In this post, I would like to give a simple pseudo code for managing time intervals, how to switch them between. Remember that following code is belong to 'Evaluate' function which is stated in    &lt;a href="http://indanotes.blogspot.com/2008/10/blog.html"&gt;second post&lt;/a&gt; and executing in a continious loop:&lt;/p&gt;&lt;p&gt;&lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.4  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--&gt; 	&lt;/style&gt; &lt;/p&gt;&lt;p style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color rgb(0, 0, 0); border-width: medium medium 1px; padding: 0cm 0cm 0.07cm;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt; &lt;p style="margin-left: 1.4cm; text-indent: -1cm; margin-bottom: 0cm; font-weight: bold;"&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-style: normal;"&gt;Global TimeInterval&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 1.4cm; text-indent: -1cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Function Evaluate()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;Select Case&lt;/b&gt;&lt;/span&gt; TimeInterval&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 2.5cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;Case&lt;/b&gt;&lt;/span&gt; "T1"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;If PLC_Read.Request = True&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 5cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;TimeInterval = "T2"  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;End If&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 2.5cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;Case &lt;/b&gt;&lt;/span&gt;"T2"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;RecordData()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;TimeInterval = "T3"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;PLC_Write.Response = True &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-left: 2.5cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;Case&lt;/b&gt;&lt;/span&gt; "T3"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;If PLC_Read.Request = False Then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 5cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;TimeInterval = "T4"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;End If&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; text-indent: -1cm; margin-bottom: 0cm;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;Case&lt;/b&gt;&lt;/span&gt; "T4" &lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;TimeInterval = "T1"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 3.75cm; margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;PLC_Write.Response = False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-style: normal;"&gt;&lt;b&gt;End Select&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin-left: 1.4cm; text-indent: -1cm; margin-bottom: 0cm; font-style: normal;"&gt; &lt;span style="font-family:courier new,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;End Function&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;meta equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.4  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--&gt; 	&lt;/style&gt; &lt;/p&gt;&lt;p style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color rgb(0, 0, 0); border-width: medium medium 1px; padding: 0cm 0cm 0.07cm;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 2.4  (Win32)"&gt;&lt;style type="text/css"&gt; 	&lt;!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } 	--&gt; 	&lt;/style&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;However, it is just a sample, it is possible to simplify this code into less steps. For example it is possible to insert into database and then switch into last step according to read data from PLC.&lt;/p&gt; &lt;p&gt;For next post, we are going to give some tips about managing steps and increasing immunity against deadlocks may be caused  by power loss and operators unwanted, unexpected behaviours.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-3113708214318889284?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/3113708214318889284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/blog3_06.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3113708214318889284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3113708214318889284'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/blog3_06.html' title='Simple PC – PLC Communications Part IV - Evaluation Code Sample'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-8145458314938009122</id><published>2008-11-02T22:23:00.003+02:00</published><updated>2008-11-05T22:01:35.812+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='signals'/><category scheme='http://www.blogger.com/atom/ns#' term='animation'/><category scheme='http://www.blogger.com/atom/ns#' term='PC PLC Communication'/><category scheme='http://www.blogger.com/atom/ns#' term='Product Traceability'/><category scheme='http://www.blogger.com/atom/ns#' term='presentation'/><title type='text'>Simple PC – PLC Communications Part III – Signals with animation</title><content type='html'>A presentation may explain lots of things than words:&lt;br /&gt;&lt;br /&gt;&lt;div style="width:425px;text-align:left" id="__ss_714762"&gt;&lt;a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/moosty/simple-pc-plc-communications-presentation-presentation?type=powerpoint" title="Simple PC - PLC communications Presentation"&gt;Simple PC - PLC communications Presentation&lt;/a&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=animation1-1225658213463490-8&amp;stripped_title=simple-pc-plc-communications-presentation-presentation" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=animation1-1225658213463490-8&amp;stripped_title=simple-pc-plc-communications-presentation-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;View SlideShare &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/moosty/simple-pc-plc-communications-presentation-presentation?type=powerpoint" title="View Simple PC - PLC communications Presentation on SlideShare"&gt;presentation&lt;/a&gt; or &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint"&gt;Upload&lt;/a&gt; your own. (tags: &lt;a style="text-decoration:underline;" href="http://slideshare.net/tag/communication"&gt;communication&lt;/a&gt; &lt;a style="text-decoration:underline;" href="http://slideshare.net/tag/plc"&gt;plc&lt;/a&gt;)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-8145458314938009122?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/8145458314938009122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/simple-pc-plc-communications-part-iii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8145458314938009122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/8145458314938009122'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/simple-pc-plc-communications-part-iii.html' title='Simple PC – PLC Communications Part III – Signals with animation'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-941734549199497436</id><published>2008-11-01T01:19:00.002+02:00</published><updated>2008-11-01T01:33:05.850+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Barcode'/><category scheme='http://www.blogger.com/atom/ns#' term='Case Study'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Product Traceability'/><title type='text'>Simple PC – PLC Communications Part II – A Case Study for Product Traceability</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt; &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   TD P { margin-bottom: 0cm }   P { margin-bottom: 0.21cm }  --&gt;&lt;br /&gt; &lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;In our previous post we examined a simple application structure for basic PC – PLC communication.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;In this post, we are going to focus on 'evaluate' part of the algorithm.  &lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;It is better to focus on evaluation in a case study, assume that we have three consecutive stations in an assembly line as follows:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_MxqeMEi5UJM/SQuS5O7LqRI/AAAAAAAAAMc/cKaHQ6Mt9bI/s1600-h/blog+2_html_m17ae9813.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://1.bp.blogspot.com/_MxqeMEi5UJM/SQuS5O7LqRI/AAAAAAAAAMc/7xaVrDlHaBU/s400-R/blog+2_html_m17ae9813.gif" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Assume that each station is driven by distinct motors. We are going to study on Station Y.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;If we are studying on a case, we need a scenario. Assume that we have an operator, say 'Mike',  on assembly line.  &lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Mike is working on Station Y and he is  responsible for checking if boxes are good or not. He has two push buttons, one red and one green. He presses green button for good boxes and presses red for defected. Boxes come from Station X, and left Station Y towards Station Z after Mike's decision.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;We also have a barcode reader on  Station Y which is directly connected to PLC. A bar code reader connected to a PC requires a little trick that we are going to discuss later.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;With Mike and other components, our system should seem as:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_MxqeMEi5UJM/SQuTIUCxoTI/AAAAAAAAAMk/MjUdHCw9_VE/s1600-h/blog+2_html_mfaa8bb0.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://4.bp.blogspot.com/_MxqeMEi5UJM/SQuTIUCxoTI/AAAAAAAAAMk/fh3ULFjyGHg/s400-R/blog+2_html_mfaa8bb0.gif" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now our goal is collecting information from boxes and matching them with their quality status.&lt;br /&gt;&lt;br /&gt;Finally, we want a data table in our PC as follows:&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;table border="1" bordercolor="#000000" cellpadding="4" cellspacing="0"&gt; &lt;col width="89"&gt;  &lt;col width="66"&gt;  &lt;col width="58"&gt;  &lt;col width="43"&gt;  &lt;thead&gt;&lt;br /&gt;&lt;tr valign="top"&gt;    &lt;td width="35%"&gt;Date Time&lt;/td&gt;    &lt;td width="26%"&gt;Barcode Data&lt;/td&gt;    &lt;td width="23%"&gt;Station&lt;/td&gt;    &lt;td width="17%"&gt;Quality Status&lt;/td&gt;   &lt;/tr&gt;&lt;br /&gt;&lt;/thead&gt;  &lt;tbody&gt;&lt;br /&gt;&lt;tr valign="top"&gt;    &lt;td width="35%"&gt;10.10.2008 16:18:30&lt;/td&gt;    &lt;td width="26%"&gt;8463952819456&lt;/td&gt;    &lt;td width="23%"&gt;Station Y&lt;/td&gt;    &lt;td width="17%"&gt;OK&lt;/td&gt;   &lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;    &lt;td width="35%"&gt;10.10.2008 16:19:02&lt;/td&gt;    &lt;td width="26%"&gt;8392753021983&lt;/td&gt;    &lt;td width="23%"&gt;Station Y&lt;/td&gt;    &lt;td width="17%"&gt;NOK&lt;/td&gt;   &lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;    &lt;td width="35%"&gt;...&lt;/td&gt;    &lt;td width="26%"&gt;...&lt;/td&gt;    &lt;td width="23%"&gt;...&lt;/td&gt;    &lt;td width="17%"&gt;...&lt;/td&gt;   &lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;We can  derive several reports with this data, we can use pivot charts to see summary, or we can develop a web page to present our data, it is not in this scope of this post.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;When we think over scenario we see that events should happen step by step:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;A new box arrives on Station Y&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Barcode reader scans the barcode  (Assuming that it never fails)&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Mike pushes a button&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Data is recorded&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Box leaves Station Y and moves to  Station X&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;Following informations can be supplied by PLC:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Product presence on station&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Scanned barcode data&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Which button is pushed&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;PC can only supply one information:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Confirmation of record created  successfully.&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;We need to exchange information between PC and PLC and we must do it with a handshake protocol.  &lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;This handshake protocol is not the one used for PC – PLC communication. For example, it is not FINS protocol of Omron or it is not Modbus protocol.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;We are already reading a part of PLC data memory and filling another part continuously with an endless loop, I mean we need a safe method to manage information carried by physical PC – PLC communication.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Following diagram is a sample protocol that can be used for our case:&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_MxqeMEi5UJM/SQuTVJZIk-I/AAAAAAAAAMs/DcMLQYQAOlw/s1600-h/blog+2_html_m57ac3aae.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img src="http://2.bp.blogspot.com/_MxqeMEi5UJM/SQuTVJZIk-I/AAAAAAAAAMs/KTmxvpUTgeo/s400-R/blog+2_html_m57ac3aae.gif" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Information exchange done in four steps.&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;Our next post we will continue on the same case study.  &lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;br /&gt;We are going to discuss:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;What happens in T1, T2, T3 and T4  intervals ?&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;How can we organise internal  structure of evaluation algorithm ?&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0cm;"&gt;Few tips about design&lt;/div&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;See you in next post!&lt;/div&gt;&lt;div style="margin-bottom: 0cm;"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-941734549199497436?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/941734549199497436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/11/simple-pc-plc-communications-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/941734549199497436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/941734549199497436'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/11/simple-pc-plc-communications-part-ii.html' title='Simple PC – PLC Communications Part II – A Case Study for Product Traceability'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_MxqeMEi5UJM/SQuS5O7LqRI/AAAAAAAAAMc/7xaVrDlHaBU/s72-Rc/blog+2_html_m17ae9813.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-4609511819018519687</id><published>2008-10-30T22:30:00.006+02:00</published><updated>2008-10-31T00:06:41.085+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I/O'/><category scheme='http://www.blogger.com/atom/ns#' term='PC PLC Communication'/><category scheme='http://www.blogger.com/atom/ns#' term='Ethernet'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><category scheme='http://www.blogger.com/atom/ns#' term='RS 232'/><title type='text'>Simple PC - PLC Communications Part I</title><content type='html'>&lt;span style="font-weight: bold;"&gt;A simple PC application structure &lt;/span&gt;&lt;b style="font-weight: bold;"&gt;that communicates to PLC&lt;/b&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;In most cases PLC is enough to solve automation tasks with its programming interface and special designed architecture.&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;However,  it is not always possible to solve all problems such as database support. Some PLC brands have command sets supporting table search but it is not intended for complex operations.&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;In this post, we will focus on a PC application that supports PLC by exchanging data.&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;Most common PC – PLC communication methods are RS 232 and Ethernet, they do not differ in&lt;br /&gt;basic software structure, so you can apply this structure for both RS232 and Ethernet communications. Also it is possible to use parallel hardware I/O cards on PC for communication, the same structure also fits for I/O cards.&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;The most convenient way for communicating is continuously exchanging snapshots of memory areas between PC and PLC.&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;Actually, all PLC systems do the same thing at the background:&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;img src="http://docs.google.com/File?id=dd2jbnwt_16d7xdtcff_b" align="left" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0in;"&gt;Reading inputs, evaluating them to calculate necessary outputs and writing outputs continuously in a loop.&lt;/p&gt;&lt;br /&gt;If we adopt this to a PC application, same algorithm could be as follows:&lt;br /&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;img src="http://docs.google.com/File?id=dd2jbnwt_17gz5wcjff_b" align="left" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This structure simplifies PC evaluation algorithm.&lt;br /&gt;&lt;p style="margin-bottom: 0in;"&gt;Next post is going to be a simple case study, we will design a station  that gives feedback to PC for&lt;br /&gt;recording a products information to maintain traceability.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-4609511819018519687?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/4609511819018519687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/10/blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/4609511819018519687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/4609511819018519687'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/10/blog.html' title='Simple PC - PLC Communications Part I'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6984106770834733517.post-3330359399302754537</id><published>2008-10-29T14:37:00.003+02:00</published><updated>2008-10-30T22:42:36.388+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='start'/><category scheme='http://www.blogger.com/atom/ns#' term='First post'/><category scheme='http://www.blogger.com/atom/ns#' term='what is &apos;In da notes&apos;'/><title type='text'>First Post</title><content type='html'>This is the very first post, I hope we will share lots of experience in this blog.&lt;br /&gt;&lt;br /&gt;I am an automation engineer and using PC for many industrial automation problems.&lt;br /&gt;&lt;br /&gt;In da notes stands for 'Industrial Automation Notes' and I am planning to publish some of my experiences as case studies in this blog.  As I said, my favourite tool is PC for automation, so probably you will find more tips and trics with PC.&lt;br /&gt;&lt;br /&gt;However, automation without PLC is impossible, for that reason this blog will contain example applications with PC and PLC.&lt;br /&gt;&lt;br /&gt;If you are also an automation guy, you should be so busy and can understand me if I can't feed this blog so frequently.  All experiences from readers are wellcome.&lt;br /&gt;&lt;br /&gt;I am planning to post tutorials from simple to complex, this structure requires references links to older posts. Probably my second post will be about simple PC - PLC communication basics.&lt;br /&gt;&lt;br /&gt;I offer you to subscribe this blog to be informed on new posts because I may not feed so frequently. Unfortunately you may fed up checking this blog without any new posts, so it should be better to subscribe.&lt;br /&gt;&lt;br /&gt;See you in next post !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6984106770834733517-3330359399302754537?l=indanotes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://indanotes.blogspot.com/feeds/3330359399302754537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://indanotes.blogspot.com/2008/10/this-is-very-first-post-i-hope-we-will.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3330359399302754537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6984106770834733517/posts/default/3330359399302754537'/><link rel='alternate' type='text/html' href='http://indanotes.blogspot.com/2008/10/this-is-very-first-post-i-hope-we-will.html' title='First Post'/><author><name>Moosty</name><uri>http://www.blogger.com/profile/07112648668105900837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_MxqeMEi5UJM/SQoBAGWBR-I/AAAAAAAAAME/uOas7RLF1lg/S220/bc8e03a0f.10470615,1.jpg'/></author><thr:total>0</thr:total></entry></feed>
