Category Archives: manufacturing

How you can learn PLC Programming without spending a dime!

I have been writing PLC programs for over 20 years. I often get asked what is the best way to lean PLC programming. Programming in the way I was taught in college was with the Motorola 6809. (Yes, I know that I am dating myself) This was microprocessor programming, but it was the best way to sometimes explain the methods behind PLC programming. Manufacturers of PLCs had allot of proprietary software that were not even related in their appearance and methods of programming. Today we have a few standards that have changed the look and feel of the programming software packages so each manufacturer is similar. The following is the best recommendation that I have for beginners to start to learn PLC programming today.

The first place to start in order to learn PLC programming is the free publication by Kevin Collins. This PDF will teach you PLC programming without just telling you what a PLC is and how it functions. He also includes some test questions along the way in order for you to retain and understand the important points that he is making.

PLC Programming for Industrial Automation
by Kevin Collins
(Note: This book is now for sale on Amazon.)
https://www.amazon.com/Programming-Industrial-Automation-Kevin-Collins/dp/1846855985
Topics covered include:

  • PLC Basics
  • Ladder Programming
  • Conditional Logic
  • Ladder Diagrams
  • Normally closed contacts
  • Outputs and latches
  • Internal relays
  • Timers
  • The Pulse Generator
  • Counters
  • Sequential Programming Introduction
  • Evolution of the Sequential Function Chart
  • Programming using the Sequential Function Chart
  • Entering the SFC program into the PLC
  • Modifying an SFC Program
  • Selective Branching
  • Parallel Branching

After learning the basics from the above manual, practice. Create programs yourself and test what you have learned. You can accomplish this by using simulators. Allot of the programming software will have simulators. The simulator will mimic the PLC hardware so you can test your programs before installing in the field. Traditionally I have not been a fan of simulators, but recently Automation Direct has introduced a simulator with their Do-More PLC. It is the Do-More Designer Software. This software simulator includes the entire instruction set (Not Just Bit Logic) as well as communication protocols. It can be downloaded and installed for free from the above link.

The next step I recommend is then to advance into some of the advanced instructions. An understanding of the numbering systems in the PLC will be a benefit. Math, PID, register manipulation and conversion instructions are just a few of the advanced programming you can learn. All of these and more instruction information can be obtained from reviewing the documentation from the PLC manual that you are programming. Once again all of these instructions are included in the Do-More Designer Software.

Program structure is the next topic. Allot of programmers would stop here and can do well with developing software, however there is much more that you can lean.  Sequencers give programmers the methods to change logic on the fly and allow troubleshooting the system easier. This method of programming can benefit you greatly and reduce the development time of your logic.

The last step that I recommend learning is the sharing of information. I am meaning the information that you program through an HMI and/or SCADA package. This refers to understanding of the ways in which information can be gathered from the PLC and displayed in different ways. Here are a couple of previous articles that have been written on this subject:

How to Implement the Omron PLC Host Link Protocol 

Robust PLC Data Logger

As you can see, there is allot of information available to you to begin and lean PLC programming without spending a dime!  Remember that PLCs are similar to computers, (Moore’s Law) they increase in size and ability. Systems are expanding and changing everyday. Happy programming.

Do you know of additional tips or methods to share?

Watch on YouTube : How you can learn PLC Programming without spending a dime!

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

How to Troubleshoot a PLC

Your control system does not work. Where do you start? Lets walk through a series of questions in order to determine where the problem lies.

Is this a new installation or previous installation that was running fine? Determine if system has been running well in the past and has currently stop working correctly. This is the indication that the problem relies inside the system.

Is there anything that has happened outside of the system? Has there been a lightening strike, blown drives on other systems, etc.  This can point to the original cause of the malfunction.

What is the system doing now and what should it be doing? Gather all of the information you can from every resource you can.

  • Supervisors  – machine, location, time of error, other happenings in the plant, etc
  • Operators – What is it currently doing? What should it be doing? What do you think is wrong?
Operators of the equipment are your key resource in finding, correcting and ensuring the error does not happen again. They know the equipment from an operational point of view which can assist you greatly in troubleshooting.

PLC fatal and non-fatal errors:
If the machine is still running partially then this is an indication of a non-fatal error. Cannot run at all is usually a fatal error.

Take a look at the PLC indicator lights on the CPU. Refer to the operation manual for the PLC for troubleshooting specific lights on the CPU. The following are general tips:

If no lights are on then the possible cause is a power supply. This is usually the most common of errors on a PLC system. Mean time before failure (MTBF) is rated on the lowest rating of components which is usually the power supply.

If the run light is on and an error light flashing this usually indicates internal errors such as batteries, scan time, etc. It is usually not the reason for the lack of operation.

If the run light is on and no other errors are seen on the CPU we can put the PLC program on the bottom of the list of items that could be the cause.

Check the input cards of the PLC. You should see the individual sensors lighting up the inputs. If not then check the power supply to the input card / cards.

Ask the operator what is happening and what is suppose to happen. Try to follow the sequence of events in the PLC to determine either and input or output device not working.
Some items to watch:

If this is a new PLC program that you are doing start with a logic flow diagram. This will determine the procedure to start programming.
Every program can be done in several ways. The best method is the most documented one.

Documentation is the mark of a good program.

Some trouble with new programs can be racing conditions. This is usually a case of not understanding how the PLC scans logic. In general the PLC will scan from left to right, top to bottom. The output bits / words are available to the inputs of the next rung of logic. (Modicon PLC’s will scan differently.) Actual outputs and inputs are not read until the end of the scan of the PLC. Racing conditions happen when the output is set on multiple rungs, but will not get actually set until the end of the scan. Think of it as the last action will always win. So if this happens move the logic to the end of the program and see if it works. Then go back and see where the output was also set.  Cross reference guides are ideal for this purpose. (Refer to your programming software on how to get cross references.)

We have discussed just a few troubleshooting techniques. Hopefully now you know how to start looking for the errors on your  system. Let me know how you make  out.

Watch on YouTube : How to Troubleshoot a PLC

Do you know of additional tips or methods to share?

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Looking For Production Improvements – Then Do A Gemba Walk!

I recently went for a Gemba Walk with Ann Machan,  General Manager of Pentair. Instead of doing normal daily production meetings, their walk does everything you can do in a boardroom, plus so much more.

What is a Gemba Walk?
http://www.gembawalk.com/the-gemba-walk/

We met in her office and were explained the KPI (Key Performance Indicators) for the operation of the plant.  Each of these KPI’s are posted at each department where the work happens and are on a large white board.

The walk each morning starts at the shipping office with the rest of the staff. The operator in shipping  discusses how their department has done in the last 24 hours in relation to the KPI. Questions are raised about the next 24 hours and possible issues. Before we leave this department Ann asks a few personal questions to the shipper. He answers and they start to laugh. It is obvious that they have a good relationship in which information can flow freely.

Splitting up the group into three different teams to cover the entire plant, the walk continues. We went to three additional departments where again we were shown the KPIs and how they related to the department. Notes were taken and questions asked about possible issues and current problems. Information was exchanged from the previous days problem with the solution for one that was to be implemented that afternoon.

We assembled back all together in a central location in the plant. A large board with people’s names (Responsible for Department) was listed on the left side and twenty one numbers were written on the top representing three weeks. The current week that they were on, followed by the next two weeks. This grid pattern was where they then discussed the walk and the issues raised. To the right of the board a chart was placed. This chart contained the total number of problems/issues solved for each department and total company. A graph was also displayed showing the growing trend. Underneath this chart were the KPI charts that all showed either sustained or improved performance.

We started with the previous days issues under yesterdays date. A status update was given and the posted note was moved to either the completion clip at the side or put under a future date. When this was complete, a representative of each of the three groups when through their list of issues. These were then assigned and placed on the board. Problems that required additional investigation were discussed briefly and then the 5 why process was assigned to the person who had the greatest knowledge.

This whole process took about one hour. The Gemba walk accomplished the following:

  • Everyone’s understanding on the current company situation based upon the KPIs
  • Everyone knowing exactly what is expected
  • Everyone taking pride and knowing they are doing a good job
  • Everyone knowing someone is there to help

I found the whole experience of the Gemba walk fascinating. It is the only way that I see that you can have clear lines of communication to all staff. The way in which to grow as a company is to learn from our workers and in turn we will teach them.  It was an opportunity to:

  • See the work being done
  • Experiment with ideas
  • Learn from all parties involved
  • Explain why things are this / that way
  • Watch what is being done

Take your own Gemba walk on your production floor. Let me know how it turns out.

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Lubrication basics

I recently went to a seminar on lubrication basics. This was presented by Mike Deckert of Flo Components Ltd.

So why talk about lubrication on a industrial automation website? Lubrication is vital in maintaining uptime on equipment. It is often thought of near the end of most automation projects, but it should be a principle component of all projects. If a piece of equipment moves, it will probably need lubrication. We often talk about MTBF (Mean Time Before Failure) on equipment. MTBF will be very low if lubrication is neglected.

In a study conducted by a major component manufacturer, over 50% of failures are the result of improper lubrication.  (Pins and Bushing)

  • Lubrication Related Failures: 54%
    • Inadequate Lubrication – 34.4%
    • Contamination – 19.6%
  • Installation Errors – 17.7%
  • Overload – 6.9%
  • Storage and Handling Errors – 2.8%
  • Other 18.6 %

Bearings fail in a plant for many reasons. Manual lubrication is still the dominant method of lubrication for grease bearings. 95% of all bearings are manually lubed. With plant production increasing the scheduled service time between has lengthened. Maintenance staff have generally been reduced resulting in fewer people carrying out the lubrication requirements.

Lubrication has the following functions:

  • Reduce Friction
  • Reduce Wear
  • Helps Dampen Shock or Absorb Shock
  • Reduce Temperature
  • Minimize Corrosion
  • Seal out Contaminants

Lubrication interval depends on the following:

  • Metal to metal contact area of bearing
  • Environment (Application)
  • Machine Speed
  • Operating Temperature
  • Type of Grease

Not all grease is the same. Grease is a solid or semi-solid formed when a thickening agent is dispersed in the oil base. Additives give grease their final special properties. The National Lubrication Grading Index  (NLGI) will grade the grease from 000 to 6, but this is not the whole story. Always look at the manufactures specification. Base oil viscosity can be completely different but still have the same NLGI.

Why are automatic lubrication systems better?

  • Grease evenly distributed
    • The best time to grease is when the object is in motion. This spreads the grease evenly.
  • Will not over lubricate
    • Grease is delivered by measured injection. This prevents seals from blowing out.
  • Correct amount of grease is applied
    • This will ensure the maximum life of the equipment.
  • Environmentally safe

Lubrication is a vital component to automation. MTBF can be increase if we plan on ensuring that our moving parts are well maintained.

Flo Components Ltd. is an excellent company to help you understand and maintain your systems. They have a library full of information on their website.

www.flocomponents.com/Library.htm

I encourage you to check this out and make lubrication part of your automation projects. If you have any questions, or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

How to make a Start / Stop / Jog circuit in a PLC

Looking at a stop start jog circuit in the PLC will help us in understanding the differences in hard wiring the circuit and programming.

Lets start with the basic stop stop circuit.
Here is what it looks like hard wired. (Physical switches wired to outputs devices, such as motor contactor and relays.)

When the start pushbutton (NO) is pressed the power is passed through the stop pushbutton (NC) to the control relay (CR). The CR contact closes and ‘seals in’  the start pushbutton. The start pushbutton can now be released because the CR contacts allow the power to pass through to the CR.

NO – Normally Open – This refers to the state of the input  device if nothing acts upon it. 
NC – Normally Closed – This refers to the state of the input device if nothing acts upon it.

Lets take a look at the PLC program for the above wiring diagram.

The first thing that you will notice is that the input for Stop is NO contact and not NC. This is because the actual signal wired in the input is NC and we do not want to inverse this signal. You can see that the stop input is currently on in the program.
If we hit the start pushbutton then the circuit is complete and the output CR turns on.

Letting go of the start pushbutton, the output remains on because the CR input seals in the start pushbutton.

Pressing the stop pushbutton will break the circuit and turn off CR.

Letting go of the stop pushbutton will return us back to the original state shown above.

Adding a jog input to the hard wiring diagram will look something like this:

You can see that the diagram will work the exact same as the circuit above with the start and stop pushbuttons. The jog when pushed will break the sealing contact, and then make a bypass of the start pushbutton. This will keep the M coil on as long as the jog button is pressed. Letting go of the jog will stop the bypass of the start pushbutton which will stop M coil. When the jog returns to the original state M input will already be off so it will not keep M coil on.
The action on the jog is referred to as a Break before Make device. The jog pushbutton will break the circuit before making another connection.

Sometimes in programming a PLC it can be beneficial to think of the inputs as Make before Break. Inputs are made before the previous ones are broken. The programmable controller will scan the program from left to right, top to bottom. The outputs from the rung above are available to the rungs below. Here is a previous article on PLC scanning.
Lets take a look at PLC program with a jog that will not work.

Even though this looks like it would work… Remember that the contacts in the PLC are make before break. You can jog the unit and it will turn on but as soon as you release your finger off of the pushbutton the not jog input will seal the CR in. The output will not be able to turn off.

We must consider the delay from on to off when looking at the PLC program for this circuit.
Here is a circuit that will work:

Notice that we create a delay from on to off by turning on an intermediate bit in the program.

Another way to do start stop circuits in the PLC is to use the instructions Set (SET)  and Reset (RST).
The set will have all of the conditions to turn on a bit in memory and the reset will have all of the conditions to turn off a bit in memory. These instructions are used to make the program easier to view and troubleshoot.
Here is the same logic above using the set and reset instructions.

Notice that X10 Jog2 is in parallel with the Start. We use a trailing edge one shot in parallel with the Stop. This sets our delay so the output will turn off.

Watch on YouTube :  Learn PLC Programming – Free 4

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Now You Can Have Robust Data Logging for Free – Part 7

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5
Now You Can Have Robust Data Logging for Free – Part 6
Now You Can Have Robust Data Logging for Free – Part 7

 

Computer Program Visual Basic (VB6) Continue

We have started our VB program and have set up our Adodc connections to the database. Lets continue by setting the labels up with the Adodc connections. Then we will set up the communications to the Do-More PLC and put information into our Access 2007 (*.accdb) database. (AccRL.accdb)

Select all of the labels that will be for the Production_Log table and set the properties. Under DataSource select Adodc1. Do the same thing for all the labels under the Minute_Log table.

Now go through each of the labels and select the DataField that it represents. Do this for both the Production_Log table and the Minute_Log table.
Note: You can also set the format in which the field will display

We now have our basic display set up in visual basic. The last thing that we will do is add a text box and command buttons to control the logging of the information.

A text box is added to enter the IP Address of the PLC.
A Command1 command button is added to start the logging of the information.
A Command2 command button is added to stop the logging of the information.
We now have everything on the dispay that we will need for the program.
Lets now take a look at the modbus protocol.

http://www.simplymodbus.ca/TCP.htm

All Modbus Commands:

Function Code Action Table Name
01 (01 hex) Read Discrete Output Coils
05 (05 hex) Write single Discrete Output Coil
15 (0F hex) Write multiple Discrete Output Coils
02 (02 hex) Read Discrete Input Contacts
04 (04 hex) Read Analog Input Registers
03 (03 hex) Read Analog Output Holding Registers
06 (06 hex) Write single Analog Output Holding Register
16 (10 hex) Write multiple Analog Output Holding Registers
Due to Homeland Security the automation direct Do-More PLC will allow only the MHR area of memory to be written and read. Since this controller resides on a network and can be connected to the internet, this makes perfect sense. So the only function codes that we will be using will be 03 Read and 16 Write.
A review of the numbering systems can be found on a previous blog here.

Here is what we have to send to the PLC. (In this example we will read registers.)
00 – Transaction ID
00 – Protocol ID
06 – Length of message words
0 – Unit ID (Default)
3 – Function Code (Read) 10hex – Write
10 – Data bits (In this case the number of registers to read)
We will receive what we sent out plus the data requested.
Note: The rest of the network protocol will be handled by TCP/IP. All of the error checking is also handled by the network.

In part 8 we will continue with writing the VB6 program. We will start to put everything together in the program using code.
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Now You Can Have Robust Data Logging for Free – Part 6

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5
Now You Can Have Robust Data Logging for Free – Part 6

Computer Program Visual Basic (VB6)

We have looked at what VB is and discussed what we need to do in order to get the information out of the Do-More PLC and into an Access 2007 (*.accdb) database.
We will start by setting up the database. It will have the following two tables, Production_Log and Minute_Log. Please refer back to the data that we are storing in the PLC in Part 5.
Using Access create the two tables (Production_Log / Minute_Log) Name each record in the logs according to the data that we will be retrieving from the PLC.
See tables below.
The database will be named AccRL.accdb. This is an access 2007/2010 database.
We will store the database in the following directory:
C:AccRLDataAccRL.accdb
The visual basic program file will be in the C:AccRL directory.

Now lets start the visual basic programming:
Start a new project save it as AccRL in the directory mentioned above.

Add the Microsoft Winsock Control 6.0 component to the project. This will be needed to communicate through Ethernet to our PLC on the network.

Add the Microsoft ADO Data Control 6.0 (OLEDB) component to the project. This is required to communicate to the AccRL.accdb file created above.

This is what our program form looks like now.

We can now draw labels on our form for all of the data that we wish to display. Fonts sizes etc can all change based upon how you would like it to appear.
Note: Everything shown on the form are labels for the data. This program will just display the information that is being retrieved from the PLC.

Along the bottom of the form you will notice that the Winsock control, two Adodc controls and a timer have been added.
The Winsock control will be setup during the running of the program. On the form will will add a variable to tell the IP address of the PLC. We will deal with it after the database information has been setup.
Each of the Adodc controls represent the two tables set up earlier. Adodc1 is for the Production_Log table and Adodc2 is for the Minute_Log.
Lets now set up Adodc1.
Right click the control and select properties.

Select the ‘Use Connection String’ and click on Build.
Select ‘Microsoft Office 12.0 Access Database Engine OLE DB Provider’ and then click Next.

We will now enter where the data source is located. C:AccRLDataAccRL.accdb
Click ‘Test Connection’

If the connection is good you will receive the following message. If not please check the location of the data source and provider information mentioned earlier.

The last step is to set the table in the database.

Go back to the Property Page and select the RecordSource tab. The command type will be set for ‘2 – adCmdTable’ and the Table or Stored Procedure Name will be ‘Production_Log’. You will notice that you will only be able to choose between the Production_Log and Minute_Log because they are the only two tables in the database file.
Now repeat the same steps and set up the Adodc2 for the Minute_Log table of the database.

In part 7 we will continue with writing the VB6 program.
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Now You Can Have Robust Data Logging for Free – Part 5

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5

Computer Program

We will now start to write a program in visual basic. (VB) Visual Basic is a product by Microsoft. It was developed to allow programs to be easily written. It is the most widely used computer programming language. Visual Basic was developed after Basic. Basic was used before the world was introduced to Windows.
There are several versions of Visual Basic. Visual Basic was always backward compatible. This means that code written in it can be easily used in the new version. In 2005, VB.net was introduced which was not compatible with previous versions but opened up a whole new computer architect for programmers. We will use VB6 for our Robust Data Logging to the Do-More Controller.

The following links can be used for training on VB6:
http://www.vbtutor.net/vbtutor.html
http://www.vbtutor.net/vbtutor.html
Learning Visual Basic 6 Programming: Lesson 1
YouTube is also a great resource for learning how to program in VB.


Data Collection
Visual Basic 6 will be used to log the data into a database. The information will be collected using Modbus TCP communication to the Do-More PLC and/or Simulator of the Do-more Designer. This will use an Ethernet communication cable to the PLC. The program will read the indirect address pointers in the PLC. It will then read the information collected and store the information into an Access Database. The indirect address pointers will then be reset by the program.

The access database is 2007 and has an extension of ‘.accdb’. Here are two videos that show how we connect to a database, read, write, and delete records.
VB6 – How to connect ADO with MSAcess 2007 (*.accdb) Database – Tutorial 1
VB6 – How to connect ADO with MSAcess 2007 (*.accdb) Database – Tutorial 2

Here is a link on the Modbus TCP protocol with a good overall introduction and explanation. A video is also included on the page.
https://www.youtube.com/watch?v=E1nsgukeKKA

Here are the locations for the information in the programmable logic controller:

Daily Production Log Pointer

MHR1 is the porinter for the daily production log. It will point to the location to store the next series. (Next Day of Data)
MHR1 = 30 means that we are all data has been retrieved.
MHR1 = 650 means that we have 31 days of data to be retrieved.
A visual basic program will read MHR1. If it is greater than 30 then the data will be read and then written into a database. It will then write the value of 30 back into MHR1 to reset the pointer.
Current values are located here:
MHR10 – Year (XXXX)
MHR11 – Month (XX)
MHR12 – Day (XX)
MHR13 – Weekend 12am Meters MSW (Most significant word)
MHR14 – Weekend 12am Meters LSW (Least significant word)
MHR15 – Weekend 12pm Meters MSW
MHR16 – Weekend 12pm Meters LSW
MHR17 – Weekday 12-8am Meters MSW
MHR18 – Weekday 12-8am Meters LSW
MHR19 – Weekday 8-4pm Meters MSW
MHR20 – Weekday 8-4pm Meters LSW
MHR21 – Weekday 4-12pm Meters MSW
MHR22 – Weekday 4-12pm Meters LSW
MHR23 – Weekend 12am Utilization % (xxx.x)
MHR24 – Weekend 12pm Utilization % (xxx.x)
MHR25 – Weekday 12-8am Utilization % (xxx.x)
MHR26 – Weekday 8-4pm Utilization % (xxx.x)
MHR27 – Weekday 4-12pm Utilization % (xxx.x)
Run Minute_Logger
MHR2 – Pointer – Value 670 to 2000
MHR660 – MHR669 – Current logged values
MHR660 – Year – xxxx   MHR661 – Month – xx   MHR662- Day – xx
MHR663 – Hour – xx   MHR664 – Minute – xx   MHR665- Second – xx
MHR666 – MHR667 – Current Meters – xxxxxxxx
MHR668 – Current Rate – xxxxx mpm

In part 6 we will continue with the VB6 program of getting the information out of the PLC and putting it into a database.
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Now You Can Have Robust Data Logging for Free – Part 4

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4

PLC program – Continue

In part 3 we finished logging the daily information in the PLC. We will now log minute by minute information in the PLC memory for retrieval. Similar steps will be taken, but we no longer have to track shift by shift information.
This is where the amount of memory used in the controller can be great. The Do-More PLC will allow you to allot more memory to areas in the configuration menu.

We will leave this at the default setting in our project. Remember that this can be modified at any time if you wish to increase the amount of information logged.

Run Minute_Logger
MHR2 – Pointer – Value 670 to 2000
MHR660 – MHR669 – Current logged values
MHR660 – Year – xxxx   MHR661 – Month – xx   MHR662- Day – xx
MHR663 – Hour – xx   MHR664 – Minute – xx   MHR665- Second – xx
MHR666 – MHR667 – Current Meters – xxxxxxxx
MHR668 – Current Rate – xxxxx mpm
Internal used bits –
D40 – D49 / V2

We will start off by looking at the log pointer.

Minute Log Pointer
MHR2 is the porinter for the minute production log. It will point to the location to store the next series. (Next Minute of Data)
MHR2 = 670 means that we are all data has been retrieved.
MHR2 = 2000 means that we have 133 minutes of data to be retrieved.
A visual basic program will read MHR2. If it is greater than 670 then the data will be read and then written into a database. It will then write the value of 670 back into MHR2 to reset the pointer.
Current values are located here:
MHR660 – MHR667

After 133 minutes (~2 hours) without communication to the programmable logic controller, the data will be lost. You may wish to increase the memory area as mentioned above. This will change the MHR area so your reset value will have to change from 2000 to your new setting.

Log Time Parameters
MHR660 – Year
MHR661 – Month
MHR662 – Day
MHR663 – Hour
MHR664 – Minute
MHR665 – Second

This area sets up the real time clock. (RTC) The format is as follows: YYYY MM dd hh mm ss.

Meters
For testing purposes a 50ms internal timer is used. The count input should be activated on the leading edge if you remove the 50ms internal timer.

D19 contains the length per pulse of the counter. In our case D19 = 303
With each pulse of the input, D40 increments by 303. There for after 10 pulses the value in D40 will be 3030. This would represent 3.030 meters of product.
To change this into an integer to log the data we will divide D40 by 1000 and store the result in D41.
D41 will now contain the total meters for the shift. This is a 32 bit address location and we want the results to be in a 16 bit address location. (D vs MHR)
Using some math we split our total meters into the most significant 4 digits and the least significant 4 digits.
MHR666 – MHR667 – Current Meters – xxxxxxxx
D41 divided by 10000 will be placed into MHR666. Ex. 12345678 / 10000 = 1234
D41 minus ((Int(D41/10000)) *10000) will be placed into MHR667.
Ex. 12345678 – ((Int(12345678/10000))*10000) = 12345678 – 12340000 = 5678


Rate
This is the rate per minute. (MPM)
Samples are taken once per minute.

D40 – Current Meters
D42 – Last Minutes Meters
D43 – Meters passed since the last minute
MHR668 – Meters per minute (Rate)
If the current meters is greater than the last minute meters then subtract the last minute meters from the current meters and store it in the meters passed since the last minute.If not do the opposite. This will ensure that a negative number is not obtained. The meters passed since the last minute are then divided by 1000 so we are only looking at the integer of the number.

This finishes the PLC programming. In part 5 we will continue by getting the information out of the PLC.
If you have any questions or need further information, please contact me.
Regards,
Garry

To get a copy of the entire program. Please contact me in the contact section. I will be more than happy to send you the program. Put ‘Robust Logger’ in the subject line.




If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Now You Can Have Robust Data Logging for Free – Part 3

Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3

PLC program – Continue

We have created our shift bits, shift total seconds, shift seconds for the program.
Here is the setup for the daily log information: This is where all of the current values will be stored.

Daily Log Information
MHR10 – Year (XXXX)
MHR11 – Month (XX)
MHR12 – Day (XX)
MHR13 – Weekend 12am Meters MSW (Most significant word)
MHR14 – Weekend 12am Meters LSW (Least significant word)
MHR15 – Weekend 12pm Meters MSW
MHR16 – Weekend 12pm Meters LSW
MHR17 – Weekday 12-8am Meters MSW
MHR18 – Weekday 12-8am Meters LSW
MHR19 – Weekday 8-4pm Meters MSW
MHR20 – Weekday 8-4pm Meters LSW
MHR21 – Weekday 4-12pm Meters MSW
MHR22 – Weekday 4-12pm Meters LSW
MHR23 – Weekend 12am Utilization % (xxx.x)
MHR24 – Weekend 12pm Utilization % (xxx.x)
MHR25 – Weekday 12-8am Utilization % (xxx.x)
MHR26 – Weekday 8-4pm Utilization % (xxx.x)
MHR27 – Weekday 4-12pm Utilization % (xxx.x)

The real time clock can be populated by the following:
Note that the format is 2014 11 01 (yyyy mm dd) This will be important when setting up the database for the data.

We will determine the total meters per shift. Remember that our counter will give us one pulse every 0.303 meters.

Shift Meters – Weekend 12am
For testing purposes a 50ms internal timer is used. Also the count input should be activated on the leading edge, if the 50ms internal timer is removed.

D19 contains the length per pulse of the counter. In our case D19 = 303
With each pulse of the input, D20 increments by 303. There for after 10 pulses the value in D20 will be 3030. This would represent 3.030 meters of product.
To change this into an integer to log the data we will divide D20 by 1000 and store the result in D30.
D30 will now contain the total meters for the shift. This is a 32 bit address location and we want the results to be in a 16 bit address location. (D vs MHR)
Using some math we split our total meters into the most significant 4 digits and the least significant 4 digits.
MHR13 – Weekend 12am Meters MSW (Most significant word)
MHR14 – Weekend 12am Meters LSW (Least significant word)

D30 divided by 10000 will be placed into MHR13. Ex. 12345678 / 10000 = 1234
D30 minus ((Int(D30/10000)) *10000) will be placed into MHR14.
Ex. 12345678 – ((Int(12345678/10000))*10000) = 12345678 – 12340000 = 5678
The same calculation will be used for the other 4 shifts.
The shift percent will now be calculated. Remember that D0 contained the total seconds that have passed on the shift and D10 contains the total seconds that the machine was running. This is for weekend 12am shift.
MHR23 – Weekend 12am Utilization % (xxx.x)
To determine the shift percent to one decimal we will do the following math:
(D10 * 1000)/D0
Ex. If we want one decimal place in the output register then looking at 75% this should be equal to the value of 750 in the output channel.
(75 *1000)/100 = 75000/100 = 750
The same calculation will be used for the other 4 shifts.
Now that we have all of the data in the registers we are now ready to log this information when the day changes. That is when the weekend 12am or weekday 12-8am shift bit turns on.
 
Daily Production Log Pointer
MHR1 is the porinter for the daily production log. It will point to the location to store the next series. (Next Day of Data)
MHR1 = 30 means that we are all data has been retrieved.
MHR1 = 650 means that we have 31 days of data to be retrieved.
A visual basic program will read MHR1. If it is greater than 30 then the data will be read and then written into a database. It will then write the value of 30 back into MHR1 to reset the pointer.
Current values are located here:
MHR10 – MHR27 – As shown above.
Information will be logged for 31 days without communication from the computer program to reset the log pointer.
This is all the requirements for logging the daily information in the PLC. We will now log minute by minute information in the next part.

We will finish the PLC programming in part 4 and then continue onto getting the information out of the PLC.
If you have any questions or need further information, please contact me.
Happy Programming,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.