Pin toggle frequency in Simulink Real Time

조회 수: 2 (최근 30일)
Peter Schouten
Peter Schouten 2018년 8월 19일
댓글: Peter Schouten 2018년 8월 27일
For a project I need to simulate a Hall-Effect sensor. A Hall-effect sensor generates a block pulse with fixed amplitude and variable frequency. For this project, I need to achieve an accurate frequency signal with a maximum of 7.5 kHz.
I use Simulink Real time to gerenate the digital signal, with a MCDAQ Dio 24 Digital output.I measure the output frequency with a scope to my laptop. I am using a very high end TargetPC (i7 CPU, 16GB DDR3 etc.)
I have multiple models that can generate such a signal. However, I am running into problems with signal accuracy. https://nl.mathworks.com/matlabcentral/fileexchange/35922-programmable-pulse-generator-using-simulink-s-basic-blocks
When running this model, I get the desired signal frequency, but the signal is oscillating around the input frequency. For example: Desired is 6 kHz, output is 5.8 kHz to 6.2 kHz. Average is good, but the fluctuating signal frequency is visible on the datalogger during testing. In the real world, no fluctuation occurs.
Furthermore, using this models to generate a pulse signal requires extreme sampling times of 0.0001 [s].
Having done a project like this with different hardware in the past, I have once succesfully generated extremely high frequency block pulses on a Olimexino STM32 using interrupts to generate this signal. This was all done with a custom simulink library.
It seems to be really hard for the hardware to generate a block signal by model calculation. There must be a simpler method.
What I really want: Is there a way in Simulink Real Time to toggle a digital output state with a certain input frequency? In simple words: Can I just tell a digital output: 'toggle with 7.5 kHz now, and now with 7.4 kHz etc.?
Any help is greatly appreciated.
Kind regards, Peter

답변 (1개)

Diego Kuratli
Diego Kuratli 2018년 8월 26일
The MCDAQ is not supported by Simulink Real-Time and therefore I guess you are using a different product or third-party drivers?
In general, a x86 computer introduces some jitter. The Simulink Real-Time kernel and Speedgoat target machines are designed and optimized to reduce such unwanted behaviors.
Note that a generic digital output might not be appropriate for generating an accurate signals. Typically, the signal generator internal frequency requires to be much faster than the generated signal. There are solutions allowing generating high-speed and accurate signals, see: https://www.speedgoat.com/products-services/fpgas
  댓글 수: 3
Diego Kuratli
Diego Kuratli 2018년 8월 27일
Which MCDAQ board are you using? Is the board installed on a target computer?
FPGA-based solutions are available for Speedgoat's target machines only.
Peter Schouten
Peter Schouten 2018년 8월 27일
I am using the MCDAQ DIO 24.
https://www.mccdaq.com/PDFs/Specs/PCI-DIO24-spec.pdf

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

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by