Page 1 of 2 12 LastLast
Results 1 to 12 of 24

Thread: Using a system variable (time) to start a program

  1. #1
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    50
    Downloads
    0
    Uploads
    0

    Question Using a system variable (time) to start a program

    OK guys,
    I have two machines, one is a Kitamura HX500i and the other is a Makino A51. I need to run a warmup program for the axis and the spindle for atleast 30 minutes prior to production to ensure all the axis and the spindle is warmed up enough to produce parts with consistency. We have seen as much as .003" change in dimensions from running a part with the machine "cold" and after running a warm-up program for a period of time. We have a down time of approx 4 hours between 2nd and 1st shift (2am to 6am) and want to try to get a macro program to start a program at a set time (lets say 0500 hrs everyday).

    I was thinking of maybe having the operator start a program at the end of 2nd shift, or incorporate a macro to start the warm up if the machine sits for a set period of time waiting (i.e. when the operator leaves at the end of 2nd shift with the pallet #2 ready to go, it goes in normally, but when that done, the machine will just sit waiting on the pallet ready button to be pressed for the pallet #1 to go back in, but as the operator has gone for the day and pallet #1 still has finished parts so dont want to rerun over it, the machine just sits waiting).


    Is this possible? What variables would I look at?


    Thanks,
    Jake


  2. #2
    Registered
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    989
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Jake E. View Post
    OK guys,
    I have two machines, one is a Kitamura HX500i and the other is a Makino A51. I need to run a warmup program for the axis and the spindle for atleast 30 minutes prior to production to ensure all the axis and the spindle is warmed up enough to produce parts with consistency. We have seen as much as .003" change in dimensions from running a part with the machine "cold" and after running a warm-up program for a period of time. We have a down time of approx 4 hours between 2nd and 1st shift (2am to 6am) and want to try to get a macro program to start a program at a set time (lets say 0500 hrs everyday).

    I was thinking of maybe having the operator start a program at the end of 2nd shift, or incorporate a macro to start the warm up if the machine sits for a set period of time waiting (i.e. when the operator leaves at the end of 2nd shift with the pallet #2 ready to go, it goes in normally, but when that done, the machine will just sit waiting on the pallet ready button to be pressed for the pallet #1 to go back in, but as the operator has gone for the day and pallet #1 still has finished parts so dont want to rerun over it, the machine just sits waiting).


    Is this possible? What variables would I look at?


    Thanks,
    Jake
    Hi Jake,
    Yes its possible, but it would require modification to the PMC program, or a relay that is controlled by one of the interface signals, to effectively press the pallet ready button. Post back if you want to get involved with that and I or other Forum members will be able to explain.

    Regards,

    Bill


  3. #3
    Registered fordav11's Avatar
    Join Date
    Aug 2011
    Location
    Fordaville
    Posts
    1713
    Downloads
    0
    Uploads
    0
    if the machine is left running after the operator leaves it should be possible as long as the machine has not got to the M00 or APC wait command.
    you could have a macro time check at the end of the program that checks the time and if after 2am (when no one is there) then sit there and wait until 5am then run a macro that does a warmup.
    if not between 2am to 6am it skips the macro warmup and runs as per normal.

    Initially I'm not thinking of it in CNC Macro terms, more in very rough pseudo-code computer programming terms.
    Basically just ideas. something like.....

    Let's say the time is 2:48am when the machine reaches the end of the program.....


    Function (convert_current_time_to_decimal)
    Begin
    A = hour macro variable (e.g. 02)
    A = A + 100 (=200)
    B= minute macro variable (e.g. 48)
    C= A+B (248)
    End

    (Skip Normal Working Hours)
    IF C > 600 GOTO 100 (i.e. any time from 6am to 23:59, operator there working)
    the next line is only read if time is between 000 (midnight) and 1:59am (159)
    IF C < 200 GOTO 100 (i.e. operator is still present and working)
    the next line is read if time is 2am or after

    (Time is now after 2am)
    IF C > 200 THEN
    WHILE C > 200 AND < 500 DO1
    DWELL 60 seconds (i.e. G04 U60.0 or whatever time period you want)
    Convert_Current_Time_To_Decimal (this calls the above Function)
    C = C (i.e. set old time value to current time value)
    END1
    RUN warmup
    100 END


    *edit*
    Adding a rough macro. The manual says time is one variable (#3012). I had previously thought each component (H:M:S) was separate. This makes it even easier as the time variable is a decimal number.


    The actual macro might look like this..... (Note I have not checked if this runs nor have I check the formatting for the IF or WHILE). The theory is solid though


    %
    O0001
    (normal program here)
    ......
    ......
    M98 P9000 (call macro. check current time variable and run warmup program when time is after 5am)
    M00
    (APC command here or whatever is called to keep the machine going on the next pallet)
    M30

    %
    O9000 (time check)
    IF [#3012 GT 060000] GOTO 100 (i.e. any time from 6am to 23:59, operator present. #3012 within range 060000 to 235959)
    IF [#3012 LT 020000] GOTO 100 (i.e. operator is still present and working. time between midnight and 2am. #3012 within range 000000 to 015959)
    IF [#3012 GT 020000] THEN (time is now after 2am but before 6am)
    (not sure of the exact formatting for a double WHILE check with an AND.....)
    WHILE [#3012 GT 020000 AND LT 050000] DO1
    (maybe WHILE [[#3012 GT 020000] AND [#3012 LT 050000]] ??)
    G04 U60.0 (wait 1 minute or U600.0 wait 10 minutes etc.)
    END1
    M98 P0002 (call warmup program)
    N100 M99
    %

    %
    O0002 (warmup program)
    (some warmup stuff here)
    .....
    .....
    M99
    %



    I pulled this out of my ass. Be kind with your comments and corrections
    Last edited by fordav11; 02-02-2012 at 07:52 AM.


  4. #4
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    50
    Downloads
    0
    Uploads
    0
    Thanks guys,
    I will be looking into it today, hopefully the program idea by fordav will work for me.

    Again, thanks and will post up status later.

    Jake


  • #5
    Registered fordav11's Avatar
    Join Date
    Aug 2011
    Location
    Fordaville
    Posts
    1713
    Downloads
    0
    Uploads
    0
    I ironed out the bugs.
    I still couldn't get the WHILE with AND working on the machine just an alarm
    (125 FORMAT ERROR IN MACRO) but not really needed anyway.
    Two nested WHILE's will do the same thing.
    This is tested and works....

    %
    O9000 (CHECK TIME / RUN WARMUP)
    #100=20000 (START WAITING)
    #101=50000 (START WARMUP)
    #102=60000 (END WAITING)
    #103=#3012 (TIME WHEN THIS MACRO STARTS)
    IF [#3012 GT #102] GOTO 100 (AFTER 6AM)
    IF [#3012 LT #100] GOTO 100 (BEFORE 2AM)
    IF [#3012 GT #100] THEN (AFTER 2AM)
    WHILE [#3012 GT #100] DO 1
    WHILE [#3012 LT #101] DO 2
    G4 U1.0
    #100=#3012
    END 2
    END 1
    M98 P0002 (RUN WARMUP PROGRAM)
    N10 M00
    M99
    %

    The way it works is the start time is checked and if not within the range 2am
    to 6am it jumps to N10
    #100 is checked and the outer loop (DO 1) starts
    #101 is checked and the inner loop (DO 2) starts.
    #100 is re-used and counts up every second because of the dwell.
    The current time is getting closer to the warmup time (#101) each second. Because
    #100 is getting larger every second as well the current time eventually becomes
    equal to #100 which ends the outer loop (DO 1) at the same time as the inner loop
    ends (DO 2)
    At that point the M98 is read.

    The added variables at the top allow you to watch (or debug) the progress by
    monitoring the variables on the macro variable page.
    #103 is there purely to see when the macro actually started (assuming the
    machine was running when everyone went home #103 = the time when the
    PALLET of parts was completed.

    Note the time format. it's 24 hour military time etc.
    020000 is 02:00:00 (2am) but the leading zeros are truncated so 2am = 20000.
    6am = 60000.
    3:30pm is 153000.
    etc

    By changing #100,#101 and #102 and the IF checks you can get this to start
    any time you want or skip it entirely.
    Last edited by fordav11; 02-03-2012 at 09:27 PM.


  • #6
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1275
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fordav11 View Post
    ...
    WHILE [[#3012 GT 020000] AND [#3012 LT 050000]] ??)
    ...
    AND would work as intended provided parameter 6006#0 is set to 1.


  • #7
    Registered fordav11's Avatar
    Join Date
    Aug 2011
    Location
    Fordaville
    Posts
    1713
    Downloads
    0
    Uploads
    0
    that's interesting. thanks for the info.
    6006 is not listed in my manual (Fanuc Series 21i Model A Parameter Manual B-63090EN/01)
    an older 18 series manual has it listed. It disables all logical operations!

    my parameter is set to 0.
    I will test this next week and report back....

    I also discovered it is listed in the later revision B-63090EN/02 parameter manual.


  • #8
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1275
    Downloads
    0
    Uploads
    0
    See the attachment for more details.

    Fanuc gives ample scope to confuse the users. I cannot see any utility of this parameter except to keep CNC forums going.
    Attached Files Attached Files


  • #9
    Registered fordav11's Avatar
    Join Date
    Aug 2011
    Location
    Fordaville
    Posts
    1713
    Downloads
    0
    Uploads
    0
    I tried it again after changing parameter 6006.0 to 1
    It still gives an alarm: 125 FORMAT ERROR IN MACRO

    I even tried something simple like
    WHILE [#100 AND #101] DO 1

    same alarm.


  • #10
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1275
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fordav11 View Post
    WHILE [#100 AND #101] DO 1
    This syntax is not correct.
    #100 and #101 should be replaced by conditional expressions returning TRUE or FALSE.
    What other syntax you tried?


  • #11
    Registered fordav11's Avatar
    Join Date
    Aug 2011
    Location
    Fordaville
    Posts
    1713
    Downloads
    0
    Uploads
    0
    I'm not really trying to evaluate anything to true or false. I just want to do one calculation AND another calculation until they are LT or GT something else then exit the WHILE

    This is what I tried. it doesn't work.
    WHILE [[#3012 GT 20000] AND [#3012 LT 50000]] DO 1

    at this point is doesn't really matter because I solved the initial problem using two WHILEs
    it's more of a curiosity now
    Last edited by fordav11; 02-06-2012 at 08:23 AM.


  • #12
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1275
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fordav11 View Post
    ...
    This is what I tried. it doesn't work.
    WHILE [[#3012 GT 20000] AND [#3012 LT 50000]] DO 1
    The syntax is correct. I am clueless as to why this gives format error.
    Please try this and check if it works:
    #1 = #3012;
    WHILE [[#1 GT 20000] AND [#1 LT 50000]] DO 1;


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. Replies: 1
      Last Post: 11-17-2011, 09:38 AM
    2. Replies: 0
      Last Post: 12-27-2010, 03:55 AM
    3. Dry-run system variable?
      By machzero in forum Okuma
      Replies: 3
      Last Post: 06-12-2009, 10:08 AM
    4. okuma time variable
      By Bala in forum Okuma
      Replies: 1
      Last Post: 11-28-2007, 05:55 AM

    Posting Permissions



    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.