[Help] Ideal comparator: Inverting comparator with hysteresis

I’m trying to build a hysteretic current controller using KSKelvin’s ideal comparator.

When I test the hysteresis comparator with a sinusoidal input, it works perfectly. However, when I integrate the controller into a branch that emulates a buck converter, the system no longer behaves correctly.

I would appreciate any help or suggestions on what might be causing this issue.

Thank you in advance.


Hysteresis_current_control.qsch (14.2 KB)

There are at least two types of hysteresis comparator circuits. I think you have to use the HMITT comparator to build that instead of my ideal comparator. I saw that you used HMITT with Vt and Vh, so do you specifically want to build it with a resistor network?

I also made custom symbols for them in this directory: Hysteresis-CKT...
Qspice/Symbols-KSKelvin/devices/comparators at main · KSKelvin-Github/Qspice

concept.Hysteresis-CKT.qsch (6.9 KB)

concept.Hysteresis-CKT-InvertedOutput.qsch (6.1 KB)

1 Like

Thank you very much, Kelvin. Changing to the HMITT comparator solved the issue and the circuit now works perfectly.
By the way, were you proposing an alternative solution? I saw your comment regarding the resistor network and would be interested in learning more about that approach.

This is what I refer to Vh, Vt with HMITT. (this is for simulation only)

Resistor network is what I posted and you highlighted as solution. (this can be built)

I see. No my hysteresis circuit was the following one:


But it did not work well with the ideal comparator.

Do you know you can config a HMITT with Vh and Vt to achieve hysteresis? If you just looking for such function and not a practical circuit to implement.

concept.Hysteresis-CKT-InvertedOutput-compare-HMITT.qsch (7.9 KB)

I have a device guideline in my Github, you can search HMITT in this pdf for more information
current from p.331, and this is direct download link
https://github.com/KSKelvin-Github/Qspice/raw/main/Guideline/Qspice%20-%20Device%20Reference%20Guide%20by%20KSKelvin.pdf

1 Like