# How to model the input and output process flow in a liver model to simulate it?

What's the confusion:

Confusion is to how to model the equations. What signs to use for incoming and outgoing components in a process flow. The confusion isn't mainly for how to translate the equations to a amplifier-figure(although I learnt a lot from the previous answer), it's mainly how to convert that first block diagram I've mentioned to equations. And it's only the second equations that I'm confused of signs positive or negative.

My thoughts about sign what they should be:

If the arrows are coming towards the block in consideration, add + sign else add - sign.

For example: consider c1 (c1 in the book is labeled x1 in the slide) block, then we find x1', for that **+ will be what comes towards it i.e $$K_{21}*x_2$$, and - will be what goes outside i.e. $$K_{12}*x_1$$.

I really don't know why, because it's probably related to medical sciences. But I don't need to understand it as far as I know.

So, $$x_1'=K_{21}*x_2-K_{12}*x_1$$

So according to this logic, for x2', this'd be the equation-:

$$x_2'=K_{12}*x_1-K_{21}*x_2-K_{23} *x_2$$

This is the notation being used.

How to translate compartmentalized liver to analog computer? I just want to learn to translate the figure to equations.

This is the question:

International source:

The compartmental analysis figure is the diagram that I want to translate to differential equations and eventually analog computer.

This is from mathematical models in the health sciences book by Eugene Ackerman.

I don’t know about the author, but I bet that this is extremely reliable compared to the materials locally available and written by local authors. But it doesn't tell which equation it is modeling, so I am not 100 % sure about it. But to be honest, I don't clearly understand its conventions and it's age old book which is un-updated, so relying on it would be a mistake.

It has problems as well:

It doesn't use negative for $$K_{12}$$ And idk why is it using negative for $$K_{23}$$.

Less reputed source:

This is pretty ambiguous, their equation and figure don't even match.

If $K_{21}$ is negative then $$K_{23}$$ should also be negative(although it doesn't writes that in its equation.

I can guess that it's trying to subtract the net output instead of doing it individually, but I'm not sure why it's doing it.

Highly reputed source (LOCAL):

If this source is correct, I don't understand how is it correct?

My thoughts about sign what they should be:

If the arrows are coming towards the block in consideration, add + sign else add - sign.

For example: consider c1 (c1 in the book is labeled x1 in the slide) block, then we find x1', for that **+ will be what comes towards it i.e $$K_{21}*x_2$$, and - will be what goes outside i.e. $$K_{12}*x_1$$.

I really don't know why, because it's probably related to medical sciences. But I don't need to understand it as far as I know.

So, $$x_1'=K_{21}*x_2-K_{12}*x_1$$

So according to this logic, for x2', this'd be the equation:

$$x_2'=K_{12}*x_1-K_{21}*x_2-K_{23} *x_2$$

My teacher (he is not the one to check the final papers):

He says "some books have written plus in $$K_{21}$$ while some minus I am not sure what it is actually."

We don't know who will check the paper or who checked it.

• I don't believe that you really want to make an analog computer, you want to simulate a process with a digital computer. Commented Jul 29, 2022 at 13:50
• Yes, I can simulate it in any programming language that has subroutines for this. I'm confused with equations notations, are they correct? Why? Commented Jul 29, 2022 at 13:52
• Assuming that this isn't closed for being off-topic, there are a lot of people that can help with a process flow, but I don't quite understand it yet. We (EEs) normally have an control input that controls a process, then feedback stabilizes the process. Feedback usually must be negative in a stable system. Commented Jul 29, 2022 at 14:03
• You should edit and change all references of "analog computer" to "process flow", many people are going to go off on a tangent with the analog computer reference. Commented Jul 29, 2022 at 14:07
• Or, sometimes the input is constant (maybe even implied) and you need to show how the system reacts to a disturbance. Where would a disturbance be added? Eating a meal would probably be the disturbance. Commented Jul 29, 2022 at 14:18

You really want to read an analog computer introductory material from that era. There is a lot of unspoken convention in those diagrams. For example, all summers (triangles) are assumed to be inverting, and same goes for integrator inputs (triangles with a vertical bar). That's because the implementations used inverting amplifiers, to reduce the number of stages needed. E.g. an inverting integrator can be done with just one high-gain inverting stage.

To understand analog computation diagrams - which are their own technical language and are not circuit diagrams! - see e.g. A Practical Approach to Analog Computers by Strong and Hannauer. You won't go very far without trying some simple examples using e.g. SPICE or on a breadboard.

The translation between the differential equations and integrators is also a specific process tailored to the building blocks available in an analog computer.

For numerical solutions, there's no need to translate differential equations into equivalent analog circuits. I.e. if you can look up a reference on liver physiology that's tailored towards bio-modelling, you'll get the differential equations, and then you can either solve them directly using Octave, Mathematica, etc., or use a reference on analog computing to translate them into an analog computation diagram.

It doesn't use negative for K12. And idk why is it using negative for K23.

Potentiometer coefficients were usually positive-only, between 0 and 1. Inversions, if needed, were done using summer blocks. A triangle without a bar is a summer, and if the gains are not shown, they are -1 by default. Summers typically had inputs with gains of -1 and -10. The negative sign was not written out explicitly! This is the language that publications that used analog computer models would use, the language that the analog computer application notes used, the language that anyone doing anything with analog computing had to learn, since it mapped almost 1:1 to the configuration of the hardware the problem would run on. That's how you'd read that publication from the 70s. The later stuff is, sadly, too often regurgitated without the wherewithal to spend an hour or two read the free contemporaneous introductory materials.

So, a summer element with a "-" sign in the middle is a creation of someone who doesn't know what they are talking about, pretty much :(

Analog computation diagrams do not have "positive" and "inverting" summers, nor are there separate inverters. The "summer" and "inverter" symbols from the diagram you cited are bogus:

## Do Not Use These Symbols Like This!

You've also shown this part of the diagram:

K21 is not negative, because K21 is a pot with a value between 0 and 1. All inputs to the integrator are inverting by convention.

The liver model, redrawn with implied conventions made explicit, is:

The integral equations that it models are:

\begin{aligned} X_1(t) &= \int{-K_{12}X_1(t) - K_{21}(-X_2(t)) {\,\rm d}t} + {I\!C}_1, \\ -X_2(t) &= \int{-(K_{23}-K_{21})(-X_2(t)) -K_{12}X_1(t) {\,\rm d}t}, \\ X_3(t) &= \int{-K_{23}(-X_2(t)) {\,\rm d}t}. \\ \end{aligned}

Simplifying a bit:

\begin{aligned} X_1(t) &= \int{-K_{12}X_1(t) + K_{21}X_2(t) {\,\rm d}t} + {I\!C}_1, \\ X_2(t) &= \int{K_{12}X_1(t) + (K_{21}-K_{23})X_2(t) {\,\rm d}t}, \\ X_3(t) &= \int{K_{23}X_2(t) {\,\rm d}t}. \\ \end{aligned}

• Wow, I didn't realize that there was a standard format for analog computers. Since this is an archaic format that almost nobody can read, wouldn't the OP be better off to use a more standard block diagram format? Something that most EEs can read, and something that is easier to convert to a simulation. Commented Jul 29, 2022 at 16:52
• @Mattman944 There are probably tens of thousands of publications that use that convention, and it was still in use when I was born over 4 decades ago. There's nothing "archaic" about. If one deals with analog computation, that's the language - one either learns it, or gets terribly confused (and confusing to others). Commented Jul 29, 2022 at 17:18
• @Kubahasn'tforgottenMonica 1) Why is ouput of 1st integrator x1 positive but the output of 2nd integrator x2 negative? It's as per the equation but idk why, but I feel sth is missing. 2) In the analog block diagram, does it make a difference if we use either of K21-K23 or K23-K21, my main confusion was this(Although I learnt a lot from your answer). Since both are going outwards(in the first liver model 3 piece-block diagram), shouldn't they have same sign? Commented Jul 30, 2022 at 3:26
• @Mattman944 There're literally 0 materials(ofc there're some like 3-4 but not clear) about this online. I think this is perhaps in the book by naim kheir about simulation, but that buying that ebook will cause me bankruptcy. Commented Jul 30, 2022 at 3:29
• @Kubahasn'tforgottenMonica I edited my 2nd question-: 2) In the analog block diagram(or in the modeling equation), does it make a difference if we use either of K21-K23 or K23-K21, my main confusion was this(Although I learnt a lot from your answer). Since both are going outwards(in the first liver model 3 piece-block diagram), shouldn't they have same sign? Commented Jul 30, 2022 at 3:36