Data acqusition with embedded matlab function. Some functions don't work.
Mostra commenti meno recenti
Hi, sorry for so many questions, but I keep getting stuck in making a speed control system for rotating shaft via an encoder and a Pci 1711 acqusition board.
At first I tried making the pulse count through simulink but I found that the program wasn't fast enough and it missed many pulses when the speed wasn't too low ( less than 75 RPM). Then I tried to make a little program in a .m file for measuring pulses and worked well.
Now I want to use that file in the simulink model with an embedded matlab function block, when trying to build the model with the funciton block I find that some functions are not supported for code generation, even though I made a little program for using the analog output and I could build it without problems so I don't know why some functions are available and some are not for code generation.
Any ideas or help about will be vey appreciated.
Thanks in advance.
Alejandro
3 Commenti
ayam mohsen
il 21 Apr 2013
please help me ,what version of matlab using with pci-1711,thanks
Walter Roberson
il 21 Apr 2013
Ayam, anything from R14SP1 onward, and R14 itself if you apply the fix I posted the link to in response to your other query.
ayam mohsen
il 22 Apr 2013
thank you walter Roberson ,i read the page
Risposte (2)
Azzi Abdelmalek
il 4 Set 2012
Modificato: Azzi Abdelmalek
il 4 Set 2012
0 voti
Unfortunatly there are some functions which are not allowed with code generation. The only way to find solutions to your problems is to find another way to program whatever you want by usig compatibles codes.
Kaustubha Govind
il 4 Set 2012
0 voti
The (Embedded) MATLAB Function Block automatically generates C code from your MATLAB code for accelerated execution, hence only a subset of MATLAB functions are supported for code-generation. If you are simply running the simulation in normal mode (and don't intend to generate code from your model), you can use the coder.extrinsic (formerly eml.extrinsic) directive to call unsupported functions from the block.
However, it may be simpler for you to use the Interpreted MATLAB Function block or a MATLAB S-function block. If you are using toolbox functions like from the Data Acquisition Toolbox, you may find that the toolbox ships with Simulink versions of the functions. For example: Data Acquisition Block Library.
10 Commenti
Alejandro Martín
il 4 Set 2012
Kaustubha Govind
il 4 Set 2012
Alejandro: analoguotput doesn't sound like something shipped with MATLAB. Perhaps it is a user-defined function implemented using functions that are supported for code-generation, or might be using coder.extrinsic, or even calls to external libraries invoked using coder.ceval.
Walter Roberson
il 4 Set 2012
Azzi Abdelmalek
il 4 Set 2012
the faster way to data aquisition is "xpc target" or using a special card with it's own processor
Kaustubha Govind
il 5 Set 2012
Modificato: Kaustubha Govind
il 5 Set 2012
Walter: Thanks for the correction!
Alejandro: As Walter pointed out, analogoutput is part of the DAQ toolbox, but is not listed amongst the functions supported for code-generation. I'm guessing that the implementations that you've seen declare and use the function with eml.extrinsic (now coder.extrinsic). However, the DAQ Simulink library does ship with the equivalent "Analog Output" block, so you may simply use that.
Alejandro Martín
il 6 Set 2012
Kaustubha Govind
il 6 Set 2012
Alejandro: Are you saying that the analogoutput MATLAB function is faster than the Analog Output block in the Simulink library? Since you're using Real-Time Windows Target, would any of the driver blocks from that library work for you: http://www.mathworks.com/products/rtwt/supported/index.html
Azzi Abdelmalek
il 6 Set 2012
Alejandro, can you tell us what do you mean by fast aquisition? what is your sample time, if it's around 10^-6 s, Real time windows target will not be the good choice, mainly if your machine is a simple PC.
Alejandro Martín
il 7 Set 2012
Modificato: Alejandro Martín
il 7 Set 2012
Kaustubha Govind
il 7 Set 2012
Alejandro: I don't have expertise in the data acquisition area, so there's not much useful advice that I can provide. Perhaps you could contact Tech Support and ask if it is expected that the Simulink Data Acquisition blocks are slower than their MATLAB counterparts?
Categorie
Scopri di più su Texas Instruments C2000 Processors in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!