Jump to content

PCM Parameter File


---
 Share

Recommended Posts

PCM Newbie here

Looking to transfer information read from bar scanner on robot to printout header.

Currently, scanner is reading barcode field and putting data into a register on the robot controller. Next, the robot is writing a text file called runpart.para. The problem is the information in the text file is only the barcode data with no name or label. I assume as long as the data in the text field is always in the same order, I could PCM to parse the data out and assign variable names to each data string. However, I am concerned about the data integrity. Could the data in the para file be rearranged somehow? I'm looking for ideas on how others might be handling this. I also looking into having the robot include the register address along with the data but the robot guy is not here right now 😮
Link to comment
Share on other sites

So you wish to assign variable names to all information from the runpart.para?
If that's correct this will do that for you.
barcodeFile=readListFile("c:\runpart.para") //reads runpart.para and stores as an array in barcodeFile.
for i = 1 to barcodeFile.size //itterate same amount of times as there are values. (min 1 time)
	value[i]=getParameterNamed(barcodeFile,i) //assign values one by one to value[counter]
next i  //next itteration in loop, until done
All values will be assigned to the variable value[incremental # based on # of lines in runpart.para] (If you have 3 lines of info, you will get value[1] value[2] value[3])

The data will not be re-arranged by any way, its collected row by row from top to bottom.
I don't how the barcode info looks like for you, but if certain values have different amount of characters or anyting else that systematically and consistently seperates them, it's possible to make re-arrangements based on that if you wish to do so.

And beware that the above code has the potential of failing if runpart.para is missing. (If you are building fully automated, unsupervisored stuff, you need to make sure the file exists before you run the loop. Either by waitForFile() or fileExists() and if-statements. Witch one to choose depends on your application.)

To build automation if fun, but it takes attention to details when separate systems communicate. It can work for thousands of times just to fail the same day summer vacation starts. And the reason can be a single unwanted space generated by something stupid, hidden in a subroutine deep down. Or something simple, just like the above, there are no control that a file that you wish to read actually has been created yet. Don't ask me how I know...
Link to comment
Share on other sites

Tom, by "rearranged", do you mean the robot controller may already rearrange the data?
As long as the barcode data has a fixed order, that shouldn't happen, especially when the data from the robot has no labels. If it's intended to be read by an external application, there should be a format spec available (the robot guy should know). If there are any rearrangements that can happen, the specs must mention them and the exact circumstances under which they occur. If that's the case, you would of course have to write your PCM code to react accordingly. But there shouldn't be any "random" rearrangements, because that would be a very stupid way of transmitting data to external apps.
Link to comment
Share on other sites

Please sign in to view this quote.

I agree that it is probably not likely but when dealing the medical industry, there are many requirements to make sure nothing could go wrong. All it takes is for some engineer to come up with a "What happens if....?" question.

I just spoke with the robot guy and he feels we should be able to output data like lotId="123L5" which solves my major concern.
Link to comment
Share on other sites

Please sign in to view this quote.

Eric, I was more concerned that a glitch could cause the output from the robot controller to be in a random order. I'm being told that is highly unlikely, but I need to prepare for a worst-case scenario. Update: As I stated in my reply to Norbert, I think we may have solved the data control concern with the ability to add names to the data.
Link to comment
Share on other sites

Then you can simplify by using something like this:
waitForFile("runpart.para")
readPCMFile("runpart.para")
And all values will be in the calypso cache "as is". E.g (lotId="123L5")
Link to comment
Share on other sites

Can pcm script be saved as a file and called from the parameters window? I have several parts and would like to be able to edit one file and have file available for all programs to run.
Link to comment
Share on other sites

Yes, then you use
runPCMFile("Toms stuff")
that will read and execute the code just as it was written in the pre or post settings of a plan/feature/etc.
Link to comment
Share on other sites

I think I may have stumbled onto a better idea and that is to use external pcm txt files that will execute pcm code at various times in the program, i.e. inspection_start_pcm.txt The benefit is that it does not require editing the program with call,i.e. runPCMFile

I have about 20 programs that will use the same pcm code. This would certainly make it easier for changes.

What do you think?

On a somewhat related topic. I need to run a probe qualification every X hours. However, this requires the robot to remove the part fixture and place the reference sphere on the table. If we use a timer, we don't want to be getting ready to run a part and then have the timer run out. This would require the robot to remove the part, remove the part fixture and then proceed with probe qual. If we set a timer = to X-15 minutes, we test for the time before we start a measurement. The benefit of using the time limit on the stylus system is we can keep control of qualification status during any periods that robot is down and operator has to run CMM manually.

I know we can set a X time limit in the stylus system properties but is that time value able to be read by pcm?
Link to comment
Share on other sites

You are right, but. If you need to edit the pcm code, you have multiple places to edit then. How about runPCMFile() in the inspection_start_pcm.txt. Thats neat 😉

I would personally never use a timer along with human interaction.. A quick smoke break or some hanky panky with a female colleauge in the janitors closet at the night shift, time ticks on and boom. If thats what you meant. But reading it again and I belive you meant something else.

Yes you should be able to get that time, but I'm lying in my sofa watching that new movie "The Meg". And the only thing a can come up with direct from my head is:
getProbe().probeDate
That will give you the last qualification date.

Sounds like you have a fun job... 😉
Link to comment
Share on other sites

Tom,

Does it have to be x # of hours or could it be x # of parts? I'm thinking that if they could do it by #of parts then the machine would know when to swap out without worrying about the time.
Link to comment
Share on other sites

 Share

×
×
  • Create New...