Difference between revisions of "Tri Aji Setyawan"
(→MINGGU KE 3) |
(→Trusses HW) |
||
Line 333: | Line 333: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Transformasi Matriks | |
<syntaxhighlight lang="modelica"> | <syntaxhighlight lang="modelica"> | ||
− | + | function Stiffness_Matrices | |
− | + | input Real A; | |
− | + | Real Y; | |
− | + | output Real X[4,4]; | |
− | Real | + | Real float_error = 10e-10; |
− | |||
− | |||
− | Real | ||
− | |||
− | |||
− | |||
− | + | final constant Real pi=2*Modelica.Math.asin(1.0); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
algorithm | algorithm | ||
− | / | + | Y:=A/180*pi; |
− | + | ||
− | + | X:=[(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y); | |
− | + | Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2; | |
− | |||
− | + | -(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y); | |
− | |||
− | + | -Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2]; | |
− | |||
− | + | for i in 1:4 loop | |
− | + | for j in 1:4 loop | |
− | + | if abs(X[i,j]) <= float_error then | |
− | + | X[i,j] := 0; | |
− | + | end if; | |
− | + | end for; | |
− | |||
− | for i in 1: | ||
− | |||
− | |||
− | |||
− | |||
end for; | end for; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | end | + | end Stiffness_Matrices; |
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 13:37, 2 December 2020
Biodata
Tri Aji Setyawan 1906301324
Saya merupakan mahasiswa teknik mesin UI angkatan 2019. saya menyukai teknik mesin karena tertarik pada bidang manufaktur dan karena teknik mesin sendiri memiliki prospek kerja yang luas. hal yang saya pelajari sebelum uts ini adalah mengenai turunan numerik, deret mclaurin , interpolasi, regresi, pengertian dari metode numerik, pseucode.
MINGGU KE 1
- Tujuan mempelajari metode numerik
- 1. matching dengan tujuan belajar: memahami konsep dan prinsip dasar di dalam metnum. contoh persamaan aljabar, algorithma, pencocokan kurva, persamaan diferensial parsial.
- 2. dapat menerapkan pemahaman terhadap konsep di dalam permodelan numerik ( pengaplikasian metode numerik )
- 3. mampu menerapkan metnum di dalam persoalan keteknikan.
- 4. untuk mencapai poin 1,2,3, yaitu dengan cara moral value (adab). untuk menambah nilai tambah / adabsehingga kita menjadi orang yang lebih beradab
TUGAS 1
Pada pertemuan sebelumnya , saya mendapatkan tugas untuk membuat video terkait penggunaan aplikasi open modelica
MINGGU KE 2
perbedaan openmodelica dengan python , open modelicca lebih ke bahasa permodelan sedangkan python hanya bahasa cpoding. kelebihan dari open modelicca yaitu :
- menggunakan bahasa permodelan yang cocok untuk seorang engineer
- proses perhitungan lebih cepat
- pengguna aplikasi openmodelica cukup banyak penggunanya, dan termasuk open teknologi (free).
pada minggu kedua, saya mempelajari mengenai cara memanggil fungsi dalam suatu kelas tertentu
Tugas 2
mengaplikasikan penggunaan fitur function dan class pada open modelica. Membuat sebuah fungsi berupa persamaan aljabar simultan dengan variabel array kemudian membuat class untuk memanggil fungsi tersebut. Persamaan aljabar simultan adalah sebuah persoalan matematika yang kompleks sehingga penyelesaian perlu dengan menggunakan tools, agar dapat dibuat lebih sederhana.
pada tugas kali ini saya mencoba menyelesaikan suatu soal sistem persamaan linier menggunakan metode gauss
MINGGU KE 3
- pseudocode figure 9.4
function NaiveGauss
/*
input Real [:,:] A;
input Real [:] B;
output Real [:,:] y;
output Real [:] x;
protected
Real [:,:] a;
Real [:] b;
Integer m = size(A,1); // JUMLAH BARIS
Integer n = size(A,2); // JUMLAH KOLOM
Real k = 1;
Real i = 1;
Real j = 1;
Real factor = 1;
Real sum = 1;
algorithm
// Transfer input matrix (A,B) into variables (a,b)
a := A;
b := B;
// Forward Elimination
for k in 1:(n-1) loop
for i in (k+1):n loop
factor := a[i,k] / a[k,k];
for j in (k+1):n loop
a[i,j] := a[i,j] - (factor * a[k,j]);
end for;
b[i] := b[i] - (factor * b[k]);
end for;
end for;
// Back Substitution
x[n] := b[n] / a[n,n];
for i in (n-1):(-1) loop
sum := b[i];
for j in (i+1):n loop
sum := sum - (a[i,j] * x[j]);
end for;
x[i] := sum / a[i,i];
end for;
end NaiveGauss;
PR 3
problem 1
*model Trusses
parameter Integer N=10; //Global matrice = 2*points connected
parameter Real A=8;
parameter Real E=1.9e6;
Real G[N,N]; //global
Real Ginitial[N,N]; //global
Real Sol[N]; //global dispplacement
Real X[N]={0,0,0,0,0,0,0,-500,0,-500};
Real R[N]; //global reaction force
Real SolMat[N,1];
Real XMat[N,1];
//boundary coundition
Integer b1=1;
Integer b2=3;
//truss 1
parameter Real X1=0; //degree between truss
Real k1=A*E/36;
Real K1[4,4]; //stiffness matrice
Integer p1a=1;
Integer p1b=2;
Real G1[N,N];
//truss 2
parameter Real X2=135; //degree between truss
Real k2=A*E/50.912;
Real K2[4,4]; //stiffness matrice
Integer p2a=2;
Integer p2b=3;
Real G2[N,N];
//truss 3
parameter Real X3=0; //degree between truss
Real k3=A*E/36;
Real K3[4,4]; //stiffness matrice
Integer p3a=3;
Integer p3b=4;
Real G3[N,N];
//truss 4
parameter Real X4=90; //degree between truss
Real k4=A*E/36;
Real K4[4,4]; //stiffness matrice
Integer p4a=2;
Integer p4b=4;
Real G4[N,N];
//truss 5
parameter Real X5=45; //degree between truss
Real k5=A*E/50.912;
Real K5[4,4]; //stiffness matrice
Integer p5a=2;
Integer p5b=5;
Real G5[N,N];
//truss 6
parameter Real X6=0; //degree between truss
Real k6=A*E/36;
Real K6[4,4]; //stiffness matrice
Integer p6a=4;
Integer p6b=5;
Real G6[N,N];
/*
for each truss, please ensure pXa is lower then pXb (X represents truss element number)
*/
algorithm
//creating global matrice
K1:=Stiffness_Matrices(X1);
G1:=k1*Local_Global(K1,N,p1a,p1b);
K2:=Stiffness_Matrices(X2);
G2:=k2*Local_Global(K2,N,p2a,p2b);
K3:=Stiffness_Matrices(X3);
G3:=k3*Local_Global(K3,N,p3a,p3b);
K4:=Stiffness_Matrices(X4);
G4:=k4*Local_Global(K4,N,p4a,p4b);
K5:=Stiffness_Matrices(X5);
G5:=k5*Local_Global(K5,N,p5a,p5b);
K6:=Stiffness_Matrices(X6);
G6:=k6*Local_Global(K6,N,p6a,p6b);
G:=G1+G2+G3+G4+G5+G6;
Ginitial:=G;
//implementing boundary condition
for i in 1:N loop
G[2*b1-1,i]:=0;
G[2*b1,i]:=0;
G[2*b2-1,i]:=0;
G[2*b2,i]:=0;
end for;
G[2*b1-1,2*b1-1]:=1;
G[2*b1,2*b1]:=1;
G[2*b2-1,2*b2-1]:=1;
G[2*b2,2*b2]:=1;
//solving displacement
Sol:=Gauss_Jordan(N,G,X);
//solving reaction force
SolMat:=matrix(Sol);
XMat:=matrix(X);
R:=Reaction_Trusses(N,Ginitial,SolMat,XMat);
end Trusses;
problem 2
*class Trusses_HW
parameter Integer N=8; //Global matrice = 2*points connected
parameter Real A=0.001; //Area m2
parameter Real E=200e9; //Pa
Real G[N,N]; //global
Real Ginitial[N,N]; //global
Real Sol[N]; //global dispplacement
Real X[N]={0,0,-1035.2762,-3863.7033,0,0,-1035.2762,-3863.7033};
Real R[N]; //global reaction force
Real SolMat[N,1];
Real XMat[N,1];
//boundary condition
Integer b1=1;
Integer b2=3;
//truss 1
parameter Real X1=0; //degree between truss
Real k1=A*E/1;
Real K1[4,4]; //stiffness matrice
Integer p1a=1;
Integer p1b=2;
Real G1[N,N];
//truss 2
parameter Real X2=0; //degree between truss
Real k2=A*E/1;
Real K2[4,4]; //stiffness matrice
Integer p2a=2;
Integer p2b=3;
Real G2[N,N];
//truss 3
parameter Real X3=90; //degree between truss
Real k3=A*E/1.25;
Real K3[4,4]; //stiffness matrice
Integer p3a=2;
Integer p3b=4;
Real G3[N,N];
//truss 4
parameter Real X4=90+38.6598; //degree between truss
Real k4=A*E/1.6;
Real K4[4,4]; //stiffness matrice
Integer p4a=1;
Integer p4b=4;
Real G4[N,N];
//truss 5
parameter Real X5=90-38.6598; //degree between truss
Real k5=A*E/1.6;
Real K5[4,4]; //stiffness matrice
Integer p5a=3;
Integer p5b=4;
Real G5[N,N];
/*
for each truss, please ensure pXa is lower then pXb (X represents truss element number)
*/
algorithm
//creating global matrice
K1:=Stiffness_Matrices(X1);
G1:=k1*Local_Global(K1,N,p1a,p1b);
K2:=Stiffness_Matrices(X2);
G2:=k2*Local_Global(K2,N,p2a,p2b);
K3:=Stiffness_Matrices(X3);
G3:=k3*Local_Global(K3,N,p3a,p3b);
K4:=Stiffness_Matrices(X4);
G4:=k4*Local_Global(K4,N,p4a,p4b);
K5:=Stiffness_Matrices(X5);
G5:=k5*Local_Global(K5,N,p5a,p5b);
G:=G1+G2+G3+G4+G5;
Ginitial:=G;
//implementing boundary condition
for i in 1:N loop
G[2*b1-1,i]:=0;
G[2*b1,i]:=0;
G[2*b2-1,i]:=0;
G[2*b2,i]:=0;
end for;
G[2*b1-1,2*b1-1]:=1;
G[2*b1,2*b1]:=1;
G[2*b2-1,2*b2-1]:=1;
G[2*b2,2*b2]:=1;
//solving displacement
Sol:=Gauss_Jordan(N,G,X);
//solving reaction force
SolMat:=matrix(Sol);
XMat:=matrix(X);
R:=Reaction_Trusses(N,Ginitial,SolMat,XMat);
end Trusses_HW;
Transformasi Matriks
function Stiffness_Matrices
input Real A;
Real Y;
output Real X[4,4];
Real float_error = 10e-10;
final constant Real pi=2*Modelica.Math.asin(1.0);
algorithm
Y:=A/180*pi;
X:=[(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y);
Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2;
-(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y);
-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2];
for i in 1:4 loop
for j in 1:4 loop
if abs(X[i,j]) <= float_error then
X[i,j] := 0;
end if;
end for;
end for;
end Stiffness_Matrices;