Preparación del modelo en tiempo real
Preparar un modelo de Simscape para tiempo real implica equilibrar de forma iterativa el rendimiento y la fidelidad para producir resultados precisos con coste y unidades de tiempo suficientemente pequeñas para la plataforma objetivo. Comience por obtener resultados de referencia del modelo. Cuando el modelo produzca resultados precisos en comparación con los resultados de referencia usando un solver de paso fijo, puede intentar desplegar el modelo en la plataforma objetivo en tiempo real. Siga estos pasos para equilibrar rendimiento y fidelidad según sea necesario:
Utilice bloques ideales o de nivel de sistema y parametrizaciones ideales en lugar de bloques y parametrizaciones más complejos.
Elimine fuentes de dinámica rápida.
Elimine fuentes de rigidez numérica.
Elimine fuentes de cruces por cero.
Utilice el solver de partición.
Realice particiones en el modelo.
Minimice las iteraciones del solver.
Para el despliegue en FPGA, reduzca fuentes de modos.
Para analizar el rendimiento del solver para dinámicas rápidas y rigidez numérica, utilice la herramienta Solver Profiler. Cuando tenga todo listo para convertir a paso fijo y coste fijo, utilice la función simscape.getLocalSolverFixedCostInfo para determinar cuántas iteraciones no lineales debe realizar.
Herramientas
| Solver Profiler | Identify solver performance bottlenecks |
Funciones
simscape.getLocalSolverFixedCostInfo | Determine iteration requirement when transitioning to fixed cost (Desde R2021b) |
Temas
Configuración de paso fijo y coste fijo
- Examine Model Dynamics Using Solver Profiler
Identify factors affecting model simulation using the Solver Profiler. - Solvers for Real-Time Simulation
The fixed-step solver, step size, and number of iterations that you specify affect how your Simscape™ model simulates in real time. - Identify and Resolve System Stiffness in Simscape Models
Analyze the effect of particular block variables on overall system stiffness of a Simscape network. - Define Step Size and Number of Nonlinear Iterations for Simscape Real-Time Simulation
Determine the step size and number of nonlinear iterations for fixed-step, fixed-cost simulation. - Calcular los costes computacionales
Determine si es posible que su modelo de Simscape incurra costes inesperados cuando lo simule en un equipo objetivo en tiempo real calculando la carga computacional.
Optimización del rendimiento
- Reduce Zero Crossings
Eliminate components that cause zero crossings to increase the minimal step-size for fixed-step simulation and to make your Simscape model real-time capable. - Increase Simulation Speed Using the Partitioning Solver
Improve performance by using the Simscape Partitioning solver to convert a large system of equations into several smaller systems of equations that are easier to solve.
Despliegue en FPGA
- Get Started with Simscape Hardware-in-the-Loop Workflow (HDL Coder)
Simscape Hardware-in-the-Loop workflow modeling guidelines and restrictions. - Simscape Language Support for FPGA HIL Deployment (HDL Coder)
Simscape language support in Simscape Hardware-in-the-Loop Workflow. - Modeling Guidelines for Simscape Subsystem Replacement (HDL Coder)
Simscape modeling best practices for replacing Simscape subsystem with state-space algorithm. - Replace Piecewise-Constant Resistor with Switched Linear Components (HDL Coder)
Convert a Simscape model with nonlinear component into a switched linear model. - Estimate Achievable Target Frequency Without Running Synthesis (HDL Coder)
Estimate the optimal frequency that you want your Simscape models to achieve on FPGA without running synthesis. - Modeling Techniques for Simscape Converters for FPGA HIL Deployment (HDL Coder)
Model your power electronic converter by using hardware-in-the-loop (HIL) simulation in a real-time target machine.
Plataformas genéricas
- Requirements for Using Alternative Platforms
Follow the recommendations for minimum hardware, software, and compiler specifications to deploy your Simscape model for hardware-in-the-loop (HIL) simulation using a custom standalone application. - Embedded and Generic Real-Time Resources
Simulink® Coder™ and Embedded Coder® use system target files (STFs) to generate code for interfacing with specific real-time operating systems.

