• No results found

(!$_POST) ); 7. {?> /> /> } { 18. = "", 19. > 0) { 20. = 21. = 22.

N/A
N/A
Protected

Academic year: 2021

Share "(!$_POST) ); 7. {?> /> /> } { 18. = "", 19. > 0) { 20. = 21. = 22."

Copied!
11
0
0

Loading.... (view fulltext now)

Full text

(1)

APPENDIX

Index.php

1. <body> 2. <head>

3. <title>Hanif73-Prediksi WMA</title> 4. <h2>Upload Data Minyak Bumi dan Gas Alam</h2> 5. <?php

6. ini_set('max_execution_time', 3000); 7. if (!$_POST) { ?>

8. <body>

9. <form action="" method="post" enctype="multipart/form-data">

10. Choose your file:

11. <input name="csv" type="file" id="csv" /> 12. <br>

13. <input type="submit" name="Submit" value="Submit" />

14. </form> 15. </body> 16. <?php

17. } else {

18. $connect = new mysqli("localhost", "root", "", "minyak"); 19. if ($_FILES['csv']['size'] > 0) {

20. $file = $_FILES['csv']['tmp_name'];

21. $handle = fopen($file, "r");

22. while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {

23. $import = "INSERT into data (Tahun,MinyakBumi,GasAlam)

24. values( 25. '$data[0]', 26. '$data[1]', 27. '$data[2]' 28. )"; 29. $connect->query($import); 30. } 31. fclose($handle);

32. print "Import done"; 33. ?>

34. <body>

35. <form action="" method="post"

enctype="multipart/form-data">

36. Choose your file:

37. <input name="csv" type="file" id="csv" /> 38. <br>

39. <input type="submit" name="Submit" value="Submit" /> 40. </form> 41. </body> 42. <?php 43. } 44. else A

(2)

45. { 46. ?> 47. <body>

48. <form action="" method="post"

enctype="multipart/form-data">

49. Choose your file:

50. <input name="csv" type="file" id="csv" /> 51. <br>

52. <input type="submit" name="Submit" value="Submit" /> 53. </form> 54. </body> 55. <?php 56. } 57. } 58. 59. ?> 60. 61. <body> 62. <div>

63. <h2>Data Produksi Minyak Bumi dan Gas Alam</h2>

64. <table border='1'> 65. <tr> 66. 67. <th width="80" align="center">Tahun</th> 68. <th width="150" align="center">Minyak Bumi</th> 69. <th width="150" align="center">Gas Alam</th> 70. </tr> 71. <?php 72. include "koneksi.php";

73. $sql = $pdo->prepare("SELECT * FROM data ORDER BY Tahun ASC"); 74. $sql->execute(); 75. $no = 0; 76. 77. while($data = $sql->fetch()){ 78. echo "<tr>"; 79. echo "<td>".$data['Tahun']."</td>"; 80. echo "<td>".$data['MinyakBumi']."</td>"; 81. echo "<td>".$data['GasAlam']."</td>"; 82. echo "</tr>"; 83. $no++; 84. } 85. ?> 86. </table>

87. <a> Total Data : </a> 88. <?php

89. echo $no;

90. ?>

91. <h4> Menu :</h4>

92. <form method="post" action="hapusdata.php"> 93. <button type="submit">Hapus Data</button>

(3)

94. </form>

95. <form method="post" action="prediksisatutahun.php">

96. <button type="submit">Prediksi Minyak Bumi dan Gas Alam Satu Tahun Kedepan</button>

97. </form>

98. <form method="post" action="akurasialgoritma.php">

99. <button type="submit">Akurasi Prediksi

Data</button> 100. </form> 101. </div> 102. </body> 103. </body>

prediksitahundepan.php

1. <head> 2. <title>Hanif73-Prediksi WMA</title> 3. </head> 4. <body>

5. <h2>Data Prediksi Minyak Bumi dan Gas Alam Tahun Depan</h2> 6. <table border='1'> 7. <tr> 8. <th width="80" align="center">Tahun</th> 9. <th width="160" align="center">Minyak Bumi</th> 10. <th width="160" align="center">Gas Alam</th> 11. <th width="160" align="center">Weight</th> 12. <th width="160" align="center">Minyak X Weight</th> 13. <th width="160" align="center">Gas X Weight</th> 14. </tr> 15. <?php 16. include "koneksi.php";

17. $sql = $pdo->prepare("INSERT INTO perhitungan1 (Tahun,PrediksiMinyakBumi,PrediksiGasAlam) SELECT * FROM data ORDER BY Tahun DESC LIMIT 2");

18. $sql->execute();

19. $sql = $pdo->prepare("SELECT * FROM

perhitungan1");

20. $sql->execute();

21. $sql = $pdo->prepare("SET @n:=0; UPDATE

perhitungan1 SET No=@n:=@n+1 ORDER BY No");

22. $sql->execute();

23. $sql = $pdo->prepare("SELECT * FROM perhitungan1 INNER JOIN pemberat ON perhitungan1.No=pemberat.No");

24. $sql->execute();

(4)

25. $prediksim = 0; 26. $prediksig = 0; 27. while($data = $sql->fetch()) 28. { 29. $mw = $data['PrediksiMinyakBumi']*$data['Angka']; 30. $gw = $data['PrediksiGasAlam']*$data['Angka']; 31. $prediksim += $mw; 32. $prediksig += $gw; 33. echo "<tr>"; 34. echo "<td>".$data['Tahun']."</td>"; 35. echo "<td>". $data['PrediksiMinyakBumi']."</td>"; 36. echo "<td>".$data['PrediksiGasAlam']."</td>"; 37. echo "<td>".$data['Angka']."</td>"; 38. echo "<td>".$mw."</td>"; 39. echo "<td>".$gw."</td>"; 40. echo "</tr>"; 41. } 42. echo "<tr>";

43. echo "<td colspan='4'>Perkiraan Data Tahun Depan</td>"; 44. echo "<td>".$prediksim."</td>"; 45. echo "<td>".$prediksig."</td>"; 46. echo "</tr>"; 47. ?> 48. </table>

49. <form method="post" action="hapusperhitungan1.php"> 50. <button type="submit">Kembali</button> 51. </form> 52. </body>

akurasialgoritma.php

1. <head> 2. <title>Hanif73-Prediksi WMA</title> 3. </head> 4. <body>

5. <h2>Tingkat Akurasi Berdasarkan Data</h2>

6. <a>*Catatan : Perhitungan akurasi ini menggunakan data 2 tahun sebelum tahun yang dipilih</a>

7. <form method="post" action=""> 8. Pilih Tahun :

9. <select name="akurasi"> 10. <?php

11. $con = mysqli_connect("localhost","root","","minyak"); 12. $query = "SELECT * FROM data";

13. $hasil = mysqli_query($con,$query); 14. while($data=mysqli_fetch_array($hasil)){ 15. echo "<option value=$data[Tahun]>$data[Tahun]</option>"; 16. } D

(5)

17. ?>

18. </select>

19. <input type="submit" name="submit" value="Submit" /> 20. <?php 21. if (isset($_POST['submit'])){ 22. $data = $_POST['akurasi']; 23. } 24. ?> 25. </form>

26. <form method="post" action="hapusakurasi.php"> 27. <button type="submit">Kembali</button> 28. </form> 29. 30. <?php 31. include "koneksi.php"; 32. $sql = $pdo->prepare("TRUNCATE akurasi"); 33. $sql->execute();

34. $sql = $pdo->prepare("INSERT INTO akurasi (Tahun,Minyak,Gas) SELECT * FROM data WHERE Tahun < $data ORDER BY Tahun DESC LIMIT 2");

35. $sql->execute();

36. $sql = $pdo->prepare("SELECT * FROM akurasi ORDER BY Tahun ASC");

37. $sql->execute();

38. $sql = $pdo->prepare("SET @n:=0; UPDATE akurasi SET No=@n:=@n+1 ORDER BY No");

39. $sql->execute();

40. $sql = $pdo->prepare("SELECT * FROM akurasi INNER JOIN pemberatkebalik ON akurasi.No=pemberatkebalik.No"); 41. $sql->execute(); 42. $count = $sql->rowCount(); 43. if($count<2){ 44. die("<strong>Data kurang!</strong>"); 45. } 46. $prediksim = 0; 47. $prediksig = 0; 48. while($data1 = $sql->fetch()) 49. ?> 50. 51. <h4>Data</h4> 52. <table border='1'> 53. <tr> 54. <th width="80" align="center">Tahun</th>

55. <th width="160" align="center">Minyak Bumi</th> 56. <th width="160" align="center">Gas Alam</th> 57. <th width="160" align="center">Weight</th>

58. <th width="160" align="center">Minyak X Weight</th> 59. <th width="160" align="center">Gas X Weight</th> 60. </tr> 61. <?php 62. include "koneksi.php"; 63. $sql = $pdo->prepare("TRUNCATE akurasi"); 64. $sql->execute(); E

(6)

65. $sql = $pdo->prepare("INSERT INTO akurasi (Tahun,Minyak,Gas) SELECT * FROM data WHERE Tahun < $data ORDER BY Tahun DESC LIMIT 2");

66. $sql->execute();

67. $sql = $pdo->prepare("SELECT * FROM akurasi"); 68. $sql->execute();

69. $sql = $pdo->prepare("SET @n:=0; UPDATE akurasi SET No=@n:=@n+1 ORDER BY No");

70. $sql->execute();

71. $sql = $pdo->prepare("SELECT * FROM akurasi INNER JOIN pemberatkebalik ON akurasi.No=pemberatkebalik.No"); 72. $sql->execute(); 73. $prediksim = 0; 74. $prediksig = 0; 75. while($data1 = $sql->fetch()) 76. { 77. $ma = $data1['Minyak']*$data1['Angka']; 78. $ga = $data1['Gas']*$data1['Angka']; 79. $prediksim += $ma; 80. $prediksig += $ga; 81. echo "<tr>"; 82. echo "<td>".$data1['Tahun']."</td>"; 83. echo "<td>".$data1['Minyak']."</td>"; 84. echo "<td>".$data1['Gas']."</td>"; 85. echo "<td>".$data1['Angka']."</td>"; 86. echo "<td>".$ma."</td>"; 87. echo "<td>".$ga."</td>"; 88. echo "</tr>"; 89. } 90. ?> 91. </table> 92. 93. <h4>Akurasi</h4> 94. <table border='1'> 95. <tr> 96. <th width="80" align="center">Tahun</th>

97. <th width="160" align="center">Minyak Bumi</th> 98. <th width="160" align="center">Gas Alam</th>

99. <th width="160" align="center">Prediksi Minyak Bumi</th>

100. <th width="160" align="center">Prediksi Gas Alam</th>

101. <th width="160" align="center">MAD Minyak</th> 102. <th width="160" align="center">MAD Gas Alam</th> 103. <th width="160" align="center">MSE Minyak</th> 104. <th width="160" align="center">MSE Minyak</th> 105. <th width="160" align="center">MAPE Minyak</th> 106. <th width="160" align="center">MAPE Minyak</th> 107. </tr>

108. <?php

109. include "koneksi.php";

110. $sql = $pdo->prepare("SELECT * FROM data WHERE Tahun=$data");

111. $sql->execute();

(7)

112. while($data2 = $sql->fetch()) 113. { 114. $madm = $data2['MinyakBumi']-$prediksim; 115. $madg = $data2['GasAlam']-$prediksig; 116. $msem = $madm*$madm; 117. $mseg = $madg*$madg; 118. $mapem = $madm/$data2['MinyakBumi']; 119. $mapeg = $madg/$data2['GasAlam']; 120. echo "<tr>"; 121. echo "<td>".$data2['Tahun']."</td>"; 122. echo "<td>".$data2['MinyakBumi']."</td>"; 123. echo "<td>".$data2['GasAlam']."</td>"; 124. echo "<td>".$prediksim."</td>"; 125. echo "<td>".$prediksig."</td>"; 126. echo "<td>".$madm."</td>"; 127. echo "<td>".$madg."</td>"; 128. echo "<td>".$msem."</td>"; 129. echo "<td>".$mseg."</td>"; 130. echo "<td>".$mapem."</td>"; 131. echo "<td>".$mapeg."</td>"; 132. echo "</tr>"; 133. } 134. ?> 135. </table> 136. </body>

137. <form method="post" action="hapusakurasi.php"> 138. <button type="submit">Kembali</button> 139. </body>

koneksi.php

1. <?php 2. $host = "localhost"; 3. $username = "root"; 4. $password = ""; 5. $database = "minyak"; 6.

7. $pdo = new PDO('mysql:host='.$host.';dbname='.$database, $username, $password);

8. ?>

(8)

hapusdata.php

1. <?php 2. include 'koneksi.php'; 3. $sql = $pdo->prepare("TRUNCATE data"); 4. $sql->execute(); 5. header("location:index.php"); 6. ?>

hapusperhitungan1.php

1. <?php 2. include 'koneksi.php'; 3. $sql = $pdo->prepare("TRUNCATE perhitungan1"); 4. $sql->execute(); 5. header("location:index.php"); 6. ?>

hapusakurasi.php

1. <?php 2. include 'koneksi.php'; 3. $sql = $pdo->prepare("TRUNCATE akurasi"); 4. $sql->execute(); 5. header("location:index.php"); 6. ?> H

(9)

97.52%

Originality

2.48%

Similarity

16

Sources

Doc vs Internet + Library

Web sources: 9 sources found

1. http://socj.telkomuniversity.ac.id/ojs/index.php/indojc/article/view/7 0.7% 2. http://sinta2.ristekdikti.go.id/journals/detail?id=1706 0.7% 3. http://garuda.ristekdikti.go.id/journal/view/8972 0.7% 4. http://socj.telkomuniversity.ac.id/ojs/index.php/indojc/article/download/7/14 0.7% 5. https://publikasi.dinus.ac.id/index.php/joins/article/download/1301/964 0.52% 6. http://staffallocationsolution.com/main/index 0.39% 7. https://files.eric.ed.gov/fulltext/EJ752840.pdf 0.35% 8. https://physoc.onlinelibrary.wiley.com/doi/pdf/10.1113/jphysiol.1951.sp004584 0.35% 9. https://brandmarketingblog.com/articles/branding-definitions/what-is-a-brand 0.35%

Library sources: 7 sources found

14.K1.0038 Roberto Rio Rakana Jaya.docx 0.39%

15K10051-KAROLUS LETA WICAKSONO.docx.docx 0.39%

14.K1.0047.docx.docx 0.39%

14k20011WahyuJeniusk.odt.odt 0.35%

14K10009 HIZKIA KEVIN KURNIANTO UTOMO.odt.odt 0.35%

13.02.0026-Fransiskus Ian Sutanto (revisi).doc 0.35%

Proposal_Project(inggris).odt 0.35%

14K10071 HANIF PANDU S... Uploaded: 07/30/2019 Checked: 07/30/2019

Similarity

Similarity from a chosen source Possible character replacement

abc

Citation References

(10)

CHAPTER 1 INTRODUCTION

Background

The annual production of Petroleum and Natural Gas has an irregular up and down change, this amount can be seen on the website of the Badan Pusat Statistik www.bps.go.id. This number can be use for data to predict the amount of production in the next year.

This journal discusses how to predict this with the help of the Weighted Moving Average Algorithm. As the name implies the calculation by giving weight to each data used for calculation.

Of the several algorithms available, the Moving Average Weight is chosen because of its good accuracy and to make it easier to predict the number of productions the following year.

Scope

Based on the background above, some of the problems resolved here include:

1. Utilizing the statistical data to predict the amount of production of Petroleum and Natural Gas in the next year with the help of the Weighted Moving Average Algorithm

2. Calculate the accuracy of this algorithm to predict the amount of production, whether it qualifies or not.

Objective

The final result of this program is an application to predict the amount of petroleum and natural gas production in Indonesia.

1

14K10071 HANIF PANDU S... Uploaded: 07/30/2019 Checked: 07/30/2019

Similarity

Similarity from a chosen source Possible character replacement

abc

Citation References

(11)

CHAPTER 2 LITERATURE STUDY

The first journal that became a reference in working on this project from Dewa Putu Yudhi Ardiana & Luciana Hendrika Loekito (2018). Sistem Informasi Peramalan Persediaan Barang Menggunakan Metode Weighted Moving Average.

WMA (Weighted Moving Average) is a moving average that is weighted differently, where the weight was if added together will equal one, recent data more heavily weighted. For example there are 4 data, therefore the weights used are 0.1, 0.2, 0.3 and 0.4. In this journal the problem is in the form of uncertain demand for imported meat. The authors calculated the prediction using 3 data with the respective weights 0.1 0.2 0.7. The resulting accuracy is quite interesting. It is known that the MSE results from the data calculated by the WMA algorithm are only 0.00834.

Not only that, to compare the accuracy of other Moving Average Algorithms, the second Journal by Hari Prapcoyo (2018). Peramalan Jumlah

Mahasiswa Menggunakan Moving Average. compare 3 Algorithms MA.

SMA(Simple Moving Average), WMA(Weighted Moving Average), and

EMA(Exponential Moving Average) to predict the number of UPN Veteran Yogyakarta informatics engineering students for the coming period. The lowest MAPE value obtained is the WMA algorithm, only 0.0524132. Whereas SMA is 0.1482000 and EMA is 0.1132568.

Not only that, comparisons are still ongoing in the third journal. Journal by

Malik Ibrahim (2016). Perbandingan Metode Weighted Moving Average dan Trend Semi Average(Studi Kasus Penjualan Kayu Sumber Alam Sawmill). Where in this journal discusses the comparison of WMA (Weighted Moving Average) Algorithms with TSA (Trend Semi Average). the journal predicts the sale of wood. The results of the comparison of the two algorithms obtained WMA algorithms

2

14K10071 HANIF PANDU S... Uploaded: 07/30/2019 Checked: 07/30/2019

Similarity

Similarity from a chosen source Possible character replacement

abc

Citation References

References

Related documents