Jump to content

Bonus Calculation with PCM


---
 Share

Recommended Posts

my bonus is not calculating correctly. what am i doing wrong? the feature is 4mm±0.1.
If the feature is in spec, subtract the nominal and give the absolute value. If the feature is not within spec there is no bonus.
when I use "display(4_B3_BONUS_TOL)" the bonus tolerance it shows 4. what gives? its like it isn't subtracting the difference...
TIA,
JG

//GIVE BONUS IF FEATURE IS IN SPEC

ITEM_4_B3_FEATURE=getActual("B-3 Hole").diameter

//	               LCL                      UCL
if ITEM_4_B3_FEATURE>3.9 and ITEM_4_B3_FEATURE<4.1 then
	4_B3_BONUS_TOL=abs(ITEM_4_B3_FEATURE-4)
else
	4_B3_BONUS_TOL=0
endif
Link to comment
Share on other sites

your code worked for me. I plugged in into my currently opened program and changed your variable to my variable STEMLEN (Stem Length).
when the conditions greater than and less than were both true, it gave me a bonus result.
When one condition was true and one was false, it gave me Zero


What is the actual value of "ITEM_4_B3_FEATURE" diameter?

in tol.JPGout of tol.JPG

Link to comment
Share on other sites

If i just test out my code by setting a value for the variable and display the outcome my display should say 0.05 if the feature is in spec or 0 if its out of spec. I get "4" no matter if my feature is in spec or out of spec... am I missing something?

My calypso version is 6.4.28

OUT OF SPEC.PNGIN SPEC.PNG

Link to comment
Share on other sites

Change the variable names, PCM does not work good when the variable names start with a number:

//GIVE BONUS IF FEATURE IS IN SPEC

ITEM_4_B3_FEATURE=4.2

//	               LCL                      UCL
if ITEM_4_B3_FEATURE>3.9 and ITEM_4_B3_FEATURE<4.1 then
	B3_BONUS_TOL=abs(ITEM_4_B3_FEATURE-4)
else
	B3_BONUS_TOL=0
endif
Link to comment
Share on other sites

There are some limitations when we write PCM Code, in this case you could obtain the error message adding spaces between operators, numbers and variables:
1375_c93c90ca2ad69a85bf9fb46c7d14da79.png
ITEM_4_B3_FEATURE = 4.2

//	               LCL                      UCL
if ITEM_4_B3_FEATURE > 3.9 and ITEM_4_B3_FEATURE < 4.1 then
	4_B3_BONUS_TOL = abs(ITEM_4_B3_FEATURE - 4)
else
	4_B3_BONUS_TOL = 0
endif
Link to comment
Share on other sites

It's not a quark. It's a native radix function.
Where the first digit(s) assign the base. In your case you try to use "4" as base (Quaternary) and message that to "_" witch is nothing less then syntax error.
Link to comment
Share on other sites

yeah I meant quark because it gave me no error message, but that makes sense Eric thanks for the explanation. Just something to keep in mind when using variables. appreciate the feedback guys!
Link to comment
Share on other sites

Mmm when reading what I wrote, I see that it might be unclear what I was trying to say.

4_B3_BONUS_TOL=abs(ITEM_4_B3_FEATURE-4)

Lets see if We can spead a little light over this scenario.
The blue-ish one, will be our base. The green our function and finally the red will be our string.

So, what you actually tell Calypso to do is to use the function _ (that doesnt exist, except as an object) and convert the string "(B3_BONUS_TOL=abs(ITEM_4_B3_FEATURE-4)" that you say is of quaternary format. Wich its absolutely not.

So as Israel pointed out, you wont get a pcm error message without using space. Because without space you are not using pcm. Actually, you don't even assign a value properly to you variable, even if you use =. Because its interpteted as a string, that is the message to the reciever of 4 to the function _.

Hope this clear things up.
Link to comment
Share on other sites

 Share

×
×
  • Create New...