Implementing variable resistor as suggested by Mathworks with fixed point output

조회 수: 5 (최근 30일)
TuttoAlDoc
TuttoAlDoc 2025년 4월 11일
답변: Ronit 2025년 7월 15일
Hello,
I saw this interesting solution
that you provided and I tried it: it works fine but I discovered that it automatically force to use floating point data type.
Do you know how is possible to force to use fixed point? I tried to read the documentation but I'm not able to find anything.
thanks
Michele

답변 (1개)

Ronit
Ronit 2025년 7월 15일
Yes, it is possible to generate a fixed-point HDL implementation model from a Simscape-based variable resistor or inductor model, but there are some important clarifications regarding where fixed-point is supported in the workflow.
Simscape simulation itself always runs in floating-point (double or single). Fixed-point support is available for the HDL implementation model (the Simulink subsystem generated from your Simscape model).
This means you can generate a fixed-point compatible subsystem for HDL code generation, but you cannot run the original Simscape block in fixed-point.
To enable fixed-point output for HDL code Generation, please follow these steps:
  1. Build your Simscape model.
  2. Open the Simscape HDL Workflow Advisor for your model.
  3. In the 'Generate implementation model' task, set the 'Data type precision' option to 'Fixed-point'.
  4. Run the Advisor task to generate the HDL implementation model.
  5. Use HDL Coder to generate HDL code from the fixed-point implementation model.
Refer to the following documentation link on how to use Fixed-Point Precision to generate the implementation model: https://www.mathworks.com/help/releases/R2024b/hdlcoder/ug/validate-hdl-implementation-model-and-resolve-numerical-mismatches.html#mw_2e512b1a-a4ae-4bca-a3d0-0bad8fb77419
Note: You cannot force the Simscape block itself to run in fixed-point, only the generated HDL implementation model can use fixed-point. All Simscape simulation and validation logic are floating-point. The fixed-point configuration applies only to the implementation model used for HDL code generation.
I hope this helps with your query!

카테고리

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

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by