error after 24 seconds in model

25 views (last 30 days)
harsh
harsh on 30 Nov 2024 at 21:35
Answered: Suraj Kumar on 1 Dec 2024 at 5:51
component divide
% PS Divide :0.75
% This block divides the first input signal by the second one:
% y = u_1 ./ u_2
%
% All connections are physical signal ports.
inputs
I1; % Left input signal (numerator)
I2; % Right input signal (denominator)
end
outputs
O; % Output signal (result of division)
end
equations
epsilon = 1e-1; % Small value to prevent division by zero
O = I1 ./ max(I2, epsilon); % Apply regularization to denominator
end
end

Answers (1)

Suraj Kumar
Suraj Kumar on 1 Dec 2024 at 5:51
Hi @harsh,
The error that you are encountering during simulation of the model can be eliminated by using the following steps.
You can select 'Use local solver' in the ‘SolverConfiguration’ block if it is present in the model.
This allows Simscape and physical network components to utilize a specialized local discrete solver. The local solver treats the physical network as a stiff system, using an implicit solver to iteratively find the solution for the next time step with an algebraic solver.
To learn more about making optimal solver choices for physical simulation, you can refer to the following documentation:
Hope it helps!

Tags

Products

Community Treasure Hunt

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

Start Hunting!