I already have started a topic on this, however, i'm not having having any luck getting some help. I have a working program that is giving me some of the proper output, but i really need some help on the functions that are not working.....namely R2,R3,V2,V3,V4.
Again, I apologize for starting the same topic again, but any help at all would greatly be appreciated.
Capacity Planning
Decision Parameters
DP1 Length of time interval = 1
DP2 Maximum planned inventory factor = 5
DP3 Receiving rate factor = 20
DP4 Receiving capacity = 50
DP5 Productivity factor = 10
DP6 Shipping capacity =35
DP7 Number of simulated periods = 31
Rates of Flow
R1 Order rate = 20
R2 Receiving Rate = 20
R3 Production Rate = 20
R4 Shipping Rate = 20
Volume
V1 Order Backlog = 20
V2 Desired Inventory = 100
V3 Raw materials inventory = 80
V4 Finished Goods Inventory = 100
Formulae
Delta T = DP1
V1(t) = V1 (t-1) + (R1(t) – R4(t)) delta T
V2(t) = DP2 * delta T * [(sumR1(t-j)) /10]…….from j=0 to 9
V3(t) = V3 (t-1) + (R2(t) – R3(t)) *delta T
V4(t) = V4 (t-1) + (R3(t) – R4(t)) * delta T
R2(t) = { A = DP3 * V2 (t-1) / V4 (t-1), if A <= DP4
{ DP4, IF A > DP4
R3(t) = { B = V3(t-1) / (DP5 * delta T), IF B<= DP8
{ DP8, IF B> DP8
Output
Time Interval R1 R2 R3 R4 V1 V2 V3 V4
1 20 20 20 20 20 100 80 100
2 18 20 8 20 18 99 92 88
3 16 22.5 9.2 18 16 97 105.3 79.2
4 14 24.4 10.5 16 14 94 119 73
5 12 25.5 11.9 14 12 90 132.8 71.6
6 10 25.1 13.2 12 10 85 144.6 72.9
etc
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
double R1[12],R2[12],R3[12],R4[12],V1[12],V2[12],V3[12],V4[12],DP1,DP2,DP3,DP4,DP5,DP6,DP7,DP8,A,B,sum;
R1[0]=20,R2[0]=20,R3[0]=20,R4[0]=20, V1[0]=20, V2[0]=100, V3[0]=80, V4[0]=100, DP1=1, DP2=5, DP3=20, DP4=50, DP5=10, DP6=35, DP7=50, DP8=500;
int t,j;
sum=0;
for (j=0;j<10; ++j)
for (t=1;t<12; ++t)
{
V1[t] = ((R1[t] - R4[t])*DP1) + V1[t-1];
V2[t] = ((sum+=R1[j])/10)*DP1*DP2;
V3[t] = ((R2[t] - R3[t])*DP1) - V3[t-1];
V4[t] = ((R3[t] - R4[t])*DP1) + V4[t-1];
if (t<=1)
R1[t]=20;
else
R1[t]=R1[t-1]-2;
A = (DP3*V2[t-1])/V4[t-1];
{
if (A<= DP4)
R2[t]=A;
else
R2[t]=DP4;
}
B= ((V3[t-1])/(DP5*DP1));
if (B<=DP8)
R3[t]=B;
else
R3[t]=DP8;
if ( V1[t-1]<=min(V4[t-1],DP6*DP1))
R4[t] = V1[t-1]/DP1;
if (V4[t-1]<=min(V1[t-1],DP6*DP1))
R4[t] = V4[t-1]/DP1;
if ((DP6*DP1)<=min(V1[t-1],V4[t-1]))
R4[t] = DP6;
}
cout.precision (3);
cout<< "Results for the Simulation\n";
cout<<"\n";
cout<<"Time R1 R2 R3 R4 V1 V2 V3 V4\n";
cout<<"---------------------------------------------------------------------------\n";
for (t=1; t<12; ++t)
{
cout<<setw(2)<<t<<setw(8)<<R1[t]<<setw(8)<<R2[t]<<setw(8)<<R3[t]<<setw(8)<<R4[t]<<setw(8)<<V1[t]<<setw(8)<<V2[t]<<setw(8)<<V3[t]<<setw(8)<<V4[t]<<endl;
}
return 0;
}

New Topic/Question
Reply




MultiQuote





|