Tugas Besar Metode Numerik - Josiah Enrico S

From ccitonlinewiki
Revision as of 15:58, 6 January 2021 by JosiahEnrico (talk | contribs) (Result and Analysis)
Jump to: navigation, search

Abstract

Introduction

Objective

  • Membuat program analisis truss dan optimasi sederhana dengan Modelica
  • Mengoptimasi harga pembuatan rangka truss sederhana dengan memvariasi dimensi dan elastisitas material.

Methodology

  • Metode Optimasi Golden Section (univariabel)
  • Metode Optimasi Golden Section (multivariabel)

Procedure

Geometri dan Load

Tugas Besar Metnum Geometri Jos.jpg


Constraint:

- Spesifikasi L (Panjang) dan geometri rangka truss

- Gaya beban terhadap struktur (1000 N dan 2000 N)


Asumsi:

- Beban akan terdistribusi hanya pada point penghubung dan semua gaya yang dipengaruhi moment diamggap tidak ada karena sistem bersifat truss


Koleksi Data

Tugas Besar Metnum Dimension Jos.jpg Tugas Besar Metnum Sample Jos.jpg

Data Proceessing

Elasticity Constraint

Tugas Besar Metnum ExcelElas Jos.jpg
Tugas Besar Metnum GraphElas Jos.jpg

Area Constraint

Tugas Besar Metnum ExcelArea Jos.jpg
Tugas Besar Metnum GraphArea Jos.jpg

Result and Analysis

Modelica Result

Powell Method

model Powell_Method_Opt_Jos_Ratio

parameter Integer order=2; //order of regression
parameter Integer GoldN=15; //maximum iteration of linear gold optimization
parameter Integer N=10; //maximum iteration
parameter Real maxerror=1e-50; //maximum error

//Assumed to be X function
parameter Real RatioArea[size(Area,1)]={3.6534e-5, 3.75348e-5, 3.79639e-5, 3.79507e-05, 3.74821e-05};
parameter Real CostArea[size(Area,1)]={829776,1053955,1308215,1722235,2202651};
parameter Real Area[:]={141e-6, 184e-6, 231e-6, 304e-6, 384e-6};
Real CoeArea[order+1];
Real CoeAreaCost[order+1];

//Assumed to be Y function
parameter Real RatioElas[size(Elas,1)]={2.83875e-5, 8.5637e-5, 12.5153e-5, 5.70447e-5};
parameter Real CostElas[size(Elas,1)]={1367994,732878,492691,622939};

parameter Real Elas[:]={192e9, 195e9, 198e9, 201e+9};
Real CoeElas[order+1];
Real CoeElasCost[order+1];


//Guessing Start (1 point, 2 vector) - the second vector will be auto-generated
parameter Real StartPoint[2]={171e-6,195e9};
parameter Real VectorPoint[2]={205e-6,200e9};

//Solution
Real RatioZ[N]; //Optimum result
Real CostZ; //Cost Optimum result
Real x3[2]; //Optimum point coordinate (x,y)
Real error[N]; //Error 

protected
Real jos;
Real RatioZX;
Real RatioZY;
Real CostZX;
Real CostZY;
Real x0tes[2];
Real x0[2];
Real x1[2];
Real x2[2];
Real grad1;
Real grad2;
Real grad3;

//Checking approach 
Real cek0[N];
Real cek1[N];
Real cek2[N];
Real cek3[N];
Real yek0[N];
Real yek1[N];
Real yek2[N];
Real yek3[N];

algorithm
//Creating function at both 
CoeArea:=Curve_Fitting(Area,RatioArea,order);
CoeElas:=Curve_Fitting(Elas,RatioElas,order);
CoeAreaCost:=Curve_Fitting(Area,CostArea,order);
CoeElasCost:=Curve_Fitting(Elas,CostElas,order);

//Creating 2 vector defined in 2 gradient (grad1,grad2)
x0:=StartPoint;
x0tes:=VectorPoint;
grad1:=(x0tes[2]-x0[2])/(x0tes[1]-x0[1]);
grad2:=-0.5*grad1;

//Provide error variable
RatioZX:=CoeArea[1]*x0[1]^2+CoeArea[2]*x0[1]+CoeArea[3];
RatioZY:=CoeElas[1]*x0[2]^2+CoeElas[2]*x0[2]+CoeElas[3];
jos:=(RatioZX+RatioZY)/2;

//Computing approach
for i in 1:N loop
 cek0[i]:=x0[1];
 yek0[i]:=x0[2];
 x1:=Gold_Opt_Func_2D_Vector(x0,grad1,GoldN,CoeArea,CoeElas);
 cek1[i]:=x1[1];
 yek1[i]:=x1[2];
 x2:=Gold_Opt_Func_2D_Vector(x1,grad2,GoldN,CoeArea,CoeElas);
 cek2[i]:=x2[1];
 yek2[i]:=x2[2];
 
   if (x0[1]==x2[1]) and (x0[2]<>x2[2]) then
     grad3:=1/0; //divergent gradient, please subtitute vector
     x3:=Gold_Opt_Func_2D_Vector_1(x2,1,GoldN,CoeArea,CoeElas);    
   else  
     grad3:=(x2[2]-x0[2])/(x2[1]-x0[1]);
     x3:=Gold_Opt_Func_2D_Vector(x0,grad3,GoldN,CoeArea,CoeElas);  
   end if;
 
 cek3[i]:=x3[1];
 yek3[i]:=x3[2];
 grad1:=grad2;
 grad2:=grad3; 
   
 //Function Created
 RatioZX:=CoeArea[1]*x3[1]^2+CoeArea[2]*x3[1]+CoeArea[3];
 RatioZY:=CoeElas[1]*x3[2]^2+CoeElas[2]*x3[2]+CoeElas[3];
 RatioZ[i]:=(RatioZX+RatioZY)/2;
 
 CostZX:=CoeAreaCost[1]*x3[1]^2+CoeAreaCost[2]*x3[1]+CoeAreaCost[3];
 CostZY:=CoeElasCost[1]*x3[2]^2+CoeElasCost[2]*x3[2]+CoeElasCost[3];
 CostZ:=(CostZX+CostZY)/2;
 x0:=x3;
 
 error[i]:=abs(1-jos/RatioZ[i]);
 jos:=RatioZ[i];
 if error[i]<maxerror then
   break;
 end if;
end for;

end Powell_Method_Opt_Jos_Ratio;

Acknowledgement

Reference