Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Student project

  1. May 12, 2010 #1

    I'm a student working on a project in temperature control. I have to investigate some of the properties of a standard PID controller. Sadly my project supervisor is not very helpful and I was hoping somebody here could offer me a litte guidance. I would like to simulate my controller in Simulink to see if my mesured results match up to what the simulation predicts. However my knowledge of Simulink is very basic and so I'm not making much progress. I had the following questions:

    What are th basics that one needs to keep in mind to make a simulink model?
    How can I make the best model in simulink?
    How do I simulate the plant in simulink?

    Any ideas/tips/suggestions would be greatly appreciated.

  2. jcsd
  3. May 13, 2010 #2


    User Avatar
    Gold Member

    Recommend just writing it in C or something you're more familiar with. Here is your pseudo-code:

    previous_error = 0
    integral = 0

    error = setpoint - actual_position
    integral = integral + (error*dt)
    derivative = (error - previous_error)/dt
    output = (Kp*error) + (Ki*integral) + (Kd*derivative)
    previous_error = error
    goto start

    You can play with Kp, Ki, and Kd to tune the system for good response. Remember, if you are simulating a temperature control system, you won't want it constantly cycling, so you will also want hysteresis in your system (i.e. leave it on too long, and leave it off for too long so that you don't break the darn thing).
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook