I am relatively novice with LabView. I have made a code to take measurements of an experiment where I have an electrical machine with some superconductors in it. I have set some Hall sensors on the coils to measure the magnetic field (from the stator and the superconductor). I can measure when a superconductor or magnet passes based on the hall sensor signal and thus calculate the speed.
Now I have the following problem, as my machine is currently a one phase motor, I set up an external motor to drive the machine. The motor is controlled by a speed controller which is regulated by voltage and sets the a PWM to the motor to control its speed, this has its own hall sensors. Now in theory the speed should be fixed, however since it operates in LN2 the motor cools down and the speed increases due to resistance drop.
I made a PID to regulate the speed of the motor, by using a setpoint to estimate a speed based on the frequency of a function generator which provides the signal to an amplifier to energize the coils of the machine. This should allow synchronous generation. In the process variable I set the speed calculated by the hall sensors of measuring the magnets. In the output range, I used a the voltage range in which the desired speed is located to prevent it from going too fast or too slow. The values of speed are reversed from rpm into voltage using a table from the motor characterization of rpm vs voltage.
Unfortunately, I noted the following, if I use the speed of the motor based on the input from the hall sensors calculating the speed, the motor starts to become too unstable, it goes from too fast to too slow and it never reaches the target speed. If I read the speed from the function generator frequency, then it works ok but it never really reaches the target speed, it stays slightly under the desired value and it won't catch up once it cools down. I also noted that the output range seems to have a strange behaviour, instead of starting from a value close to the setpoint, it starts from the low end of the range and go abruptly into the high end. If the output range is too spread (i.e. 0.1 and 0.9), it will stay in the low end value and won't do anything.
I'll appreciate any comments and advice, as I have tried fixing the PID settings without any success. In the screenshots you can see the code of the PID and a screenshot of the interface (the objective is to align the peaks of the stator signal blue and the red signal, the hall sensor in the middle). Ignore the broken hall sensor displayed.