Oil Refinery Production Example Model ... Problem-Solving



Oil Refinery Production Model

Problem Description: An oil company may have many different distillation processes going on at each of its refineries. Each time new crude oil arrives at a refinery, or one distillation unit goes in or out of service, a new tweaking of all distillation parameters must be done in order to maximize the company’s profit.


global all
problem OilProduction
nRefineries= 22:  nProducts= 33
dynamic hi, low, totCrudeIn, ooo
call setup    ! initial values
call history  ! extrapolate 4 today’s usage
! find product percentages for all Refineries in order to maximize profit.
find totProdPrct     in refineries     by jupiter
matching errsum      to maximize profit
End
Model refineries
pollution=0:  profit=0:  cost=0:  errSum=0
do i=1, nProducts
  do j=1, nRefineries
     sameProd(j) = totProdPrct(j, i) * totCrudeIn(i)
  end do
  crudeUsed = 0:  crudeErr=0
! finds qty production @ each refinery to minimize overall pollution

! to restrict prod., e.g. 3rd qty, set hi(3) = low(3)

find sameProd    in processing    by Jove
with upper hi    and lower low
matching crudeErr      to minimize pollution

  do j=1, nRefineries
errSum=errSum+ (sameProd(j) - totProdPrct(j,i) * totCrudeIn(i))**2
  end do
end do
! find best routes to deliver products

ooo

find routes   in distribution   ooo   to minimize distPollution
profit = profit - cost
end
Model distribution
  distPollution =0
! your (algebraic?) equations that model your distribution go here.

ooo

  distPollution = distPollution + ???
End
Model processing	! jth distillation unit @ refinery
! assume distillation requires solving a PDE or two.  So below is the bases for solving a PDE.
t=0:  tPrt= tPrint
do k = 1, nDistUnits( j)
kDistModel = ???
Initiate ISIS  for PDEquations   ooo
do while (t .lt. tFinal)
  Integrate PDEquations    by ISIS
  if( t .ge. tPrt) print 79, t, (U(ii),ii=1,ip)
  tPrt=tPrt + tPrint
end do
end do
crudeErr=crudeErr+(totCrudeIn(j)– crudeUsed)**2
79  format( 1x,f8.4,20(g14.5, 1x))
end
Model PDEquations
if( kDistModel .eq. 1) then
  pde_1= pde equations with parameters 
! assume # 3, 7, & 8 products are created
qtyProd(3) = qtyProd(3) + ???
qtyProd(7) = qtyProd(7) + ???
qtyProd(8) = qtyProd(8) + ???
elseif( kDistModel .eq. 2) then
  pde_2= pde equations with parameters 
! assume # 2 & 8 products are created
qtyProd(2) = qtyProd(2) + ???
qtyProd(8) = qtyProd(8) + ???

ooo

elseif( kDistModel .eq. k) then
pde_k= pde equations with parameters 
! assume # 1, 2, & 8 products are created
qtyProd(1) = qtyProd(1) + ???
qtyProd(2) = qtyProd(2 )+ ???
qtyProd(8) = qtyProd(8 )+ ???
end if
crudeUsed = crudeUsed + ???
pollution= pollution + ???
cost= cost + mfgCost + distCost + ???
profit = profit + ???
end
procedure Setup
allot totProdPrct(nRefineries, nProducts), hi(nProducts), low(nProducts), ooo

! today’s available Crude Oil at different refineries
  =data( …’ available crude INPUT levels at each Refinery goes here’ …>
= data( … storage limits for various products goes here …)
= data( … target amounts less inventory goes here …)
=data( … # of distillation units @ each refinery goes here …)
End
procedure history
! here, use past history to estimate today’s oil needs
  totQtyOut( 1,1)>=data( …’ amount of crude oil to be targeted for today at the 1st Refinery goes here’
  totQtyOut ( 2,1)>=data( …’ 2nd Refinery’ …)
    ooo
  totQtyOut (nRefineries,1)>=data( …’ nth Refinery’ …)
end

This example shows nesting of find statements that will help maximize productivity. Getting agreement on what a companies objective is or should be may take some time. It is hoped that this example will aide you on solving your problem with Calculus programming. Solve not just one equation but your entire problem/project in one program.

Communication:Have you seen movie Hidden Figures, if you haven’t seen it, you should. It may help understand the communication problem between different types of people; e.g. NASA’s Engineers, Scientists, and Mathematicians. The movie shows engineers trying to solve some equations and getting no where fast! A mathematician comes along and solves the problem. But numbers say little to engineers. Near the movie’s end, the mathematician draws a graph showing a solution. The engineers finally get the ‘picture’ of what the equations are trying to say to them. Remember, a picture is worth a 1,000 words, right?

Feedback Request: How many companies are interested in solving their similar problem? At present, this program may not work due to amount of storage necessary. In order to fix this storage problem, we need your values for ‘nRefineries’ & ‘nProducts’. The product of nRefineries * nProducts may be the problem. Assume each is 100 then their product is 104. Internal arrays (e.g. jacobian) is the square of this product, 108! Knowing that the majority of problems would work with 10n would provide a target value for future releases of Calculus compilers.

If interested in solving such production problems please contact FortranCalculus.