main content

half-凯发k8网页登录

this example shows how to implement a field-oriented control (foc) algorithm for a permanent magnet synchronous machine (pmsm). the example shows both a single-precision floating-point implementation and a half-precision floating-point implementation. when an algorithm contains large or unknown dynamic ranges (for example integrators in feedback loops) or when the algorithm uses operations that are difficult to design in fixed-point (for example, atan2), it can be advantageous to use floating-point representations. the half-precision data type occupies only 16 bits of memory, but its floating-point representation enables it to handle wider dynamic ranges than integer or fixed-point data types of the same size.

load the data required to simulate the model.

focmodeldata

open the ex_foc_current model. this model uses the same source block for two versions of a field-oriented control algorithm. the first version uses single-precision data types, while the second uses half-precision data types.

model = 'ex_foc_current.slx';
open_system(model)

simulate the model. you can see from the scope that the response of the single-precision implementation is identical to the response of the half-precision implementation.

sim(model)
ans = 
  simulink.simulationoutput:
           logtestbench: [1x1 simulink.simulationdata.dataset] 
     simulationmetadata: [1x1 simulink.simulationmetadata] 
           errormessage: [0x0 char] 

网站地图