simulation stopped because powergui caused 1000 zero crossings events

3 views (last 30 days)
Simulation was stopped because powergui and some other blocks like relays etc. caused 1000 zero crossings events.This error did not go even after I increased the maximum no. of zero crossings in configuration properties.
I also made the zero crossing detection "adaptive" and changed ignored and masked zero crossings to "none", as instructed in the diagnostics pane, but even though the simulation ran uptil completion after that, the ouput graphs were not correct. It was as if, after the time intervals where zero crossings> 1000 was indicated, the graphs just continued as per previous state. It was no longer responsive to the changes in input signals.

Answers (1)

Riya
Riya on 20 Dec 2023
Edited: Riya on 5 Jan 2024
Hello Rhea,
As per my understanding, you're facing issues with zero crossing events in your MATLAB/Simulink simulation and altering the maximum number of zero crossings and the zero crossing detection settings did not resolve the issue.
Please note that here's a step-by-step guide to troubleshoot the problem.
  • Ensure that the parameters and initial conditions of your model represent a physically realistic system.
  • Choose a solver that is better suited for handling stiff systems or systems with discontinuities and adjust the step size and tolerances.
  • Implement hysteresis in the switching logic of relays and other components that cause zero crossings to prevent chattering.
% Add hysteresis to a relay block programmatically
set_param('my_model/Relay', 'SwitchOnPoint', '5.1', 'SwitchOffPoint', '4.9');
  • Filter Noisy Signals
Apply filtering to noisy signals that could be causing unnecessary zero crossings.
% Applying a low-pass filter to a noisy signal
fs = 1000; % Sampling frequency
fc = 50; % Cutoff frequency
[b, a] = butter(3, fc/(fs/2)); % Create a 3rd-order Butterworth filter
filtered_signal = filter(b, a, noisy_signal);
  • Temporarily disable non-essential dynamics to isolate the problematic part of the model.
  • Use Event-Based Modeling
  • Resolve Algebraic Loops
Identify and resolve any algebraic loops in your model that could be causing numerical difficulties.
% Introduce a delay to break an algebraic loop
set_param('my_model/AlgebraicLoopBlock', 'SampleTime', '1e-3');
  • Review Output Graphs and Data
After running the simulation, thoroughly review the output graphs to ensure they are physically plausible.
If you continue to experience issues, please provide more details about your model, the blocks causing problems, and the exact nature of the incorrect outputs in your graphs. This will help in offering a more precise solution.
For more information you can refer following articles:
I hope it helps!

Categories

Find more on Trimming and Linearization in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!