Compare commits

..

56 Commits

Author SHA1 Message Date
Rifqi D. Panuluh
7104eb275a Update latex/chapters/id/03_methodology/data_analysis/index.tex
fix(latex): Fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-23 03:23:59 +07:00
Rifqi D. Panuluh
ee9bd98a9e Update latex/chapters/id/03_methodology/steps/index.tex
chore: remove double slash of image path

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-23 03:23:38 +07:00
Rifqi D. Panuluh
279703c1bb Update latex/chapters/id/03_methodology/tool/hardware.tex
fix(latex): Fix figure reference

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-23 03:22:58 +07:00
nuluh
5f00fcf7bf feat(latex): add hardware and software sections with detailed descriptions and components used in the research 2025-05-23 01:02:29 +07:00
nuluh
d41eb8c539 fix(latex): update input paths in methodology chapter for correct file referencing 2025-05-23 00:06:41 +07:00
nuluh
cc191122af feat(latex): add data acquisition section with dataset details and sampling information 2025-05-23 00:03:46 +07:00
nuluh
802f2a01ce fix(latex): fix citation format for secondary data source in methodology chapter 2025-05-22 22:04:38 +07:00
nuluh
26d47e8538 feat(latex): expand data analysis section in methodology chapter 2025-05-22 22:02:20 +07:00
nuluh
51118c13b3 feat(latex): update dataset figure and add specimen image in methodology chapter 2025-05-15 23:18:13 +07:00
nuluh
c07af1b937 Merge branch 'main' into latex/methodology, fix the ams package required for joint and sensor diagrams written in tex 2025-05-15 23:11:01 +07:00
nuluh
c96fd43e76 feat(latex): add diagram for joint and sensors placement in methodology chapter 2025-05-15 23:00:15 +07:00
nuluh
083b00e914 feat(latex): add specimen diagram with sensor notation for data representation in methodology chapter 2025-05-15 22:58:15 +07:00
nuluh
b4fb0d64a2 feat(latex): add amsmath package for improved math support 2025-05-15 22:52:42 +07:00
nuluh
d5c9d6dec4 feat(latex): initialize methodology steps with overall clue descriptions of research phases 2025-05-15 21:50:05 +07:00
nuluh
26b276c1f9 feat(latex): add section for tools in methodology chapter 2025-05-15 21:49:02 +07:00
nuluh
82fb8ff629 fix(latex): correct section title from "Bahan dan Materi" to "Benda Uji" to give more context about the thesis
Closes #71
2025-05-15 21:44:38 +07:00
nuluh
2aa5cda6c7 feat(latex): add detailed description and structure for materials section in methodology chapter 2025-05-15 21:38:18 +07:00
nuluh
fd696a41b9 feat(latex): initialize sections for methodology chapter including data analysis, materials, and steps 2025-05-15 21:37:06 +07:00
nuluh
077768917d feat(latex): initialize new structure for methodology chapter 2025-05-15 21:31:06 +07:00
nuluh
b1e1edee77 Merge branch 'main' of https://github.com/nuluh/thesis 2025-05-15 06:32:05 +07:00
Rifqi D. Panuluh
2016f4e780 Merge pull request #69 from nuluh/latex/68-feat-refactor-chapter-two
[FEAT] Refactor Chapter Two
2025-05-15 05:51:01 +07:00
nuluh
0cf2834095 refactor(latex): remove unused figure from literature review chapter 2025-05-15 02:04:17 +07:00
nuluh
d5f43ba48b refactor(latex): refactor literature review and theoretical foundations files structure with placeholder 2025-05-15 02:03:39 +07:00
nuluh
a872ae144c feat(latex): initialize new literature review files for comprehensive analysis 2025-05-15 01:59:00 +07:00
nuluh
452afd6580 Merge branch 'main' of https://github.com/nuluh/thesis 2025-05-14 18:53:58 +07:00
Rifqi D. Panuluh
3d2432f26e Merge pull request #66 from nuluh/latex/initial-template
Add Initial LaTeX Template
2025-05-14 18:41:52 +07:00
nuluh
1533a6ce46 fix(latex): add TOC entries for approval and originality sections 2025-05-14 17:59:36 +07:00
nuluh
471eccb12c fix(latex): remove new macro \frontmattersection to manually add \addcontentsline into each frontmatter to make hyperlink ToC jumpt into correct page.
Closes #65
2025-05-14 17:58:06 +07:00
nuluh
74ea4d412c fix(latex): update TOC title to use the correct language dynamically 2025-05-14 17:37:17 +07:00
nuluh
9d526971d9 feat(latex): add polyglossia package and set main language to Bahasa Indonesia 2025-05-14 17:34:56 +07:00
nuluh
49adb273d8 fix(latex): fix equation numbering to include chapter prefix in arabic
Closes #62
2025-05-14 12:21:21 +07:00
nuluh
ee004e55f4 fix(latex): add figure and table numbering prefixes to TOC 2025-05-13 02:02:41 +07:00
nuluh
f97c58e114 feat(latex): add styling for List of Figures and List of Tables titles 2025-05-13 01:42:16 +07:00
nuluh
190cd0904e fix(latex): fix merge conflicts 2025-05-12 00:45:30 +07:00
nuluh
6105da57f0 Merge branch 'latex/57-feat-add-dynamic-page-style-for-chapter-page' into latex/initial-template 2025-05-12 00:36:34 +07:00
nuluh
63da3b6308 fix(latex): remove titlepage environment from frontmattersection macro to make the \frontmatter and \mainmatter pagination number type change properly
Closes #57
2025-05-12 00:31:24 +07:00
nuluh
5634776d26 fix(latex): fix wrong endorsement content by moving it into approval sheet 2025-05-12 00:08:40 +07:00
nuluh
e65026f9ca feat(latex): add originality statement content 2025-05-12 00:06:24 +07:00
nuluh
eb1d2a87b4 refactor(latex): move figure numbering declaration 2025-05-11 23:05:13 +07:00
nuluh
1f275fad42 feat(latex): add figure and table numbering to include chapter numbern arabic despite the chapter number using roman and dummy figures to test 2025-05-11 22:57:26 +07:00
nuluh
07ed6a9a13 fix(latex): reorder document structure by moving \frontmatter and \mainmatter for proper page numbering 2025-05-11 22:54:02 +07:00
nuluh
1b20376700 Merge branch 'latex/initial-template' into latex/57-feat-add-dynamic-page-style-for-chapter-page 2025-05-11 22:15:40 +07:00
nuluh
104b72e624 fix(latex): remove second \hfill in the \cftaftertoctitle to fix the \contentsname with book document class 2025-05-11 22:15:05 +07:00
nuluh
e9568583e4 fix(latex): change document class from report to book for having access to \frontmatter, \mainmatter, and \backmatter 2025-05-11 22:13:46 +07:00
nuluh
ae201d61fa Merge branch 'latex/initial-template' into latex/57-feat-add-dynamic-page-style-for-chapter-page 2025-05-11 21:56:14 +07:00
nuluh
921dc9245c fix(latex): add draft watermark functionality with conditional loading 2025-05-11 19:32:13 +07:00
nuluh
bf3c43639d fix(latex): update page layout margins to 3cm for all sides 2025-05-11 18:26:46 +07:00
nuluh
f38d44df1d fix(latex): add dummy introductory chapter and sections for doing unittest of new implemented page number and chapter numbering 2025-05-11 13:00:53 +07:00
nuluh
5c70d7db51 fix(latex): ensure fancyplain page style preset is applied before content inclusion so it use top right number for non-first-page chapter 2025-05-11 12:54:55 +07:00
nuluh
702760cc5e fix(latex): assign fancyhdr preset page style to frontmatter section macro 2025-05-11 12:52:52 +07:00
nuluh
43a0f40182 fix(latex): creating header and footer styles preset 2025-05-11 12:51:23 +07:00
nuluh
c8509aa728 fix(notebooks): fix out of index stft plotting iteration 2025-04-22 10:55:34 +07:00
nuluh
4ebfb52635 Merge branch '40-feat-add-export-to-csv-method-for-dataprocessor-in-convertpy' 2025-04-21 00:16:39 +07:00
nuluh
1511012e11 refactor(test): update test script to generate damage files index for dataset_B and adjust export path for processed data 2025-04-20 16:02:16 +07:00
nuluh
db2947abdf fix(data): fix the incorrect output of scipy.stft() data to be pandas.DataFrame shaped (513,513) along with its frequencies as the index and times as the columns (transposed) instead of just the magnitude that being flattened out; add checks for empty data and correct file paths for sensor data loading.
Closes #43
2025-04-20 14:45:38 +07:00
nuluh
36b36c41ba feat(data): add export_to_csv method for saving processed data into individuals sensor end and update test script
Closes #40
2025-04-17 10:10:19 +07:00
24 changed files with 638 additions and 148 deletions

View File

@@ -121,8 +121,9 @@
"signal_sensor2_test1 = []\n",
"\n",
"for data in df:\n",
" signal_sensor1_test1.append(data['sensor 1'].values)\n",
" signal_sensor2_test1.append(data['sensor 2'].values)\n",
" if not data.empty and 'sensor 1' in data.columns and 'sensor 2' in data.columns:\n",
" signal_sensor1_test1.append(data['sensor 1'].values)\n",
" signal_sensor2_test1.append(data['sensor 2'].values)\n",
"\n",
"print(len(signal_sensor1_test1))\n",
"print(len(signal_sensor2_test1))"
@@ -156,8 +157,6 @@
"from scipy.signal import stft, hann\n",
"from multiprocessing import Pool\n",
"\n",
"\n",
"\n",
"# Function to compute and append STFT data\n",
"def process_stft(args):\n",
" # Define STFT parameters\n",
@@ -199,23 +198,22 @@
" # Compute STFT\n",
" frequencies, times, Zxx = stft(sensor_data, fs=Fs, window=window, nperseg=window_size, noverlap=window_size - hop_size)\n",
" magnitude = np.abs(Zxx)\n",
" flattened_stft = magnitude.flatten()\n",
" df_stft = pd.DataFrame(magnitude, index=frequencies, columns=times).T\n",
" df_stft.columns = [f\"Freq_{i}\" for i in frequencies]\n",
" \n",
" # Define the output CSV file path\n",
" stft_file_name = f'stft_data{sensor_num}_{damage_num}.csv'\n",
" sensor_output_dir = os.path.join(damage_base_path, sensor_name.lower())\n",
" os.makedirs(sensor_output_dir, exist_ok=True)\n",
" stft_file_path = os.path.join(sensor_output_dir, stft_file_name)\n",
" print(stft_file_path)\n",
" # Append the flattened STFT to the CSV\n",
" try:\n",
" flattened_stft_df = pd.DataFrame([flattened_stft])\n",
" if not os.path.isfile(stft_file_path):\n",
" # Create a new CSV\n",
" flattened_stft_df.to_csv(stft_file_path, index=False, header=False)\n",
" df_stft.to_csv(stft_file_path, index=False, header=False)\n",
" else:\n",
" # Append to existing CSV\n",
" flattened_stft_df.to_csv(stft_file_path, mode='a', index=False, header=False)\n",
" df_stft.to_csv(stft_file_path, mode='a', index=False, header=False)\n",
" print(f\"Appended STFT data to {stft_file_path}\")\n",
" except Exception as e:\n",
" print(f\"Error writing to {stft_file_path}: {e}\")"
@@ -295,7 +293,7 @@
"\n",
"# get current y ticks in list\n",
"print(len(frequencies))\n",
"print(len(times))\n"
"print(len(times))"
]
},
{
@@ -326,7 +324,6 @@
"ready_data1 = []\n",
"for file in os.listdir('D:/thesis/data/converted/raw/sensor1'):\n",
" ready_data1.append(pd.read_csv(os.path.join('D:/thesis/data/converted/raw/sensor1', file)))\n",
"ready_data1[0]\n",
"# colormesh give title x is frequency and y is time and rotate/transpose the data\n",
"# Plotting the STFT Data"
]
@@ -337,8 +334,8 @@
"metadata": {},
"outputs": [],
"source": [
"ready_data1[1]\n",
"plt.pcolormesh(ready_data1[1])"
"ready_data1[0]\n",
"plt.pcolormesh(ready_data1[0])"
]
},
{
@@ -363,8 +360,7 @@
"source": [
"ready_data2 = []\n",
"for file in os.listdir('D:/thesis/data/converted/raw/sensor2'):\n",
" ready_data2.append(pd.read_csv(os.path.join('D:/thesis/data/converted/raw/sensor2', file)))\n",
"ready_data2[5]"
" ready_data2.append(pd.read_csv(os.path.join('D:/thesis/data/converted/raw/sensor2', file)))"
]
},
{
@@ -384,10 +380,25 @@
"outputs": [],
"source": [
"x1 = 0\n",
"\n",
"print(type(ready_data1[0]))\n",
"ready_data1[0].iloc[:,0]\n",
"# x1 = x1 + ready_data1[0].shape[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x1 = 0\n",
"print(type(x1))\n",
"for i in range(len(ready_data1)):\n",
" print(ready_data1[i].shape)\n",
" # print(ready_data1[i].shape)\n",
" # print(ready_data1[i].)\n",
" print(type(ready_data1[i].shape[0]))\n",
" x1 = x1 + ready_data1[i].shape[0]\n",
" print(type(x1))\n",
"\n",
"print(x1)"
]
@@ -407,13 +418,6 @@
"print(x2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Appending"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -455,10 +459,15 @@
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"### Labeling"
"y_1 = [1,1,1,1]\n",
"y_2 = [0,1,1,1]\n",
"y_3 = [1,0,1,1]\n",
"y_4 = [1,1,0,0]"
]
},
{
@@ -494,16 +503,6 @@
" print(ready_data1[i].shape[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for i in range(len(y_data)):\n",
" print(ready_data2[i].shape[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -521,8 +520,7 @@
"metadata": {},
"outputs": [],
"source": [
"# len(y_data[0])\n",
"y_data[0]"
"y_data"
]
},
{
@@ -806,6 +804,7 @@
"\n",
" # df1['s1'] = sensor1[sensor1.columns[-1]]\n",
" # df1['s2'] = sensor2[sensor2.columns[-1]]\n",
"ed\n",
" # # Combined Plot for sensor 1 and sensor 2 from data1 file in which motor is operated at 800 rpm\n",
"\n",
" # plt.plot(df1['s2'], label='sensor 2')\n",
@@ -835,19 +834,14 @@
" # plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test with Outside of Its Training Data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"spectograph('D:/thesis/data/converted/raw')"
]
}
],
"metadata": {

View File

@@ -2,6 +2,7 @@ import pandas as pd
import os
import re
import sys
import numpy as np
from colorama import Fore, Style, init
from typing import TypedDict, Dict, List
from joblib import load
@@ -225,25 +226,56 @@ class DataProcessor:
"""
idx = self._create_vector_column_index()
# if overwrite:
for i in range(len(self.data)):
for j in range(len(self.data[i])):
for i in range(len(self.data)): # damage(s)
for j in range(len(self.data[i])): # col(s)
# Get the appropriate indices for slicing from idx
indices = idx[j]
# Get the current DataFrame
df = self.data[i][j]
# Keep the 'Time' column and select only specified 'Real' columns
# First, we add 1 to all indices to account for 'Time' being at position 0
# Keep the 'Time' column and select only specifid 'Real' colmns
# First, we add 1 to all indices to acount for 'Time' being at positiion 0
real_indices = [index + 1 for index in indices]
# Create list with Time column index (0) and the adjusted Real indices
# Create list with Time column index (0) and the adjustedd Real indices
all_indices = [0] + [real_indices[0]] + [real_indices[-1]]
# Apply the slicing
self.data[i][j] = df.iloc[:, all_indices]
# TODO: if !overwrite:
def export_to_csv(self, output_dir: str, file_prefix: str = "DAMAGE"):
"""
Export the processed data to CSV files in the required folder structure.
:param output_dir: Directory to save the CSV files.
:param file_prefix: Prefix for the output filenames.
"""
for group_idx, group in enumerate(self.data, start=1):
group_folder = os.path.join(output_dir, f"{file_prefix}_{group_idx}")
os.makedirs(group_folder, exist_ok=True)
for test_idx, df in enumerate(group, start=1):
# Ensure columns are named uniquely if duplicated
df = df.copy()
df.columns = ["Time", "Real_0", "Real_1"] # Rename
# Export first Real column
out1 = os.path.join(
group_folder, f"{file_prefix}_{group_idx}_TEST{test_idx}_01.csv"
)
df[["Time", "Real_0"]].rename(columns={"Real_0": "Real"}).to_csv(
out1, index=False
)
# Export last Real column
out2 = os.path.join(
group_folder, f"{file_prefix}_{group_idx}_TEST{test_idx}_02.csv"
)
df[["Time", "Real_1"]].rename(columns={"Real_1": "Real"}).to_csv(
out2, index=False
)
def create_damage_files(base_path, output_base, prefix):
# Initialize colorama

View File

@@ -4,5 +4,22 @@ from joblib import dump, load
# a = generate_damage_files_index(
# num_damage=6, file_index_start=1, col=5, base_path="D:/thesis/data/dataset_A"
# )
# dump(DataProcessor(file_index=a), "D:/cache.joblib")
a = load("D:/cache.joblib")
b = generate_damage_files_index(
num_damage=6,
file_index_start=1,
col=5,
base_path="D:/thesis/data/dataset_B",
prefix="zzzBD",
)
# data_A = DataProcessor(file_index=a)
# # data.create_vector_column(overwrite=True)
# data_A.create_limited_sensor_vector_column(overwrite=True)
# data_A.export_to_csv("D:/thesis/data/converted/raw")
data_B = DataProcessor(file_index=b)
# data.create_vector_column(overwrite=True)
data_B.create_limited_sensor_vector_column(overwrite=True)
data_B.export_to_csv("D:/thesis/data/converted/raw_B")
# a = load("D:/cache.joblib")
# breakpoint()

View File

@@ -0,0 +1,25 @@
\chapter{PENDAHULUAN}
\section{Latar Belakang}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc consequat lectus dolor, a commodo odio suscipit nec. Aliquam posuere elit eget tellus dapibus, auctor ornare mi porttitor. Donec auctor aliquet nisl, quis convallis ligula rutrum id. Duis tortor ipsum, scelerisque vestibulum viverra eu, maximus vel mi. Nullam volutpat nunc et varius tempor. Vivamus convallis mi eros, aliquam semper dui tincidunt a. Morbi nunc dui, accumsan ac arcu nec, condimentum efficitur mauris. Etiam sed mauris semper, volutpat justo eu, placerat mauris. Suspendisse at erat eu arcu gravida mattis et id nunc. Aliquam malesuada magna odio, ac dictum erat vestibulum a. Mauris vel nisi sit amet elit tempor bibendum sit amet a velit. Morbi dignissim facilisis placerat.\par
\begin{figure}
\centering
\includegraphics[width=0.5\linewidth]{frontmatter/img/slice1.jpg}
\caption{Enter Caption}
\label{fig:enter-label}
\end{figure}
Pellentesque vel accumsan lorem, id vulputate metus. Nulla mollis orci ante, et euismod erat venenatis eget. Proin tempus lobortis feugiat. Fusce vitae sem quis lacus iaculis dignissim ut eget turpis. Vivamus ut nisl in enim porttitor fringilla vel et mauris. Mauris quis porttitor magna. Pellentesque molestie viverra arcu at tincidunt. Maecenas non elit arcu.\par
Etiam feugiat enim sit amet tortor interdum lobortis. Curabitur elementum faucibus sapien. Morbi eget facilisis lorem. In sed suscipit metus. Etiam porttitor, libero sit amet sodales hendrerit, libero dolor hendrerit nulla, sed convallis risus leo posuere metus. Cras gravida ac elit viverra ultrices. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Maecenas dictum urna elit, nec eleifend nulla mattis sit amet. Pellentesque suscipit metus vitae leo suscipit, a vehicula quam pretium. Sed eu est ut risus convallis hendrerit a vulputate justo. Nulla sollicitudin quam ut risus euismod, quis consequat dui mattis. Mauris id eros varius, pellentesque quam quis, venenatis tellus. Nulla vitae condimentum nisl. Vestibulum suscipit scelerisque dui, non posuere purus finibus nec. Nulla ultrices felis quis vestibulum porta. Suspendisse potenti.\par
Nam tempus tincidunt interdum. Pellentesque at ligula ac massa semper efficitur vitae non ante. Suspendisse potenti. Cras vitae interdum erat, nec facilisis urna. Nulla commodo porttitor tellus non posuere. Vestibulum tristique ut urna quis porttitor. Sed pellentesque lectus sit amet ultrices aliquam. Aliquam erat volutpat. Nam dictum eu erat a mollis. Donec eget nulla vel risus aliquet suscipit sed at libero.\par
Maecenas hendrerit pharetra bibendum. Donec ut tortor ac augue aliquam ullamcorper nec id eros. Quisque consectetur elementum ipsum vitae posuere. Sed ultricies ipsum nibh, vitae volutpat neque bibendum at. Morbi dictum metus eu bibendum malesuada. Nam scelerisque purus erat, id dictum nisl pretium vitae. Curabitur finibus commodo dui ac molestie. In sed sem ac dui dapibus ullamcorper. Aenean molestie nulla eu lorem maximus hendrerit. Vivamus viverra velit dolor, in vehicula eros facilisis at. Vivamus in rhoncus sem.
\section{Lingkup Penelitian}
\section{Tujuan Penelitian}
\section{Manfaat Penelitian}
% \subsubsection{Dolor}

View File

@@ -0,0 +1,7 @@
\chapter{TINJAUAN PUSTAKA DAN LANDASAN TEORI}
\section{Tinjauan Pustaka}
\input{chapters/id/02_literature_review/abdeljaber2017.tex}
\section{Dasar Teori}
\input{chapters/id/theoritical_foundation/stft.tex}
\input{chapters/id/theoritical_foundation/machine_learning.tex}

View File

@@ -0,0 +1 @@
\subsection{Machine Learning}

View File

@@ -0,0 +1 @@
\subsection{Short-Time Fourier Transform}

View File

@@ -0,0 +1,151 @@
\section{Analisis Data}
\subsection{Grid, Kode \textit{Joint}, dan Nama File}
% \begin{figure}[ht]
% \centering
% \input{chapters/img/specimen}
% \caption{Caption}
% \label{fig:enter-label}
% \end{figure}
% Dimulai dengan memberi indeks pada setiap node pengukuran dari struktur grid berukuran 6$\times$5 menggunakan sebuah bilangan bulat tunggal \(k\) dari nol hingga dua puluh sembilan. Setiap sinyal domain waktu mentah disimpan dalam file yang dinamai berdasarkan indeks ini:
% \begin{equation*}
% F_{k} = \texttt{``zzzAD}k\texttt{.TXT,''}
% \quad k = 0,1,\dots,29.
% \end{equation*}
Direpresentasikan \(F_{k}\) di sini sebagai nama file untuk \textit{node} ke-\(k\). Kemudian dilampirkan nama file tersebut sebagai superskrip pada simbol \textit{node}:
\begin{equation*}
n_{k}^{F_{k}}
\quad\text{adalah \textit{node} dengan indeks }k\text{ yang datanya diambil dari \textit{file} }F_{k}.
\end{equation*}
\subsection{Pemetaan Sensor}
Semua tiga puluh node dikelompokkan ke dalam enam folder ``damage-case``, dilabeli \(d_{i}\) untuk \(i=0,\dots,5\). Setiap folder berisi tepat lima node berurutan, yang merepresentasikan satu skenario kerusakan:
\begin{equation*}
d_{i} = \bigl\{\,n_{5i}^{F_{5i}},\;n_{5i+1}^{F_{5i+1}},\;\dots,\;n_{5i+4}^{F_{5i+4}}\bigr\},
\quad i = 0,\dots,5.
\end{equation*}
Atau secara konkrit,
\begin{align*}
d_0&=\{n_{0}^{F_0},\;n_{1}^{F_1},\;n_{2}^{F_2},\;n_{3}^{F_3},\;n_{4}^{F_4}\}\\
d_1&=\{n_{5}^{F_5},\;n_{6}^{F_6},\;n_{7}^{F_7},\;n_{8}^{F_8},\;n_{9}^{F_9}\}\\
\;\;\vdots\\
d_5&=\{n_{25}^{F_{25}},\;n_{26}^{F_{26}},\;n_{27}^{F_{27}},\;n_{28}^{F_{28}},\;n_{29}^{F_{29}}\}\\
\end{align*}
\subsection{Seleksi Sensor \textit{Node} Ujung-Ujung (Domain Waktu)}
Dari setiap folder kerusakan, kita hanya menyimpan \textit{node} pertama dan terakhir untuk mensimulasikan tata letak sensor terbatas. Subset domain waktu ini dilambangkan dengan \(d_{i}^{\mathrm{TD}}\):
\begin{equation*}
d_{i}^{\mathrm{TD}}
= \bigl\{\,n_{5i}^{F_{5i}},\;n_{5i+4}^{F_{5i+4}}\bigr\},
\quad |d_{i}^{\mathrm{TD}}| = 2.
\end{equation*}
\subsection{Ekstraksi Fitur}
Kemudian, didefinisikan operator STFT \(\mathcal{T}\) untuk memetakan sinyal domain waktu mentah dengan panjang \(L=262144\) sampel menjadi sebuah spektrogram berukuran \(513\times513\). Kemudian digunakan \textit{Hanning window} dengan panjang \(N_{w}=1024\) dan hop size \(N_{h}=512\). Bentuk kompleks dari STFT adalah:
\begin{equation*}
\begin{aligned}
\text{(1) Window function:}\quad
w[n] &= \frac12\Bigl(1 - \cos\frac{2\pi n}{N_w - 1}\Bigr),
\quad n=0,\ldots,N_w-1; \\[1ex]
\text{(2) STFT:}\quad
S_k(p,t)
&= \sum_{n=0}^{N_w-1}
x_k\bigl[t\,N_h + n\bigr]
\;w[n]\;
e^{-j2\pi p n / N_w},\\
&\quad
p = 0,\ldots,512,\quad t = 0,\ldots,512.
\end{aligned}
\end{equation*}
Pengambilan magnitudo menghasilkan matriks spektrogram pada bilah frekuensi $p$ dan \textit{frame} waktu $t$ untuk \textit{node} $k$
\begin{equation*}
\widetilde n_{k}^{F_{k}}(p,t) \;=\; \bigl|S_{k}(p,t)\bigr|
\;\in\;\mathbb{R}^{513\times513}.
\end{equation*}
Dengan demikian operatornya adalah
\begin{equation*}
\mathcal{T}:\; n_{k}^{F_{k}}\in\mathbb{R}^{262144}
\;\longmapsto\;
\widetilde n_{k}^{F_{k}}\in\mathbb{R}^{513\times513}.
\end{equation*}
\subsection{Subset Domain Frekuensi}
Kemudian, \(\mathcal{T}\) diterapkan pada \textit{node} ujung-ujung yang telah dipilih, dihasilkan:
\begin{equation*}
d_{i}^{\mathrm{FD}}
= \bigl\{\,
\widetilde n_{5i}^{F_{5i}},\;
\widetilde n_{5i+4}^{F_{5i+4}}
\,\bigr\},
\quad
|d_{i}^{\mathrm{FD}}| = 2.
\end{equation*}
\subsection{Pengelompokan Berdasarkan Letak Ujung Sensor}
Sensor-sensor ujung bagian bawah dilabeli sebagai Sensor A dan Sensor-sensor ujung bagian atas dilabeli sebagai Sensor B. Semua enam kasus kerusakan dikumpulkan menjadi satu menghasilkan dua himpunan spektrogram, masing-masing berisi enam (kasus kerusakan):
\begin{equation*}
\text{Sensor A}
=
\bigl\{\,
\widetilde n_{0}^{F_{0}},\,
\widetilde n_{5}^{F_{5}},\,
\dots,\,
\widetilde n_{25}^{F_{25}}
\bigr\},
\quad
\text{Sensor B}
=
\bigl\{\,
\widetilde n_{4}^{F_{4}},\,
\widetilde n_{9}^{F_{9}},\,
\dots,\,
\widetilde n_{29}^{F_{29}}
\bigr\}.
\end{equation*}
\subsection{Perakitan Baris dan Pelabelan}
Setiap spektrogram berukuran \(513\times513\) diartikan sebagai 513 vektor fitur berdimensi 513. Kemudian diberikan indeks pengulangan dalam satu kasus kerusakan dengan \(r\in\{0,\dots,4\}\) dan potongan waktu dengan \(t\in\{0,\dots,512\}\). Misalkan
\begin{equation*}
\mathbf{x}_{i,s,r,t}\in\mathbb{R}^{513}
\end{equation*}
menunjukkan baris (atau kolom) ke-\(t\) dari spektrogram ke-\(r\) untuk kasus kerusakan \(i\) dan sensor \(s\). Label skalar untuk kasus kerusakan tersebut adalah
\begin{equation*}
y_{i} = i,\quad i=0,\dots,5.
\end{equation*}
Kemudian didefinisikan fungsi \textit{slicing} sebagai
\begin{equation*}
\Lambda(i,s,r,t)
\;=\;
\bigl[\,
\mathbf{x}_{i,s,r,t},
\;y_{i}
\bigr]
\;\in\;\mathbb{R}^{513+1}.
\end{equation*}
\subsection{Bentuk Akhir Data untuk Pelatihan}
Seluruh baris dari enam kasus kerusakan, lima pengulangan, dan 513 potongan waktu dikumpulkan menghasilkan \textit{dataset} untuk satu sisi sensor:
\begin{equation*}
\mathcal{D}^{(s)}
=
\bigl\{
\Lambda(i,s,r,t)
\;\big|\;
i=0,\dots,5,\;
r=0,\dots,4,\;
t=0,\dots,512
\bigr\}.
\end{equation*}
Karena terdapat total \(6\times5\times513=15{,}390\) baris dan setiap baris memiliki \(513\) fitur ditambah satu kolom label, maka bentuk akhir dari data untuk satu sisi sensor yang siap digunakan untuk pelatihan adalah
\begin{equation*}
|\mathcal{D}^{(s)}| = 15\,390 \times 514.
\end{equation*}

View File

@@ -0,0 +1,7 @@
\chapter{METODE PENELITIAN}
\input{chapters/id/03_methodology/material/index}
\input{chapters/id/03_methodology/tool/index}
\clearpage
\input{chapters/id/03_methodology/steps/index}
\input{chapters/id/03_methodology/data_analysis/index}

View File

@@ -0,0 +1,26 @@
\section{Benda Uji}
Penelitian ini menggunakan data sekunder dari \textcite{abdeljaber2017}, yang tersedia secara publik dan diperoleh melalui eksperimen menggunakan \textit{Queen's University Grandstand Simulator}. Adapun rincian data yang digunakan adalah sebagai berikut:
\begin{itemize}
\item Dataset terdiri atas rekaman respons getaran dari struktur rangka baja berukuran $6 \times 5$ yang dilengkapi dengan 30 akselerometer.
\item Setiap skenario dalam dataset mencakup satu kasus struktur tanpa kerusakan (healthy) dan 30 kasus kerusakan tunggal pada masing-masing sambungan (\textit{single-joint damage}).
\item Sinyal getaran direkam dengan frekuensi pengambilan sampel sebesar 1024 Hz selama durasi 256 detik untuk tiap skenario.
\item Kerusakan struktur disimulasikan dengan cara mengendurkan baut pada sambungan-sambungan tertentu.
\end{itemize}
Struktur dataset yang digunakan ditampilkan pada Gambar~\ref{fig:specimen-photo}.
% \begin{figure}[!ht]
% \centering
% \includegraphics[width=0.5\textwidth]{chapters/img/original_data.png}
% \caption{Overview of the original data used from Abdeljaber et al. (2017)}
% \label{fig:original-data}
% \end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=0.75\linewidth]{chapters/img/specimen.png}
\caption{Bentuk benda uji}
\label{fig:specimen-photo}
\end{figure}

View File

@@ -0,0 +1,33 @@
Dataset yang digunakan dalam penelitian ini bersumber dari basis data getaran yang dipublikasi oleh \textcite{abdeljaber2017}.
Dataset terdiri dari dua folder:
\begin{itemize}
\item \texttt{Dataset A/} biasanya digunakan untuk pelatihan (training)
\item \texttt{Dataset B/} biasanya digunakan untuk pengujian (testing)
\end{itemize}
Setiap folder berisi 31 berkas dalam format \texttt{.TXT}, yang dinamai sesuai dengan kondisi kerusakan struktur. Pola penamaan berkas adalah sebagai berikut:
\begin{itemize}
\item \texttt{zzzAU.TXT}, \texttt{zzzBU.TXT} — struktur tanpa kerusakan (sehat)
\item \texttt{zzzAD1.TXT}, \texttt{zzzAD2.TXT}, ..., \texttt{zzzAD30.TXT} — Dataset A, kerusakan pada sambungan 130
\item \texttt{zzzBD1.TXT}, \texttt{zzzBD2.TXT}, ..., \texttt{zzzBD30.TXT} — Dataset B, kerusakan pada sambungan 130
\end{itemize}
Sepuluh baris pertama dari setiap berkas berisi metadata yang menjelaskan konfigurasi pengujian, laju sampling, dan informasi kanal. Oleh karena itu, data deret waktu percepatan dimulai dari baris ke-11 yang berisi 31 kolom:
\begin{itemize}
\item \textbf{Kolom 1:} Waktu dalam detik
\item \textbf{Kolom 231:} Magnitudo percepatan dari \textit{joint} 1 hingga 30
\end{itemize}
Setiap sinyal di-\textit{sampling} pada frekuensi $f_s = 1024$ Hz dan direkam selama durasi total $T = 256$ detik, sehingga menghasilkan:
\begin{equation*}
N = f_s \cdot T = 1024 \times 256 = 262{,}144 \quad \text{sampel per kanal}
\end{equation*}
Dengan demikian, setiap berkas dapat direpresentasikan sebagai matriks:
\begin{equation*}
\mathbf{X}^{(c)} \in \mathbb{R}^{262{,}144 \times 31}, \quad c = 0, 1, \dots, 30
\end{equation*}
di mana $c$ mengacu pada indeks kasus (0 = sehat, 130 = kerusakan pada \textit{joint}n ke-$c$), dan setiap baris merepresentasikan pengukuran berdasarkan waktu di seluruh 30 kanal sensor.

View File

@@ -0,0 +1,29 @@
\section{Tahapan Penelitian}
Alur keseluruhan penelitian ini dilakukan melalui tahapan-tahapan sebagai berikut:
\begin{figure}[H]
\centering
\includegraphics[width=0.3\linewidth]{chapters/id/flow.png}
\caption{Diagram alir tahapan penelitian}
\label{fig:flowchart}
\end{figure}
\begin{enumerate}
\item \textbf{Akuisisi Data:} Mengunduh dataset dari \textcite{abdeljaber2017} yang berisi sinyal percepatan untuk 31 kondisi struktur (1 kondisi sehat dan 30 kondisi kerusakan tunggal).
% \item \textbf{Seleksi Sensor:} Memilih sinyal dari sejumlah sensor terbatas pada garis vertikal tertentu (misalnya, node 1 dan 26) untuk mensimulasikan konfigurasi sensor yang direduksi.
\item \textbf{Pra-pemrosesan:} Melakukan normalisasi dan mengubah sinyal domain waktu mentah menjadi domain waktu-frekuensi menggunakan metode Short-Time Fourier Transform (STFT).
\item \textbf{Ekstraksi Fitur:} Menghasilkan \textit{data frame} frekuensi dalam domain waktu.
\item \textbf{Pengembangan Model:} Membangun dan melatih model klasifikasi berbasis algoritma pemelajaran mesin klasik (SVM, LDA, Bagged Trees, Random Forest, XGBoost) untuk mengklasifikasikan lokasi kerusakan struktur.
\item \textbf{Evaluasi:} Mengevaluasi kinerja model menggunakan metrik akurasi, presisi, dan confusion matrix pada berbagai skenario pengujian.
\end{enumerate}
\subsection{Akuisisi Data}
\input{chapters/id/03_methodology/steps/data_acquisition}
% \subsection{Prapemrosesan Data dan Ekstraksi Fitur}

View File

@@ -0,0 +1,39 @@
Data getaran struktur yang digunakan dalam penelitian ini diperoleh dari penelitian oleh \textcite{abdeljaber2017}, yang dilakukan menggunakan simulator struktur baja Grandstand di Queens University. Dalam eksperimen tersebut, struktur baja dipasang dengan akselerometer pada setiap sambungan-sambungan (\textit{joints}). Rangkaian perangkat keras yang digunakan untuk pengambilan data meliputi:
\begin{itemize}
\item \textbf{27 akselerometer PCB model 393B04} (Gambar~\ref{fig:pcb393}) untuk merekam respons percepatan pada sebagian besar titik pengukuran.
\item \textbf{3 akselerometer B\&K model 8344} (Gambar~\ref{fig:bk8344}) digunakan pada beberapa lokasi untuk validasi tambahan.
\item \textbf{Mounting magnetic PCB model 080A121} digunakan untuk menempelkan akselerometer secara aman pada struktur baja.
\item \textbf{Modal shaker (Model 2100E11)} digunakan untuk memberikan eksitasi getaran terkontrol pada struktur (Gambar~\ref{fig:shaker}). Sinyal input untuk shaker dihasilkan melalui \textbf{penguat daya SmartAmp 2100E21-400}.
\item \textbf{Dua perangkat akuisisi data 16-kanal (DT9857E-16)} digunakan secara simultan: satu untuk menghasilkan sinyal input ke shaker dan satu lagi untuk merekam data keluaran dari akselerometer (Gambar~\ref{fig:datalogger}).
\end{itemize}
Seluruh perangkat ini memungkinkan pengambilan data getaran dengan fidelitas tinggi, dengan laju pengambilan sampel sebesar 1024 Hz per kanal selama 256 detik untuk setiap skenario pengujian.
Adapun sumberdaya komputasi yang digunakan untuk pemrosesan semua data dan pemodelan pada skripsi ini, yaitu:
\begin{itemize}
\item \textbf{\textit{Processor}:} Intel Core i7 11th-gen @ 2.8 GHz
\item \textbf{RAM:} 2$\times$8 GB LPDDR4X
% \item \textbf{GPU:} Intel iris Xe Graphics (16 GB VRAM \textit{shared})
\item \textbf{Sistem Operasi:} Windows 10 64-bit
\end{itemize}
\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{chapters/img/accel393.png}
\caption{Akselerometer yang digunakan: (a) PCB 393B04, (b) B\&K 8344}
\label{fig:accel393}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{chapters/img/shaker.png}
\caption{Modal shaker (TMS 2100E11) yang dipasang pada struktur uji}
\label{fig:shaker}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.7\textwidth]{chapters/img/datalogger.png}
\caption{Perangkat akuisisi data (DT9857E-16) dan penguat daya SmartAmp 2100E21-400}
\label{fig:datalogger}
\end{figure}

View File

@@ -0,0 +1,7 @@
\section{Alat}
\subsection{Alat Perangkat Keras}
\input{chapters/id/03_methodology/tool/hardware}
\subsection{Alat Perangkat Lunak}
\input{chapters/id/03_methodology/tool/software}

View File

@@ -0,0 +1,11 @@
Berikut merupakan perangkat lunak yang digunakan selama proses penelitian ini:
\begin{itemize}
\item \textbf{Python 3.11} digunakan untuk proses pra-pemrosesan data, pemodelan, dan evaluasi.
\item \textbf{NumPy 1.22.4} digunakan untuk perhitungan deret numerik.
\item \textbf{Pandas 1.5.1} digunakan untuk memanipulasi struktur data.
\item \textbf{Pandas 1.7.3} digunakan untuk memproses sinyal.
\item \textbf{Matplotlib 3.7.1} digunakan untuk menghasilkan plot data.
\item \textbf{Scikit-Learn 1.5.1} digunakan untuk membangun dan melatih model dengan algoritma pemelajaran mesin klasik.
\item \textbf{Jupyter Notebook} digunakan untuk pelatihan model dan percobaan eksperimental secara interaktif.
\end{itemize}

BIN
latex/chapters/img/flow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 KiB

View File

@@ -0,0 +1,13 @@
\begin{matrix}
N_{6,5} & \text{---} & N_{6,4} & \text{---} & N_{6,3} & \text{---} & N_{6,2} & \text{---} & N_{6,1} \\
\vert & & \vert & & \vert & & \vert & & \vert \\
N_{5,5} & \text{---} & N_{5,4} & \text{---} & N_{5,3} & \text{---} & N_{5,2} & \text{---} & N_{5,1} \\
\vert & & \vert & & \vert & & \vert & & \vert \\
N_{4,5} & \text{---} & N_{4,4} & \text{---} & N_{4,3} & \text{---} & N_{4,2} & \text{---} & N_{4,1} \\
\vert & & \vert & & \vert & & \vert & & \vert \\
N_{3,5} & \text{---} & N_{3,4} & \text{---} & N_{3,3} & \text{---} & N_{3,2} & \text{---} & N_{3,1} \\
\vert & & \vert & & \vert & & \vert & & \vert \\
N_{2,5} & \text{---} & N_{2,4} & \text{---} & N_{2,3} & \text{---} & N_{2,2} & \text{---} & N_{2,1} \\
\vert & & \vert & & \vert & & \vert & & \vert \\
N_{1,5} & \text{---} & N_{1,4} & \text{---} & N_{1,3} & \text{---} & N_{1,2} & \text{---} & N_{1,1} \\
\end{matrix}

View File

@@ -0,0 +1,65 @@
% frontmatter/endorsement.tex
\setmainfont{Times New Roman}
\addcontentsline{toc}{chapter}{LEMBAR PERSETUJUAN TUGAS AKHIR}
\begin{center}
\textbf{\Large LEMBAR PERSETUJUAN TUGAS AKHIR} \\[0.5em]
\textit{APPROVAL SHEET}
\end{center}
\vspace{1em}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{llp{10cm}}
\textbf{Judul} & : & \thesistitle \\
\textit{Title} & & \\
\textbf{Mahasiswa} & : & \studentname \\
\textit{Student} & & \\
\textbf{Nomor Mahasiswa} & : &\studentid \\
\textit{Student ID.} & & \\
\textbf{Dosen Pembimbing} & : & 1. \firstadvisor \\
\textit{Advisors} & & 2. \secondadvisor
\end{tabular}
\vspace{1em}
\textbf{Telah disetujui oleh Tim Penguji:} \\
\textit{Approved by the Committee on Oral Examination}
\vspace{1em}
\begin{tabular}{lp{5cm}}
\textbf{\firstadvisor} &:
% \vspace{2cm} % signature space
% \\[1em] % pull up next row
\\
\textit{Ketua Tim Penguji} &
\noindent\makebox[5cm]{\hrulefill}\\[-0.5em]
\textit{\small Chair} & \small Yogyakarta, \dotfill 2020
\\
\textbf{\secondadvisor} &:
% \vspace{2cm} % signature space
% \\[1em] % pull up next row
\\
\textit{Ketua Tim Penguji} &
\noindent\makebox[5cm]{\hrulefill}\\[-0.5em]
\textit{\small Chair} & \small Yogyakarta, \dotfill 2020 \\
\end{tabular}
\vspace{1em}
\noindent
\textbf{Diterima dan disetujui sebagai persyaratan untuk memperoleh gelar Sarjana Teknik} \\
\textit{Accepted in partial fulfillment of the requirements for the degree of Bachelor of Engineering}
\vspace{2em}
\begin{center}
\textbf{Ketua Program Studi} \\
\textit{Head of Department}
\end{center}
\vspace{3em}
\begin{center}
\textbf{\headdepartement} \\
NIK. \headdepartementid
\end{center}

View File

@@ -1,64 +1,7 @@
% frontmatter/endorsement.tex
\setmainfont{Times New Roman}
\chapter*{LEMBAR PENGESAHAN TUGAS AKHIR}
\begin{center}
\textbf{\Large LEMBAR PENGESAHAN TUGAS AKHIR} \\[0.5em]
\textit{APPROVAL SHEET}
\end{center}
\vspace{1em}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{llp{10cm}}
\textbf{Judul} & : & \thesistitle \\
\textit{Title} & & \\
\textbf{Mahasiswa} & : & \studentname \\
\textit{Student} & & \\
\textbf{Nomor Mahasiswa} & : &\studentid \\
\textit{Student ID.} & & \\
\textbf{Dosen Pembimbing} & : & 1. \firstadvisor \\
\textit{Advisors} & & 2. \secondadvisor
\end{tabular}
\vspace{1em}
\textbf{Telah disetujui oleh Tim Penguji:} \\
\textit{Approved by the Committee on Oral Examination}
\vspace{1em}
\begin{tabular}{lp{5cm}}
\textbf{\firstadvisor} &:
% \vspace{2cm} % signature space
% \\[1em] % pull up next row
\\
\textit{Ketua Tim Penguji} &
\noindent\makebox[5cm]{\hrulefill}\\[-0.5em]
\textit{\small Chair} & \small Yogyakarta, \dotfill 2020
\\
\textbf{\secondadvisor} &:
% \vspace{2cm} % signature space
% \\[1em] % pull up next row
\\
\textit{Ketua Tim Penguji} &
\noindent\makebox[5cm]{\hrulefill}\\[-0.5em]
\textit{\small Chair} & \small Yogyakarta, \dotfill 2020 \\
\end{tabular}
\vspace{1em}
\noindent
\textbf{Diterima dan disetujui sebagai persyaratan untuk memperoleh gelar Sarjana Teknik} \\
\textit{Accepted in partial fulfillment of the requirements for the degree of Bachelor of Engineering}
\vspace{2em}
\begin{center}
\textbf{Ketua Program Studi} \\
\textit{Head of Department}
\end{center}
\vspace{3em}
\begin{center}
\textbf{\headdepartement} \\
NIK. \headdepartementid
{\normalsize\textit{ENDORSEMENT SHEET}}
\end{center}

View File

@@ -0,0 +1,40 @@
% frontmatter/originality.tex
\setmainfont{Times New Roman}
\chapter*{PERNYATAAN KEASLIAN}
\addcontentsline{toc}{chapter}{PERNYATAAN KEASLIAN}
% \begin{center}
% {\normalsize\textit{ORIGINALITY STATEMENT}}
% \end{center}
Saya yang bertanda tangan di bawah ini:
\renewcommand{\arraystretch}{1.2}
\begin{center}
\begin{tabular}{llp{10cm}}
\textbf{Nama} & : & \studentname \\
\textbf{Nomor Mahasiswa} & : & \studentid \\
\textbf{Judul} & : & \thesistitle \\
\end{tabular}
\end{center}
Menyatakan dengan sebenarnya bahwa tugas akhir ini merupakan karya says sendiri. Apabila terdapat karya orang lain yang saya kutip, maka saya akan mencantumkan sumber secara jelas. Jika dikemudian hari ditemukan dengan ketidakbenaran dalam pernyataan in, maka saya bersedia menerima sanksi dengan aturan yang berlaku. Demikian pernyataan ini saya buat tanpa ada paksaan dari pihak mana pun.\par
\begin{flushright}
\begin{minipage}{0.5\textwidth}
\centering
Yogyakarta, \today \\[1em]
Yang membuat pernyataan, \\[0.5cm] % space for signature
% Materai box
\hspace*{-2cm}% shift the box slightly left
\begin{tabular}{@{}c@{}}
\fbox{
\begin{minipage}[c][2cm][c]{2.5cm}
\centering
Materai\\
6000
\end{minipage}
}
\end{tabular}
\\[1cm]
% \rule{6cm}{0.4pt} % signature line
Rifqi Damar Panuluh
\end{minipage}
\end{flushright}

View File

@@ -1,4 +1,4 @@
\documentclass{thesis}
\documentclass[draftmark]{thesis}
% Title Information
\setthesisinfo
@@ -18,11 +18,14 @@
\begin{document}
\maketitle
\theendorsementpage{toc}
\originalitystatement{toc}
\frontmatter
\input{frontmatter/approval}\clearpage
\input{frontmatter/originality}\clearpage
\input{frontmatter/acknowledgement}\clearpage
\tableofcontents
\clearpage
\mainmatter
\pagestyle{fancyplain}
% Include content
\include{content/abstract}
\include{content/introduction}

View File

@@ -1,9 +1,15 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{thesis}[2025/05/10 Bachelor Thesis Class]
\LoadClass[a4paper,12pt]{report}
\newif\if@draftmark
\@draftmarkfalse
\DeclareOption{draftmark}{\@draftmarktrue}
\ProcessOptions \relax
\LoadClass[a4paper,12pt,oneside]{book}
% Load common packages
\RequirePackage{polyglossia}
\RequirePackage{fontspec}
\RequirePackage{titlesec}
\RequirePackage{fancyhdr}
@@ -14,9 +20,24 @@
\RequirePackage{etoolbox}
\RequirePackage{tocloft}
\RequirePackage{tocbibind}
\RequirePackage{amsmath,amsfonts,amssymb}
% Polyglossia set language
\setmainlanguage{bahasai}
% \setotherlanguage{english}
% Conditionally load the watermark package and settings
\if@draftmark
\RequirePackage{draftwatermark}
\SetWatermarkText{Draft: \today [wip]}
\SetWatermarkColor[gray]{0.7}
\SetWatermarkFontSize{2cm}
\SetWatermarkAngle{90}
\SetWatermarkHorCenter{1.5cm}
\fi
% Page layout
\geometry{margin=1in}
\geometry{left=3cm, top=3cm, right=3cm, bottom=3cm}
\setlength{\parskip}{0.5em}
\setlength{\parindent}{0pt}
\onehalfspacing
@@ -28,7 +49,7 @@
\setmonofont{Courier New}
% Metadata commands
\input{metadata} % Load metadata from external file
\input{metadata}
\newcommand{\setthesisinfo}[7]{%
\renewcommand{\thesistitle}{#1}%
@@ -40,19 +61,35 @@
\renewcommand{\yearofsubmission}{#7}%
}
% Header and footer
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{\nouppercase{\rightmark}}
\fancyhead[L]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}
% % Header and footer
\fancypagestyle{fancy}{%
\fancyhf{}
\fancyhead[R]{\nouppercase{\rightmark}}
\fancyhead[L]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}
}
\fancypagestyle{fancyplainfrontmatter}{%
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\thepage}
}
\fancypagestyle{fancyplain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[R]{\thepage}
}
% Chapter formatting
\titlespacing{\chapter}{0pt}{0pt}{*1.5}
\titleformat{\chapter}[display]
{\bfseries\Large\centering}
{\normalsize\bfseries\centering}
{BAB~\Roman{chapter}} % << display format
{1ex}
{\MakeUppercase}
\titleformat{\section}
{\normalsize\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalsize\bfseries}{\thesubsection}{1em}{}
% Ensure chapter reference in TOC matches
\renewcommand{\cftchappresnum}{BAB~}
@@ -64,7 +101,7 @@
\renewcommand{\maketitle}{\input{frontmatter/maketitle}}
% Chapter & Section format
\renewcommand{\cftchapfont}{\bfseries\MakeUppercase}
\renewcommand{\cftchapfont}{\normalsize\MakeUppercase}
% \renewcommand{\cftsecfont}{}
% \renewcommand{\cftsubsecfont}{\itshape}
% \renewcommand{\thesection}{\textup{\Roman{chapter}}.\arabic{section}}
@@ -74,38 +111,47 @@
\setlength{\cftbeforechapskip}{0em}
\setlength{\cftchapindent}{0pt}
\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecindent}{3em}
\setlength{\cftchapnumwidth}{4em}
\setlength{\cftsecnumwidth}{2.5em}
\setlength{\cftsubsecindent}{2.5em}
\setlength{\cftchapnumwidth}{3.5em}
\setlength{\cftsecnumwidth}{3.5em}
\setlength{\cftsubsecnumwidth}{2.5em}
\setlength{\cftfignumwidth}{5em}
\setlength{\cfttabnumwidth}{4em}
\renewcommand \cftchapdotsep{4.5} % https://tex.stackexchange.com/a/273764
\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftsecdotsep}}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftfigpresnum}{\figurename~}
\renewcommand{\cfttabpresnum}{\tablename~}
% Ensure TOC and References Respect Custom Numbering
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
% Change figure numbering to include chapter (e.g., Figure 1.1, 1.2...)
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
% Table of Contents (TOC) Title styling
\renewcommand{\contentsname}{DAFTAR ISI}
\renewcommand{\cfttoctitlefont}{\bfseries\MakeUppercase}
\renewcommand{\cftaftertoctitle}{\hfill\hfill} % https://tex.stackexchange.com/a/255699/394075
% Table of Content (TOC) Title styling
\renewcommand{\cfttoctitlefont}{\hfill\bfseries\MakeUppercase}
\renewcommand{\cftaftertoctitle}{\hfill} % https://tex.stackexchange.com/a/255699/394075
% List of Figures (LOF) Title styling
\renewcommand{\cftloftitlefont}{\hfill\bfseries\MakeUppercase}
\renewcommand{\cftafterloftitle}{\hfill}
% List of Tables (LOT) Title styling
\renewcommand{\cftlottitlefont}{\hfill\bfseries\MakeUppercase}
\renewcommand{\cftafterlottitle}{\hfill}
% \renewcommand{\cfttoctitlefont}{\bfseries\MakeUppercase}
% \renewcommand{\cftaftertoctitle}{\vskip 2em}
% Frontmatter Macro (Toggle TOC Inclusion)
\newcommand{\frontmattersection}[3]{%
\begin{titlepage}
\centering
\ifstrequal{#1}{toc}{\addcontentsline{toc}{chapter}{#2}}{\chapter*{#2}}%
\input{frontmatter/#3}
\end{titlepage}
\clearpage
}
% Wrapper Command for Each Page
\newcommand{\theendorsementpage}[1]{\frontmattersection{#1}{Pengesahan}{endorsement}}
\newcommand{\originalitystatement}[1]{\frontmattersection{#1}{Pernyataan Keaslian}{originality}}
% % Apply a custom fancyhdr layout only on the first page of each \chapter, and use no header/footer elsewhere
% % \let\oldchapter\chapter
% % \renewcommand{\chapter}{%
% % \cleardoublepage
% % \pagestyle{fancyplainchapter}%
% % \oldchapter
% % \thispagestyle{fancyplainchapter} % ensure chapter start page uses it
% % \pagestyle{fancyplain}% switch for subsequent pages
% % }
\endinput