I though I found an error and it seems that it is not really an error as it works in simulation... I am completely confused and I do not understand how it works. What is the math behind this scheme? How to calculate the current through the diode with its PNP set wrongly on the schematic?
And here is the current through the diode and the voltage input of the source voltage:
Could this work in practice?