I am sorry
i am new in here.
Im an not realy into coding but into mushrooms so i found that system.
I dont know if i made everything right.
Please can some one explain to me what the problem is.
The controler worked just fine but sunddenly it doset stop when the setpoint was achieved.
The PID Controller does appear to be working correctly. However, it is not tuned to your environment. I see you are using the default gains (Kp=1, Ki=0, Kd=0), which should not be expected to produce good results until tuned.
I often tell people to start with a simple Bang-Bang Function before moving to using a PID Controller Function, since it is a lot easier to operate and provides good to excellent results without tuning.
To learn about tuning the PID, I would recommend reading an article I wrote: