01-15-2024 07:16 AM - edited 01-15-2024 07:19 AM
Hello together,
Im trying to control a motor and everything is working seperately but when i put it together this error message occurs.
Im reading a Angle with digital inputs and the Toque as a Analog input. The thought behind the program is that every time the angle changes, the Torque should be measured and given out to the graph over the corresponding angle measured.
The motor control channel is just starting the motor via button.
The analog output controls the speed of the motor.
The program runs fine for the first minute and then the error is stopping the program.
Im aware that the programm is not the cleanest and i will do the fine tuning when it is running properly without an error. Im using a NI 6212 as data exchange device.
Below are the pictures of the Tasks configured in NI MAX.
I hope your able to help me because im stuck and have no idea how to fix this.
Thanks in advance
Best regards
Julius
Solved! Go to Solution.
01-15-2024 12:57 PM
Hallo Julius,
bitte nicht per PM um Hilfe zu deinem Thread im Forum fragen…
@Julsbng wrote:
Im aware that the programm is not the cleanest and i will do the fine tuning when it is running properly without an error. Im using a NI 6212 as data exchange device.
Comments on your VI:
01-15-2024 04:25 PM
Hey,
thanks for all the advices and improvements first! I really appreciate.
I will fix the points you mentioned and will upload the Vi in version 2019 tomorrow.
That’s true with the shift registers and the loop i will fix that!
Thank you for the first help.
best regards
Julius
01-16-2024 05:17 AM
Hello Gerd,
Thanks again for all the points you mentioned, the error notification is fixed now.
I also corrected all other things you mentioned.
Sadly i got a new problem while fixing this.
When the motor speed is increased the angle measurement is getting worse and incorrect. The motor is rotating in on direction but the angle is not increasing like it should. At higher speeds than 2rpm the measurement goes crazy... It goes from 1.6 degree to -3 without even changing the direction of rotation.
Do you have any idea how to fix this.
I attached the program in version 2019.
01-16-2024 05:40 AM
I did not have the problem when the Torque Task where set to Continuous Sample 100 1k.
Thats why i did this.
01-16-2024 06:00 AM
Hi Julius,
how fast does your loop iterate?
What is the expected data rate of the Angle sensor? Do you obey Mr. Nyquist?
What happens when you don't update the graph in each iteration?
How is the "ANGLE" task defined?
You seem to handle just 2 bits, but the DAQmxRead value is delivered with 32 bits and the lower 3 bits are unused? The Angle calculation only adds/subtracts the value 0.25 all the time!?
01-16-2024 06:39 AM
Hi Gerd,
How can i determine how fast my loop iterates? Or change that?
The angle measurement is a TTL Signal from a Torque measurement shaft. You are right there are only 2 bits used. Would it be better to use P1.0 and p1.1 instead of p1.3 and p.4? I could deliver the DAQmxRead with just the single bits and add them afterwards? So i dont have all 32bits? Yes the 3 lower bits are unused.
I also deleted the Graph ones and the angle still didnt work with higher speeds.
I need to ask the company of the sensor about the data rate of the angle measurement. I can only find the cut off frequency of 1kh -3db.
The resolution of the angle sensor is 0.25 degree. So every time the value of digital input changes i add or subtract 0.25 degree corresponding to the direction of rotation. The values which come out of the input are 0 8 24 and 16. if they are in this order the rotation is against the clock and i subtract 0.25 of the angle. In the other direction i add 0.25.
01-16-2024 06:52 AM
Hi Julius,
@Julsbng wrote:
The resolution of the angle sensor is 0.25 degree. So every time the value of digital input changes i add or subtract 0.25 degree corresponding to the direction of rotation. The values which come out of the input are 0 8 24 and 16. if they are in this order the rotation is against the clock and i subtract 0.25 of the angle. In the other direction i add 0.25.
Does your DAQ devices support AB counters? Then the card itself could count all the encoder pulses, no need stack case structures inside of each other…
@Julsbng wrote:
How can i determine how fast my loop iterates?
Place a GetDateTimeInSeconds inside the loop and subtract the current value from the previous one…
01-16-2024 07:14 AM
Hi,
Yes it supports counters but i have no idea how these counters work and what the outputs are. I need to test this. Could this be the problem of the angle measurement?
Does your DAQ devices support AB counters? Then the card itself could count all the encoder pulses, no need stack case structures inside of each other…
Place a GetDateTimeInSeconds inside the loop and subtract the current value from the previous one…
Here should be the pace of the loop.
01-17-2024 12:42 AM
Hi Julius,
@Julsbng wrote:
Here should be the pace of the loop.
You better subtract previous from current time, even though I wrote the opposite! 🙂
The loop needed 7ms for the last iteration...
@Julsbng wrote:
Yes it supports counters but i have no idea how these counters work and what the outputs are. I need to test this. Could this be the problem of the angle measurement?
Open MAX and configure a counter task. MAX will show you how to connect your encoder...