Part counting is an extremely useful data item that will enable you to monitor your throughput, quality, and much more. This article will walk you through the basics of ensuring part counting is enabled on your machines.
The number we use for part count almost always comes from the internal part counter on the machine's control, also referred to as the work counter. Controls often have multiple part counters, and these counters are generally incremented by the program's G-code that is running on the machine. Programs are often complex, with controls given to operators to skip areas of a program, run multiple parts on a pallet, to stop before the end of the bar, etc. Therefore, getting part counts correct can also be complicated, and having an understanding of how your programs are written might come in handy!
Note: If you're unsure how your machine increments its work counter/part counter, you may need to speak with that machine's vendor or support.
Topics covered in this article
- Increment the part counter by M code or Macro
- Determining which PATH/Part Counter is counting parts on your Machine
- Select the Correct Part Count Metric/Path
- Control Dependent Part Count Methods
Increment the part counter by M code or Macro
The standard part count M-codes works for nearly all machines/controls. If you have not added an M-code or Macro for incrementing part counts in your code, you must do so. Each machine make has it's own documented M-code for incrementing parts, but the universal macro that works for almost all machines for incrementing the counter by 1 is:
#3901 = #3901 + 1
In the above macro, the "+1" represents the number of parts to be counted each time the machine sees this code. If multiple parts are made per program, you can edit this number to reflect that.
The best place to add this macro would be near the end of the program before M99, M30, or M02.
Typically these changes can be applied to the machine profile in your post-processor so that whenever a program is posted to a machine, it has the correct code applied and new programs will contain the proper part count macro or M code.
For more complicated machining, such as multi-pallet machines, subprograms with their own counts, or cases where block-delete is commonly used, some changes to the control might be required. This is because areas where the M code is typically contained might be skipped or might be run more than once. In these cases, our recommendation is that the machine's control be configured to not increment the part counter with the standard M codes. Instead, we can use the standard Macro as defined above. Parameters on the machine control may need to be changed.
Determining which PATH/Part Counter is counting parts on your Machine
The first step in understanding how your machine is or is not counting parts is looking at its diagnostic page. Here is more information on the Machine Diagnostics page if you are unfamiliar with it.
In the following example, we are working with a test machine. While your machines will likely have different diagnostics, the general layout and naming of the fields will be the same.
In the image below, you can see that there is a Part Count and Part Count (Total) within the Path/Path section of the Diagnostics page. This is the part counter for Path1, and it has a significant number of parts being made. If you want to learn more about what a "Path" is, please see this article.
Additionally, there is a Work Counter Codes field within that section. This indicates which M-code we detect is being used to increment the part counter on this Path.
On the same Diagnostic page for this machine, there is also a Path/Path2 section with its own Part Count and Part Count (Total) data items. However, these are both at 0, meaning that no parts have been counted on this path. This Path also has a Work Counter Codes section, but there are no M-codes listed, which means there are no codes that will increment these counters.
If like in the example above you only have a single Path that is counting parts, you likely don't need to adjust any settings. However, if you have a single Path and are seeing incorrect part counts, you should verify that the M-code listed in the Work Counter Codes field is being included the appropriate number of times in your program.
If multiple Paths are counting parts and you're seeing an incorrect number of parts being counted in MachineMetrics, see the next section in this article on how to select a single Path to use for counting.
Select the Correct Part Count Metric/Path
If one or more of your machines are counting too many parts, you might have too many/the wrong part counter selected.
In MachineMetrics, navigate to Settings and select Machine Settings from the dropdown menu.
Select the Machine in question from the list of Machines on this page. Once on the Machine Form, you will see a list of options on the left side. Navigate to Data Rules, as shown in the image below:
Next, change the option selected by the Select Part Count Metric drop-down. You can leave this as "Default" if you wish to detect all parts from all counters, or you can change this to the part metric that matches the one on the machine that you wish to use for counting parts as shown below.
By selecting a specific part counting metric, your machine will only count parts when that metric increases. If after making this change you see that you are missing part counts, please confirm that the M-code that increments your control's part counter is included on that path for all programs.
Control Dependent Part Count Methods
Some controls have more options for configuring part counts, while others require certain steps to be taken for it to function. The sections below go over a few of these more specific methods.
FANUC FOCAS Controls
You can configure your FANUC control to count on any M code Except M98 and M99. If your machine is double counting you can use these steps to remove extra part count M codes or isolate to just the part count macro.
1. In MDI mode, press the System hardkey followed by Parameter softkey. use page down key to scroll to 6700
2. Change parameter 6700 bit 0 (The furthest bit to the right) to 1 (on)
3. Change parameter 6710 to the M code you would like to increment the part count
6700 bit 0 = count on M2, M30 or an M code specified by parameter 6710 or 1= only count on M code specified by parameter 6710
6710 = M code to count on - this can be any available M code except M98 and M99
5. The control may need reboot for parameter changes to take place.
Check with Manufacturer/FANUC before changing parameters to make sure the parameters are not in use by any other features.
MTConnect - Okuma
Many Okuma machines count on M89, If yours is not or not doing so accurately, you can use the following method:
1. Start the MTConnect application on your machine's control.
2. Open the "Device Configuration" page.
3. Select what variable(s) you would like to use for the part count by choosing a range of variables. Ex. Selecting 1 & 100 would enable variables 1 through 100.
4. Add a common variable code within your program to increment the part counter. An example of this is VC1=VC1+2 (this will increment Common Variable 1 two parts per count). Add this common variable code near the end of the program for best results.
5. When the common variable code and MTConnect Common Variable settings are finished, you will need to notify MachineMetrics of the variable used so that our configuration can match.
If you have any questions regarding part counting on any of your machines, reach out to us any time at firstname.lastname@example.org.“