MATLAB Answers

0

Pin toggle frequency in Simulink Real Time

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

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: 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 件のコメント

Peter Schouten 2018 年 8 月 27 日
I am using MATLAB R2016B which still supports the MCDAQ hardware board. Therefor I am not using a Speedgoat Target machine.
Are there FPGA Chips available for this setup?
Thank you for time and consideration.
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 2018 年 8 月 27 日
I am using the MCDAQ DIO 24.
https://www.mccdaq.com/PDFs/Specs/PCI-DIO24-spec.pdf

サインイン to comment.



Translated by