Your Simulink and Simscape solver choices must work together consistently. To ensure consistency of your Simulink and Simscape solver choices for a particular model, open the model Configuration Parameters dialog box. From the top menu bar in the model window, select Simulation > Model Configuration Parameters. Review and adjust the following settings.
• “Switching from the Default Explicit Solver to Other Simulink Solvers” on page 4-14
• “Filtering Input Signals and Providing Time Derivatives” on page 4-14 • “Enabling or Disabling Simulink Zero-Crossing Detection” on page 4-16 • “Making Multirate Simulation Consistent” on page 4-16
Switching from the Default Explicit Solver to Other Simulink Solvers
If you do not modify the default (explicit) solver, your performance may not be optimal. Implicit solvers are better for most physical simulations. For more information about implicit solvers and physical systems, see “Important Concepts and Choices in Physical Simulation” on page 4-17.
Diagnostic Messages About Explicit Solvers
When you use an explicit solver in a model containing Simscape blocks, the system issues a warning to alert you to a potential problem.
To turn off this default warning or to change it to an error message, go to the Simscape pane of the Configuration Parameters dialog box:
1 From the Explicit solver used in model containing Physical Networks blocks drop-down list, select the option that you want:
• warning — If the model uses an explicit solver, the system issues a warning upon simulation. This is the default option that alerts you to a potential problem if you use the default solver.
• error — If the model uses an explicit solver, the system issues an error message upon simulation. If your model is stiff, and you do not want to use explicit solvers, select this option to avoid future errors.
• none — If the model uses an explicit solver, the system issues no warning or error message upon simulation. If you want to work with explicit solvers, in particular for models that are not stiff, select this option.
2 Click OK.
Filtering Input Signals and Providing Time Derivatives
You may need to provide time derivatives of some of the input signals, especially if you use an explicit solver. One way of providing the necessary input derivatives is by filtering the input through a low-pass filter. Input filtering makes the input signal smoother and generally improves model performance. The additional benefit is that the Simscape engine computes the time derivatives of the filtered input. The first-order filter provides one derivative, while the second-order filter provides the first and second derivatives. If you use input filtering, it is very important to select the appropriate value for the filter time constant.
you choose. Set the time constant to a value no larger than the smallest time interval in the system that interests you. If you choose a very small time constant, the filtered input signal is closer to the true input signal. However, this filtered input signal increases the stiffness of the system and slows the simulation.
Instead of using input filtering, you can provide time derivatives for the input signal directly, as additional physical signals.
You can control the way you provide time derivatives for each input signal by configuring the Simulink-PS Converter block connected to that input signal:
1 Open the Simulink-PS Converter block dialog box. 2 Click the Input handling tab.
3 To turn on input filtering, set the Filtering and derivatives parameter to Filter input. Select the first-order or second-order filter, by using the Input filtering order parameter, and set the appropriate Input filtering time constant parameter value for your model.
• Provide first derivative — If you select this option, an additional Simulink input port appears on the Simulink-PS Converter block, to let you connect the signal providing input derivatives.
• Provide first and second derivatives — If you select this option, two additional Simulink input ports appear on the Simulink-PS Converter block, to let you connect the signals providing input derivatives.
Enabling or Disabling Simulink Zero-Crossing Detection
By default, Simulink tracks an important class of simulation events by detecting zero crossings. With a global variable-step solver and without a local solver, Simulink attempts to locate the simulated times of zero crossings, if present. See “Working with Simscape Representation” on page 4-3.
Diagnostic Messages About Globally Disabling Zero-Crossing Detection
You can globally disable zero-crossing detection in the Solver pane of the Configuration Parameters dialog box, under Zero-crossing options. If you do, and if you are using a global variable-step solver without a local solver, the system issues a warning or error when you simulate with Simscape blocks.
You can choose between warning and error messages in the Simscape pane of the Configuration Parameters dialog box.
1 From the Zero-crossing control is globally disabled in Simulink drop-down list, select the option that you want, if you globally disable zero-crossing detection: • warning — The system issues a warning message upon simulation. This option
is the default.
• error — The system issues an error message upon simulation, which stops. 2 Click OK.
Making Multirate Simulation Consistent
The sample time or step size of the global Simulink solver must be the smallest time step of all the solvers in a multirate Simscape simulation.
To avoid simulation errors in sample time propagation, go to the Solver pane in the Configuration Parameters dialog box and select the Automatically handle rate transition for data transfer check box.