## Tuesday, March 22, 2016

### SIM7: determining both the time constant (Tc) and the steady state values with the SIM parameters (α1, α2 and θ)

This post was inspired by this post by Jason Smith.

In the case of Godley & Lavoie's SIM model, given an equivalent continuous time system with $h$ the equivalent of $H$ and $\dot{g}$ the equivalent of $G$ we have:
$$(1)\:\dot{h} = ah + b\dot{g}$$
Defining
$$X \equiv 1 - \alpha_{1}(1 - \theta)$$
We have
$$a = \frac{1}{T_{s}} log (1 - \frac{\alpha_{2}\theta}{X})$$
$$b = \frac{a(\theta - X)}{\alpha_{2}\theta}$$
Where $T_{s}$ is the sample period of SIM (specified by G&L as 1 "period"). For the outputs (continuous time equivalents to $Y$, $T$, $Y_{D}$ and $C$) we have:
$$\dot{y} = \frac{\alpha_{2}}{X}h + \frac{1}{X}\dot{g}$$
$$\dot{t} = \frac{\alpha_{2}\theta}{X}h + \frac{\theta}{X}\dot{g}$$
$$\dot{y}_{D} = \frac{\alpha_{2}(1 - \theta)}{X}h + \frac{1 - \theta}{X}\dot{g}$$
$$\dot{c} = \frac{\alpha_{2}}{X}h + (\frac{1}{X} - 1)\dot{g}$$
Where $\dot{h}$, $\dot{g}$, $\dot{y}$, $\dot{t}$, $\dot{y}_{D}$ and $\dot{c}$ are all rates expressed in dollars per sample period $T_{s}$ and $h$ is expressed in dollars. Then solving for (steady state $h$) $\equiv h_{ss}$ by setting $\dot{h} = 0$ in (1), we have:
$$(2)\:h_{ss} = K_{h}\dot{g}_{ss}$$
Where the steady state gain $K_{h}$ is:
$$(3)\:K_{h} \equiv \frac{h_{ss}}{\dot{g}_{ss}} = -\frac{b}{a} = \frac{X - \theta}{\alpha_{2}\theta} = \frac{1 - \alpha_{1}(1 - \theta) - \theta}{\alpha_{2}\theta}$$
And $\dot{g}_{ss} \equiv$ (the steady state value of exogenous input $\dot{g}$). Substituting $h_{ss}$ for $h$ and $\dot{g}_{ss}$ for $\dot{g}$ in the above equations for $\dot{y}$, $\dot{t}$, $\dot{y}_{D}$ and $\dot{c}$ to find the corresponding steady state values, and then solving for the corresponding steady state system gains we have:
$$(4)\:K_{\dot{y}} \equiv \frac{\dot{y}_{ss}}{\dot{g}_{ss}} = \frac{1}{\theta}$$
$$(5)\:K_{\dot{t}} \equiv \frac{\dot{t}_{ss}}{\dot{g}_{ss}} = 1$$
$$(6)\:K_{\dot{y}_{D}} \equiv \frac{\dot{y}_{Dss}}{\dot{g}_{ss}} = \frac{1 - \theta}{\theta}$$
$$(7)\:K_{\dot{c}} \equiv \frac{\dot{c}_{ss}}{\dot{g}_{ss}} = \frac{1 - \theta}{\theta}$$
And finally, expressing the system time constant $T_{c}$ as a function of $\alpha_{1}$, $\alpha_{2}$, $\theta$ and sample period $T_{s}$, we have:
$$(8)\:T_{c} = -\frac{1}{a} = -\frac{T_{s}}{log(1 - \frac{\alpha_{2}\theta}{X})} = -\frac{T_{s}}{log(1 - \frac{\alpha_{2}\theta}{1 - \alpha_{1}(1 - \theta)})}$$
Now culling the above equations for the interesting bits, and expressing in the more familiar discrete time notation we conclude that we have only four interesting equations for our desired values of $K_{H}$, $K_{Y}$, $K_{Y_{D}}$ and $T_{c}$ with three unknown parameters ($\alpha_{1}$, $\alpha_{2}$, and $\theta$) and solving (8) for the ratio of the system time constant to the sample period $T_{c}/T_{s}$:
$$(3A)\:K_{H} = \frac{1 - \alpha_{1}(1 - \theta) - \theta}{\alpha_{2}\theta}$$
$$(4A)\:K_{Y} = \frac{1}{\theta}$$
$$(6A)\:K_{Y_{D}} = K_{C} = \frac{1 - \theta}{\theta}$$
$$(8A)\:\frac{T_{c}}{T_{s}} = \frac{-1}{log(1 - \frac{\alpha_{2}\theta}{1 - \alpha_{1}(1 - \theta)})}$$
Clearly we can choose to determine $\theta$ with either (4A) or (6A) (but not both) and then we can solve (3A) and (8A) for $\alpha_{1}$ and $\alpha_{2}$, thus determining both the steady state and the time constant of the system.

Without loss of generality, we can set $T_{s} = 1$ and choose to let (4A) determine $\theta$. Thus if we select ahead of time $K_{Y}$, $K_{H}$, and $T_{c}$ we can determine $\alpha_{1}$, $\alpha_{2}$, and $\theta$ as follows:
$$(9)\:\theta = \frac{1}{K_{Y}}$$
$$(10)\:\alpha_{1} = \frac{K_{H}(e^{-\frac{1}{T_{c}}} - 1) + 1 - \theta}{(K_{H}(e^{-\frac{1}{T_{c}}} - 1) + 1)(1 - \theta)}$$
$$(11)\:\alpha_{2} = \frac{1 - \alpha_{1}(1 - \theta) - \theta}{K_{H}\theta}$$

To see a demonstration of how this works, I've updated SIM6 with the ability to set these parameters via these equations (look for the green cells under the results table). You'll note that not all combinations of $K_{Y}$, $K_{H}$, and $T_{c}$ are valid or work very well. For example, setting $K_{Y} = 1$ causes $\theta = 1$ which makes (10) blow up. I discuss more of these problems in this comment.