Build Thread Tree325 Retrofit Started - Page 13


Page 13 of 18 FirstFirst ... 310111213141516 ... LastLast
Results 241 to 260 of 343

Thread: Tree325 Retrofit Started

  1. #241
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hey Peter, try these files. I saw you posted these a few days ago but ive been busy sorry. I think you were on the right track with the code in the second post. Im not sure if you can just set DAC to -speed. You may have to use something like speed = speed * -1 and then set the DAC value.

    These files should work. I added the spindle.c code to M3 and M4 in case they get ran by themselves without a S code. You wont need to set a variable for M3 or M4 as the persist variables (9 for spindle speed) will be remembered. Also since each "if statement" is only doing one liine of code i removed the brackets to make it a little cleaner.

    Attached Files Attached Files


  2. #242
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hi PeterTheWolf,

    Yes that can be a bit confusing. GCode has an order of doing things when they are specified on the same line. For example with:

    M04S200

    The S action is performed first and then the M04 regardless of the order placed on the line. I think the logic is that is better to set the speed before turning on the Spindle otherwise the Spindle might momentarily lurch to some huge previously specified speed.

    This causes an issue with your system because you don't necessarily know the direction when the speed is sent. Both the speed and direction in your system are set by writing a value to the DAC. Most other systems have a separate Independent IO bit to control the direction which simplifies things a bit. So what you need to do is also command the Speed and Direction in the M3 and M4 Programs. That's why the S Program saves the last commanded speed in a persist variable (SPEEDVAR). So for example to retrieve the saved RPM setting and convert it to a corresponding DAC value in your M3 M4 Programs you might do:

    int speed = persist.UserData[SPEEDVAR] * FACTOR;; // last s value from g code scaled to DAC counts

    Then output it to the DAC with the appropriate sign. In the M3 program I believe the value should be +. So just code:

    DAC(7,speed);

    In the M4 program the value should be - so code:

    DAC(7,-speed);


    Regarding C headers and libraries: The KFLOP environment is somewhat different from a PC environment. KFLOP doesn't have a Keyboard, Display, Disk, etc.. KFLOP does allow printing to the Console and some basic disk text IO, So printf, sprintf, fprintf, fopen, fclose are supported. Everything that KFLOP supports is included by including KMotionDef.h You might read through KMotionDef.h to see all the functions and variables, and definitions that are available. It is located in the DSP_KFLOP directory.

    btw on a minor note its always nicer to read C code that has been indented properly. Unfortunately a tab in KMotion.exe indents 4 spaces and a tab in cnczone indents 8 spaces. So for code that mixes spaces and tabs the code gets all jumbled up when displayed in cnczone even though it looks proper in other editors. You can solve the problem by replacing all the tabs with spaces before pasting into cnczone. To do this with KMotion.exe you can right click at the top of the file, Replace... , Find '/t', Replace ' ', Regular expression, Replace All. Microsoft Visual Studio and some other editors have nice simple menu selections to "Format Document" and "Untabify"


    HTH
    Regards

    Regards
    TK http://dynomotion.com


  3. #243
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by mmurray70 View Post
    Hey Peter, try these files. I saw you posted these a few days ago but ive been busy sorry.
    Thanks mmurray70, However, no need to apology ... I appreciate your help when you get the time. Beside, I am going to need to learn this C-Code thing anyways. Baptism by Fire has always been a good way to learn even if one does loose all of ones hair.

    I will give this code a try tonight.

    ...
    ...



  4. #244
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    ...
    ....

    Since I am using a DAC setting to rotate my spindle motor I can see that there will be an issue if NC code goes from M03 to M04 without the motor coming to complete stop on rotation before the change in direction.

    Knowing this, would the best way to handle this be something like:

    Delay_sec(10); // Wait time, seconds, for spindle to stop rotating ...... in the M3.C, M4.C and M5.C?

    Also, this spindle seems to rattle a bit too much when I execute (start-up) a higher "S" code in the NC code.

    Would I have to write more C-code accordingly to get the spindle RPM to ramp-up-to-speed and as well as to reduce RPM from very high RPMs?

    If so, is a Delay_sec (XX) the best command to do this?


    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



  5. #245
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hi PeterTheWolf,

    Since I am using a DAC setting to rotate my spindle motor I can see that there will be an issue if NC code goes from M03 to M04 without the motor coming to complete stop on rotation before the change in direction.

    Knowing this, would the best way to handle this be something like:

    Delay_sec(10); // Wait time, seconds, for spindle to stop rotating ...... in the M3.C, M4.C and M5.C?

    Also, this spindle seems to rattle a bit too much when I execute (start-up) a higher "S" code in the NC code.

    Would I have to write more C-code accordingly to get the spindle RPM to ramp-up-to-speed and as well as to reduce RPM from very high RPMs?

    If so, is a Delay_sec (XX) the best command to do this?
    You could write code to gradually ramp up the DAC value. But there is an alternate approach. I was trying to push you in that direction initially. Which is to treat the Spindle as a KFLOP Axis. There are two advantages to this approach. #1 you can use the Acceleration and Jerk parameters to cause the speed to ramp however you wish. #2 M3, M4, M5, S Programs already exist that should be useable out-of-the box. These programs can be used with any Spindle if it can be controlled like any motor axis with Jog commands.

    Even though your Spindle doesn't have any feedback it can still be controlled like an axis by using the open loop feedforward. If you recall in your other axes with feedback you adjusted the feedforward to output the expected DAC output to run at the current speed. That allowed the feedback and tuning to only have to make small adjustments to make the motion more exact. Well in this case there simply won't be any feedback corrections by setting all the PID feedback terms to zero, There is an article that describes this method here.

    So please decide which direction you feel more comfortable with:

    #1 tweak your current C programs to add DAC ramping with a loop

    #2 switch to use a KFLOP Axis that has built in Acceleration and Jerk control

    Regards

    Regards
    TK http://dynomotion.com


  6. #246
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by PeterTheWolf View Post
    ...
    ....

    Since I am using a DAC setting to rotate my spindle motor I can see that there will be an issue if NC code goes from M03 to M04 without the motor coming to complete stop on rotation before the change in direction.

    Knowing this, would the best way to handle this be something like:

    Delay_sec(10); // Wait time, seconds, for spindle to stop rotating ...... in the M3.C, M4.C and M5.C?

    Also, this spindle seems to rattle a bit too much when I execute (start-up) a higher "S" code in the NC code.

    Would I have to write more C-code accordingly to get the spindle RPM to ramp-up-to-speed and as well as to reduce RPM from very high RPMs?

    If so, is a Delay_sec (XX) the best command to do this?
    .
    Peter, pretty much all VFD's have a parameter for acceleration. Read your VFD manual, find the parameter and adjust it. This would be the easiest way and should work great. Also im not too sure about the Tree mill, but some of those style mills tend to have terrible sounding gears anyway. Not a whole lot you can do on some machines. Doesnt seem to hurt anything, but it is annoying.

    It will probably be fine to jam it in reverse even while running full speed forward. The VFD should take care of everything with suitable acceleration rates. Delays can be added easily yes, and not a bad idea to add them. Nice to allow spindle to reach speed before actually doing any cutting, and to make sure spindle is stopped. Set Kmotioncnc to execute wait for your M3/4/5 files. You can simply add a delay that will work for fastest speeds or you can calculate the delay fairly easy. Try this code at the ends of your m3/4/5 files and adjust the constant to work for your machine.

    delay = (spd*0.0008); // set start or stop time
    Delay_sec(delay); // wait for spindle to start or stop

    Also to prevent your M3 to M4 situation from happening you can check if currently running in reverse at the start of M3 with something like this:

    if(ReadBit(151) && ReadBit(152) && persist.UserData[98] == 2) // if running in reverse
    {
    ClearBit(151)
    ClearBit(152)
    Delay_sec(5); // wait for spindle to stop
    }

    This is why i like Kflop and C-code so much, no matter what kind of little issue you can think of with your machine, there always seems to be a way around it if you put some effort in it. I guess there are some advantages of setting it up as an Axis. I think you will get it working great either way. Is M4 working now?

    Last edited by mmurray70; 05-22-2018 at 10:32 PM.


  7. #247
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    .....
    ....

    Quote Originally Posted by mmurray70 View Post
    ......
    ......
    It will probably be fine to jam it in reverse even while running full speed forward. The VFD should take care of everything with suitable acceleration rates.

    Is M4 working now?
    Hello mmurray70,

    Well, that is one thing this VFD has is parameters ..... I will see what I can understand.

    Tree325 Retrofit Started-vfd_rampparameterspage-pdf-jpg


    YES, it worked great and corrected the M03 / M04 direction accordingly.

    .....
    .....



  8. #248
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    just had a look at your drive and the quickstart section only mentions p1.01 and 1.02 for acceleration. Id say these are all you have to worry about. Not sure what that "accelleration time 2" is about.

    Also, i made an error in the delay calculation in previous post, its fixed now. It should just be speed x constant, not speed squared times constant.



  9. #249
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    ....
    ....

    Quote Originally Posted by mmurray70 View Post
    just had a look at your drive and the quickstart section only mentions p1.01 and 1.02 for acceleration. Id say these are all you have to worry about..
    OK ... I changed the VFD parameters from P1.01=0.1 to P10.0 and P1.02=0.1 to P1.02=10.0 (These are seconds)and when I single step through this NC code:

    M05
    M03S2000
    S3000
    M05
    M04S3000
    M05
    M30

    The spindle runs beautiful, it accelerates and decelerates really smooth with no rattling noise at all. Nice.

    However, if I were to run this same NC code with a "Cycle Start" from KMotionCNC instead of single stepping the NC code .... then KMotionCNC processes the NC code so fast that nothing happens.
    The spindle never even goes on. I do have 3 second dwells on the M3.C, M4.C, M5.C code.

    Is there some NC command in KMotionCNC I can run to ensure each NC line being processed completes it task before going onto the next line of NC code? I am pretty sure the Siemens & Bosch controllers have NC commands for this.

    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



  10. #250
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hi PeterTheWolf,

    To configure KMotionCNC to wait for the programs to complete before going on configure the Actions for M3,M4,M5,S as "Exec/Wait"" instead of "Execute Prog"

    HTh
    Regards

    Regards
    TK http://dynomotion.com


  11. #251
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by TomKerekes View Post

    To configure KMotionCNC to wait for the programs to complete before going on configure the Actions for M3,M4,M5,S as "Exec/Wait"" instead of "Execute Prog"
    I tried this; however, it still does not work quite right. It still runs through the NC code faster than actually executing each line to completion.


    Quote Originally Posted by TomKerekes View Post
    You could write code to gradually ramp up the DAC value. But there is an alternate approach. I was trying to push you in that direction initially. Which is to treat the Spindle as a KFLOP Axis. There are two advantages to this approach. #1 you can use the Acceleration and Jerk parameters to cause the speed to ramp however you wish. #2 M3, M4, M5, S Programs already exist that should be useable out-of-the box. These programs can be used with any Spindle if it can be controlled like any motor axis with Jog commands.

    Even though your Spindle doesn't have any feedback it can still be controlled like an axis by using the open loop feedforward. If you recall in your other axes with feedback you adjusted the feedforward to output the expected DAC output to run at the current speed. That allowed the feedback and tuning to only have to make small adjustments to make the motion more exact. Well in this case there simply won't be any feedback corrections by setting all the PID feedback terms to zero, There is an article that describes this method here.

    So please decide which direction you feel more comfortable with:

    #1 tweak your current C programs to add DAC ramping with a loop

    #2 switch to use a KFLOP Axis that has built in Acceleration and Jerk control
    I tied the use of the KFLOP axis with DAC open loop to see how it would work since it is already connected to DAC output 7. In general, from my test I think this works.

    Tom, can I please get you to review these two videos and offer some advice?

    Video #1 (98.3mb Zip FIle)

    Video #2 (43mb Zip File)

    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



  12. #252
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hi PeterTheWolf,

    I tried this; however, it still does not work quite right. It still runs through the NC code faster than actually executing each line to completion.
    You didn't seem to show running the GCode in the video. I think you should:

    #1 add a delay also into the S Program

    #2 put all the delays at the end of the main Programs


    Because for example the code
    M03
    S2000
    S3000
    M05

    I would expect to see:

    #1 M03 Delay, Turn on the Spindle
    #2 S2000 Change the speed
    #3 S3000 Change the speed

    Which would result in the Spindle on and instantly 2 speed changes

    The idea should be for the programs to make some change, wait for it to occur, then finish to go on to the next thing.

    Please try this. If there are still any issue show in one of your Videos the GCode running and also the KMotion Console screen messages (you might also print some messages in the M3 M4 programs also.

    HTH

    Regards
    TK http://dynomotion.com


  13. #253
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    It should wait if you have a delay in the c program and have it set as "exec/wait". Maybe triple check everything. Make sure the path points to the latest revised file etc. If you cant figure it out post your M3/4/5 files again.

    Im not sure its a good idea to add a delay to your Spindle.c file, might cause problems when using spindle overrides. If you want to add a delay between S codes for testing just use a dwell in G code. for example

    M05
    M03S2000 (should start spindle and wait for the delay in M3 program)
    S3000 (change speed to 3000)
    G4 P5 (wait 5 seconds)
    M05 (stop spindle and wait for delay in M5 program)
    M04S3000
    M05
    M30

    Without the G4, the above code should start spindle at 2000, wait for the delay in m3.c then it would process the S3000 and instantly go to m5 which means it will never run at 3000.

    Also, you said you have VFD set to 10 second acceleration but only a 3 sec delay in m3 program. You should probably have these the same or closer to the same. The delay is mostly to wait for the spindle to reach speed. Doesnt make sense to wait 3 seconds when the drive will take 10 to reach speed.



  14. #254
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by TomKerekes View Post
    #1 add a delay also into the S Program

    #2 put all the delays at the end of the main Programs
    Because for example the code
    M03
    S2000
    S3000
    M05

    I would expect to see:

    #1 M03 Delay, Turn on the Spindle
    #2 S2000 Change the speed
    #3 S3000 Change the speed

    Which would result in the Spindle on and instantly 2 speed changes

    The idea should be for the programs to make some change, wait for it to occur, then finish to go on to the next thing.

    Please try this. If there are still any issue show in one of your Videos the GCode running and also the KMotion Console screen messages (you might also print some messages in the M3 M4 programs also.
    Ok ... I changed the VFD Acceleration Ramp Up/Ramp Down to 4 seconds each.

    And here is the C-Code for M3/M4/M5/Spindle.C (at the bottom) and the NC Code I ran:

    M05
    M03S2000 (should start spindle and wait for the delay in M3 program)
    S3000 (change speed to 3000)
    G4 P5 (wait 5 seconds)
    M05 (stop spindle and wait for delay in M5 program)
    M04S3000
    M05
    M30

    and the Video for this run (Zip file 217 mb ... sorry for large size, couldn't reduce it without losing res.)


    ......
    ......

    Quote Originally Posted by mmurray70 View Post
    It should wait if you have a delay in the c program and have it set as "exec/wait". Maybe triple check everything. Make sure the path points to the latest revised file etc. If you cant figure it out post your M3/4/5 files again.

    Im not sure its a good idea to add a delay to your Spindle.c file, might cause problems when using spindle overrides. If you want to add a delay between S codes for testing just use a dwell in G code. for example

    M05
    M03S2000 (should start spindle and wait for the delay in M3 program)
    S3000 (change speed to 3000)
    G4 P5 (wait 5 seconds)
    M05 (stop spindle and wait for delay in M5 program)
    M04S3000
    M05
    M30

    Without the G4, the above code should start spindle at 2000, wait for the delay in m3.c then it would process the S3000 and instantly go to m5 which means it will never run at 3000.

    Also, you said you have VFD set to 10 second acceleration but only a 3 sec delay in m3 program. You should probably have these the same or closer to the same. The delay is mostly to wait for the spindle to reach speed. Doesnt make sense to wait 3 seconds when the drive will take 10 to reach speed.
    Here is the NC Code I ran with the dwells. I believe this will work; however, I will need to ensure that the post I use puts these dwells in accordingly.

    M05
    M03S2000 (should start spindle and wait for the delay in M3 program)
    S3000 (change speed to 3000)
    G4 P5 (wait 5 seconds)
    M05 (stop spindle and wait for delay in M5 program)
    G4 P5 (wait 5 seconds)
    M04S3000
    G4 P5 (wait 5 seconds)
    M05
    M30


    Here is the video of this run (Zip file 154 mb ... sorry for large size, couldn't reduce it without losing res.).


    M3.C .........
    Code:
    #include "KMotionDef.h"
    
    main()
    {
        int dwell_in_sec;
        dwell_in_sec = 3;  //Delay in C-Code execution for spindle response
        SetBit(151); // spindle on
        SetBit(152); // FET Driver 0 on (Relay), Spindle will go on thru Interlock
        persist.UserData[98] = 1;  // set state to CW
    
    
        // re run code from spindle.c in case M3 or M4 is ran by itself
    
        int speed; 
        float spd = *(float *)&persist.UserData[9]; // s value from g code
        speed = spd * 0.2228; // set dac counts 
    
    
        // limit min speed
        if (speed < 60) speed = 60;
    	
        // limit max speed
        if (speed > 1000) speed = 1000;
    	
        // Set speed negative if in reverse	
        if (persist.UserData[98] == 2) speed = speed * -1;
        DAC(7,speed);
        printf("\n");
        Delay_sec(dwell_in_sec);  // Wait time, seconds, for spindle to stop rotating
        printf("Dwell Point in Seconds on M3.C = ");  //single line comment    
        printf("%4.4f\n",Delay_sec);
        printf("\n");
        printf("\n");		
    }
    M4.C ...........
    Code:
    #include "KMotionDef.h"
    
    main()
    {
        int dwell_in_sec;
        dwell_in_sec = 3;  //Delay in C-Code execution for spindle response
        SetBit(151); // spindle on
        SetBit(152); // FET Driver 0 on (Relay), Spindle will go on thru Interlock
        persist.UserData[98] = 2;  // set state to CCW
    
    
        // re run code from spindle.c in case M3 or M4 is ran by itself
    
        int speed; 
        float spd = *(float *)&persist.UserData[9]; // s value from g code
        speed = spd * 0.2228; // set dac counts 
    
    
        // limit min speed
        if (speed < 60) speed = 60;
    	
        // limit max speed
        if (speed > 1000) speed = 1000;
    	
        // Set speed negative if in reverse	
        if (persist.UserData[98] == 2) speed = speed * -1;
        DAC(7,speed);
        printf("\n");
        Delay_sec(dwell_in_sec);  // Wait time, seconds, for spindle to stop rotating
        printf("Dwell Point in Seconds on M4.C = ");  //single line comment    
        printf("%4.4f\n",Delay_sec);
        printf("\n");
        printf("\n");		
    }
    M5.C ........
    Code:
    #include "KMotionDef.h"
    
    main()
    {
        int dwell_in_sec;
        dwell_in_sec = 3;  //Delay in C-Code execution for spindle response
        ClearBit(151); // spindle off
        ClearBit(152); // FET Driver 0 off (Relay), Spindle will go off thru Interlock
        printf("\n");
        Delay_sec(dwell_in_sec);  // Wait time, seconds, for spindle to stop rotating
        printf("Dwell Point in Seconds on M5.C = ");  //single line comment    
        printf("%4.4f\n",Delay_sec);
        printf("\n");
        printf("\n");
    }
    Spindle.C .........
    Code:
    #include "KMotionDef.h"
    
    main()
    {
        int dwell_in_sec;
        dwell_in_sec = 3;  //Delay in C-Code execution for spindle response
        int speed; 
        float spd = *(float *)&persist.UserData[9]; // s value from g code
        speed = spd * 0.2228; // set dac counts
        printf("Spindle RPM is = ");  //single line comment
        printf("%1.1f\n",spd);
    
    
        // limit min speed
        if (speed < 60) speed = 60;
    	
        // limit max speed
        if (speed > 1000) speed = 1000;
    	
        // Set speed negative if in reverse	
        if (persist.UserData[98] == 2) speed = speed * -1;
        printf("DAC 7 Voltage is = ");  //single line comment
        printf("%d\n",speed);
        printf("\n");
        DAC(7,speed);
        printf("\n");
        Delay_sec(dwell_in_sec);  // Wait time, seconds, for spindle to stop rotating
        printf("Dwell Point in Seconds on Spindle.C = ");  //single line comment    
        printf("%4.4f\n",Delay_sec);
        printf("\n");
        printf("\n");	
    }
    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



  15. #255
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Hi PeterTheWolf,

    I think things are working as expected except your Spindle takes longer than you expect to change speed. Or mainly to slow down It seems like closer to 8-9 seconds to stop from 3000RPM. You may find the Spindle Decelerates faster if it is kept on and told to go to zero speed (or reverse) rather than turned off and coasts.

    So here is what I think happens:

    #1 the Spindle is at 3000RPM (seems to accelerate quickly in 1~2 sec)
    #2 M05 commands Spindle off
    #3 the M05 finishes after the 3 second delay but the Spindle is still ~2000RPM
    #4 M04S3000 first commands S3000 which has no effect as the Spindle is off
    #5 S3000 finishes after 3 sec Delay but spindle is still at ~1000RPM
    #6 M04 finally gets commanded, enables Spindle and sets DAC with proper sign
    #7 M04 finishes after 3 sec Delay spindle has just finally came to a stop
    #8 M05 immediately turns off Spindle - spindle now remains stopped


    You may find the Spindle Decelerates faster if it is kept on and told to go to zero speed (or reverse) rather than turned off and coasts.

    You might just increase the Delays in the C Programs. I think mainly the M5 should be like 10 seconds.

    We could be smarter about the delays. For example when the DAC is changed when the Spindle is off there should be no reason to delay, or even output to the DAC for that matter.

    On a minor note I'd find it easier to follow if messages were printed before any delay and also every place the DAC was changed.

    Regards

    Regards
    TK http://dynomotion.com


  16. #256
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Yes looks like your almost there but something is not right with the decelleration. It should basically be the same as acceleration. I noticed your drive has a seperate parameter for accel and decel, wouldnt hurt to double check that both are 4 seconds instead of just one of them. If both parameters are definitely the same, try what Tom is suggesting. Easy way to do it is to turn your spindle on and just command a much lower S value once up to speed. Kinda looks to me like accel is set at 4 and deccel is still at the origional 10.

    Also, I think you should probably be running your spindle.c program in a different thread since both are executed on the same line. Maybe use thread 4.

    And finally the dwells should only be used for testing. Dont try and setup a post processor to add dwells to get spindle working properly. You will get it sorted out with the C code, your pretty close now. Also keep in mind that CAM software will never post two speeds back to back anyway. It will always perform a certain operation before changing speed.



  17. #257
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Peter what exactly does bit 151 and 152 do? These lines here:

    SetBit(151); // spindle on
    SetBit(152); // FET Driver 0 on (Relay), Spindle will go on thru Interlock

    One of these is not turning on and off the 240v power supply to the VFD is it? If it were that would explain the delay in your M3 starting (taking a second to power up VFD), and also the M5 coasting to a stop (no power).

    Im guessing this is a long shot but just thought id mention it. This would not be the right was to control it, and would be very hard on the VFD. The VFD needs to have a constant supply of 240v power even while spindle is turned off. Sorry if this is obvious, but it would explain whats happening in your video.



  18. #258
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by mmurray70 View Post
    Yes looks like your almost there but something is not right with the decelleration. It should basically be the same as acceleration. I noticed your drive has a seperate parameter for accel and decel, wouldnt hurt to double check that both are 4 seconds instead of just one of them. If both parameters are definitely the same, try what Tom is suggesting. Easy way to do it is to turn your spindle on and just command a much lower S value once up to speed. Kinda looks to me like accel is set at 4 and deccel is still at the origional 10.

    Also, I think you should probably be running your spindle.c program in a different thread since both are executed on the same line. Maybe use thread 4.

    And finally the dwells should only be used for testing. Dont try and setup a post processor to add dwells to get spindle working properly. You will get it sorted out with the C code, your pretty close now. Also keep in mind that CAM software will never post two speeds back to back anyway. It will always perform a certain operation before changing speed.


    SetBit(151); // DAC Voltage for spindle (Kanalog - JP11 DAC Output #7)
    SetBit(152); // FET Driver 0 on (Relay Signal), Spindle will go on thru Interlock (Kanalog – JP8 Switch #SW0)

    SetBit(152) turns my relay on and off that drives the 24V relay of the interlock …. Per #232 of this thread…….

    Quote Originally Posted by PeterTheWolf View Post
    Thanks Tom ... I just tried Option #3 .... and it Worked; however, I will need to turn the "FET Driver 0" on and off as "OPTO Out 7" goes on and off I think.
    Then I think the following will work. However, I still need to prove this.
    Do all KMotion Bits work the same as far as setting them on and off?
    So, I should be able to turn the "FET Driver 0" Bit (in my case #152)
    on by: SetBit(152); // FET Driver 0 on (Relay), Spindle will go on thru Interlock
    and
    off by: ClearBit(152); // FET Driver 0 off (Relay), Spindle will go off thru Interlock
    ...
    ....
    Attachment 393158



    Most definitely I have set the VFD parameters P1.01=4.0 sec. (VFD Accelerate Time) and P1.02=4.0 sec (VFD De-Accelerate Time)… I checked and verified.

    Setting the C-code to keep the relay on and the DAC voltage for a reduced spindle speed in the M05 did not work so good for me.

    Even in the NC code below ... the spindle change from S6000 for S300 took 18 seconds. I am convinced the VFD is most likely not set correctly even though I have the accel/decel parameters set for 4 seconds.


    M05
    M03
    S2000 (should start spindle and wait for the delay in M3 program)
    S3000 (change speed to 3000)
    G4 P5 (wait 5 seconds)
    S6000
    S300 (18 SEC. TO GET TO THIS)
    M05 (stop spindle and wait for delay in M5 program)
    G4 P5 (wait 5 seconds)
    M04S3000
    G4 P5 (wait 5 seconds)
    M05
    M30

    I think for now I will just accept the fact that I will need a dwell in the M05 C-code and move on to other features I would like to get working ... like the Front Panel Cycle Start and Cycle Stop Buttons from the KFLOP signals on JP4 ... I think that is what I want to connect too to get these buttons working.


    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



  19. #259
    Member
    Join Date
    Apr 2007
    Location
    Canada
    Posts
    54
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by PeterTheWolf View Post
    Most definitely I have set the VFD parameters P1.01=4.0 sec. (VFD Accelerate Time) and P1.02=4.0 sec (VFD De-Accelerate Time)… I checked and verified.

    Setting the C-code to keep the relay on and the DAC voltage for a reduced spindle speed in the M05 did not work so good for me.
    I haven't read through all of your posts about the VFD but here are some thoughts after reading the above:

    What is parameter P1.00 set to?
    Should be 00 - ramp to stop
    To test your acceleration/deceleration independent of Kflop/Kanalog do this:

    - Set parameter P3.00 to 00 Operation Determined by Digital Keypad
    - Set parameter P4.00 to 01 Frequency determined by digital keypad up/down
    - Use key pad arrow keys to set an RPM, start LOW
    - Press Run button
    - Spindle should accelerate to your set RPM in the seconds you have set in P1.01
    - Press Stop button
    - Spindle should decelerate to 0 RPM in the seconds you have set in P1.02
    - increase set RPM and repeat test, do this a number of times. See if at any point you reach a point where deceleration time increases past that set in P1.02.

    Now test direction change
    - Press Run button
    - wait for spindle to accelerate
    - Press Fwd/Rev key
    - spindle should change direction and reach set RPM in P1.01 + P1.02 seconds

    If your spindle is taking too long to decelerate it could be that you need a braking resistor. You would normally get a fault about DC bus voltage too high when that happens, however reading P6.05 it looks like you may not get a fault. This could be why deceleration from 6000 to 300 takes 18 seconds. To see if this is happening, monitor the DC Bus Voltage (use keypad to select this display parameter) while decelerating. Whatever you do, do NOT disable P6.05 unless you have a braking resistor installed. A good drive should still fault, but I'm not sure what yours will do in the case of over voltage.

    What are:
    P6.06 Auto Adjustable Accel/Decel
    P6.18 Braking Voltage Level
    P6.06 Auto Adjustable Accel/Decel



  20. #260
    Member PeterTheWolf's Avatar
    Join Date
    Aug 2008
    Location
    USA
    Posts
    213
    Downloads
    0
    Uploads
    0

    Default Re: Tree325 Retrofit Started

    Quote Originally Posted by Greg9504 View Post

    What is parameter P1.00 set to?
    Should be 00 - ramp to stop
    To test your acceleration/deceleration independent of Kflop/Kanalog do this:

    - Set parameter P3.00 to 00 Operation Determined by Digital Keypad
    - Set parameter P4.00 to 01 Frequency determined by digital keypad up/down
    - Use key pad arrow keys to set an RPM, start LOW
    - Press Run button
    - Spindle should accelerate to your set RPM in the seconds you have set in P1.01
    - Press Stop button
    - Spindle should decelerate to 0 RPM in the seconds you have set in P1.02
    - increase set RPM and repeat test, do this a number of times. See if at any point you reach a point where deceleration time increases past that set in P1.02.

    Now test direction change
    - Press Run button
    - wait for spindle to accelerate
    - Press Fwd/Rev key
    - spindle should change direction and reach set RPM in P1.01 + P1.02 seconds

    If your spindle is taking too long to decelerate it could be that you need a braking resistor. You would normally get a fault about DC bus voltage too high when that happens, however reading P6.05 it looks like you may not get a fault. This could be why deceleration from 6000 to 300 takes 18 seconds. To see if this is happening, monitor the DC Bus Voltage (use keypad to select this display parameter) while decelerating. Whatever you do, do NOT disable P6.05 unless you have a braking resistor installed. A good drive should still fault, but I'm not sure what yours will do in the case of over voltage.https://www.cnczone.com/forums/dynom...t-started.html

    What are:
    P6.06 Auto Adjustable Accel/Decel
    P6.18 Braking Voltage Level
    P6.06 Auto Adjustable Accel/Decel
    Hello Greg9504,

    Thanks for taking the time to share on this VFD.

    I followed your instruction/testing and here are my results:

    Manual VFD spindle test:

    1.) At 57.5 Hz, Keypad display read 260 RPM, at the spindle RPM=1357. It took 1 Sec. to reach spindle speed and 4 sec. to decelerate to a stop.
    2.) At 80.0 Hz, Keypad display read 350 RPM, at the spindle RPM=1830. It took 2 Sec. to reach spindle speed and 6 sec. to decelerate to a stop.
    3.) At 100.0 Hz, Keypad display read 437 RPM, at the spindle RPM=2289. It took 2 Sec. to reach spindle speed and 7 sec. to decelerate to a stop.
    4.) At 125.0 Hz, Keypad display read 546 RPM, at the spindle RPM=2865. It took 2 Sec. to reach spindle speed and 10 sec. to decelerate to a stop.
    5.) At 151.0 Hz, Keypad display read 660 RPM, at the spindle RPM=3463. It took 3 Sec. to reach spindle speed and 13 sec. to decelerate to a stop.

    6.) At 200.0 Hz, Keypad display read 875 RPM, at the spindle RPM=4592. It took 3 Sec. to reach spindle speed and 19 sec. to decelerate to a stop.
    Output Voltage on keypad display = 120.0V
    DC Bus Voltage on keypad display = 345.0V
    When the Stop Button was pressed on the keypad the DC Bus Voltage on keypad display = 364.2V
    Just after the Stop Button was pressed on the keypad and the spindle was slowing down (took 19 sec.) the DC Bus Voltage on keypad display = 363.0 - 364.0V
    Once the spindle came to a stop the DC Bus Voltage on keypad display = 367.3V


    I did not try to:

    "Now test direction change
    - Press Run button
    - wait for spindle to accelerate
    - Press Fwd/Rev key
    - spindle should change direction and reach set RPM in P1.01 + P1.02 seconds"

    As I was not sure what would happen since the deceleration was not working within the 4.0 sec. time frame.


    Below are my current VFD parameter settings as of today, 6/10/2018

    I check all the parameters on the VFD P0.00 thru P10.05 (Chapter 4 of the DuraPluse Manual, first 14 pages are the setting parameters) and the only ones not set to the factory defaults were:

    P0.00=200
    P0.01=32
    P0.02=400HZ
    P0.03=1750
    P0.04=8000
    P0.07=28.0

    P1.01=4.0 sec
    P1.02=4.0 sec


    P2.00=03
    P2.01=0.0
    P2.02=1
    P2.04=200HZ
    P2.06=120v
    P2.07=5.0v
    P2.08=9 (not sure why this would not have been the 1-5hp setting which would be 15)
    P3.00=1
    P3.11=01
    P3.12=02 (DO1 ... At Speed)
    P3.13=03 (DO2 ... Zero Speed)
    P3.14=02 (DO3 ... At Speed)
    P4.00=06 (Frequency determined by -10V to +10V input on AI3 terminal.)
    P4.12 thru P4.18 N/A

    P6.05=0
    P6.06=0
    P6.07=0
    P6.08=150%
    P6.18=380.0V


    P6.31 thru P6.36=24 (Momentary Power Loss)
    P9.39=1.02 (Firmware Version)
    P9.41=03 (GS3)
    P942=05 (GS3-2010 -- 230V 3ph 10hp)
    P10.00=1024 (Encoder Pulses per Revolution)
    P10.01=00 (this is Disable) is that correct?


    I am not sure about connecting up a " braking resistor ". Where would this be connected and what size would I use?


    .....
    .....

    J325 Quick Links:

    Machine
    Existing Machine Schematics
    Electronic Cabinet-Right Side
    Electronic Cabinet-Back SIde
    Existing Drive Board SD1525-10
    J325 Servo Drive-SD1525 Manual
    3-Phase Rotary Convert Used
    RickB's J325 Retrofit Wiring
    KFLOP 5VDC/15Watt/3A Power Supply
    KANALOG Mounted & Connected
    Kmotion - Axis Encoder Manual Test of Position via Manual Movement
    Kanalog-Encoder Voltage High/Low Checks & 1KOhm Resister
    Kmotion Configuration Screens "RUN-AWAY"
    Tree Journeyman 325 Designed Specs.
    Tree Journeyman 325 Axis-Tension Frequency Settings
    Final Axis Tuned Error Parameters
    VFD Wiring to Existing Tree325 Old Controller
    DAC Values to RPM / Voltage Checks

    .....
    .....



Page 13 of 18 FirstFirst ... 310111213141516 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Tree325 Retrofit Started

Tree325 Retrofit Started