For machine-data acquisition it’s often necessary to access, read and use data stored at the PLC (Fanuc: PMC) of a controller. For machines equipped with FOCAS-enabled Fanuc controllers you can use the utility program fanucpmc to do so.
For your convenience a new program with a graphical user interface is now also included in fanucpmc.zip, FanucPMCGui.exe (Ver. 4.7.1.0).
FIG 1: FanucPMC GUI Version
Initially this utility was developed for a project with lots of machines, all equipped with Fanuc controllers but from different manufacturers. The requirement was to get part counter values from all machines. Unfortunately machine manufacturers are free to store such values at different locations including the PMC. With fanucpmc it was possible to scan the PMC and find the location of the values. The program is also very useful for process, tool and quality data acquisition.
DOWNLOAD SOFTWARE
Important: If you’re using HSSB (High Speed Serial Bus) see notes on HSSB below. In both cases run the test directly on the PC with the HSSB interface card!
If you can access the controller via the network it is highly recommend to use the program on a laptop with a network connection at the shop-floor in front of the machine. For safety reasons it is recommended NOT to use the program on machine during production.TOP
STEPS
Download fanucpmc.zip.
Extract all contents of fanucpmc.zip to a folder on your PC.
Open a command line (run CMD), navigate to the folder with fanucpmc.exe
Ping the controller, verify that you get a response.
If you just type in fanucpmc the program shows 4 required and one optional arguments (1): IP or DNS Hostname PMC Area Start Address End Address HSSB Type (optional 1 = real HSSB, 2 = NCGUIDE (Simulator) HSSB)
Type in something like ‘fanucpmc IPORHOSTNAME 9 1103 1106 (2). In this example the user data section 9 is accessed and values from address 1103 to 1106 are read. If data can be found at the selected addresses the program outputs it similar to the following:
FIG 2: Fanucpmc: Read PMC data
In the above example the program found data for addresses 1103, 1104, 1105 and 1106. If you get an error please look here (section PMC Data Window) to find out the reason.
The program accesses 3 types of data, byte, word and long. For datatype long it outputs 2 values, float and long (float is just long * 60 / 100000, may be required sometimes).
At address 1106 values for all 3 datatypes were found.
Tip: To output the results to a file you can simply type in fanucpmc IPORHOSTNAME PMCAREA STARTADDR ENDADDR > test.txt at the command line. The output then is sent to file test.txt (in the same folder as fanucpmc) instead of the monitor. For different areas or addresses you can use different file names.
In practice fanucpmc can be used for various requirements: If you know that the machine stores part counter values at the PMC you can note down the value shown at the operator panel, scan the PMC (not too much addresses at the same time!), store the output in a file and search the file for the value (for part counter values look at the byte type). You probably will find more than one matching value. Let the machine produce one part. Scan again and search for the value. By doing so it is even possible to find these values without any documentation or assistance of the machine manufacturer.
In case you want to track things like process parameters you can use the same technique: Look at the output at the operator panel and note down the respective value. Scan the PMC and try to find the value. Change the value and scan again. As it is common that the operator panel displays converted values it may be necessary to get the conversion formula from the machine manufacturer.TOP
HSSB
If your machine has a PC that is connected to the controller via HSSB or you use HSSB features of FANUC’s NCGUIDE simulation software the above procedure is slightly different. In both cases do NOT use the dll files starting with fwlib (e.g. Fwlib32.dll) included in fanucstate.zip. For HSSB on a real machine use the fwlib dll’s that the machine’s PC uses (search for them). For NCGUIDE use the following 5 dll’s that are installed by NCGUIDE: fwlib0DN.dll, Fwlib32.dll, fwlibNCG.dll, hssb.dll and mcnhssb.dll.
For the fanucpmc instead of command ‘fanucpmc IPORHOSTNAME PMCAREA STARTADDR ENDADDR’ type in ‘fanucpmc IPORHOSTNAME PMCAREA STARTADDR ENDADDR 1’ on a real machine or ‘fanucpmc IPORHOSTNAME PMCAREA STARTADDR ENDADDR 2’ for HSSB with NCGUIDE.TOP
USE THE OUTPUT
CNCnetPDM
If you are building your own device driver for CNCnetPDM you can simply use the output of fanucpmc to create logic for output of machine- process and quality data to your application. In the following code excerpt (C++) the PMC output of various addresses is used to fill a char array which then is used to create a database record with multiple process parameters. The process parameters are delimited with pipe symbols ‘|’. In practice this code is used to track process parameters on AGIE sinkers. The program uses a for loop to query values from different addresses. Conversion formulas are applied.
i1 is the address to be queried
pmc_rdpmcrng is the function to query the PMC
hfanuc is the communication handle
&fanpmc points to structure IODBPMC
cQuality is the char array to store the values
cNoresult is the standard value if the function returns no valueTOP
CODE EXAMPLE (C++)
for (int i = 1; i < 10; i++)
{
// short adr_type, short data_type, short s_number, short e_number, short length, IODBPMC *buf)
switch (i)
{
case 1: i1 = 4160; // P - Verfügbarer Spitzenstrom
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%.1f%.1s", (float)fanpmc.u.idata[0] / 10, cDelim); // float 1 decimal (coded!)
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 2: i1 = 4094; // A - Impulsdauer
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%.1f%.1s", (float)fanpmc.u.idata[0] * 0.2, cDelim); // float 1 decimal 0.2 microseconds
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 3: i1 = 4100; // B - Pausendauer
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%.1f%.1s", (float)fanpmc.u.idata[0] * 0.2, cDelim); // float 1 decimal 0.2 microseconds
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 4: i1 = 4174; // SV - Bearbeitungsservo
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%d%.1s", fanpmc.u.idata[0], cDelim); // int
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break; //...
case 5: i1 = 4170; // R - Rückzugdauer
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%.3f%.1s", (float)fanpmc.u.idata[0] / 1000, cDelim); // float 3 decimals milliseconds
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 6: i1 = 4332; // U - Bearbeitungsdauer
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%.3f%.1s", (float)fanpmc.u.idata[0] / 1000, cDelim); // float 3 decimals milliseconds
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 7: i1 = 4412; // Vpuls- Abhebegeschwindigkeit (Standard pulsation tab)
if (!pmc_rdpmcrng(stat.hFanuc, 9, 2, i1, i1 + 3, 8 + 4 * 1, &fanpmc)) // Long = 2
{
sprintf(buf, "%.0f%.1s", (float)fanpmc.u.ldata[0] * 60 / 100000, cDelim); // float 0 decimals
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 8: i1 = 4158; // M - Bearbeitungsmodus
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%d%.1s", fanpmc.u.idata[0], cDelim); // int
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
case 9: i1 = 4104; // C - Schlichtkapazität
if (!pmc_rdpmcrng(stat.hFanuc, 9, 1, i1, i1 + 1, 8 + 2 * 1, &fanpmc))
{
sprintf(buf, "%d%.1s", fanpmc.u.idata[0], cDelim); // int
strcat(stat.cQuality, buf); // Add to stat.cQuality
}
else
strcat(stat.cQuality, cNoresult); // 0|
break;
default:
break;
} // End switch
} // End for