function u = CalcBlock(v,x,d,p)
% static calculation block to solve for u = f(ut)

T1 = d(1);                      % [K], disturbance inlet flow 1 temperature
T2 = d(2);                      % [K], disturbance inlet flow 1 temperature

T    = x;                                     % diff state. temperature [K]
m    = p(1);                                             % tank holdup [kg]
tau0 = p(2);                                             % tuning parameter

% reformulate as linear system: Au=B with u = [u1;u2]-original inputs
A = [1 1; tau0/m*(T1-T) tau0/m*(T2-T)];   % condition: T1 different than T2
B = [v(1); v(2)-T];

u = A\B;                                          % solve as a linear system

end