07-05-2019 07:12 AM - edited 07-05-2019 07:13 AM
Greetings everyone,
i am doing a student project in an institute which require building up a model on Labview to control a DC Servo motor to produce a constant force to press a heated up specimen, so as temperature increases the specimen will expand changing the acting force from the motor. So using a PID controller we can compensate that and keep the force constant.
I needed to learn Labview from scratch on a span of 2 months so please bear with me. After a lot of forum searches and reading countless guides, i came up with the attached code. Next week i will connect the hardware and start experimenting, but before that i wanted to have your opinions on the code, whether i missed something or if something is totally wrong.
I am only sceptical about the part with daqmax (Force control), as i am having a tough time understanding all the little bits of information regarding these blocks. The idea is; a PWM signal is fed to the DC Servo Motor where the duty cycle changes constantly due to the controller. A force signal is fed from a force sensor to the controller together with a set point for the said force. I also implemented an automatic trip to shutdown the motor once the force has exceeded 45kN for 10minutes.
If you have any questions regarding the code please feel free to ask and feel free to criticise part of it as it will help me immensly, thanks a lot in advance.
07-08-2019 06:21 AM
The only useful part is the PID function from NI, IMHO. That's not how you should write a program in LabVIEW. The code is 'pragmatic' at best (that is, 'pragmatic' is the one positive thing)...
I'd start with reading an AI and writing an AO 9there should be examples), then put in the PID function. You'd have a much cleaner results.
07-08-2019 06:44 AM
I would appreciate a more detailed answer with the problems in the code.
What do you mean by cleaner results?
07-08-2019 07:06 AM
@Wolfgang69 wrote:
What do you mean by cleaner results?
That code doesn't do that much of what you describe. It does a lot of things you didn't describe. And in a messy way... If you make what you need, you'll get a clean program. Well, at least you'll have a change of getting a clean program. If you start with that 'example' (a source reference would be nice), you'll probably make a worse mess than it already is.
@Wolfgang69 wrote:
I would appreciate a more detailed answer with the problems in the code.
The problem with that code is that it's huge. It's mostly based on express VIs. It doesn't do any PWM as far as I can tell (there are subVIs missing). It does a lot of things that you don't need, and doesn't do the things you do need.