필터 지우기
필터 지우기

Single precision equivalent to the Electrical RMS and Mean blocks

조회 수: 2 (최근 30일)
Hi,
I am trying to generate C code from a Simulink model, in order to run it on an embedded platform. This platform can only use its hardware acceleration when dealing with single precision floats, meaning that the execution time for double precision computations is (unsurprisingly) atrocious.
Unfortunately, the model features two types of block that appear unable to work with single precision: the RMS and Mean blocks from the “Electrical” library. Would you know of any single precision compatible blocks that could offer an alternative?
Thanks in advance.
  댓글 수: 1
Segmentation Fault
Segmentation Fault 2022년 5월 4일
Not finding any better alternative, we ended up re-implementing the Mean block using a cycling array, and the RMS using the similarly named (although not expecting the same form of input) RMS block from the "DSP" library, which does support single precision.

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

채택된 답변

Joel Van Sickel
Joel Van Sickel 2022년 5월 5일
Hello Segmentation Fault:
You are correct, those blocks (in the Simscape Electrical library) are implemented intended primarily for desktop analysis, not hardware implementation. This is fairly typical for Simulink blocks in the Simscape Libraries, while blocks in the DSP libraries, motor control blockset, etc, will be geared more toward optimal code generation. Your approach is the correct the approach and I'm pasting it into the answers so people will see it. Thank you for updating your question with the self-found solution.
Solution found by Segmentation Fault: Not finding any better alternative, we ended up re-implementing the Mean block using a cycling array, and the RMS using the similarly named (although not expecting the same form of input) RMS block from the "DSP" library, which does support single precision.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear Operators에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by