using "stage_separators/batch_dist"; using "controllers/pids"; FlowSheet TesteBatch_PID PARAMETERS PP as CalcObject(Brief="Physical Properties",File="vrpp"); NComp as Integer; P_max as pressure(Brief="Maximum Pressure on distillator"); P_min as pressure(Brief="Minimum Pressure on distillator"); VARIABLES P_ad as fraction(Brief="Dimensionless pressure"); P_set as pressure(Brief="Minimum Pressure on distillator"); SET PP.Components = [ "isobutane", "n-pentane" ]; PP.LiquidModel = "PR"; PP.VapourModel = "PR"; NComp = PP.NumberOfComponents; DEVICES batch as Diff_Dist; reflux as stream_therm; feed as stream_therm; pidP as PID_Ideal_AWBT; CONNECTIONS reflux to batch.InletL; feed to batch.Inlet; EQUATIONS if batch.Level > 1E-3 then batch.Q = 3.7743e6 * "kJ/h"; else batch.Q = 0 * "kJ/h"; end "Pressure Controller" pidP.Parameters.tau = 0*"s"; pidP.Parameters.tauSet = 0*"s"; pidP.Parameters.alpha = 0.3; pidP.Parameters.bias = 0; pidP.Parameters.gamma = 1; pidP.Parameters.beta = 1; pidP.Options.action = -1; pidP.Options.clip = 1; pidP.Options.autoMan = 0; pidP.Parameters.intTime = 0.1*"min"; pidP.Parameters.gain = 1; pidP.Parameters.derivTime = 0.02*"min"; pidP.Ports.setPoint = (P_set-P_min)/(P_max-P_min); pidP.Ports.input = P_ad; P_ad = (batch.P-P_min)/(P_max-P_min); batch.OutletV.F = 500 * "kmol/h" * pidP.Ports.output; SPECIFY reflux.F = 0 * "kmol/h"; reflux.T = 328 * "K"; reflux.P = 180 * "kPa"; reflux.z = [0.5, 0.5]; reflux.v = 0; feed.F = 0 * "kmol/h"; feed.T = 328 * "K"; feed.P = 180 * "kPa"; feed.z = [0.5, 0.5]; feed.v = 0; P_set = 300 * "kPa"; SET batch.V = 3 * "m^3"; batch.Across = 1 * "m^2"; P_max = 500 * "kPa"; P_min = 100 * "kPa"; INITIAL batch.T = 298 *"K"; batch.Level = 2.5 * "m"; batch.x(2) = 0.2; OPTIONS relativeAccuracy = 1e-5; outputLevel = "high"; time = [0:0.01:20]*"min"; end