필터 지우기
필터 지우기

How to speed up a Simulink simulation of slow mechanics requiring a fast clock?

조회 수: 11 (최근 30일)
What are the best methods to speed up a simulation that uses a 5Mhz clock but needs to simulate 2 sec of run-time?
I am running a brushless DC motor in a phase lock loop (DPLL) simulation and am concerened with estimating jitter. My actual system uses a 50MHz clock in a FPGA. I am simulating with a 5MHz clock because I want a resolution of at least 0.2us on jitter estimates.
I am using a combination of S-functions and sub-sytems. I am using a boolean pulse generator at 5Mhz as the clock. My motor model is continuous time. I only run S-functions if the clock transitions low to high. I only run the phase detector on the rising edge of the reference or feedback as sampled with the rising edge of the boolean clock. The compensation, a digital filter, is an S-block that is only run if the phase detector state changes. The effective sample rate is 360Hz.
Because it is a mechanical system I need to simulate about 2 seconds of time to gather lock and seettle.
Thanks,
Brian
  댓글 수: 1
Brian Tremaine
Brian Tremaine 2019년 7월 16일
I put phase detector code in an S-function because I thought that would be faster than a sub-system. I guess thats a wrong assumption ;) I wrote the phase detector code with "if - else" structures paralleling closely the verilog code I used to implement it in an FPGA. If the boolean clock does not transition high the majority of the code in the 'update' is not executed.
Do you think execution would be faster if I 1) Generated a C compiled S-function or 2) Implement the phase detector using logic gates & counters in a sub-system ?
Thanks for your helpful advice,
Brian

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

답변 (1개)

Bharath Venkataraman
Bharath Venkataraman 2019년 7월 15일
There are a wide variety of things you can do. The first thing to try is to run the model in Accelerator or Rapid Accelerator mode. You can also try to change the model to simulate frames rather than scalar values.
Here is a documentation page devoted to the topic.
  댓글 수: 1
Brian Tremaine
Brian Tremaine 2019년 7월 16일
I put phase detector code in an S-function because I thought that would be faster than a sub-system. I guess thats a wrong assumption ;) I wrote the phase detector code with "if - else" structures paralleling closely the verilog code I used to implement it in an FPGA. If the boolean clock does not transition high the majority of the code in the 'update' is not executed.
Do you think execution would be faster if I 1) Generated a C compiled S-function or 2) Implement the phase detector using logic gates & counters in a sub-system ?
Thanks for your helpful advice,
Brian

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

카테고리

Help CenterFile Exchange에서 Target Language Compiler에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by