Numerical glitches

Hello there,

Would you tell me the reason for the numerical glitches appearing in the simulation results, coming from the attached PLECS simulation case? It is a simple circuit (R-L-e with current source), then there is a conflict between the inductor and current source, thus a snubber R was put in parallel with the L.

pp135.slx (21.1 KB)

Hello, this is because the solution is not stable with this solver algorithm given the constraints of the system’s Eigenvalues and the user-imposed error checking setting. If you reduce the “Relative tolerance” parameter of the Simulink solver settings (“Configuration Parameters”) from 1e-3 to 1e-6, for example, the results will no longer show these artifacts. The relative tolerance setting is your best option to influence accuracy control with a variable-step (Continuous time) solver, and can often be used to mitigate issues like the one exhibited with your model. I hope this helps, but let me know if you have further questions!

Hello there,

Thank you for your clear answer! Your recommendation (reducing the tolerance to 1e-6) worked. Then, I wonder if I can ask these two follow-up questions: 1) does this mean the state space solver (a.k.a, the Simulink solver) tries to reduce the size of the time step and attempt the internal iteration, which would determine the necessary ‘sub’ timestep until the given tolerance is satisfied? 2) All the circuit elements in the simulation case are linear(current source, voltage source, R, and L). What, in the circuit, does trigger the internal iteration?

Hello, sure you can, though to be honest, this (simulation of numerical systems) is a whole day topic we lecture on for our users during training workshops, so it’s not something I can fully cover here.

  1. Yes! See "Error Tolerances for Variable-Step Solvers in the Simulink documentation for a short explanation and visuals.

  2. The time steps of the solver are always changing based on the previous calculation and its accuracy. Typically the time steps are smaller in the beginning of the simulation and will get larger as the simulation carries on if there are not any other events that require the solver to take iterations to ensure accuracy. Essentially error checking is made during each step and based on the outcome of that an internal iteration may be triggered.

Does that make sense?

Thanks,

Kris

Thank you for the answers, Kris.

Please let me ask these two follow-up questions:

  1. I could not run the simulation with a fixed time step solver. As far as I remember, PLECS turns into a Dommel style solver once the main solver turns into the fixed-step. However, that was not the case this time. Would you tell me the reason for generating errors, instead of moving forward with a different solver, when the main solver got changed into a fixed step one?

  2. Is there any way to generate the system transition matrix (usually referred to as ‘A’ matrix) from a given circuit? If that is possible, a usual linear system analysis, e.g., eigen-analysis, can be done to see the circuit from a different viewpoint.

Best Regards,

In Kwon Park

Hi In Kwon : ). So you will know more about this topic than some others.

  1. In this case you actually need to go to the PLECS Preferences (not Simulink) from the Simulation menu while having the PLECS Circuit window active and change the state-space type from Continuous to Discrete. You also have access to the two discretization methods we provide in that window as well.

  2. Yes, you can extract the state-space matrices via the MATLAB command line. Please go to the PLECS Online Help (or User Manual), navigate to the Analysis Tools chapter, and at the bottom, you will find within the “Usage in PLECS Blockset” section a description of how this works and the commands syntax.

Let me know if you are able to find these items.

Regards,

Kris

Hi Kris,

Thank you for your message and information. I was able to check both answers. The state-space matrix extraction (in my opinion) was more intuitive than MATLAB/Simulink’s. The match(of mapping) between the elements of the matrices and the circuit elements was clear and easy to follow.

Best Regards,

In Kwon Park

Hi In Kwon,

OK, great! Thank you for the feedback.

Kris