필터 지우기
필터 지우기

Data acqusition with embedded matlab function. Some functions don't work.

조회 수: 4 (최근 30일)
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
Walter Roberson
Walter Roberson 2013년 4월 21일
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
ayam mohsen 2013년 4월 22일
thank you walter Roberson ,i read the page

댓글을 달려면 로그인하십시오.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 4일
편집: Azzi Abdelmalek 2012년 9월 4일
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
Kaustubha Govind 2012년 9월 4일
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
Alejandro Martín
Alejandro Martín 2012년 9월 7일
편집: Alejandro Martín 2012년 9월 7일
Hello again.
Kaustubha, What I meant is quite close to what you wrote, If I make a model in simulink, and use a digitaliput function of the real time windows target library, some pulses are missed. Instead, using the digital input function (the one that belongs to data acquisition toolbox) in a .m file it does not miss pulses (at least for the speeds i'm trying to measure). I wrote the example of analogoutput and analoginput because after trying with digitalinput I made a program for measuring pulses using the analoginput function and attempted to "put" the code in an embedded matlab function block but i found that those functions were not supported for code generation. The same occured with a program using the digitalinput function.
Azzi, sorry for not commenting about the speeds, I want to measure a digital signal with a maximum frequency of, let's say, 120hz. With these speeds I shouldn't be having trouble unsing real time windows target.
Thanks to both of you for your help.
Kaustubha Govind
Kaustubha Govind 2012년 9월 7일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by