Hi All;
I am attempting to configure EMC2 10.04.06 to control RPM
on a 60 HZ AC generator.

The basic approach is:
-Set the steps per inch to the number of AC cycles per day.
-Monitor the AC frequency into phase A of a HAL encoder.
-Feed the encoder output into the axis and PID feedback.
-Feed the axis motor-pos-cmd  to stepgen  position-cmd.
-Feed the stepgen out through the paraport to a stepper motor driver.

This seems to work in general but there are two problems I
have not been able to pin down.
1- The PID error is a sawtooth shape causing the throttle
    stepper motor to quiver at 60 HZ.
    A HAL Scope image is available at
http://imagebin.org/135986

    Anyone have an idea how to correct this. The tighter i
    make the PID loop the greater the quiver.

2-  When the RPM (step rate) gets behind during start up
     or load increase, EMC attempts to correct as soon as
     allowed in .ini and PID acceleration settings.

     Is there a way to limit this correction max RPM to avoid
     excessive over speed?

A snippet of the .ini and .hal files follow.
The HAL Scope image is at http://imagebin.org/135986 for
14 days.

    Thanks
        Don


.ini  snippet
----------------------------------------------------------------
[TRAJ]
AXES =                 9
#COORDINATES =       X Y Z A B C U V W  Template for counting AXIS numbers
COORDINATES =        X Y Z U
HOME =               0 0 0 0
NO_FORCE_HOMING =      1
LINEAR_UNITS =      inch
ANGULAR_UNITS =   degree
CYCLE_TIME =           0.010
DEFAULT_VELOCITY =     1.
MAX_VELOCITY =         1.
DEFAULT_ACCELERATION = 100.0
MAX_ACCELERATION =    20.0
#POSITION_FILE =   position.txt

# First axis ---- (X) Generators Electrical Switching ??
-----------------------
[AXIS_0]
TYPE =                          LINEAR
HOME_SEQUENCE      =   0
MAX_VELOCITY =         1.2
MAX_ACCELERATION =    20.0
STEPGEN_MAXACCEL =    21.0
BACKLASH =             0.0
SCALE =             4000
OUTPUT_SCALE =         1.000
MIN_LIMIT =          -10.0
MAX_LIMIT =           10.0
FERROR =               0.050
MIN_FERROR =           0.010
DEADBAND =             0.000

# Second axis ---- (Y) Gen1 RPM Controll ---------------------------
[AXIS_1]
TYPE =            LINEAR
HOME_SEQUENCE      =   1
# 62 HZ Max (makeup rate)
MAX_VELOCITY =         0.00001195169045
# 60 HZ = .00001156615205
#MAX_ACCELERATION =    20.0
MAX_ACCELERATION =      1.
#STEPGEN_MAXACCEL =    21.0
#STEPGEN_MAXACCEL =    .1
STEPGEN_MAXACCEL =    1.005
#PID_MAX_VEL =          1.25
#PID_MAX_VEL =          0.00001195169045
# 60 HZ for one Day (= one inch). Includes leap seconds
INPUT_SCALE =    5187550.687
#INPUT_SCALE =   10375101.37
#OUTPUT_SCALE =   5187550.687
OUTPUT_SCALE =   1.0
MIN_LIMIT =           -0.0
# 14 Days (inches) = 336 Hours. **** OIL CHANGE & LUBE TIME ****
MAX_LIMIT =            14
FERROR =               1.5100
MIN_FERROR =           1.501

DEADBAND =             0.0
P =                  200
I =                   50
D =                    1
BIAS =                 0
FF0 =                  0
FF1 =                  0.4
FF2 =                  0.0


.hal snippet   ------------------------------------------------------------
# HAL config file for power1 (servo to stepper)
# first load the core RT modules that will be needed
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD
servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
#loadrt stepgen step_type=0,0,0,0 ctrl_type=p,v,v,v
loadrt stepgen step_type=0,0,0,0
loadrt pid num_chan=3
loadrt encoder num_chan=4
loadrt hal_parport cfg="0x0378"

# hook functions to base thread
addf parport.0.read          base-thread 1
addf stepgen.make-pulses     base-thread
addf encoder.update-counters base-thread
addf parport.0.write         base-thread -1

# hook functions to servo thread
addf stepgen.capture-position servo-thread
addf encoder.capture-position servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.0.do-pid-calcs       servo-thread
addf pid.1.do-pid-calcs       servo-thread
addf pid.2.do-pid-calcs       servo-thread
addf stepgen.update-freq      servo-thread


# set values from .ini file for AXIS_0 - (X Electrical Switching ??)
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
# connections for AXIS_0 - (X)
net Xen   axis.0.amp-enable-out => stepgen.0.enable
net Xcmd  axis.0.motor-pos-cmd  => stepgen.0.position-cmd
net Xfb   stepgen.0.position-fb => axis.0.motor-pos-fb
#net Xstep stepgen.0.step => parport.0.pin-03-out    ------ borrowed for
Axis 1 below temp.
#net Xdir  stepgen.0.dir  => parport.0.pin-02-out


# set values from .ini file for AXIS_1 - (Y Gen1 RPM)
setp pid.0.maxerror 1.
setp pid.0.maxoutput 1.

setp pid.0.Pgain [AXIS_1]P
setp pid.0.Igain [AXIS_1]I
setp pid.0.Dgain [AXIS_1]D
setp pid.0.bias [AXIS_1]BIAS
setp pid.0.FF0 [AXIS_1]FF0
setp pid.0.FF1 [AXIS_1]FF1
setp pid.0.FF2 [AXIS_1]FF2
setp pid.0.deadband [AXIS_2]DEADBAND
setp encoder.1.counter-mode 1
setp encoder.1.position-scale [AXIS_1]INPUT_SCALE
setp stepgen.1.position-scale [AXIS_1]INPUT_SCALE
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
# connections for AXIS_1 - (X)
net Yenabl  axis.1.amp-enable-out => pid.0.enable => stepgen.1.enable
net Ycmd    axis.1.motor-pos-cmd  => pid.0.command
net YencAin encoder.1.phase-A     <= parport.0.pin-10-in
net Yfb     encoder.1.position    => axis.1.motor-pos-fb => pid.0.feedback
net YRPMcmd pid.0.output   => stepgen.1.position-cmd
#net Ystep   stepgen.1.step => parport.0.pin-05-out
#net Ydir    stepgen.1.dir  => parport.0.pin-04-out
net Ystep   stepgen.1.step => parport.0.pin-03-out
net Ydir    stepgen.1.dir  => parport.0.pin-02-out
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to