Basic question: how do I get Kmotion to create Bode plots?


Results 1 to 16 of 16

Thread: Basic question: how do I get Kmotion to create Bode plots?

  1. #1
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Basic question: how do I get Kmotion to create Bode plots?

    I have a K2CNC machine that works fine but I was curious to see how the step response/Bode plots look. However, when I try to create them the servos don't respond at all when I try to take measurements. I don't really understand how K2 set it up, but in KMotionCNC everything works fine. Hitting the "enable" button in KMotion doesn't seem to make any difference. Is there something I need to do in KMotion to enable the axes using K2's settings?

    Many thanks for your help!

    Similar Threads:


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

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi amorey,

    The first step would be to learn how to test Motion in the KMotion Step Response Screen. Pushing "Enable" downloads the settings and configuration from the KMotion Screens to KFLOP. If the Screen settings haven't been set properly this will miss-configure the axis. There are several ways you can make sure the screen settings in KMotion match the settings used bu KMotionCNC. Such as importing the Initialization C Program or uploading the parameters from KFLOP (assuming KFLOP is currently configured). You might watch this video (it requires Flash):

    http://dynomotion.com/Help/FlashHelp...ers/index.html

    Regards

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Thanks for your help, Tom. I went into the Config and Flash screen and uploaded the configuration for all three axes, and it seemed to load the correct data, as far as I can tell. However, there's still no movement when I try Step Response. The Axis dialog indicates that all three axes are enabled. Is there something else I need to do?



  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi amowry,

    Are you pushing the "Move" button on the Step Response Screen?

    Is the Axis holding position before and after the Move?

    What size move are you commanding?

    Post a Plot of the response. Showing Command, Position, Output vs Time.

    Regards
    TK

    Regards
    TK http://dynomotion.com


  5. #5
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Thanks Tom-- here are the configuration and step response windows. The servos hold their position; i.e. there's no motion at all. I've tried moves of different sizes, with the same results.Basic question: how do I get Kmotion to create Bode plots?-configuration-jpgBasic question: how do I get Kmotion to create Bode plots?-step-response-jpg



  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi amowry,

    Holding position and not moving are two different things. When a servo is actively holding position if you manually push the motor away the motor will create resistance and tend to move back to where it was. If the servo is inactive and not holding position then it should be easy to manually move away and then simply remain wherever it is moved to.

    I'm guessing your system needs a C Program that takes the servo output and writes it to one of KFLOP's PWM channels to drive some H-Bridge Motor Drivers that K2CNC created and often used.

    You haven't described the steps you do to get the motors to work in KMotionCNC. Do you push an "Init" User Button? What program is the button configured to execute in Tool Setup | User Buttons??

    Have you tried first getting the motors to servo in KMotionCNC, then going to the KMotion.exe Step Response Screen?

    I see "Launch on Startup Thread #6" has been configured to run on power up. The KMotion.exe C Programs Screen will have a green bar on each Thread that is currently running.

    Regards

    Regards
    TK http://dynomotion.com


  7. #7
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    The servos are holding position-- I can push them a few steps and they move right back.

    Sorry, I do have to push an Init button in KMotionCNC, which runs this file: http://mowrystrings.com/K2_Init%20Servo.c. Thread 6 in KMotion runs this one: http://mowrystrings.com/K2MC_driver.c

    There is indeed a green bar next to thread 6 in the C programs Screen.

    Yes, I've tried getting the servos running in KmotionCNC, but the same thing happens. By the way, there's a box with an E-stop button that also has another small button that I have to press before initializing the machine in KmotionCNC. It doesn't have an effect that I've noticed in Kmotion (but I've tried pressing it

    -Andrew



  8. #8
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi Andrew,

    Those C files include other C files. Please post all of them.

    BTW the program flashed into and running in KFLOP Thread #6 isn't necessarily the C File loaded into the KMotion | C Programs | Thread #6 Edit screen. And it is likely something different than the K2MC_driver file you posted because that C program appears to only run for an instant and then terminate.

    Very strange that the servo would be functional and active and yet the Step Response Screen would move the Destination and create an Output and not cause any motion.

    Regards

    Regards
    TK http://dynomotion.com


  9. #9
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Sorry for the delay. I've uploaded all of the included files, except KMotionDef.h, which I couldn't seem to find?

    I understand now about the thread #6 file-- the K2MC_Driver one is just what appears there now, but maybe it's not what's flashed. Is there a way to tell what is flashed?

    I don't want you to spend too much time on this, because as I said my machine is working well, this is mostly just spurred by curiosity. It probably would be good for me to understand how it's set up, though, for that day when it stops working and I have to set it up again. Thanks again for your help so far.

    Here are the files:

    http://mowrystrings.com/KMotion/BlinkStatus.c
    http://mowrystrings.com/KMotion/CallBack%20Servo.c
    http://mowrystrings.com/KMotion/CycleStart.c
    http://mowrystrings.com/KMotion/Defines.c
    http://mowrystrings.com/KMotion/Homing.c
    http://mowrystrings.com/KMotion/Jogging.c
    http://mowrystrings.com/KMotion/SoftLimits.c
    http://mowrystrings.com/KMotion/SPI.c
    http://mowrystrings.com/KMotion/UpdatePersistant.c



  10. #10
    Registered
    Join Date
    Jan 2015
    Location
    China
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    That's good

    www.dongtai168.com www.dongtai1688.com
    gem processing machine


  11. #11
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi Andrew,

    There isn't a way to read back what was has been Flashed to KFLOP.

    The CallBack Servo.c code looks like what sends the servo Output to the PWMs to cause the motors to move.

    The K2MC_driver.c should install that Callback code so it continuously executes every Servo Sample.

    Again very strange that the servo would be functional and active and yet the Step Response Screen would move the Destination and create an Output and not cause any motion.

    If you care to pursue it please perform the following steps:

    #1 Verify KMotionCNC works and Jogs the motors correctly.
    #2 Run KMotion.exe at the same time and open the Axis Screen
    #3 Verify when Jogging X in KMotionCNC that Axis #0 on the Axis Screen Changes
    #4 In KMotion.exe Config/Flash Screen Select Channel 0 and push "Upload"
    #5 In KMotion.exe Step Response Screen push "Move" and post the plot.

    Regards

    Regards
    TK http://dynomotion.com


  12. #12
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Okay, I followed all the steps, and Axis#0 does indeed change on the Axis screen when I jog the axis in KmotionCNC. However, there still appears to be no movement in Step Response. Here's the plot.Basic question: how do I get Kmotion to create Bode plots?-step-response-jpg



  13. #13
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Okay, here's something that may help--I just noticed that the green light on the E-Stop box that indicates that the machine is "enabled" turns off when I push "Move" in the Step Response screen. I'm not sure what the light actually means, but when I start up the machine I have to push a button on the E-Stop box that causes the light to go on. The machine won't do anything unless it's on. Pushing the E-stop button also turns the light off, disabling all axes. Not sure why the Step Response screen would do the same...



  14. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    What happens if you repeat all the steps but push "Zero". Then what happens if you push "Move".

    Regards

    Regards
    TK http://dynomotion.com


  15. #15
    Member
    Join Date
    Mar 2013
    Location
    US
    Posts
    48
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    There seems to be no effect, other than the position in the Axis window gets zeroed. There's still no movement when I press Move, and the machine still becomes disabled (i.e. the light goes off).



  16. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4042
    Downloads
    0
    Uploads
    0

    Default Re: Basic question: how do I get Kmotion to create Bode plots?

    Hi Andrew,

    I think I see the problem. This code in the callback that always executes (notice the comment by K2CNC):

    Code:
    	case 2:
    //* // Comment out for Servo Tunning in KMotion Step Response	
    		if (HomingRunning == 0 && (persist.UserData[SETTINGS_PERSIST] & 0x40000000) == 0)
    		{
    			if ((!chan[PortArray[0]].Enable) |
    				(!chan[PortArray[1]].Enable) |
    				(!chan[PortArray[2]].Enable) |
    				(!chan[PortArray[3]].Enable))		    
    			{
    				if (ReadBit(EN_DRV))
    				{
    					if (!chan[PortArray[0]].Enable)
    						SetBit(1040);
    					if (!chan[PortArray[1]].Enable)
    						SetBit(1041);
    					if (!chan[PortArray[2]].Enable)
    						SetBit(1042);
    					if (!chan[PortArray[3]].Enable)
    						SetBit(1043);
    				}	
    				ClearBit(EN_DRV);
    				ClearBit(FAN);
    			}		
    		}
    it watches if any axis is ever disabled and if so disables the drives. The Step Response Move button disables the axis momentarily to download the screen settings.

    Commenting out and re-flashing might be risky, It looks like setting bit 30 in persist Variable 0 will disable that functionality.

    Try running this code in an unused thread:

    Code:
    #include "KMotionDef.h"
    #define SETTINGS_PERSIST 0
    
    main()
    {
        persist.UserData[SETTINGS_PERSIST] |= 0x40000000;
    }
    Then see if the Step Response Move will work.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


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

Basic question: how do I get Kmotion to create Bode plots?

Basic question: how do I get Kmotion to create Bode plots?