Chattering in 6-phase generator + diode rectifier under fixed-step codegen — role of parallel resistor and "step size compensation" block?

Hi,

I’m building a 6-phase synchronous generator feeding a diode rectifier, intended to run in codegen mode with a fixed-step solver (Tstep ≈ 2.5 µs) for a real-time hardware target.

The generator is a custom model: the machine terminals are driven by controlled current sources inside abc->dq transformation blocks (dq equivalent circuit computes the currents, which are injected at the terminals, and the terminal voltages are measured back). The terminals connect directly to a 3-phase diode rectifier with a DC-link capacitor and load. The diodes are already set to Non-Ideal.

The problem: I observe high-frequency oscillation (“chattering”) on the generator terminal voltage waveform. When I zoom in, the voltage toggles between 0 and full scale (±5000 V) on a per-step (2.5 µs) basis, so it is clearly a numerical oscillation, not a physical waveform. The chattering occurs around the diode commutation / current zero-crossing instants, and because a 6-phase rectifier commutates so frequently, it covers a large portion (~2/3) of each cycle.

What’s puzzling — the behavior depends on a parallel terminal resistor: I placed a parallel resistor (R_parallel) at the generator terminals and swept its value:

  • R = 1 kΩ → clean (no chattering), but with significant conduction loss, which I want to avoid.

  • R = 10 kΩ → chattering appears.

  • No resistor → chattering appears, but the simulation still runs (current and DC voltage build up normally to the rated value).

Question 1: Why does only R = 1 kΩ remove the chattering, while both R = 10 kΩ and no resistor show it? And why does the simulation still run correctly (currents/power fine) even without the resistor, despite the voltage chattering?

What I’ve already tried (no success):

  • Sweeping the “Allow state-space inlining” option (on/off) over ~80 combinations of the 8 controlled voltage sources, with the current sources fixed to ZOH+on or FOH+on — no clear trend, chattering remained.

  • RC snubber across the terminals (e.g., R+C in series) — did not resolve the commutation chattering.

  • Inserting a unit delay in the feedback path — made overshoot worse.

The reference that led to my second question: While investigating, I opened the PLECS built-in Induction Machine model. It uses a very similar terminal interface (controlled current source + voltage measurement), but it has no parallel terminal resistor and runs cleanly under fixed-step. I noticed two things inside it:

  1. It is built as a Configurable Subsystem that switches its schematic based on “solverType.”

  2. It contains a block labeled “Step Size Compensation” (which internally contains a Solver Configuration block).

Question 2: What exactly is the role of this “Step Size Compensation” block? Is it what allows the built-in machine to run cleanly with a diode rectifier under fixed-step, without needing a parallel resistor? And is it something I can apply to my custom 6-phase model, or is it tied to the internal solverType-specific implementation of the library machine?

Question 3: More generally, for a custom machine model with current-source terminals feeding a diode rectifier in fixed-step codegen, what is the recommended way to eliminate this commutation chattering without adding a lossy parallel resistor?

Any guidance would be greatly appreciated. Thank you!

six_phase_gen.plecs (345.3 KB)

Question 1:

See the discussion on Rotor Reference Frame vs. Voltage Behind Reactance machine formulations in the Electric Machines FAQ. Without a snubber, the current injected into the diode bridge must fully go through one of the two diodes. When there is low current, the change in voltage at the bridge influences the current injection in the next step such that it may toggle the current polarity. This in turn changes the diode states, which then changes the applied voltages, which in turn toggles the current polarity, etc. With smaller snubber resistors values the current path and node voltage is better defined, hence no toggling. The snubber resistances change how the current branches at the diode bridge but does not guarantee that this toggling effect won’t occur.

You’ll also notice in your model that even though the node voltage is toggling - the average value over several toggle events of the applied voltage ends up being quite close to the correct value (at higher currents).

Question 2:

The step size compensation block does not address this underlying interface issue. Its purpose is to compensate for a loss in accuracy of the model due to discretization effects that manifest at high speeds / larger time steps.

The induction machines in the PLECS library interface without snubbers because of the state-space inlining setting of the current sources, as you identified. However, for state space inlining to work there are two requirements 1) the parameter is set to on and 2) “the input signal is a linear combination of electrical measurements”. The induction machines are in the stationary reference frame; there is not a sin(\theta) or cos(\theta) term. This contrasts with your model which is in the rotating reference frame and therefore has the non-linear sin/cos product preventing state-space inlining.

Question 3

There are two approaches - add a snubber element or reformulate the machine equations into a VBR-style model.

Earlier in your post you noted “The diodes are already set to Non-Ideal.”

In the model you posted this is not accurate. While there is a Vf and Ron term, the turn-on/turn-off event is an ideal transition. You can review more about what a Non-Ideal switch means in the context of real-time simulation / code generaiton in the Ideal and Non-Ideal Switch Models in Electric Circuits section of the PLECS manual.

One advantage of non-ideal switches is that they have a snubber-like effect. I modified the diode bridges in your model to be configurable as non-ideal and increased the snubber resistance (you can set to inf to disable). I also set the Non-Ideal Switch Resistance setting to ~15. The solver was set to variable step, such that you could compare a “reference” solution with a large 10kOhm snubber which simulates with a variable step solver fine against the CodeGen model with various configuration options.

six_phase_gen_bl.plecs (402.9 KB)