[Me...] Posted January 13, 2020 Share Posted January 13, 2020 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 More sharing options...
[Ro...] Posted January 13, 2020 Share Posted January 13, 2020 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 More sharing options...
[Me...] Posted January 13, 2020 Author Share Posted January 13, 2020 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.28OUT OF SPEC.PNGIN SPEC.PNG Link to comment Share on other sites More sharing options...
[Is...] Posted January 14, 2020 Share Posted January 14, 2020 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 More sharing options...
[Ro...] Posted January 14, 2020 Share Posted January 14, 2020 Please sign in to view this quote. Yes! Good catch Israel. Link to comment Share on other sites More sharing options...
[Me...] Posted January 14, 2020 Author Share Posted January 14, 2020 It makes sense but doesn't haha...A PCM quark I guess.Thanks for the suggestion It worked like a charm now! Please sign in to view this quote. Link to comment Share on other sites More sharing options...
[Is...] Posted January 14, 2020 Share Posted January 14, 2020 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: 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 More sharing options...
[Er...] Posted January 14, 2020 Share Posted January 14, 2020 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 More sharing options...
[Me...] Posted January 14, 2020 Author Share Posted January 14, 2020 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 More sharing options...
[Er...] Posted January 14, 2020 Share Posted January 14, 2020 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 More sharing options...
[Is...] Posted January 15, 2020 Share Posted January 15, 2020 4r10 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in