Jump to content
OMRON Forums

tanakakai

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by tanakakai

  1. I am just passing along this information, so hopefully this answers your question:

     

    #define matrixsize 10

    global matrix(matrixsize);

    matrix(0)=1,2,3,4,5,6,7,8,9,10

     

    The #define is available to use in your programs.

     

    Thanks Gregs! Adding the '(0)' to the end in order to assign values to the matrix was not intuitive. I think this will help me move forward with my code, I appreciate it!

  2. I would like to create some matrix variables to hold certain parameters for my PMAC program.

     

    As I understand it, the format for defining a matrix is:

    global mymatrix(n)

    Where n is the number of elements in the matrix.

     

    I can't find anything in the documentation that explains how I can set the values for all elements in the variable. Is there some way I can do something like this:

     

    global mymatrix(5);
    mymatrix = (1,2,3,4,5)
    

    Such that mymatrix(0)=1, mymatrix(1)=2, etc?

     

    edit:

    Also wondering if there is a function that finds (or defines) the length of the vector so I can be sure my indexing variable does not exceed the matrix length. Something like:

    mymatrix.index
    

     

    There has to be a way that the software knows how many P variables to reserve. Is the index variable generic and overwritten each time a new matrix is created? If so I suppose I should define matrix length via another variable like:

    global matrixlength = 5;
    global mymatrix(matrixlength);
    

  3. I'm using a DT to automate some lab tests right now (just using it as data collection and DAC), and I was hoping to be able to read a test matrix from a file so that I can change my test parameters without changing the code. Is there a way to read in a text file and parse it so that it can be comprehended by our PMAC?
  4. Monitor the actual hardware register value(s) of the ASIC like Gate1[6].Chan[0].ServoCapt in the IDE Watch window while you move the encoders. The values reported have nothing to do with conversion table or motor setup, so if there is a problem, you have isolated it to the ASIC setup or a signal problem.

     

    Thanks Curt. I was pretty sure that was the register to be monitoring. I found that our EE (yeah, throw him under the bus!) wired the encoder into the card wrong. I'm getting signal now.

  5. We are currently using our Power PMAC to collect some external data. We are recording 2 digital inputs:

     

    1. Linear quadrature incremental encoder

    2. Linear hall effect sensor

     

    and one analog input:

     

    3. Load cell (voltage)

     

    I have set up the linear quadrature encoder as shown in the users manual but I am still not seeing any change in the input (Acc24E2[6].Chan[0].ServoCapt). I am sure the encoder works because we can view the data through the software provided by the manufacturer.

     

    I'm guessing there is an error in my motor setup (since I've never set up a pure slave motor before). I did notice that my motors are both "ClosedLoop" and I have a feeling I want them to be in open-loop mode but could not find a way to set them to open-loop mode. (I tried setting Motor[1].pAdc=0 but that had no effect).

     

    Global Defs

    #define LoadCellSens	1 //Enter Load cell sensitivity in V/lbf
    
    //Gate Setup
    Gate1[6].PwmPeriod = 5896;  // Set Max Phase Freq to 10 kHz (MaxPhase Freq. = 117,964.8 kHz / [2*Gate1[i].PwmPeriod+3])
    Gate1[6].PhaseClockDiv = 0;  // Set phase clock freq to 10 kHz
    Gate1[6].ServoClockDiv = 1;  // Set servo clock freq to 5 kHz (Servo Clock Freq. = Phase Clock Freq. / (Gate1[i].ServoClockDiv +1))
    Gate1[6].HardwareClockCtrl = 2258;  // Set Encoder sample clock to 9.83 MHz (default)
    Gate1[6].PwmDeadTime = 0;  // Dead time to zero per Copley/Delta Tau app note
    Gate1[6].Chan[0].EncCtrl = 3; //Set x4 quadrature deocde CW for Linear Encoder (set 7 for CCW)
    Gate1[6].Chan[1].EncCtrl = 11; //Set x6 quadrature decode CW for Hall Sensor (set 15 for CCW)
    
    //Linear Encoder data (as suggested in manual)
    EncTable[1].Type = 3;	//Software 1/T extension of count value
    EncTable[1].pEnc = Acc24E2[6].Chan[0].ServoCapt.a;
    EncTable[1].pEnc1 = Acc24E2[6].Chan[0].TimeBetweenCts.a;
    EncTable[1].ScaleFactor = 1/(512);
    
    //Hall Sensor data
    EncTable[2].Type = 3;
    EncTable[2].pEnc = Acc24E2[6].Chan[1].ServoCapt.a;
    EncTable[2].pEnc1 = Acc24E2[6].Chan[1].TimeBetweenCts.a;
    EncTable[2].ScaleFactor = 1/(512);
    
    //Load Cell data
    EncTable[3].Type = 1;
    EncTable[3].pEnc = Acc28E[3].AdcSdata[0].a;  // Point to A-D Channel 1 on Acc28E (J3 pins 1-3)
    //EncTable[3].pEnc1 = Sys.pushm;
    //EncTable[3].index1 = 16;
    //EncTable[3].index2 = 16;
    //EncTable[3].index3 = 0;
    //EncTable[3].index4 = 0;
    EncTable[3].ScaleFactor = 1/(3276.8*2.205/LoadCellSens)  // Scale counts to kg (signed 16 bit register)
    //(3276.8 [counts/v])*(2.205 [lb/kg])*(LoadCellSens [V/lb])
    
    //Motor 1 setup (Linear Encoder)
    Motor[1].ServoCtrl=1;
    Motor[1].PhaseCtrl=0;
    Motor[1].pLimits=0;
    Motor[1].pEnc = EncTable[1].a;
    Motor[1].pEnc2 = EncTable[1].a;
    Motor[1].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[1].AbortTa = -1; //Disable auto abort over acceleration
    
    //Motor 1 setup (Hall Sensor)
    Motor[2].ServoCtrl=1;
    Motor[2].PhaseCtrl=0;
    Motor[2].pLimits=0;
    Motor[2].pEnc = EncTable[1].a;
    Motor[2].pEnc2 = EncTable[1].a;
    Motor[2].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[2].AbortTa = -1; //Disable auto abort over acceleration
    

     

    Program 1

    global end = 0; //set end parameter
    
    open prog 1
    
    //Setup Gather Routine
    /****************************************/
    Gather.Enable = 0; //Disable Gather
    
    Gather.Type[0] = 1; //Set Gather type signed 32-bit
    Gather.Type[1] = 1; //Set Gather type signed 32-bit
    Gather.Type[2] = 1; //Set Gather type signed 32-bit
    Gather.Type[3] = 1; //Set Gather type signed 32-bit
    
    Gather.Addr[0] = sys.Time.a //Time since last powerup (seconds)
    Gather.Addr[1] = Motor[1].ActPos.a //Linear Encoder Position (mm)
    Gather.Addr[2] = Motor[2].ActPos.a //Hall Sensor Position (mm)
    Gather.Addr[3] = Acc28E[3].AdcSdata[0].a //Load Cell Data (kg)
    
    Gather.Items = 4;
    Gather.Period = 1; //Sample every servo cycle (5kHz)
    
    Gather.MaxLines = 100000;
    Gather.MaxSamples = 400000;
    
    //Main Loop
    /****************************************/
    while (end == 0) 
    {
    while (Acc24E2[6].Chan[0].UserFlag == 1) //Check for high from Copley
    {
    	if (Gather.Enable == 0)
    	{
    		Gather.Enable = 2;
    	}
    	else{}
    }
    Gather.Enable = 0;
    }
    
    close
    /****************************************/
    

  6. Nope, same results as before.

     

    Any other data I can collect that would help determine what's going on here?

     

    Based upon the data that you have sent, it appears that you only have 16 bits of data and not 26-bits. Try the following setting and see if it solves the issue:

     

    //--------------------------------------------------------------------------------
    // Encoder Setup: Renishaw RESOLUTE encoder (Biss-C Unidirectional)
    //--------------------------------------------------------------------------------
    
    #define SingleTurnRes        16
    
    //System Timing
    Sys.ServoPeriod = 8427*3/117694.8;
    Sys.PhaseOverServoPeriod = 1/3;
    
    //Gate Setup
    Gate1[6].PwmPeriod = 6527/2;  // Set PWM freq to 9.034 kHz
    Gate1[6].PhaseClockDiv = 0;  // Set phase clock freq to 18.068kHz (NOT 9.034 kHz - this comment was wrong)
    Gate1[6].ServoClockDiv = 2;  // Set servo clock freq to 6.023 kHz
    Gate1[6].HardwareClockCtrl = 2258;  // Set Encoder sample clock to 4.9 MHz, others at default
    Gate1[6].PwmDeadTime = 0;  // Dead time to zero per Copley/Delta Tau app note
    
    
    //Renishaw Encoder Setup
    ptr GlobalRegister->u.io:$A0007C.8.24;
    //GlobalRegister=$18000B        // Global Control register, 4MHz (Not 2MHz - this comment was wrong) Clock setting
    // Try the following:
    GlobalRegister=$18020B        // Global Control register,4MHz Clock setting, encoder read on rising edge of servo clock
    
    ptr Chan1Reg->u.io:$A00020.8.24;
    Chan1Reg = $211480 + SingleTurnRes    // Ch1 Control register, 16-Bit EnDat Encoder
    
    ptr PosReg1->u.io:$A00000.8.24;
    ptr PosReg2->u.io:$A00004.8.24;
    
    EncTable[1].type=1
    EncTable[1].index1=16
    EncTable[1].index2=8
    EncTable[1].index3=0
    EncTable[1].index4=0
    EncTable[1].index5=0
    EncTable[1].pEnc1=Sys.pushm
    EncTable[1].pEnc=Acc84E[0].Chan[0].SerialEncDataA.a
    EncTable[1].MaxDelta=0
    EncTable[1].ScaleFactor=1/(256*256)
    EncTable[1].TanHalfPhi=0
    EncTable[1].CoverSerror=0
    
    //Motor 5 Setup (PWM Output)
    Motor[5].pDac = Acc24E2[6].Chan[0].Pwm[2].a
    Motor[5].ServoCtrl=0;
    Motor[5].pLimits=0 ; 
    Motor[5].pEnc = EncTable[1].a;
    Motor[5].pEnc2 = EncTable[1].a;
    Motor[5].Desired.Pos = 0;
    Motor[5].pAbsPos = Acc84E[0].Chan[0].SerialEncDataA.a;
    Motor[5].AbsPosFormat = $00001008;
    
    Motor[5].Ctrl = Sys.PosCtrl;  //Set output for Open-Loop output
    Motor[5].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[5].MaxSpeed=300000000;
    
    Motor[5].AbortTa=-1;
    

  7. I have attached the data you requested.

     

    Channels:

    1. Time
    2. EncTable[1].PrevEnc
    3. Motor[5].DesPos

     

    It does not appear to be rolling over at the maximum value of the PrevEnc register. It also doesn't appear the that the rollover is occurring at the same value every time.

     

    I have also noticed that the resting point for the PrevEnc register is on the order of ~1.35e9. That is pretty close to the maximum value of the register. Is there a way I could be setting the value of this register (or whatever feeds into it) manually each time the machine runs to prevent it from winding up?

     

    tanakakai,

     

    Please gather the EncTable[n].PrevEnc as CurtWilson explained. We need to find out why this register is not rolling over properly.

    EncTableRolloverGather.zip

  8. I made the changes to the "GlobalRegister" and did not see any change in clipping behavior. I did notice that there was less noise, but I'm not sure if this is a coincidence or not. The data I am seeing now look more like those I collected before testing the last code you gave me.

     

    http://imgur.com/PgaH0VR.png

     

    The problem also happens multiple times per cycle (and is repeatable). This is a 1Hz sine wave input with a sample taken every servo cycle (.215 ms/sample).

     

    http://i.imgur.com/zBeuCvv.png

     

    I made some modifications in your original settings. See if this fixes your problem:

     

    //--------------------------------------------------------------------------------
    // Encoder Setup: Renishaw RESOLUTE encoder (Biss-C Unidirectional)
    //--------------------------------------------------------------------------------
    
    #define SingleTurnRes        26
    
    //System Timing
    Sys.ServoPeriod = 8427*3/117694.8;
    Sys.PhaseOverServoPeriod = 1/3;
    
    //Gate Setup
    Gate1[6].PwmPeriod = 6527/2;  // Set PWM freq to 9.034 kHz
    Gate1[6].PhaseClockDiv = 0;  // Set phase clock freq to 8.068kHz (NOT 9.034 kHz - this comment was wrong)
    Gate1[6].ServoClockDiv = 2;  // Set servo clock freq to 2.33 kHz
    Gate1[6].HardwareClockCtrl = 2258;  // Set Encoder sample clock to 4.9 MHz, others at default
    Gate1[6].PwmDeadTime = 0;  // Dead time to zero per Copley/Delta Tau app note
    
    
    //Renishaw Encoder Setup
    ptr GlobalRegister->u.io:$A0007C.8.24;
    //GlobalRegister=$18000B        // Global Control register, 4MHz (Not 2MHz - this comment was wrong) Clock setting
    // Try the following:
    GlobalRegister=$18020B        // Global Control register,4MHz Clock setting, encoder read on rising edge of servo clock
    
    ptr Chan1Reg->u.io:$A00020.8.24;
    Chan1Reg = $211480 + SingleTurnRes    // Ch1 Control register, 26-Bit EnDat Encoder
    
    ptr PosReg1->u.io:$A00000.8.24;
    ptr PosReg2->u.io:$A00004.8.24;
    
    EncTable[1].index1=8
    EncTable[1].index2=8
    EncTable[1].index3=0
    EncTable[1].index4=0
    EncTable[1].index5=0
    EncTable[1].pEnc1=Sys.pushm
    EncTable[1].pEnc=Acc84E[0].Chan[0].SerialEncDataA.a
    EncTable[1].MaxDelta=0
    EncTable[1].ScaleFactor=1/256
    EncTable[1].TanHalfPhi=0
    EncTable[1].CoverSerror=0
    
    //Motor 5 Setup (PWM Output)
    Motor[5].pDac = Acc24E2[6].Chan[0].Pwm[2].a
    Motor[5].ServoCtrl=0;
    Motor[5].pLimits=0 ; 
    Motor[5].pEnc = EncTable[1].a;
    Motor[5].pEnc2 = EncTable[1].a;
    Motor[5].Desired.Pos = 0;
    Motor[5].pAbsPos = Acc84E[0].Chan[0].SerialEncDataA.a;
    Motor[5].AbsPosFormat = $00081A08;
    
    Motor[5].Ctrl = Sys.PosCtrl;  //Set output for Open-Loop output
    Motor[5].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[5].MaxSpeed=300000000;
    
    Motor[5].AbortTa=-1;
    

  9. Sorry to take so long in replying, another project needed my attention. I have implemented the code you suggested and it did not solve the issue. Again I have tested multiple drive levels and frequencies and they all display the same single data point length for the jump in values. I have noticed that they sometimes occur at different values, not sure if this means I'm looking for a mechanical issue now or if it could still be linked to the Delta Tau programming.

     

    I've also observed sing data point spikes in the results as well:

     

    http://imgur.com/cQuHkSt.png

     

    Try the following settings in your EncTable:

     

    EncTable[1].type=1
    EncTable[1].index1=8
    EncTable[1].index2=8
    EncTable[1].index3=0
    EncTable[1].index4=0
    EncTable[1].index5=0
    EncTable[1].pEnc1=Sys.pushm
    EncTable[1].pEnc=Acc84E[0].Chan[0].SerialEncDataA.a
    EncTable[1].MaxDelta=0
    EncTable[1].ScaleFactor=1/256
    EncTable[1].TanHalfPhi=0
    EncTable[1].CoverSerror=0
    

  10. I'll start off with an image of what I'm seeing. The ActPos is coming from a Renishaw BiSS absolute encoder tied to the end of one of our magnetostrictive actuators.

     

    http://i.imgur.com/vbGaQmX.png

     

    I have convinced myself this is not an issue with anything mechanical in our system since at all frequencies and drive levels the jump is a single data point. I'm having trouble finding where the problem is coming from, can anyone explain the entire chain of data from BiSS in to the ActPos register? I've posted my Renishaw code and motor config below in case I changed something that would be affecting this.[/code]

     

    //--------------------------------------------------------------------------------
    // Encoder Setup: Renishaw RESOLUTE encoder (Biss-C Unidirectional)
    //--------------------------------------------------------------------------------
    
    #define SingleTurnRes        26
    
    //System Timing
    Sys.ServoPeriod = 8427*3/117694.8;
    Sys.PhaseOverServoPeriod = 1/3;
    
    //Gate Setup
    Gate1[6].PwmPeriod = 6527/2;  // Set PWM freq to 9.034 kHz
    Gate1[6].PhaseClockDiv = 0;  // Set phase clock freq to 9.034 kHz
    Gate1[6].ServoClockDiv = 2;  // Set servo clock freq to 2.33 kHz
    Gate1[6].HardwareClockCtrl = 2258;  // Set Encoder sample clock to 4.9 MHz, others at default
    Gate1[6].PwmDeadTime = 0;  // Dead time to zero per Copley/Delta Tau app note
    
    
    //Renishaw Encoder Setup
    ptr GlobalRegister->u.io:$A0007C.8.24;
    GlobalRegister=$18000B        // Global Control register, 2 MHz Clock setting
    
    ptr Chan1Reg->u.io:$A00020.8.24;
    Chan1Reg = $211480 + SingleTurnRes    // Ch1 Control register, 26-Bit EnDat Encoder
    
    ptr PosReg1->u.io:$A00000.8.24;
    ptr PosReg2->u.io:$A00004.8.24;
    
    EncTable[1].type=2;        // 24+8 bit read entry
    EncTable[1].pEnc = Sys.piom + $A00000;    // address of lower 24 bit
    EncTable[1].pEnc1 = Sys.piom + $A00004;    // address of upper 8 bits
    EncTable[1].index1 = 32-SingleTurnRes;                    // left shift for sign adjustment 32-26=6
    EncTable[1].index2 = 0;
    EncTable[1].index3 = 0;
    EncTable[1].index4 = 0;
    EncTable[1].ScaleFactor = 1/exp2(32-SingleTurnRes);    // scale back to offset the left adjustment done by index2
    EncTable[1].MaxDelta = 50000 * 256;
    
    //Motor 5 Setup (PWM Output)
    Motor[5].pDac = Acc24E2[6].Chan[0].Pwm[2].a
    Motor[5].ServoCtrl=0;
    Motor[5].pLimits=0 ; 
    Motor[5].pEnc = EncTable[1].a;
    Motor[5].pEnc2 = EncTable[1].a;
    Motor[5].Desired.Pos = 0;
    Motor[5].pAbsPos = Acc84E[0].Chan[0].SerialEncDataA.a;
    Motor[5].AbsPosFormat = $00081A08;
    
    Motor[5].Ctrl = Sys.PosCtrl;  //Set output for Open-Loop output
    Motor[5].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[5].MaxSpeed=300000000;
    
    Motor[5].AbortTa=-1;
    

  11. Currently when I abort a script motion program Motor[1].DesPos goes to -947e6. I would like to change this behavior to have DesPos (and thus the dac) to go to 0.

     

    I've found the rates (AbortTa, AbortTs) but I don't see the abort target anywhere.

     

    [Note, I am running Motor[1].Ctrl = Sys.PosCtrl so DesPos is linearly related to the output of the DAC. Thus, when the system is aborted, it will try to rail our linear amplifier]

  12. I'm trying to use Sys.Time as a marker for a data file (just a way to show when a sample was taken). However, when I type in Sys.Time.a, it gives the value of Sys.Time not the address at which it's stored.

     

    What is the address for Sys.Time?

     

    example terminal window:

    sys.Time
    Sys.Time=4029.52099447074715
    sys.Time.a
    Sys.Time.a=4033.07312619812183
    

  13. Motor[1].pDac = Gate1[6].Chan[0].Dac[1].a <- Did not work

    Motor[1].pDac = Gate1[6].Chan[3].Dac[1].a <- Did not work

    Motor[1].pDac = Sys.Idata[256].a <- Worked

     

    No other motors were active. (Only checked motors 1-10, but there's no reason any motor beyond 2 would be assigned to anything, I only have 2 channels of motor output connected to the pmac)

  14. As far as I can tell PhaseCtrl is set to zero (but PhaseFound is still true).

     

    Here is the code I'm running as well:

    undefine all;
    
    Coord[1].SegMoveTime = 1;
    
    global myrad = 1; //In Volts
    global ctr;
    global maxctr = 8;
    global period = 1000;
    global loc=0;
    global valueof
    
    &1#1->838861x  //Gain for Close-Loop output
    
    Motor[1].Ctrl = Sys.PosCtrl;  //Set output for Open-Loop output
    Motor[1].FatalFeLimit = 0; //Prevent disable from over error limit
    Motor[1].MaxSpeed=300000;
    
    open prog 1
    // --------------------User Code Goes Here------------------------
    Acc24E2A[6].Chan[0].AmpEna=1;
    Motor[1].Desired.Pos = 0;
    
    
    loc = 1;
    tm(period) x(myrad);
    
    loc = 2;
    circle1 tm(period) ts 0 ta 0;
    
    ctr = 0;
    
    //Gather.Enable = 2;
    
    loc = 3;
    while (ctr < maxctr)
    {
    loc =4;
    x(myrad) i(-myrad)
    ctr ++
    }
    
    loc =5;
    dwell 100;
    
    //Gather.Enable = 0;
    
    x0;
    
    close
    /****************************************/
    

    PhaseCtrl.png.0bc7aba2e94e7f30d188571d4ffbeaae.png

  15. Curt, I will check on the status of IqCmd.

     

    I have verified that:

     

    *Motor[1].pDac = Acc24E2A[6].Chan[0].Pwm[0].a

     

    *Acc24E2A[6].Chan[0].Pwm[0] = 0 while DesPos changes (via monitoring w/ both the internal IDE scope)

     

    The jog functions do the same thing. They will change DesPos but not the Dac register.

     

    I am currently trying to replicate the issue after having to perform a full reset on the system.

     

    edit:

     

    Looking at IqCmd while using the Jog Ribbon, it does in fact change when I press the jog buttons. However, there is still no change in the Dac register. I am on Motor 1 and it is defined as:

     

    Motor[1].pDac=Acc24E2A[6].Chan[0].Pwm[0].a

     

    I know it's not the hardware, if I click "enable output" in system setup I can manually change output voltage. I can also write directly to the Dac address and get an output, I just can't get any output when working with the scripting language.

     

    edit2:

    Here are some pictures from the scope.

    Signal.png.cbdf43374fc5e008187411e743250bd2.png

    153854920_DacLevelinScope.png.d1a8c0f8b523f92a23aa9c3728fd77c1.png

  16. As suggested by Curt during my training, I am using Motor[1].Ctrl = Sys.PosCtrl to force a direct open loop output to the Dac register.

     

    The basic gist of the program is that it generates a sine wave by moving one axis of a circular motion.

     

    When running my code (or jogging the motor) the desired position changes but there is no change to Acc24E2A[6].Chan[0].Dac[0] (the configured Dac register. DesPos was monitored in the scope to verify that it was in fact being generated correctly.

     

    Currently I do not have an encoder connected to the system (as it's not supposed to use any feedback).

     

    While Running:

     

    Motor Status (True):

    HomeComplete

    FeWarn

    ClosedLoop

    AmpEna

    PhaseFound

    Csolve

     

    Coordinate System Status (True):

    FeWarn

    TimerEnabled

    HomeComplete

    ClosedLoop

    AmpEna

    BlockRequest (flashes)

    TimersEnabled

    Csolve

    ContMotion

    SegEnabled

    AddedDwellDis

    ProgRunning

    ProgActive

    ProgProceeding

×
×
  • Create New...