From ControlTheoryPro.com

Contents
1 Introduction to Calculating PID Gains Symbollically
Peter Nachtway provided the meat of this article to me. (You can see the original file here.)
Peter had answered a problem on the sci.engr.control usenet group (the question that was asked can be found here). Here's the original question
Hello,
The task: I will simulate a numerical PID under scicos. I use a ScifuncBlock. This block is triggered each ms. There I have following question:
1. The integral part of the PID has the form Yi = Yi + Ki * u1; The Problem: It seems, as Yi keeps not the value of the run before. Thus no integration is done. How can I reach, that Yi keeps this value?
2. Variable init: The variables are initialized in Diagram/context. Is this the correct place? is This init at "context" only done at the start of simulation and not every Scifunccalling?
3. What else must be considered that the PID works propper?
Best regards
Wolfgang
There were some private conversations between Peter and Wolfgang. The result is the pdf I linked to above.
2 PID Control Problem Formulation
The plant is standard second order system (Type 0). Peter Nachtway formulates that system as follows
Type 0 System with 2 poles 
The PID controller is
Standard PID Controller 
The closed loop transfer function for a controller and second order velocity is
'1' 
Let's start by evaluating
'2' 
Substituting Eqn. 2 into Eqn. 1
'3' 
}
Multiply top and bottom by and get
'4' 
The closed loop transfer function with characteristic equation in powers of s. Explicitly, the characteristic equations is
'5' 
Based on design requirements we can construct a desired closed loop transfer function.
In this example the desired characteristic equation is
'6' 
2.1 Symbollic Solution
Using Eqn. 5 and Eqn. 6 it is easily determined that
'7' 
The values of K, A_{1}, A_{0} are part of the plant model and therefore known at the time of the PID controller design. As a result there are 3 equations and 3 unknowns. Here are the values of K_{i}, K_{p}, adn K_{d}.
'8' 
2.2 Example
This example comes from http://www.engin.umich.edu/group/ctm/PID/PID.html.
For this example
 M = 1 kg
 c = 10 Ns/m
 k = 20 N/m
 F = 1 N
Leading to
' 
Therefore
 K = 1
 A_{1} = 10
 A_{0} = 20
So if we choose rad/sec then we get
' 