Main Content

sschdl.generateOptimizedModel

Replace Simscape switches and converter blocks with dynamic switches optimized for FPGA deployment

Since R2024a

    Description

    example

    generatedModel = sschdl.generateOptimizedModel(input) replaces common Simscape™ switches and converter blocks with their dynamic equivalents from the SimscapeFPGAHIL_lib library to optimize the model for FPGA deployment. To learn more about dynamic switch replacement, see Generate HDL Code for Simscape Models by Using Linearized Switch Approximation.

    The function supports replacement of these blocks:

    The generated optimized model has the same name as input but with the suffix _generated. Once the optimized model is generated, open the model and verify the connection. Connect any gate signal inports of the replaced blocks to their respective sources and remove any additional Simulink-PS Converter (Simscape) blocks.

    Examples

    collapse all

    Open the three-phase PMSM drive model at the MATLAB® command prompt.

    ModelName = 'sschdlexThreePhasePMSMDrive';
    open_system(ModelName)
    

    Open the Three-phase inverter subsystem that contains Simscape blocks.

    open_system([ModelName '/Three-phase inverter'])
    

    To optimize the model for FPGA deployment, run the sschdl.generateOptimizedModel function at the MATLAB command prompt:

    generatedModel = sschdl.generateOptimizedModel('sschdlexThreePhasePMSMDrive');
    
    The following blocks have been replaced: 
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT A(H)'
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT A(L)'
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT B(H)'
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT B(L)'
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT C(H)'
    'sschdlexThreePhasePMSMDrive/Three-phase inverter/IGBT C(L)'
    
    Saving sschdlexThreePhasePMSMDrive as sschdlexThreePhasePMSMDrive_generated with switches and converters replaced by dynamic equivalents.
    

    The generated optimized model for the three-phase PMSM drive model is saved as sschdlexThreePhasePMSMDrive_generated. In this model, the Three-phase inverter subsystem contains the replaced blocks.

    Input Arguments

    collapse all

    Simscape model name or a cell array of Solver Configuration (Simscape) block paths, specified as a character vector or string scalar, or a cell array of character vectors or string scalars. You can specify a Solver Configuration block attached to the Simscape network that you want to optimize within the model.

    Data Types: char | string | cell

    Output Arguments

    collapse all

    Path of the generated model that is optimized for HDL code generation, returned as a string array or cell array of character vectors. In the generated optimized model, when you double-click any dynamic switch block, the parameter values of Block Parameters Conductance (1/Ohm) Gs and Time scaling s are configured by using a Simulink.Parameter object. The values are stored in the base workspace and referenced from the block. For example, in the generated optimized model for the three-phase PMSM drive model the values are referenced as SolverConfiguration_Gs and SolverConfiguration_s from the blocks.

    Limitations

    • This function does not support all switches and converter blocks. Only listed switches and converter blocks are supported.

    • In the model, if a parameter references any workspace variable or an expression then the parameter value is replaced by the evaluated value.

    Version History

    Introduced in R2024a