Another bug bites the dust.
Writing software without glitches or bugs is an illusion. The algorithm that forms the heart of Tivatrainer dates back to around 1985, and I was surprised that, even after such a long period, an issue recently surfaced that hinted to a deeper problem.
The Target Controlled Infusion (TCI) simulations in Tivatrainer are built upon a sequence of targets entered by the user. Decreasing a target before it is established is not a problem in plasma (blood) control, but in effect-site control the previous target may cause an overshoot in the effect-site concentration that cannot be undone. The “old” Tivatrainer (and TivatrainerX ) would enter an endless loop because of this contradictory situation: the plasma concentration decreases while the effect-site concentration continues to increase. In Tivatrainer version 3.1.0 (and later), this issue has now been resolved.

The ability to correct the target while operating in effect-site control provides fuel for debates on one of the fundamental questions in TCI: plasma control or effect-site control?
Suppose you are teaching TCI and you want to illustrate that, in a frail or unfit elderly patient, effect-site controlled TCI may not always be the optimal way to deliver Total Intravenous Anaesthesia.
You can now demonstrate that, unlike blood control, once an inadequate effect-site target is initiated, it cannot simply be “taken back” without consequences. Note that you can inspect the entered targets in the 'inputs' window (harmonica button>inputs)
While working on the correction I noticed another slightly annoying behaviour of the control algorithm. It is not wrong, but it is somewhat strange.
When the effect-site target is decreased, the infusion is stopped until the effect-site concentration equals the new target. During this period, the plasma concentration continues to decrease, falling well below this target. Once the effect-site concentration equals the target exactly, the plasma concentration must be increased again for the effect site to maintain its target(effect-site-control now becomes blood-control). This takes time, and during this process the effect-site concentration may decrease further due to the persistent concentration gradient between plasma and effect site for a short period of time. This, in turn, may trigger the effect-site control algorithm, resulting in a relatively fast infusion. The consequence can be a small overshoot in plama concentration, followed by stopping the infusion again [fig 2]. This behaviour is more likely to occur in models with a larger central volume and a smaller keo, such as the Marsh model. Although this behaviour is not incorrect, I prefer a bit more gentle landing on the target. This has now been implemented in version 3.0.1 and above [fig 1]. I am curious how the commercial TCI pumps handle this subtle but relevant issue.
