# Derive a Transfer Function from first principles (PID, system identification, statics)

I want to derive a transfer function of my system so I can plug it into MATLAB and use the PID tuner tool.

My system is a balancing beam with a motor on each end of the beam.

My first principles calculations for this system:

Taking only the clockwise moment (at 0 degrees, equilibrium):

So the clockwise moment goes from being $$\text{Thrust Left} + Mg$$ to $$\text{Thrust Left} + Mg\cos\theta$$ where $$\theta$$ is the tilt of the beam.

So the overall moment is decreased. In order to hold the beam at equilibrium (at any value of tilt), the ThrustLeft needs to be multiplied by $$\dfrac{1}{\cos\theta}$$.

Because thrust is proportional to the square of motor speed, the motor speed needs to be multiplied by:

$$RPM_{\text{left thrust}} = k \dfrac{1}{\sqrt{\cos \theta \ }}$$

Subsequently, the force required by ThrustLeft to maintain equilibrium at any angle is given by:

So the thrust required increases at an increasing rate as the angle of tilt increases.

If you're still with me, thanks very much. Subsequently, the tilt against time is the same as the graph above (albeit on a slightly different scale). The angle of tilt increases at an increasing rate over time.

I need to represent this as a transfer function! But my theory is poor.

I'm assuming it would be something like

$$f(t) = k \dfrac{1}{\sqrt{\cos t}}$$

where $$f(t)$$ is a function of tilt with respect to time.

• Start with a block diagram with all inputs and outputs, sensors with forward controls and feedback errors for your PID solution, create a general equation of each block with conversion constants , so far you do not have a system defined with enough details. – Tony Stewart Sunnyskyguy EE75 Apr 24 '19 at 15:12
• You say that the moment goes from $Thrust + mg$ to $Thrust + mg\cos\theta$, but it actually always has that $\cos\theta$ component. It's just that when the beam is horizontal, $\theta = 0$ and $\cos0 = 1$. Also, the moment also needs to include the lever arm between the two forces which make up the couple. – Wasabi Apr 24 '19 at 15:50
• Also if I understand correctly that $m$ is the mass of the beam, then the force $mg$ is applied at the CG of the beam, not at the extremity. – am304 Apr 24 '19 at 16:50
• You say "motor" but you have a motor that generates thrust -- are the motors driving propellers, jackscrews, angry cats, what? – TimWescott Apr 24 '19 at 22:36