tanakakai
Members-
Posts
21 -
Joined
-
Last visited
tanakakai's Achievements
-
How to assign values for all elements of matrix variable
tanakakai replied to tanakakai's topic in Power PMAC
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! -
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);
-
To clarify, I would like to load data from a file to change the values of certain global variables.
-
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?
-
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.
-
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 /****************************************/
-
Rollover in Motor[x].ActPos causing waveform distortion?
tanakakai replied to tanakakai's topic in Power PMAC
Sina, I tried your code and it did not make a difference, I still see the same thing. I'll update my Delta Tau to the latest firmware and try again. -
Rollover in Motor[x].ActPos causing waveform distortion?
tanakakai replied to tanakakai's topic in Power PMAC
Nope, same results as before. Any other data I can collect that would help determine what's going on here? -
Rollover in Motor[x].ActPos causing waveform distortion?
tanakakai replied to tanakakai's topic in Power PMAC
I have attached the data you requested. Channels: Time EncTable[1].PrevEnc 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? EncTableRolloverGather.zip -
Rollover in Motor[x].ActPos causing waveform distortion?
tanakakai replied to tanakakai's topic in Power PMAC
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 -
Rollover in Motor[x].ActPos causing waveform distortion?
tanakakai replied to tanakakai's topic in Power PMAC
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 -
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;
-
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]
-
No, I am trying to add it to a gather from within a script motion program.
-
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