Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Labkack T7 PRO,24v motor,need help for my master thesis-PID and other stuff

rpm pid

  • Please log in to reply
10 replies to this topic

#1 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 09 May 2015 - 01:52 AM

I want to control a 24 v motor with T7 PRO and I need to implement an VI that will show RPM and based on this to implement an PID .I started reading the documentation and playing with the labview examples but I am very confused. For example how can I add a block that will output an RPM reading ? I believe I have to use the DIO extended feature....

 

Do you guys have any suggestions ? How can I start...unfortunately I don't have to much time left...I know the principles and how to do this with and Arduino,but understanding T7 PRO and Labview is kind of difficult .(I tried in Matlab but I Simulink does not offers me to much possibilities ) My work has to be ready until the end of this month....

Thank you! 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 11 May 2015 - 08:51 AM

There is good information on the LabVIEW_LJM page:

 

http://labjack.com/s...xamples/labview

 

Working with the T7 & LJM is very straightforward.  You look at the T7 datasheet to determine what registers you need to write and read, then use WriteName & ReadName calls to write and read those registers.

 

For example, say you want to measure RPM using the Frequency In DIO extended feature:

 

http://labjack.com/s...tures/frequency

 

That section describes the registers you write to configure the feature.  In your case, you should be able to use mostly defaults so I suggest you simply write:

 

DIO_EF_CLOCK0_DIVISOR=1

DIO_EF_CLOCK0_ROLL_VALUE=0

DIO_EF_CLOCK0_ENABLE=1

DIO0_EF_INDEX=3

DIO0_EF_CONFIG_A=1  //use continuous mode for your feedback control application

DIO0_EF_ENABLE=1

 

Then, whenever you want a read you simply read the register DIO0_EF_READ_A_F which will give you the period in seconds.  Check out the example "DIO0 Config & Read.vi".

 

What is your output?  Analog output?  In that case, whenever you want to update DAC0, you just call eWriteName to write a new value to DAC0.

 

So your LabVIEW program will start with a call to eWriteNames to configure the DIO-EF, then in a loop you will do 3 basic things:

 

1.  Call eReadName to read DIO0_EF_READ_A_F.

2.  Do your PID math to determine the new analog output setpoint.

3.  Call eWriteName to write DAC0.



#3 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 20 May 2015 - 12:35 PM

" whenever you want to update DAC0, you just call eWriteName to write a new value to DAC0. "

How can this be implemented ? I noticed that the output of DIO0_EF_READ_A_F. is an 0 or 1 ... so I was thinking to count every time 1 will be displayed( I assume I have to use a loop with some incremental blocks ? like i++ ? 



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 May 2015 - 04:14 PM

I am not quite sure what you are asking.  Looking at the end of post #2 from us, are you having trouble with step 1 or step 3?

 

 

1.  Call eReadName to read DIO0_EF_READ_A_F.

 

Reading this will return the period in seconds.

 

 

3.  Call eWriteName to write DAC0.

 

See "LJM_eWriteName Example.vi".



#5 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 20 May 2015 - 04:28 PM

So I will attached the .vi ...basically I want to see the number of rpm ...first..after that the pid..that needs to be implemented 

Attached Files



#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 May 2015 - 04:52 PM

We don't have LabVIEW 13 so can't open your VI.  It appears that you just attached our example VI, though, so we have that.  Set the values as noted in post #2 and see if you can read the period in seconds.  Perhaps attach a screenshot (Alt-PrintScreen) if you want to show us what you are seeing.



#7 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 24 May 2015 - 12:29 AM

Finally I have a .vi for rpm working properly and also I made a .vi that reads the AIN1 and AIN2 .The output is DAC0 that adjust the voltage.But after I copy-paste this 2 .vi into a single one and run it I have the error attached in the screen shoot... 

 

Error 7224 occurred at LJM_eReadAddresses.vi

This error code is undefined. Undefined errors might occur for a number of reasons. For example, no one has provided a description for the code, or you might have wired a number that is not an error code to the error code input.

Additionally, undefined error codes might occur because the error relates to a third-party object, such as the operating system or ActiveX. For these third-party errors, you might be able to obtain a description of the error by searching the Web for the error code (7224) or for its hexadecimal representation (0x00001C38).

 

Do you know what can I do in order to have this to .vi in a single one  ?



#8 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 24 May 2015 - 12:35 AM

This is the screenshoot
http://i59.tinypic.com/2co0cxk.png



#9 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 24 May 2015 - 12:47 AM

in the left loop,the AIN is Single AIN with config and in the right loop I have used DIO EF Config 1PWM and 1Counter



#10 Sinaia

Sinaia
  • Members
  • 7 posts

Posted 24 May 2015 - 07:55 AM

Later edit :

I connected the LJM_ErrorToString.vi and I found out this :  LabJack Error #1224:  LJME_DEVICE_NOT_OPEN occured at LJM_eWriteAddresses.vi  and LabJack Error #1224:  LJME_DEVICE_NOT_OPEN occured at LJM_eReadAddresses.vi (this two errors are alternating ) .... I believe the root cause is due to the fact that the LJM library is used in the same time by DIO EF Config 1 pwm and 1 counter  & Single AIN  and config blocks ?  (like in my above attached screenshoot)

 

 ( The LJME_DEVICE_NOT_OPEN occurs also if I had opened Kipling before runining any .vi example made by Labjack....Is something like a conflict in the LJM Library ?  )

 

How can I move on with my work ? Can you please help me also with this issue ?



#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 26 May 2015 - 07:25 AM

It looks like you have dropped a couple example VIs into parallel loops in your VI.  I recommend instead, you make a copy of an example that is close, and modify that copy to do what you want.  I suggest you make a copy of "Dual AIN Loop.vi" and start with that.  That example does:

 

eWriteNames

While Loop:

    eReadNames

 

... what you want is:

 

eWriteNames  (configuration)

While Loop:

    eReadNames  (AIN1, AIN2, DIO0_EF_READ_A_F)

    eWriteName  (DAC0)

 

 

So the structure of that example is very close to what you need.  You just need to add eWriteName in the loop (I suggest after eReadNames), and then need to change the names that being passed to the different functions.





Also tagged with one or more of these keywords: rpm, pid

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users