Which Looping commands to use for this situation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Which Looping commands to use for this situation

    Hey all,

    I have a program that measures a part of known values with several probes. I need to be able to choose between them in a logical way. I'm not sure which of all the possible loop combinations would be best.
    What I need to happen:

    given probes A B C D E F
    given 3 sets of 5 features SET1 SET2 SET3

    always measure SET1 with probe A.
    always measure SET2 and SET3 with probe B.

    Operator then chooses which of the remaining probes to use, I have tracefields and variables that get set to YES or NO.

    C is chosen: measure SET2 and SET3 with probe C.
    D is chosen: measure SET3 with probe D.
    E is chosen: measure SET2 and SET3 with probe E.
    F is chosen: measure SET2 with probe F.

    Each probe other than A and B are optional.

    Currently:
    Each set gets dimensioned immediately after its features.
    Each set has a name label at the beginning of the code block.

    End goal is to measure each set as required with only the single operator input at the beginning for the tracefield.
    Any combination of flow control commands to get to this end is open for consideration. I'm asking for advice hoping to avoid falling down the rabbit hole of brute force testing.

    Thanks in advance!

    Derrick







  • #2
    Not seeing any need for Looping at all, it's just a modular program with a Form with 4 checkboxes for the C/D/E/F choice and a bunch of IF blocks to skip or not skip sections of the program as needed.

    I'm guessing you don't have a probe changer, thus the need to involve the Operator in making decisions about choosing which probe to measure with? That makes very little sense to me.

    Comment


    • derrickcoyne
      derrickcoyne commented
      Editing a comment
      I do have a probe changer, I need to run the same features with different probes depending on the data we need. I did not want to have the 5 features of each set have its own name, line of code, and dimension for every probe, so I assumed that looping the features was appropriate.

  • #3
    I'm not sure which part of the program you are looking to "loop" as it's not clear from your description - looks more like a flow control problem to me. The easiest way to handle the probe selection would be to use CASE statements. I would structure the program something like this....


    Start of prg. (header, startup alignment, parameters (pre-hit retract, speeds etc)
    input comment - prompt operator for probe selection, C,D,E,F
    assign selection to PRB_CHOICE variable
    LoadProbe - PROBE A
    manual alignment (or recall external)
    DCC alignment
    measure SET 1 features

    case statements to handle probe selection for 2nd set
    Code:
                SELECT/PRB_CHOICE
                  CASE/"C"
                    ASSIGN/PRB_NAME="PROBE_C"
                  END_CASE/
                  CASE/"D"
                    ASSIGN/PRB_NAME="PROBE_B"
                  END_CASE/
                  CASE/"E"
                    ASSIGN/PRB_NAME="PROBE_E"
                  END_CASE/
                  CASE/"F"
                    ASSIGN/PRB_NAME="PROBE_F"
                  END_CASE/
                  DEFAULT_CASE/
                    ASSIGN/PRB_NAME=B
                  END_DEFAULTCASE/
                END_SELECT/
                LOADPROBE/PRB_NAME
    measure SET 2 features

    case statements to handle probe selection for 3rd set
    Code:
    SELECT/PRB_CHOICE
    CASE/"C"
    ASSIGN/PRB_NAME="PROBE_C"
    END_CASE/
    CASE/"D"
    ASSIGN/PRB_NAME="PROBE_D"
    END_CASE/
    CASE/"E"
    ASSIGN/PRB_NAME="PROBE_E"
    END_CASE/
    CASE/"F"
    ASSIGN/PRB_NAME="PROBE_B"
    END_CASE/
    DEFAULT_CASE/ ASSIGN/PRB_NAME=B END_DEFAULTCASE/
    END_SELECT/
    LOADPROBE/PRB_NAME

    measure SET 3 features

    Comment


    • derrickcoyne
      derrickcoyne commented
      Editing a comment
      I'm parsing your code, it seems to me each case only selects one? Depending on need, I might have to run A B and D in the morning, A B C D at noon, and then all 6 at close of shift, with expectation that it runs through without further human intervention other than telling it which probes we need.

  • #4
    You could use an array to hold the probe names / selection order. I'm still not entirely sure what you are trying to do? If you just want to run the same set of features but with varying probe combinations it may be easier to use automation to continuously execute the program but populate the loadprobe command with the relevant probe file name each time. The multiexecute wizard that ships with PC-Dmis allows you to run a program a set number of times or continuously until execution is cancelled so this may be a good place to start. I think the source code used to be included as part of the install for older versions of PC-Dmis - possibly pre 2011, but I'd have to check when we stopped including it to be sure.

    Comment


    • derrickcoyne
      derrickcoyne commented
      Editing a comment
      That's exactly what i want. Continuously execute the program until all the probes the operator selected have measured the relevant feature sets. Preferably without having to do an alignment each probe iteration.

  • #5
    I don't understand why? If you measure with one probe why do you need to need/want to measure it with other probes?
    Automettech - Automated Metrology Technology

    Comment


    • derrickcoyne
      derrickcoyne commented
      Editing a comment
      We aren't measuring a production part. We're measuring an NIST traceable object of known value to ensure that the probes and angles are within our uncertainty.

  • #6

    Originally posted by derrickcoyne View Post
    We aren't measuring a production part. We're measuring an NIST traceable object of known value to ensure that the probes and angles are within our uncertainty
    Aha! At last we arrive at the true goal. You should have begun with this, I was going to rant about metrology until I saw this.
    Your initial idea was completely right: this will be a Loop, a simple Do/Until that only runs 2 times.


    Originally posted by derrickcoyne View Post
    given probes A B C D E F
    given 3 sets of 5 features SET1 SET2 SET3

    always measure SET1 with probe A.
    always measure SET2 and SET3 with probe B.

    Operator then chooses which of the remaining probes to use, I have tracefields and variables that get set to YES or NO.

    C is chosen: measure SET2 and SET3 with probe C.
    D is chosen: measure SET3 with probe D.
    E is chosen: measure SET2 and SET3 with probe E.
    F is chosen: measure SET2 with probe F.
    Begin with a PC-DMIS form before the Loop to get the operator input(s) in a single step because the radio buttons make this super easy.
    Their choice gets translated to the value assigned to a varible for probe name.

    SET1 with Probe A runs before the Loop, always.

    Counter variable is assigned to value 0.
    Do Loop begins.
    Counter variable is assigned to value Counter variable + 1

    SET2 and SET3 each begin with a CASE statement testing the # of the loop:
    CASE 1: if this loop #1, assign probename B to the LOADPROBE variable value.
    CASE 2: if this loop #2, assign probename from Operator's Choice variable to the LOADPROBE variable value.

    However, SET2 has an additional IF that tests the LOADPROBE for Probe Choice D which means SET2 gets skipped, I would simply use a GOTO and a Label after the set's end to jump out of the set completely.
    Likewise, SET3 has the same IF code but keyed to exit/skip the set for probe Choice F.

    At the end, the Until condition is simply Counter variable = 2.

    Comment


    • derrickcoyne
      derrickcoyne commented
      Editing a comment
      What would your advice be for angle changes? the other 4 machines on this rotation would have to do set 1 at a0b0, set 2 at a90b0, set 3 a90b180, set 4 at a90b90 and set 5 at a90b-90. what i've got so far is a tangled mess of spaghetti that I don't even know will work

  • #7
    Originally posted by derrickcoyne View Post
    What would your advice be for angle changes? the other 4 machines on this rotation would have to do set 1 at a0b0, set 2 at a90b0, set 3 a90b180, set 4 at a90b90 and set 5 at a90b-90.
    If different things are needed for each machine, then lucky you gets to employ the fun File I/O utilities.
    The basic idea is that each machine's computer has a hard drive with a C:\Derricks_Important_Folder_Dont_Touch folder, and in each of those folders is a little text file named Which_Machine.txt.
    The actual contents of the files vary, each one has only 1 line composed of a unique machine identifier.

    Your program uses FILE/READ to open up this file, as it's always the same filename in the same filepath on every machine, and dump the contents into the value of a variable.
    This variable will be used in some IF/END_IF blocks to set the values of variables that will be put in place of the tip angles.
    Code:
                IF/MACHINE == "BIG1"
                ASSIGN/VAR_ANG="A90B0"
                END_IF/
    You can also have it write info to files, for data export or for temp storage.


    Originally posted by derrickcoyne View Post
    what i've got so far is a tangled mess of spaghetti that I don't even know will work
    Create Operator Comments at key transition points in the program.
    In the Edit Window (Command Mode), the text of the comment looks something like this:
    Code:
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                "Key Point Before SETxx, Current Value of Variable VARPROBE is: " + VARPROBE
    except you'll have multiple lines, each one displaying what the current value of each important variable is at that point in time.
    Be very deliberate with keeping text chunks enclosed in quotes and use the plus signs to concatenate them with variables.

    The idea is that during testing, you are the operator and supply the input - and expect the variable values to behave accordingly. These Oper comments allow you to track what's happening in the dynamic execution. I put them before IF tests to see values and inside the IF blocks so if the IF test fails we should NOT even get the comment at all.

    This is fun, because instead of seeing the machine slam into the part/fixture/probe rack you see an Operator Comment warning you that your variable values are empty because the FILE/READ command screwed up on your typo of the variable name and the machine is headed down a very bad path... so you click merely sigh, curse, hit CANCEL on the Oper Comment, and prevent a tragedy.

    When you are all done testing, fixing, re-testing, re-fixing, cursing, banging head on desk, re-testing, fixing, repeat 10x, then you flip all these Oper Comments to $$ comments so they remain in place (for future problem-solving and/or upgrade testing) but are inert.



    Comment


    • Kp61dude!
      Kp61dude! commented
      Editing a comment
      What you just explained here ^^^ it's called the 'poor man's' debugger.

  • #8
    Ah heck, I typed 'machine' when I meant to type 'probe.'. on each Machine I have a variable number of probes, and each of these probes must measure at certain angles. File I/O as you describe isn't necessary as each machine is set up differently enough that I plan on having a local program on each computer. I was wanting to loop through sets of features with a different probe /angle each time.

    Comment


    • #9
      Originally posted by derrickcoyne View Post
      Ah heck, I typed 'machine' when I meant to type 'probe.'. on each Machine I have a variable number of probes, and each of these probes must measure at certain angles. File I/O as you describe isn't necessary as each machine is set up differently enough that I plan on having a local program on each computer. I was wanting to loop through sets of features with a different probe /angle each time.
      No problem. The plan I posted on 7-17 uses a variable for the probe name. Simply add another variable for tip angle, and set it up to get assigned as needed at the same time as the probe name.

      Expand this requirement plan to include angles:
      C is chosen: measure SET2 and SET3 with probe C @ angle __
      D is chosen: measure SET3 with probe D @ angle __.
      E is chosen: measure SET2 and SET3 with probe E @ angle __.
      F is chosen: measure SET2 with probe F @ angle __.

      You can even add more loops and measure the features over again with multiple probe & angle combos.

      Comment

      Related Topics

      Collapse

      Working...
      X