A Cardiovascular Simulator for Research 1.0.0
(1,778 bytes)
% The function conserve_vol.m precludes the possibility of instantaneous
% volume changes in each compartment of the intact pulsatile heart
% and circulation (nominal) during a parameter update by accordingly
% adjusting the pressure in each compartment.
%
% Function arguments:
% th - current parameter values
% sumdeltaT - time surpassed in current cardiac cycle
% Q - 6x1 vector of current volumes
% [Ql; Qa; Qv; Qr; Qpa; Qpv];
% Pth - current value of intrathoracic pressure
%
% Function output:
% P - 6x1 vector of new pressures which conserve volume
% [Pl; Pa; Pv; Pr; Ppa; Ppv]
%
function P = conserve_vol(th,sumdeltaT,Q,Pth)
% Pre-allocating memory for function output.
P = zeros(6,1);
% Adjusting pressure to conserve volume in systemic and pulmonary compartments.
P([2 3 5 6]) = ((Q([2 3 5 6])-th([10 11 13 14]))./th([3 4 7 8])) + [0; 0; 1; 1]*Pth;
% Adjusting pressure to conserve volume in left ventricle compartment.
xlvol = (Q(1)-th(9))/(th(26)-th(9));
[El,dEl] = var_cap(th(1),th(2),th(24),sumdeltaT);
alpha = El;
x0 = 1/(alpha+1);
kscale = 50;
c1 = 1+exp(-kscale*(1-x0));
d1 = 1+exp(kscale*x0);
denb1 = (1+(1/kscale)*log(c1/d1));
beta = (1-alpha)/denb1;
c = 1+exp(-kscale*(xlvol-x0));
d = 1+exp(kscale*x0);
denb = (xlvol+(1/kscale)*log(c/d));
P(1) = th(31)*(alpha*xlvol+beta*denb)+Pth;
% Adjusting pressure to conserve volume in right ventricle compartment.
xrvol = (Q(4)-th(12))/(th(27)-th(12));
[Er,dEr] = var_cap(th(5),th(6),th(24),sumdeltaT);
alpha = Er;
x0 = 1/(alpha+1);
kscale = 50;
c1 = 1+exp(-kscale*(1-x0));
d1 = 1+exp(kscale*x0);
denb1 = (1+(1/kscale)*log(c1/d1));
beta = (1-alpha)/denb1;
c = 1+exp(-kscale*(xrvol-x0));
d = 1+exp(kscale*x0);
denb = (xrvol+(1/kscale)*log(c/d));
P(4) = th(32)*(alpha*xrvol+beta*denb)+Pth;