Difference in the values simulated with and without using parallel processing (parasim) for a Simulink Simscape model

7 次查看(过去 30 天)
I am trying to simulate faults on a three phase inverter connected to grid in simulink using simscpe blocks. There is a difference between the values when I simulate in accelerator mode in simulink, and when turn on "Allow tasks to execute concurrently on target". I have also noticed the same difference when I am simulating the same file as parallel simulation while changing some parameters using parasim.
The difference is around 3-4 V. So, why is this hapenning?

回答(1 个)

Shubham
Shubham 2024-6-24,8:28
Hi H R Sai,
The differences in simulation results you're observing when switching between different simulation modes (such as accelerator mode, concurrent execution, and parallel simulations) can be attributed to several factors. Here are some potential reasons for the discrepancies:
Numerical Precision and Solver Settings:
  • Different simulation modes might use different solvers or step sizes. For instance, fixed-step solvers might behave differently from variable-step solvers, and the choice of solver can significantly impact the numerical precision of the simulation.
  • Different modes might handle numerical precision differently. Accelerator modes and parallel simulations might use different levels of precision compared to normal mode.
Concurrency and Task Execution:
  • When "Allow tasks to execute concurrently on target" is enabled, the simulation might be executed in a multi-threaded or multi-core environment. This can introduce slight variations due to the non-deterministic nature of concurrent execution, especially if the model involves feedback loops or tightly coupled components.
  • Concurrent execution can lead to differences in how tasks are prioritized and scheduled, potentially causing variations in the timing of events and state updates.
Parallel Simulation Variations:
  • When using parasim for parallel simulations, even slight changes in parameters can lead to noticeable differences in the results. This is especially true for non-linear systems like a three-phase inverter connected to a grid.
  • Ensure that the initial conditions are consistent across different simulation runs. Variations in initial conditions can lead to different transient behaviors.
Model Discretization:
  • When simulating power electronics and grid-connected systems, the discretization of continuous systems can introduce variations. Different modes might discretize the system differently, leading to small differences in the results.
  • Ensure that the sampling rates are consistent across different simulation modes to avoid aliasing effects.
Recommendations to Mitigate Differences
Consistent Solver Settings:
  • Ensure that the solver settings (type, step size, tolerance) are consistent across all simulation modes.
  • Use a fixed-step solver if possible, and ensure the step size is small enough to capture the dynamics of the system accurately.
Concurrency Settings:
  • If using concurrent execution, carefully review the task prioritization and scheduling settings. Ensure that critical tasks are given appropriate priority.
  • Consider running the simulation in single-threaded mode to compare results and identify if concurrency is introducing the variations.
Parameter Consistency:
  • Double-check the parameters used in parallel simulations to ensure they are consistent and within expected ranges.
  • Use the same initial conditions for all simulation runs to ensure consistency.
Model Validation:
  • Validate the model by running a baseline simulation in normal mode and compare the results with other modes.
  • Perform sensitivity analysis to understand how variations in parameters and initial conditions affect the simulation results.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Multicore Processor Targets 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by