12-18-2007 09:37 AM
12-18-2007 10:42 AM
Note: I am using PXI-6533 ports 0 and 1 for the RTSI triggered sampling. I also have a separate task in the main application that is reading ports 2 and 3, with Internal Clock set as the sample trigger, with a scan rate of 100 scans/sec. I have tried removing the buffer config for the 2nd task, and just using software timing to periodically sample the ports, but the issue still persists. I cannot remove this task at this point, as it is used to track the encoder position for the machine's use, separate from the testing purposes.
Jason
12-19-2007 11:57 AM
Hi jjohannsen,
I would need to ask a couple of questions to be able to help you. If you can provide some kind of screen shoots of what your encoder vs. time plot should look like, and how does it looks when you skip a sample?
I'll try describing how I understand your system is setup. You have a CAN compatible system generating messages every 10 ms, those messages are receive by the PXI-8461/2. When a specific CAN message is receive the PXI-8461/2 triggers a timer in a PXI-6250. The PXI-6250 holds for 5 ms when this trigger is receive and then send a trigger through one of the RTSI lines to the PXI-6533, which reads the encoder.
May I ask, which is this specific message?, and what does it means? Since CAN message are sent every 10 ms and you read these messages from the CAN and the encoder readings every 100 ms, what happens with the other 9 CAN messages? Can you provide some more information on the parallel encoder? What is the output specification for the encoder? Is there a new encoder reading for every CAN message?
My guess on your issue is that, those times where you have fall for one sample in the PXI-6533, it was reading while no reading of the encoder was available, that is the reason why I would like to know what type of synchronization you have between the encoder and the PXI-6533. Also can you explain why you need the PXI-6250 generating the 5 ms delay?
Any other information you think might help me help you, please don't hesitate on posting it.
12-19-2007 12:27 PM
Jaime,
I am reading all 10 messages and encoder samples every 100 ms. 100 ms is just the rate at which the software is reading out all of the buffered data.
The specific CAN message is a periodically transmitted message from an angular measurement device that reports it angle. This is then compared to the actual angle measured with the encoder. The motor is set to move at a constant velocity (1800 deg/sec). The angle and velocity messages received over CAN confirm this, so we know the motor is not really accelerating and decelerating for 20 ms, as seen in the attached charts below.
The 5 ms delay is part of the test to help align our encoder sample points with the internal sampling of the CAN DUT. We have tried running the test with the 5 ms timer pause removed, but the issue was still evident on the velocity plot.
I allow a 30 ms timeout when reading the digital input buffer. If there happens to be one less sample in the 6533 buffer than in the CAN buffer, that sample should be present in < 5 ms.
The encoder has a 10 KHz update rate. It is a parallel gray coded binary 14-bit encoder. 5 V TTL outputs to the 6533. There will be a new encoder reading for every CAN message since the CAN card triggers the timer card, which then triggers the 6533 after 5 ms. RTSI (PXI bus) triggers are used. Please check the above VI that contains the configuration VIs.
Thanks
Jason
12-20-2007 06:05 PM - edited 12-20-2007 06:06 PM
Open your code this is what I see:
I can tell from the labels that the top part is the 6250 Timer Task and the bottom is the 6533. Something that might help and I will like to check is the part of the code that generates the degrees/second vs. message plot, you may want to post it.
Going on with the troubleshooting something I will try is making the 6250 (Dev4) count how many messages it receives from the 8461. You should be able to do it setting up a read digital channel from Dev4 or setting up a change detection task to count how many times the message has been received on the 6250. Another though would be doing the same with the 6533 (Dev3); counting how many times it receives the clock from the 6250 after the timer is done. Since you can count how many messages the CAN has sent, it should the same for the pulses receives on the 6250 and the clocks ticks receives on the 6533. It should also work with the no-timer setup.
I would like to clarify to avoid confusions that the 6533 is using the signal from the 6250 as an “external clock” not as a “trigger”. I would like to point also that if you take a look at this shipped example: “Read Dig Port-Ext Clk.vi” you will see that the configuration to read the port is different from what yours, you might want to try the approach taken on the example.
I hope it helps
12-21-2007 01:47 PM
Jaime,
Thanks for reviewing this. The only difference I can see in the example vs. my code appear to be "Finite" vs. "Continuous". Could this be causing a problem with the external clocking? Did I miss any differences?
If I set the sample mode to Finite, and set the buffer size to greater than the expected # of samples for one cycle, will this work the same way as setting to Continuous as it is now? Keep in mind I am stopping and starting the task every cycle, with approx 3000 samples being received over a 30+ second cycle. Stopping and starting the task (with "DAQmx Start Task" and "DAQmx Stop Task" VIs) will reset the buffer, correct?
To find velocity, I just post-process the recorded angles and CAN message timestamps. Then do a Vel = [Angle(x + 1) - Angle(x)] / [Time(x+1) - Time (x)] calculation where x is index of array.
Thanks,
Jason
12-26-2007 03:18 PM - edited 12-26-2007 03:18 PM
12-26-2007 03:40 PM
Hani,
I am starting the tasks at the start of each cycle, reading the buffers later on during the test, when power is applied and the CAN device starts transmitting messages, and stopping the tasks at the end of each cycle.
I can specify the # of samples to read at the DAQmx Read VI even when set to continuous acquisition, correct? Then the Read VI will only take as long as it needs to read out that # of samples from the buffer? i.e. if the buffer size is 1000, there are 350 samples in the buffer, and I set the Read VI to read 350 samples, there should be no wait time?
I read all available CAN messages, and the corresponding digital input samples, every 100 ms or so, in order to keep the CAN buffer from overflowing (max buffer size of around 75 messages with my configuration and both ports being used). I have attached the portion of code I use to do this.
My question now is, using "continuous" sample mode, and having the buffer size manually set to 1000 samples, could this cause a problem with "re-sizing" the buffer as more samples are placed into it, and old samples are shifted out once 1000 samples have been collected and read? I expect around 3000 messages and corresponding digital input readings for each test, so would setting the buffer size to ~4000 samples solve this issue (if it actually is a problem)? Or would I need to set the mode to finite to truly stop any "re-allocation" of memory. Or am I totally in the wrong place to be looking.
Thanks,
Jason
12-26-2007 06:33 PM
12-27-2007 07:57 AM
The encoder has a 10 KHz update rate. It is a parallel output gray coded binary 14-bit encoder. It has 14 individual 5 V TTL outputs to the 6533. The encoder outputs do not have a frequency, they just turn on or off depending on the angle. I take each encoder measurement from the 6533 and convert it from gray code to a decimal value, then convert to degrees by dividing by 16384 and multiplying by 360. There will be a new encoder reading for every CAN message since the CAN card triggers the timer card, which then triggers the 6533 after 5 ms. RTSI (PXI bus) triggers are used. Please check the above VI that contains the configuration VIs.
Thanks
Jason