Skip to content

Repository files navigation

2D Vector-Based Tolerance Analysis with Monte Carlo Simulation and Machine Learning

This repository presents a comprehensive framework for simulating and optimizing manufacturing tolerances in 2D mechanical assemblies. Utilizing vector-based geometry, Monte Carlo simulations, and machine learning techniques, the project aims to identify and optimize Key Characteristics (KCs) that influence system variability.

Overview

  • The primary objective is to develop a 2D tolerance analysis model that:
  • Implements a vector-based approach to analyze tolerance variations.
  • Utilizes Python to create a simulation environment.
  • Identifies the most relevant KCs affecting product performance.
  • Conducts extensive Monte Carlo simulations with a large sample size.
  • Analyzes the influence of tolerances on overall system variability.
  • Trains an ML model to predict the most influential KCs based on input distributions.
  • Optimizes the number of required measurements to reduce computation time while ensuring precision.

Methodology

1. Vector-Based Tolerance Modeling

  • Geometry Generation: Constructs a 2D representation of the tailgate-window system, incorporating rounded corners and defined gaps.

  • Tolerance Definition: Establishes input distributions and tolerances based on real-world constraints.

2. Monte Carlo Simulation

  • Sampling: Performs extensive simulations by randomly sampling input tolerances.

  • Analysis: Evaluates the impact of these variations on the overall system, generating histograms and statistical data.

3. Machine Learning Integration

  • KC Identification: Applies machine learning algorithms to determine the most influential KCs affecting system variability.

  • Optimization: Reduces the number of required measurements while maintaining accuracy, thereby optimizing computational resources.

📁 Project Structure

vector_tolerance_analysis/

  • config.py 🔧 Configuration for geometry, tolerances, and simulation parameters
  • geometry.py 📐 Functions to generate and manipulate 2D geometry
  • tolerance_analysis.py 🎲 Monte Carlo simulation and statistical analysis
  • kc_identification.py 🧠 Machine learning models for Key Characteristic (KC) identification and optimization
  • main.py 🚀 Entry-point script to execute the full analysis pipeline
  • tolerance_data.csv 📊 Sample input data for tolerances
  • output.png 📸 Visual output of the simulation results
  • push.bat 💻 Batch script for version control operations
  • README.md 📄 Project documentation

Installation

1. Clone the Repository:

git clone https://github.com/Nihar2082/vector_tolerance_analysis.git
cd vector_tolerance_analysis

2. Create a Virtual Environment (optional but recommended):

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies:

pip install -r requirements.txt

Note: Ensure that requirements.txt is updated with all necessary packages.

Usage

1. Configure Parameters:

  • Modify config.py to set geometry parameters, tolerance ranges, and simulation settings.

2. Run the Analysis:

python main.py

This will execute the full pipeline: geometry generation, Monte Carlo simulation, KC identification, and result visualization.

3. View Results:

  • Output statistics and plots will be saved in the project directory.
  • output.png provides a visual summary of the simulation outcomes.

Sample Output

Include sample plots or statistical summaries here to illustrate the results.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or suggestions, please contact nihar3010patel@gmail.com.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages