The most important differences between first- and second-generation arise from Simscape™ features that include:
Simscape Driveline™ components with realistic loss, threshold, and compliance dynamics
Simscape Foundation library
Physical signals with units
The practical impact of these Simscape-based features lies in how you optimally build more complex physical models. Once you have automatically updated a first-generation model to second-generation format, you can revise it manually to take advantage of and better conform to the Simscape environment.
Note: Manual optimization of a converted model sometimes requires detailed understanding of how equivalent second-generation blocks replace first-generation blocks. To learn in detail how this mapping works, see Manual Reconstruction of First-Generation Models.
Because the converted model uses the transitional library sdl_classic, the model does not have to appear or be constructed as it would if you had built it from the start with the Simscape Driveline 2 and Simscape product libraries. Follow some or all of these steps to make the converted model more naturally fit the second-generation, Simscape-based environment.
You use the block context menus on the masked subsystems for these tasks.
Because the converted blocks are masked subsystems, you can free the converted model from the transitional library by disabling and optionally breaking the converted block links to sdl_classic.
You can also remove a subsystem mask entirely.
Open the block dialog box and edit the subsystem mask to determine how the block dialog box parameters are referenced in the underlying subsystem.
Replace the block dialog box parameters in the underlying subsystem with the model-level parameter values or variables.
Unmask the subsystem.
Tip: Before removing the mask, be sure to locate and copy the subsystem dialog box parameter values or variables into the underlying subsystem blocks. You cannot retrieve these values or variables once you have removed the mask.
Depending on your model appearance and construction, decide whether you want to promote unmasked subsystem blocks higher up in the model hierarchy.
You can rearrange and, where possible, replace or modify these underlying Simscape and Simscape Driveline 2 blocks, using the regular product libraries only. For block equivalents and replacements, consult Transitional Library.
There is no equivalent to the first-generation Initial Condition block. In a Simscape-based model, you instead set initial conditions on some blocks individually, while other blocks have no initial conditions. You must ensure that the physical network as a whole has a consistent initial state.
For more about initial conditions, see Simulation Setup (Simscape).
To achieve optimal simulation performance and avoid simulation problems and failures with converted models, verify that your model conforms with these best practices. If it does not conform, modify the model.
Consider rebuilding how you model physical processes in your converted model. In the Simscape environment, the order of preference for physical modeling is to use:
Product library blocks in the Simscape Driveline and Simscape Foundation libraries
Physical Signal blocks, if the Simscape language is not adequate
Simulink® signals and blocks with sensors and actuators, making sure to break any algebraic loops (see Avoiding Algebraic Loops)
For guidance on how to customize and specialize your driveline components, see Specialized and Customized Driveline Components. Continue using Simulink for algorithmic control, nonphysical signals, and model-level input/output.
In first generation, you model custom and specialized physical components in Simulink, connecting to Simscape Driveline blocks through sensors and actuators with nonphysical Simulink signals.
In second generation, you accomplish the same goal with Simscape-based components and language, bringing all physical modeling into the Simscape environment.
Simscape simulation treats differential and algebraic constraint equations similarly. To the extent possible in your model, represent algebraic constraints between physical variables with Simscape-based components. Avoid physical signal algebraic loops that are fed back through Simulink. That is, avoid instantaneous, noncausal relationships between physical variables.
For more about algebraic loops, see Algebraic Loops (Simulink).
The default Simulink global solver is ode45. Most physical models in the Simscape environment are best simulated using ode23 or ode15s. In addition, you can optionally use the fixed-step Simscape local solvers with Simulink global solvers to improve physical simulation.
For more information about selecting global and local solvers for physical simulations, see:
Transitional library blocks that convert Simulink signals into Simscape signals provide input handling control. The block dialog box contains an Input Handling tab that you can use to select a filtering type for the input signal. You can select no filtering, first-order filtering, or second-order filtering. Alternatively, you can choose to specify up to two input derivatives. The Input Handling tab mirrors the Simulink-PS Converter. For more information, see Input Handling (Simscape).
Only transitional library blocks that convert a Simulink signal into a physical signal provide an Input Handling tab. The blocks contain one or more Simulink inports and one or more Simscape physical signal outports. If the block contains multiple Simulink input ports, the input handling options you specify apply equally to all ports. If you want to apply different input handling options to each input port, open the block subsystem and specify the input handling options for each Simulink-PS Converter block directly.
Model topology and solver choice determine the number of input derivatives required for a solution. You have the option to specify the first- and second-order derivatives, but if you fail to specify enough input derivatives, Simscape issues an error. Errors caused by insufficient input derivatives point to the Simulink-PS Converter block used under the mask of the transitional library block.
The following table lists the transitional library blocks that provide Input Handling options.
|Gears||Variable Ratio Gear|
|Dynamic Elements||Controllable Friction Clutch|
|Fundamental Friction Clutch|
|Sensors & Actuators||Torque Actuator|
|Vehicle Components||Diesel Engine|