Difference between revisions of "Ardiya Prajna Hardianto"
Line 66: | Line 66: | ||
== '''Tugas Minggu 3''' == | == '''Tugas Minggu 3''' == | ||
− | + | Berikut 2 contoh penggunaan aplikasi Modelica untuk menyelesaikan perhitungan displacement dan reaction force pada trusses: | |
− | [[File: | + | |
+ | '''Trusses Problem 1 (Example 3.1)''' | ||
+ | |||
+ | [[File:Example 3.1 Arya.jpg|700px|thumb|right]] | ||
+ | [[File:Trusses 1 Displacement Arya.jpg|700px|thumb|right|Grafik Displacement]] | ||
+ | [[File:Trusses 1 Reaction Arya.jpg|700px|thumb|right|Grafik Reaction Forces]] | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | ''Persamaan'' | ||
+ | |||
+ | 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; | ||
+ | |} | ||
+ | |||
+ | |||
+ | '''Trusses Problem 2 (Homework)''' | ||
+ | [[File:Tugas 3 Arya.jpg|700px|thumb|center]] | ||
+ | [[File:Trusses 2 Displacement Arya.jpg|700px|thumb|center|Grafik Displacement]] | ||
+ | [[File:Trusses 2 Reaction Arya.jpg|700px|thumb|center|Grafik Reaction Forces]] | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | ''Persamaan'' | ||
+ | |||
+ | 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; | ||
+ | |} | ||
+ | |||
+ | '''Fungsi Panggil''' | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | ''Matrice Transformation'' | ||
+ | |||
+ | 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; | ||
+ | |||
+ | | style="width: 20cm;"| | ||
+ | ''Global Element Matrice'' | ||
+ | |||
+ | function Local_Global | ||
+ | input Real Y[4,4]; | ||
+ | input Integer B; | ||
+ | input Integer p1; | ||
+ | input Integer p2; | ||
+ | output Real G[B,B]; | ||
+ | |||
+ | algorithm | ||
+ | |||
+ | for i in 1:B loop | ||
+ | for j in 1:B loop | ||
+ | G[i,j]:=0; | ||
+ | end for; | ||
+ | end for; | ||
+ | |||
+ | G[2*p1,2*p1]:=Y[2,2]; | ||
+ | G[2*p1-1,2*p1-1]:=Y[1,1]; | ||
+ | G[2*p1,2*p1-1]:=Y[2,1]; | ||
+ | G[2*p1-1,2*p1]:=Y[1,2]; | ||
+ | |||
+ | G[2*p2,2*p2]:=Y[4,4]; | ||
+ | G[2*p2-1,2*p2-1]:=Y[3,3]; | ||
+ | G[2*p2,2*p2-1]:=Y[4,3]; | ||
+ | G[2*p2-1,2*p2]:=Y[3,4]; | ||
+ | |||
+ | G[2*p2,2*p1]:=Y[4,2]; | ||
+ | G[2*p2-1,2*p1-1]:=Y[3,1]; | ||
+ | G[2*p2,2*p1-1]:=Y[4,1]; | ||
+ | G[2*p2-1,2*p1]:=Y[3,2]; | ||
+ | |||
+ | G[2*p1,2*p2]:=Y[2,4]; | ||
+ | G[2*p1-1,2*p2-1]:=Y[1,3]; | ||
+ | G[2*p1,2*p2-1]:=Y[2,3]; | ||
+ | G[2*p1-1,2*p2]:=Y[1,4]; | ||
+ | |||
+ | end Local_Global; | ||
+ | |||
+ | | style="width: 20cm;"| | ||
+ | ''Reaction Matrice Equation'' | ||
+ | |||
+ | function Reaction_Trusses | ||
+ | input Integer N; | ||
+ | input Real A[N,N]; | ||
+ | input Real B[N,1]; | ||
+ | input Real C[N,1]; | ||
+ | Real X[N,1]; | ||
+ | output Real Sol[N]; | ||
+ | Real float_error = 10e-10; | ||
+ | |||
+ | algorithm | ||
+ | X:=A*B-C; | ||
+ | |||
+ | for i in 1:N loop | ||
+ | if abs(X[i,1]) <= float_error then | ||
+ | X[i,1] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | for i in 1:N loop | ||
+ | Sol[i]:=X[i,1]; | ||
+ | end for; | ||
+ | |||
+ | end Reaction_Trusses; | ||
+ | |||
+ | |} |
Revision as of 14:33, 2 December 2020
بِسْمِ اللهِ الرَّحْمَنِ الرَّحِيْمِ
Assalamualaikum wr. wb.
Biodata
Nama : Ardiya Prajna Hardianto
NPM : 1806201491
TTL : Jakarta, 19 April 2000
Tempat Tinggal: Bekasi
Saya adalah mahasiswa FTUI angkatan 2018 jurusan Teknik Mesin.
Saya memilih jurusan Teknik Mesin karena saya ingin tahu lebih dalam tentang dunia Mechanical Engineering dan segala ilmu pendukungnya.
Contents
Metode Numerik
Metode numerik merupakan teknik penyelesaian permsalahan yang diformulasikan secara matematis dengan menggunakan operasi hitungan (aritmatik) yaitu operasi tambah, kurang, kali, dan bagi. Metode ini digunakan karena banyak permasalahan matematis tidak dapat diselesaikan menggunakan metode analitik.
Pada kelas MetNum 02 semester ganjil 2020/2021 sampai dengan UTS, perkuliahan diisi oleh Bapak Dr. Ir. Engkos A. Kosasih, M.T. Dimana kita membahas materi seperti:
- Regresi Linear
- Sistem Persamaan dengan metode Newton Rhapson, Sekan, dan Biseksi
- Interpolasi
- Deret Taylor dan McClaurin
- Pseudocode
- Turunan Numerik
Review Minggu 1
Untuk pertemuan pertama saya mempelajari cara menggunakan OpenModelica dimulai dari persamaan yang cukup sederhana, OpenModelica sendiri merupakan aplikasi penghitungan permodelan yang lumayan kompleks, sehingga OpenModelica itu sendiri sangat membantu saat menyelesaikan permodelan masalah mulai dari yang cukup mudah sampai ke cukup kompleks.
Tugas Minggu 1
https://www.youtube.com/watch?v=GhtBMIlO70w
Review Minggu 2
Pada kegiatan pembelajaran mata kuliah metode numerik hari ini. Bapak Ahmad Indra mengawali dengan mereview tugas yang diberikan pada pertemuan minggu lalu. Review tersebut mengenai software Open Modelica dan perhitungan yang masing - masing mahasiswa lakukan.
Review Minggu 3
Pada awal-awal Pak Dai memaparkan tiga aplikasi metode numerik yang sering digunakan dalam menyelesaikan permasalahan teknik, pertama ada Computation Fluid Dynamics (CFD), lalu Finite Element Analysis, dan Metode Stokastik. CFD dan FEA berbasis ilmu fisika, kemudian metode stokastik berbasis data dan statistik. Ada lima langkah yang Pak Dai paparkan dalam mengaplikasikan metode numerik ke permasalahan teknik :
Riset masalah tekniknya terlebih dahulu Menganalisis masalah (mendefinisikan variabel yang mau dicari dan mencari parameter fisikanya) Membuat model matematika Membuat model numerik Setelah itu cari penyelesaian dengan bantuan komputer untuk mendapatkan output yang diinginkan Agar Kami bisa lebih paham tentang dasar-dasar metode numerik, Pak Dai menyuruh Kami untuk mencoba membuat fungsi untuk menyelesaikan Persamaan 9.12 di buku Numerical Methods for Engineers 7th Edition oleh Chapra dengan cara apapun (misalnya eliminasi gauss). Kedua, Kami disuru latihan menyelesaikan sistem persamaan dengan membuat fungsi penyelesaian dengan cara pseudocode 9.4 untuk menjawab soal 9.5 yang ada di buku yang sama juga. Latihan yang kedua ini dimaksudkan agar Kami paham dalam penggunaan array dalam penggunaan OpenModelica, yang dimana array ini dapat memudahkan mengumpulkan himpunan penyelesaian.
Tugas Minggu 3
Berikut 2 contoh penggunaan aplikasi Modelica untuk menyelesaikan perhitungan displacement dan reaction force pada trusses:
Trusses Problem 1 (Example 3.1)
Persamaan 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; |
Trusses Problem 2 (Homework)
Persamaan 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; |
Fungsi Panggil
Matrice Transformation 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; |
Global Element Matrice function Local_Global input Real Y[4,4]; input Integer B; input Integer p1; input Integer p2; output Real G[B,B]; algorithm for i in 1:B loop for j in 1:B loop G[i,j]:=0; end for; end for; G[2*p1,2*p1]:=Y[2,2]; G[2*p1-1,2*p1-1]:=Y[1,1]; G[2*p1,2*p1-1]:=Y[2,1]; G[2*p1-1,2*p1]:=Y[1,2]; G[2*p2,2*p2]:=Y[4,4]; G[2*p2-1,2*p2-1]:=Y[3,3]; G[2*p2,2*p2-1]:=Y[4,3]; G[2*p2-1,2*p2]:=Y[3,4]; G[2*p2,2*p1]:=Y[4,2]; G[2*p2-1,2*p1-1]:=Y[3,1]; G[2*p2,2*p1-1]:=Y[4,1]; G[2*p2-1,2*p1]:=Y[3,2]; G[2*p1,2*p2]:=Y[2,4]; G[2*p1-1,2*p2-1]:=Y[1,3]; G[2*p1,2*p2-1]:=Y[2,3]; G[2*p1-1,2*p2]:=Y[1,4]; end Local_Global; |
Reaction Matrice Equation function Reaction_Trusses input Integer N; input Real A[N,N]; input Real B[N,1]; input Real C[N,1]; Real X[N,1]; output Real Sol[N]; Real float_error = 10e-10; algorithm X:=A*B-C; for i in 1:N loop if abs(X[i,1]) <= float_error then X[i,1] := 0; end if; end for; for i in 1:N loop Sol[i]:=X[i,1]; end for; end Reaction_Trusses; |