HUNGARIAN JOURNAL OF INDUSTRY AND CHEMISTRY Vol. 46(2) pp. 91–100 (2018) hjic.mk.uni-pannon.hu DOI: 10.1515/hjic-2018-0025 OPTIMAL DESIGN AND OPERATION OF BUFFER TANKS UNDER STOCHASTIC CONDITIONS BÁLINT LEVENTE TARCSAY1 , ÉVA MIHÁLYKÓ-ORBÁN1 , AND CSABA MIHÁLYKÓ *1 1Department of Mathematics and Computing, University of Pannonia, Egyetem u. 10, Veszprém, H-8200, HUNGARY Safety regulations demand the elimination of random mistakes and the reliable operation of production units. However, the control and maintenance of batch and semi-continuous processes haalways been difficult. In this paper, a way of preventing malfunctions in batch and semi-continuous processes is presented by using appropriately designed buffer tanks. A stochastic model was investigated in which batch and continuous subsystems were linked by an intermediate storage tank. The main concern was the reliability of the system. Reliable operation was defined as neither the exhaustion of raw materials nor the excessive accumulation of them. The counting processes that describe the random batch-input and random batch-output processes are supposed to be independent homogeneous Poisson processes with different rates. By introducing a function that describes the material in storage, reliable operation is defined as when this function satisfies two inequalities for a time interval of any duration. By applying probabilistic methods, an integral equation is set up for the the reliability. Nevertheless, its analytical solution cannot be determined, hence the values according to a Monte Carlo simulation are approximated. By applying this method, a link could be identified between the necessary initial buffer and tank capacities that belong to a reliability level. Economic investigations were conducted to help determine the optimal initial buffer and tank capacities that satisfy the appointed reliability level. Keywords: intermediate storage, stochastic modelling, batch system control, Monte Carlo simula- tion, economic optimization 1. Introduction During the operations of chemical processes, one of- ten encounters uncertainties. These events can stem from equipment failures, mistakes made by staff managing the process, or bad managerial decisions. These mistakes can often lead to malfunctions which cannot be tolerated in processes using dangerous or very expensive materials. A serious malfunction can cause damage to equipment, force the process to stop, or, in the worst-case scenario, endanger the lives of operators. All of these can cause serious financial damage to a company. Since these mal- functions carry considerable risks, some procedures are designed to be able to withstand and mitigate the effects of random events. A good control system with trained operators can be the key to neutralizing malfunctions. However, in batch and semi-continuous processes the im- plementation of control systems has always been diffi- cult. One of the best ways to manage these processes is the ISA-88 standard. ISA-88 provides a consistent set of rules as well as terminology for batch control in addition to defining the physical model, procedures and recipes. However, the implementation of a control system which *Correspondence: mihalyko@almos.uni-pannon.hu is up to standard is expensive given the costs of equip- ment, salaries of operators, etc. In the light of these fac- tors, an attempt was made to devise a method for the de- sign and operation of intermediate storages to mitigate the effects of malfunctions and reduce overall costs of equipment and operators in a plant. Intermediate storages, also known as buffer tanks, are important units in the chemical industry. Throughout the paper the investigated units will be referred to as buffer tanks, intermediate storages or simply as tanks and stor- ages. With these storages the production process can be made safer by creating an emergency reserve to provide raw materials for the operation of other units. The design of buffer tanks is not trivial even when uncertainties are disregarded which are present during the production pro- cess [1]. However, to ensure the reliable operation of a de- vice, which is even subject to uncertainties, a more com- plex approach is required. Therefore, it could prove bene- ficial to use stochastic models for the design of units since with these models all random variables which define the operation process can be taken into account. Operating and design parameters of the buffer tank must be chosen so that the amount of material stored is always sufficient to satisfy the demands of customers while also providing mailto:mihalyko@almos.uni-pannon.hu 92 TARCSAY, MIHÁLYKÓ-ORBÁN, MIHÁLYKÓ a reserve of the raw material in question in the event that other units malfunction. Nowadays, models used to de- termine these parameters under different operating con- ditions are a significant focus of research [2–5]. These models are closely related to those applied in insurance mathematics to calculate the amount of capi- tal and insurance prices required to operate an insurance company so that the firm can cover the damages of its clients while still turning a profit. Many of the techniques used in that field can be applied following minor adjust- ments in these cases as well [5, 6]. During the study of chemical processes, infinite inter- vals of time are often presumed, meanwhile, the proba- bilities of the material in the tank overflowing or being exhausted are investigated separately. If the process is in- vestigated over an infinite time interval, then the function that defines the reliability of the system can be expressed as a solution of Volterra- or Fredholm-type integral equa- tions. Despite being difficult to solve, it must be noted that they are easier to handle than those that define re- liability over a finite time interval. The main reason for this, in the case of finite intervals, is that not only the first occurrence but also the time remaining during the time interval contribute to the reliability of the system. In the case of infinite time intervals, this quantity is constant, namely infinity. If only the probability of the raw material in the tank being exhausted is studied as a function of the initial buffer capacity or the probability of it overflowing as a function of the tank capacity, then only the probabil- ity of malfunction as a function of one variable need be investigated [5, 6]. Solving equations with one variable is simpler than solving integral equations that describe the process as a function of two variables, namely initial buffer and tank capacities, supplemented with the time in- terval. The economical optimization of similar processes has already been conducted in some simpler cases [7]. In this publication, the focus of interest was on inves- tigating the process over a fixed finite time interval where the reliability of the system was treated as a function of two variables. A chemical process was examined where a raw material was loaded into a buffer tank from a batch reactor. Some of this raw material was drained from the tank at randomly chosen intervals for customers as re- quired. Moreover, the raw material could be constantly extracted which fed the unit after the tank had been used to separate components of the raw material and accumu- late the key component. This differs from popular models which investigate such processes that by and large only deal with a batch feed and continuous extraction of the raw material. To investigate the model, a function was defined to express the reliability of the process as a function of the initial buffer and tank capacities. The integral equation satisfied by the function, however, could not be solved an- alytically, therefore, a Monte Carlo simulation was used to approximate the reliability of the process numerically. Based on the investigations using one variable, a func- tion was applied to the numerical results whose param- eters were identified using the least squares method. By applying this function, the initial buffer and tank capac- ities required could be calculated to ensure the reliable operation of the unit over the examined finite time in- terval. However, the required degree of reliability could be achieved by an infinite number of parameter combina- tions. From among these combinations that ensure a safe operation, the optimal parameter pair was determined us- ing economical optimization by considering the incomes and expenditure of the process. To investigate a process like this based on actual data from a plant, a thorough knowledge of the distribution functions of every random variable present is required. To acquire such data, information about equipment failures or mistakes made by the operators is required which is documented in every chemical plant. Should the demand for the raw material vary, data with regard to economic trends from previous years can be used. If the amount of data is sufficiently large, then various methods can be used to compare the sample with a reference probability distribution. In this way a known cumulative distribution function can be used to approximate the empirical distri- bution function of the sample. In this publication, instead of using authentic data, as- sumptions about the distribution of the random variables were made, however, the techniques shown in this paper can be applied to different distributions as well and by us- ing our methods an answer to design and operation prob- lems using authentic data can be found. 2. The investigated model The change in mass of a raw material in a buffer tank was studied. The intermediate storage acts as a link between a batch system which feeds the tank and a batch in addition to a semi-continuous processes which both drain material from the tank (Fig. 1). The process was studied over the finite time interval of [0,Tmax]. Over the course of the chemical process, the product is synthesised periodically in a batch reactor (1). Then the product, which is a mixture of byproducts, and the key component are fed into the buffer tank (2). The buffer tank, also known as the intermediate storage (2), is linked to a continuously operational unit, e.g. a fractionating column (3), which is responsible for purifying the prod- uct by separating the byproducts from the key compo- nent. However, as with most processes that produce mul- tiple components, consumer demand is not exclusively focused on the key component but on the raw mixture of products as well. The goal of the plant is to design and operate the intermediate storage in a way which supplies the necessary amount of raw materials for the continuous subsystem whilst satisfying the demands of the clientele. The frequency and volume of consumer demand for the Hungarian Journal of Industry and Chemistry OPTIMAL DESIGN AND OPERATION OF BUFFER TANKS UNDER STOCHASTIC CONDITIONS 93 Figure 1: Illustration of the examined process (1. batch reactor, 2. buffer tank, 3. fractionating column). raw products as well as those of equipment failures and mistakes made by operators within the batch subsystem occur randomly. Due to equipment failures or mistakes made by operators, the batch feeds that originate from the reactor (1) can vary in terms of both mass and time of arrival. The varying amounts and schedule of both feeds and drainings can cause two types of malfunctions to oc- cur, the materials in the tank can either overflow or be completely exhausted which will hinder the rate of pro- duction in the continuous subsystem and render it impos- sible to meet consumer demands. In the following, the mathematical assumptions of this problem is discussed. Let z0 denote the initial buffer ca- pacity of the intermediate storage, zmax represent the ca- pacity of the tank, and the duration of the time intervals between the consecutive batch feeds be tbi , i = 1, 2, · · · It is assumed that these intervals are independent random variables of the exponential distribution with parameter λl. In the same way, let the duration of the time inter- vals between consecutive drainings from the intermedi- ate storage be tli, i = 1, 2, · · · which like the feeds are independent random variables of the exponential distri- bution with parameter λl. The number of feeds over time interval T denoted by Nb(T), and the number of peri- odic drainings by Nl(T), which, because of our assump- tions, are random variables of Poisson distribution with parameter λb−T or λlT , respectively. The amount of raw material fed into the intermediate storage during batch i is denoted by ybi , similarly the ith draining from the in- termediate storage is represented by yli. The character c represents the rate at which the raw product was drained from the intermediate storage by the continuous subsys- tem. The amounts of both the fed and drained batches are assumed to be random variables of identical distribution. The functions gb(y)and gl(y) are their respective proba- bility density functions. It is supposed that the amounts of materials in addition to the durations of feeds and drain- ings are independent of each other. Assuming the mate- rial in the intermediate storage was neither exhausted nor overflew throughout the operating time T then equation 0 < z0 + Nb(T)∑ i=1 ybi − Nl(T)∑ i=1 yli − cT ≤ zmax (1) must be satisfied by the amount of material currently in the buffer tank. Since these inequalities contain random variables, they can only be fulfilled with a certain prob- ability. The mass of material in the intermediate storage can be expressed by equation z(T) = z0 + Nb(T)∑ i=1 ybi − Nl(T)∑ i=1 yli − cT, (2) the reliability of the system, i.e. the probability that the material neither overflows nor is exhausted throughout the time interval [0,Tmax], can be defined as shown in equation Ψ(z0,zmax,Tmax) = P (0 < z(T) ≤ zmax) for all 0 ≤ T ≤ Tmax. (3) Conversely, 1−Ψ (z0,zmax,Tmax) is the probability of a malfunction occurring, also referred to as a failure. Both are defined as functions of the initial buffer and tank ca- pacities as well as the operating time. The expectation of z(T), i.e. E(z(T)), can be ex- pressed by E (z (T)) = E ( ybi ) λbT −E ( yli ) λlT − cT + z0 (4) If 0 > E (z (T)) − z0, then the process has decreasing tendency in average. If 0 < E (z (T)) − z0, then an overflow can be expected over a large time interval. If 0 = E (z (T)) −z0, then the process is in equilibrium. To evaluate the process, the time the failure first occurred is required during the interval [0,Tmax], when the amount of material exceeded the capac- ity of the tank or was equal to zero. The time of failure is defined as the following function: TF (z0,zmax,Tmax) = { inf {T : 0 ≤ T ≤ Tmax : z(T) ≤ 0 or zmax < z(T)} , if such a T value exists ∞, if for all 0 ≤ T ≤ Tmax 0 < z(T) ≤ zmax (5) 46(2) pp. 91–100 (2018) 94 TARCSAY, MIHÁLYKÓ-ORBÁN, MIHÁLYKÓ This time point is a random variable too, its expecta- tion, E(TF (z0,zmax,Tmax)·1TF(z0,zmax,Tmax)<∞), will be denoted by E(TF) and its standard deviation by D(TF). They are finite, as 0 ≤ TF (z0,zmax,Tmax) · 1TF(z0,zmax,Tmax)<∞ ≤ Tmax is adhered to. By applying the renewal theory [8], it can be proven that Ψ satisfies the integral equations Ψ (z0,zmax,Tmax) = λl λl+λb   min ( z0 c ,Tmax )∫ 0 z0−ct1∫ 0 Ψ (z0 − ct1 −y1,zmax,Tmax − t1) ·λle −λlt1gl(y1)dy1dt1 + e −λlTmax   + + λb λl+λb   min ( z0 c ,Tmax )∫ 0 zmax−(z0−ct2)∫ 0 Ψ (z0−ct1+y2,zmax,Tmax−t2) ·λbe −λbt2gb(y2)dy2dt2+e −λbTmax   , (6) if cTmax ≤ z0 and Ψ (z0,zmax,Tmax) = λl λl+λb   min ( z0 c ,Tmax )∫ 0 z0−ct1∫ 0 Ψ (z0−ct1−y1,zmax,Tmax−t1) ·λle −λlt1gl (y1) dy1dt1   + + λb λl+λb   min ( z0 c ,Tmax )∫ 0 zmax−(z0−ct2)∫ 0 Ψ (z0−ct2+y2,zmax,Tmax−t2) ·λbe −λbt2gb(y2)dy2dt2   (7) if z0 < cTmax. To design a buffer tank which is capable of operat- ing with a desired degree of reliability of 1 − α where α denotes the probability of malfunction during the time interval [0,Tmax], solutions to equation Ψ (z0,zmax,Tmax) = 1 −α (8) must be found. 3. Parameter dependence of the reliability of the process and the expectation of failure time Since the integral equation proved to be exceedingly dif- ficult to handle analytically, a Monte Carlo simulation to approximate the probability values for different parame- ters was used. Monte Carlo simulations are more widely accepted tools in dealing with stochastic models [9, 10]. For the simulation environment, MATLAB R2015a [11] was used. Realization of the process when the pa- rameters Tmax = 50 h, λl = 0.3 h−1, λb = 0.4 h−1 and c = 5 kgh−1 were chosen is demonstrated in Fig. 2. The mean of the input suddenly increased in the function z(t), the withdrawals from the batch caused sudden decreases and continuous withdrawal resulted in a reduction in lin- ear parts. The amounts drained and fed were defined as ran- dom variables from the Gaussian distribution. The initial buffer capacity was 50 kg and continuous withdrawal re- sulted in a linear decrease in the amount of material. At T = 1 h, the tank was filled. The amount of material in the tank increased by 3 kg, then the continuous with- drawal resumed. A little bit later a sudden withdrawal occurred. Similar events were repeated at random time points with random quantities. At T = 7.8 h a large with- drawal took place and the material became exhausted, therefore, z(t) became negative. The time of failure, in this case the time a shortage was observed, was TF = 7.8 h. Although the process was investigated over an inter- val of time, it is sufficient to compute the values of z(t) only at those points where sudden changes occurred and at the endpoint of the interval. An overflow could only occur if an input was present. Both continuous and batch withdrawals can cause shortages. If the amount of mate- rial at the time points of batch inputs and outputs is com- Figure 2: The change in the mass of material in the buffer tank. Hungarian Journal of Industry and Chemistry OPTIMAL DESIGN AND OPERATION OF BUFFER TANKS UNDER STOCHASTIC CONDITIONS 95 Figure 3: The probability of a failure as a function of the initial buffer and tank capacities. puted, it can be determined whether or not the continuous withdrawal caused the shortage during the time interval bounded by the last two batch events. If it did, the time point of the shortage can also be computed by solving a linear equation. By applying a Monte Carlo simulation, the proba- bilities were approximated by relative frequencies and the expected failure times were estimated by the average times. 10, 000 simulations were conducted which yielded an accuracy 0.01. For example, Tmax = 50 h was fixed and the param- eters of the process were λl = 8 h−1, λb = 12 h−1 and c = 12 kg h−1. The amounts drained and fed were de- fined as random variables from the Gaussian distribution with a mean of 8 kg and a standard deviation of 2 kg. With the aforementioned parameters, the probability of malfunction was calculated and the following results ob- tained for the process under the indicated conditions (Fig. 3). Figure 4: The expected malfunction times as a function of initial buffer and tank capacities. Figure 5: A histogram of the malfunction times. In Fig. 3 it can be seen that when the tank capac- ity was fixed, the probability of failure increased as a function of the initial amount of material. This can be explained by the fact that although the likelihood of a shortage decreased, the amount of material in the tank tended to increase, therefore, the free volume of the tank decreased, hence the increase in the probability of over- flow. On the other hand, when the initial buffer capacity was fixed, the probability of a failure decreased as a func- tion of the tank capacity. This tendency can be explained by the fact that the probability of overflow decreased and stemmed from the fact that λb was greater than λl mean- ing that the average time intervals between feeds were smaller than those between drainings. This caused the process to be more prone to malfunction due to overflow. The times of failures (TF ) were investigated as well. Expected failure times are shown in Fig. 4 as a func- tion of the initial buffer and tank capacities. If no fail- ure occurred, then TF was equal to zero, therefore, the expected TF was close to zero as well. A histogram of the malfunction times is provided in Fig. 5 when z0 = 400 kg and zmax = 1500 kg. It demon- strates that no quick failures occurred due to a shortage of material resulting in an increase in the amount of ma- terial and the tank overflowing. The distribution of the malfunction time in this case is unimodal and the degree of dispersion is quite large. The dispersion of the mal- function time as a function of the initial buffer and tank capacities can be seen in Fig. 6 which demonstrates that when the tank is half full, large standard deviations with regard to the malfunction times were calculated. In the case of large or small capacities, the malfunction time can be accurately predicted as the degree of dispersion is small. 46(2) pp. 91–100 (2018) 96 TARCSAY, MIHÁLYKÓ-ORBÁN, MIHÁLYKÓ Figure 6: The standard deviation of the malfunction times. 4. Design of the tank and initial buffer ca- pacities for a given reliability level During previous research, only models that consisted of a batch feed and continuous drainage in the absence of batch drainage [5–7] were studied. In the papers that deal with these models, it has been published that the integral equation for the reliability of the unit could be solved analytically in special cases where the process over an infinite time interval as a function of one variable is ob- served. In these special cases the solutions to the equation were mainly exponential in form or the linear combina- tion of exponential functions [5, 6]. Consequently, when fitting a function to simulated data, a function was chosen which exhibits similar characteristics. By fixing Tmax, seeking Ψ is suggested as a function of the initial buffer capacity x and tank capacity y, in the form of equation H (x,y) = 1 − ( 1 −e(−Ax) )C( 1 −e(−B(y−x)) )D , (9) where x < y; A, B, C, and D are positive parameters which have to be optimized. Numerical values of Ψ were computed by a Monte Carlo simulation for some values of z0 and zmax, and the parameters A–D were determined using the least squares method, by minimizing function S (A,B,C,D) = ∑ r ∑ s (Ψ (xr,ys)−H (xr,ys)) 2 (10) This function was minimized numerically. The approxi- mated function exhibited a fit to the original function of 95 % on average which was calculated using a Monte Carlo simulation. The error of the fitting was inversely proportional to the number of simulations used to model the system as well as the number of points with regard to the tank and initial buffer capacities investigated. Since the quality of the fit was high (95 % on average), it can be assumed that even if the minimum identified is a lo- Figure 7: The relationship between the tank and initial buffer capacities that correspond to different levels of re- liability 1 − α. cal minimum, the approximation is sufficient for use in further computations. Using the fitted function, equation Ψ(x,y) ∼ H (x,y) = = 1 − ( 1 −e−Ax )C( 1 −e−B(y−x) )D = 1 −α. (11) was solved. Appropriate initial buffer and tank capacities for the process are provided by the solution to the equa- tion above with a reliability of 1−α over the time interval [0,Tmax]. A link between the values of x and y is provided by the solution to the equation, namely equation y = x− ln ( 1 − ( 1 −α (1 − exp(−Ax))C )1/D) B . (12) This relationship, using the parameter set presented in the previous section, is given in Fig. 7. The interval of the initial buffer capacity was [100, 500] kg and the step sizes applied were 100 kg. The interval of the tank capacity was [1000, 2500] kg and the step sizes applied were also 100 kg. To elimi- nate numerical inaccuracies, the values of the time inter- vals were transformed into the time intervals [0, 100]. By transforming the time intervals into a subset of [0, 100], A = 0.4966, B = 0.12, C = 0.9324, and D = 86.4875 were computed. After the computations, the results were transformed into the original time intervals. The required tank capacities as a function of the initial buffer capacity in the intermediate storage corresponding to the reliabil- ities 1 − α = 0.95, 0.975, . . . 0.99 can be seen in Fig. 7. It can be seen that with some initial values a reliabil- ity of 0.99 is infeasible since the likelihood of a short- age itself exceeds level α. The minimum initial amount Hungarian Journal of Industry and Chemistry OPTIMAL DESIGN AND OPERATION OF BUFFER TANKS UNDER STOCHASTIC CONDITIONS 97 Figure 8: The required initial buffer capacity correspond- ing to a fixed tank capacity of 1,900 kg and reliability level of 0.8 as a function of the draining intensity (c) . of material in the intermediate storage with a reliability of 1 −α can be expressed by − ln ( 1 − (1 −α)1/C ) A < xmin (13) From Fig. 7 it can be seen that if the lower limit is used as the initial buffer capacity, the corresponding storage capacity is enormous. The reason for this is the fact that the likelihood of a shortage is equal to α and an over- flow is undesirable, therefore, the tank capacity must be very large. According to the results shown in Fig. 7, this value is approximately 150 kg. Moreover, if z0 exceeds a certain level, the function is by and large linear. It is shown by the linear part of the function that when the ini- tial buffer capacity exceeds 250 kg, the likelihood of a failure due to exhaustion of material is almost zero. The likelihood α of an overflow is provided by the difference between the tank and initial buffer capacities. Therefore, to calculate the required tank capacity over this time in- terval, the volume which can ensure that the likelihood of overflow will remain as α is simply added to the buffer capacity in the intermediate storage. Finally, the minimum tank capacity that corresponds to a given level of reliability can be determined by nu- merically minimizing function y = x− ln  1 − ( 1 −α (1 − exp(−Ax))C )1/D B (14) For the reliability level 1 −α = 0.95, the minimum tank capacity is approximately 1, 820 kg and the required ini- tial buffer capacity approximately 245 kg. By fixing the tank capacity and reliability level, the dependence of the required initial buffer capacity on the withdrawal rate was investigated. The values of the re- Figure 9: The required drainage intensity corresponding to a fixed tank capacity of 1,900 kg and a reliability level of 0.8 as a function of the initial buffer capacity. quired initial buffer capacity were determined numeri- cally according to the secant method. The reliability level was 1−α = 0.8 and the tank capacity was 1, 900 kg. The results can be seen in Fig. 8. According to this result, by increasing the withdrawal rate, the required initial buffer capacity increases sharply which facilitates control of the process. Finally, the required drainage intensity corresponding to the reliability level of 1 − α = 0.8 and fixed tank ca- pacity zmax = 1, 900 kg as a function of the initial buffer capacity was provided (Fig. 9). It can be seen that it is also a monotonically increasing function, but the rate of increase is usually less than in the case of Fig. 8. 5. Economic investigations According to Fig. 7, if the minimum required amount of initial buffer capacity is supplied then the required level of reliability of the process can be achieved by an infinite number of combinations of tank and initial buffer capac- ities. To determine the optimal combination, economic evaluations of the design are recommended. It is assumed that following a possible failure, the process is restarted, however, such a restart is time-consuming and expensive. During the calculations both the income and expenditure associated with each parameter are taken into account. These include the costs of raw materials, the buffer tank, malfunctions and repairs as well as the income generated from sales of both the key component and raw product. To determine the income generated by the process at time T , equation Q (T) = Gkey (T) + Graw (T) −Kmat (T) − − Kshort (T) −Krep (T) −Ktank (15) was used. The symbols G and K represent the income and ex- penditure of the process in USD. The profitability of 46(2) pp. 91–100 (2018) 98 TARCSAY, MIHÁLYKÓ-ORBÁN, MIHÁLYKÓ the whole process, (Q) stems from the income gener- ated from the sales of the key component (Gkey) and raw product (Graw). The income is reduced by the various ex- penses of the process, namely the costs of raw materials (Kmat), restoring the buffer capacity of the tank in case of exhaustion (Kshort), repairs (Krep) and the buffer tank itself (Ktank). The method of calculating each source of income and expenditure is shown below. The main goal of the process is to produce the key component, which is isolated in the continuous subsys- tem. To calculate the profit that stems from this, equation Gkey (T) =  T −Nrep(T)∑ i=1 Trep  cβkey (16) was used. In this equation, βkey denotes the sale price of the key component (USD kg−1), T represents the dura- tion of the process throughout which the profit (h), the number of malfunctions (Nrep(T)), and the random time of repair (Trep) during each malfunction are examined. Additionally, the plant secures an income from the sales of the raw product as well as the remaining raw product at the end of the production process, which can be defined as shown in Graw (T) = βraw  δ  z0 −  T −Nrep(T)∑ i=1 Trep  c + + Nb(T)∑ i=1 ybi − Nl(T)∑ i=1 yli   + Nl(T)∑ i=1 yli   (17) where βraw denotes the sale price of the raw product (USD kg−1) and δ is a factor which defines the price at which the remaining raw product can be sold following production. Among the expenses, it should be mentioned that the cost of raw materials used for the production of the raw product and the cost of the initial raw product in the tank are calculated according to equation Kmat(T) = γmat Nb(t)∑ i=1 ybi + z0γmat (18) where γmat is the cost of the raw material (USD kg−1). In the event of its exhaustion, additional raw product is required to restore the initial buffer capacity of the tank and the cost of this is shown in Kshort(T) = Nshort(T)z0γmat, (19) where Nshort(T) denotes the number of malfunctions caused by exhaustion during time T . Finally, the cost of repairs and installing the interme- diate storage itself need to be considered. To determine the installation costs, the installation factor of the tank (f) and the cost of the tank (γtank in USD) were taken Figure 10: Mean profit as a function of the initial buffer and tank capacities. into account. To determine the expense of repairs, the parameter γrep was used to represent the cost of repairs (USD h−1) which was calculated according to equations Krep(t) = Nrep(t)∑ i=1 Trepγrep (20) and Ktank = f z 0.6 max γtank. (21) The cost of installing the buffer tank was calculated ac- cording to references found in the literature [12]. The mean of the profit was investigated according to the reliability level of 0.95 ≤ 1 − α using a Monte Carlo simulation and its optimum was calculated using the grid method. It is shown by the results that if the re- liability of the system is high, then the costs of repairs and malfunctions in general are negligible compared to the cost of storage. As a result, the maximum profit was achieved close to the minimum storage capacity which is shown in Fig. 10. This value roughly corresponds to the minimum of the investigated boundary, using a reli- ability of 0.95. To generate this figure the following pa- rameters were used: βkey = 120 USD kg−1, δ = 0.3, γmat = 80 USD kg−1, βraw = 100 USD kg−1, f = 100 USD kg−0.6, γtank = 12, 000 USD, mtrep = 0.5 h, and σtrep = 0.29 h, where repair times were independent ran- dom variables of the uniform distribution during the time interval [0, 1]. The maximum profit according to these calculations is 4.76 · 104 USD, which can be achieved by tank and initial buffer capacities of 2, 101 kg and 389 kg, respectively. 6. Conclusion In this paper, a stochastic storage model was investigated. Random batches as inputs and outputs, as well as contin- uous withdrawal were allowed. A Monte Carlo simula- tion was used for the investigation. An analytic function Hungarian Journal of Industry and Chemistry OPTIMAL DESIGN AND OPERATION OF BUFFER TANKS UNDER STOCHASTIC CONDITIONS 99 was fitted to the simulated data, which provided a link between the initial buffer and tank capacities that corre- spond to a given level of reliability. The results agree with engineering practice. Although the data for the research did not stem from authentic sources, by utilizing data from the industry, the distribu- tion of the random variables present during the process could be determined using standard statistical methods. Therefore, the method can be a useful supplement during the design phase of a chemical plant and also be utilized to help simplify the overall control of a chemical process. Symbols Small letters c draining intensity (kg h−1) f installation factor of a tank (kg−0.6) g probability density function (h−1) m expectation x fixed initial buffer capacity (kg) y fixed tank capacity (kg) yb mass of batch fed into the tank (kg) yl mass of batch drained from the tank (kg) z mass of material (kg) Capital letters A,B,C,D fixed parameters of the approximated failure probability function G income (USD) E expectation H approximated failure probability function K expenses (USD) N number of events during time interval [0,Tmax] P probability Q net income (USD) T time (h) TF time of failure (h) Greek letters α probability of malfunction β sale price (USD kg−1) γ cost (USD kg−1) δ ratio of decrease in material value λ parameter of exponential distribution (h−1) σ standard deviation ψ function describing the probability of reliable operation during time interval [0,Tmax] Indices 0 initial b feed i index of event (i = 1, 2, · · · ) rep repair short material exhaustion l draining mat reactant max maximum min minimum r the number of mesh points of the initial buffer capacity s the number of mesh points of the tank capacity t time raw raw material tank tank key key component REFERENCES [1] Towler, G., Sinnott, R. K. Chemical engineering de- sign: principles, practice and economics of plant and process design. (Elsevier, Oxford, UK) 2012, pp. 183. DOI: 10.1016/C2009-0-61216-2 [2] Browning, C., Kumin, H. Stochastic reservoir sys- tems with different assumptions for storage losses, Am. J. Oper. Res., 2016 6(5), 414–423 DOI: 10.4236/ajor.2016.65038 [3] Karacan, C. Ö., Olea, R. A. Stochastic reservoir simulation for the modeling of uncertainty in coal seam degasification, Fuel, 2015 148, 87–97 DOI: 10.1016/j.fuel.2015.01.046 [4] Prabhu, U. U. Stochastic storage processes: queues, insurance risk, dams, and data communication. Springer Science & Business Media, 2012. 15, 63– 76 ISBN: 978-1-4612-1742-8 [5] Orbán-Mihálykó, É., Mihálykó, C. Investigation of operation of intermediate storages applying prob- ability density functions satisfying linear differen- tial equation, Periodica Polytechnica Chemical En- gineering, 2012 56(2), 77–82 DOI: 10.3311/pp.ch.2012- 2.05. [6] Orbán-Mihálykó, É., Mihálykó, C. Sizing prob- lem of intermediate storages under stochastic op- erational conditions, Periodica Polytechnica Chem- ical Engineering, 2015 59(3), 236–242 DOI: 10.3311/PPch.7598 [7] Orbán-Mihálykó, É., Mihálykó, C., Lakatos, B. G., Szabó, T., Papp, A. Profit optimization of batch- continuous systems under stochastic processing conditions by simulation, Hung. J. Ind. Chem., 2011 39(3), 353–358 46(2) pp. 91–100 (2018) https://doi.org/10.1016/C2009-0-61216-2 https://doi.org/10.4236/ajor.2016.65038 https://doi.org/10.4236/ajor.2016.65038 https://doi.org/10.1016/j.fuel.2015.01.046 https://doi.org/10.1016/j.fuel.2015.01.046 https://doi.org/10.3311/pp.ch.2012-2.05. https://doi.org/10.3311/pp.ch.2012-2.05. https://doi.org/10.3311/PPch.7598 https://doi.org/10.3311/PPch.7598 100 TARCSAY, MIHÁLYKÓ-ORBÁN, MIHÁLYKÓ [8] Karlin, S., Taylor, H. A first course in stochastic processes. (Academic Press, London, UK) 2014, pp. 113 ISBN: 9780123985521 [9] Zio, E. The Monte Carlo simulation method for sys- tem reliability and risk analysis. Vol. 39. (Springer, London, UK) 2013 DOI: 10.1007/978-1-4471-4588-2 [10] Amar, J. G. The Monte Carlo method in science and engineering, Computing in Science & Engineering, 2006, 8(2), 9–19 DOI: 10.1109/MCSE.2006.34 [11] https://www.mathworks.com/products/ matlab.html [12] Stone et al. Plant design and economics for chemi- cal engineers. (McGraw-Hill, New York) 1968 ISBN: 0072392665 Hungarian Journal of Industry and Chemistry https://doi.org/10.1007/978-1-4471-4588-2 https://doi.org/10.1109/MCSE.2006.34 https://www.mathworks.com/products/matlab.html https://www.mathworks.com/products/matlab.html Introduction The investigated model Parameter dependence of the reliability of the process and the expectation of failure time Design of the tank and initial buffer capacities for a given reliability level Economic investigations Conclusion