Thermal Control of Laser Powder Bed Fusion using Deep Reinforcement Learning

Overview

Thermal Control of Laser Powder Bed Fusion using Deep Reinforcement Learning

This repository is the implementation of the paper "Thermal Control of Laser Powder Bed Fusion Using Deep Reinforcement Learning", linked here. The project makes use of the Deep Reinforcement Library stable-baselines3 to derive a control policy that maximizes melt pool depth consistency. drl_am

Simulation Framework

The Repeated Usage of Stored Line Solutions (RUSLS) method proposed by Wolfer et al. is used to simulate the temperature dynamics in this work. More detail can be found in the following paper:

  • Fast solution strategy for transient heat conduction for arbitrary scan paths in additive manufacturing, Additive Manufacturing, Volume 30, 2019 (link)

Prerequisites

The following packages are required in order to run the associated code:

  • gym==0.17.3
  • torch==1.5.0
  • stable_baselines3==0.7.0
  • numba==0.50.1

These packages can be installed independently, or all at once by running pip install -r requirements.txt. We recommend that these packages are installed in a new conda environment to avoid clashes with existing package installations. Instructions on defining a new conda environment can be found here.

Usage

The overall workflow for this project first defines a gym environment based on the desired scan path, then performs Proximal Policy Optimization to derive a suitable control policy based on the environment. This is done through the following:

Overview

  • EagarTsaiModel.py: implements the RUSLS solution to the Rosenthal equation, as proposed by Wolfer et al.
  • power_square_gym.py, power_triangle_gym.py, velocity_square_gym.py, velocity_triangle_gym.py: Defines custom gym environments for the respective scan paths and control variables. square is used as shorthand for the predefined horizontal cross-hatching path and triangle is used as shorthand for the predefined concentric triangular path.
  • RL_learn_square.py, RL_learn_triangle.py performs Proximal Policy Optimization on the respective scan paths, with command line arguments to change which control parameter is varied.
  • evaluate_learned_policy.py runs a derived control policy on a specific environment. The environment is specified using command line arguments detailed below.

Testing a trained model

To test a trained model on a specific combination of scan path and control parameter, enter this command:

python evaluate_learned_policy.py --path [scan_path] --param [parameter]

Note: [scan_path] should be replaced by square for the horizontal cross-hatching scan path and triangle for the concentric triangular path. [parameter] should be replaced by power to specify power as a control parameter, and velocity to specify velocity as a control parameter.

Upon running this command, you will be prompted to enter the path to the .zip file for the trained model.

Once the evaluation is complete, the results are stored in the folder results/[scan_path]_[parameter]_control/. This folder will contain plots of the variation of the melt depth and control parameters over time, as well as their raw values for later analysis.

Pre-trained models for each of the four possible combinations of scan path and control parameter can be found in pretrained_models.

Training a new model

In order to train a new model based on the predefined horizontal cross-hatching scan path, enter the command:

python RL_learn_square.py --param [parameter]

Here, [parameter] should be replaced by the control parameter desired. The possible options are power and velocity.

The process is similar for the predefined concentric triangular scan path. To train a new model, enter the command:

python RL_learn_triangle.py --param [parameter]

Again, [parameter] should be replaced by the control parameter desired. The possible options are power and velocity.

During training, intermediate model checkpoints will be saved at

training_checkpoints/ppo_[scan_path]_[parameter]/best_model.zip

At the conclusion of training, the finished model is stored at

trained_models/ppo_[scan_path]_[parameter].zip

Defining a custom domain

Changing the powder bed features

In order to define a custom domain for use with a different problem configuration, the EagarTsaiModel.py file should be edited directly. Within the EagarTsai() class instantiation, the thermodynamic properties and domain dimensions can be specified. Additionally, the resolution and boundary conditions can be provided as arguments to the EagarTsai class. bc = 'flux' and bc = 'temp' implements an adiabatic and constant temperature boundary condition respectively.

Changing the scan path

A new scan path can be defined by creating a new custom gym environment, and writing a custom step() function to represent the desired scan path, similar to the [parameter]_[scan_path]_gym.py scripts in this repository. Considerations for both how the laser moves during a single segment and the placement of each segment within the overall path should be described in this function. More detail on the gym framework for defining custom environments can be found here.

Monitoring the training process with TensorBoard

Tensorboard provides resources for monitoring various metrics of the PPO training process, and can be installed using pip install tensorboard. To open the tensorboard dashboard, enter the command:

tensorboard --log_dir ./tensorboard_logs/ppo_[scan_path]_[parameter]/ppo_[scan_path]_[parameter]_[run_ID]

Tensorboard log files are periodically saved during training, with information on cumulative reward as well as various loss metrics.

You might also like...
PyBullet CartPole and Quadrotor environments—with CasADi symbolic a priori dynamics—for learning-based control and reinforcement learning
PyBullet CartPole and Quadrotor environments—with CasADi symbolic a priori dynamics—for learning-based control and reinforcement learning

safe-control-gym Physics-based CartPole and Quadrotor Gym environments (using PyBullet) with symbolic a priori dynamics (using CasADi) for learning-ba

Conservative Q Learning for Offline Reinforcement Reinforcement Learning in JAX
Conservative Q Learning for Offline Reinforcement Reinforcement Learning in JAX

CQL-JAX This repository implements Conservative Q Learning for Offline Reinforcement Reinforcement Learning in JAX (FLAX). Implementation is built on

Reinforcement-learning - Repository of the class assignment questions for the course on reinforcement learning

DSE 314/614: Reinforcement Learning This repository containing reinforcement lea

A resource for learning about deep learning techniques from regression to LSTM and Reinforcement Learning using financial data and the fitness functions of algorithmic trading

A tour through tensorflow with financial data I present several models ranging in complexity from simple regression to LSTM and policy networks. The s

[ICML 2020] Prediction-Guided Multi-Objective Reinforcement Learning for Continuous Robot Control
[ICML 2020] Prediction-Guided Multi-Objective Reinforcement Learning for Continuous Robot Control

PG-MORL This repository contains the implementation for the paper Prediction-Guided Multi-Objective Reinforcement Learning for Continuous Robot Contro

JAX code for the paper
JAX code for the paper "Control-Oriented Model-Based Reinforcement Learning with Implicit Differentiation"

Optimal Model Design for Reinforcement Learning This repository contains JAX code for the paper Control-Oriented Model-Based Reinforcement Learning wi

Doosan robotic arm, simulation, control, visualization in Gazebo and ROS2 for Reinforcement Learning.
Doosan robotic arm, simulation, control, visualization in Gazebo and ROS2 for Reinforcement Learning.

Robotic Arm Simulation in ROS2 and Gazebo General Overview This repository includes: First, how to simulate a 6DoF Robotic Arm from scratch using GAZE

 Multi-Agent Reinforcement Learning for Active Voltage Control on Power Distribution Networks (MAPDN)
Multi-Agent Reinforcement Learning for Active Voltage Control on Power Distribution Networks (MAPDN)

Multi-Agent Reinforcement Learning for Active Voltage Control on Power Distribution Networks (MAPDN) This is the implementation of the paper Multi-Age

a practicable framework used in Deep Learning. So far UDL only provide DCFNet implementation for the ICCV paper (Dynamic Cross Feature Fusion for Remote Sensing Pansharpening)

UDL UDL is a practicable framework used in Deep Learning (computer vision). Benchmark codes, results and models are available in UDL, please contact @

Owner
BaratiLab
BaratiLab
Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal, multi-exposure and multi-focus image fusion.

U2Fusion Code of U2Fusion: a unified unsupervised image fusion network for multiple image fusion tasks, including multi-modal (VIS-IR, medical), multi

Han Xu 129 Dec 11, 2022
Edge-aware Guidance Fusion Network for RGB-Thermal Scene Parsing

EGFNet Edge-aware Guidance Fusion Network for RGB-Thermal Scene Parsing Dataset and Results Test maps: 百度网盘 提取码:zust Citation @ARTICLE{ author={Zhou,

ShaohuaDong 10 Dec 8, 2022
This repo is about implementing different approaches of pose estimation and also is a sub-task of the smart hospital bed project :smile:

Pose-Estimation This repo is a sub-task of the smart hospital bed project which is about implementing the task of pose estimation ?? Many thanks to th

Max 11 Oct 17, 2022
BED: A Real-Time Object Detection System for Edge Devices

BED: A Real-Time Object Detection System for Edge Devices About this project Thi

Data Analytics Lab at Texas A&M University 44 Nov 18, 2022
Fusion-DHL: WiFi, IMU, and Floorplan Fusion for Dense History of Locations in Indoor Environments

Fusion-DHL: WiFi, IMU, and Floorplan Fusion for Dense History of Locations in Indoor Environments Paper: arXiv (ICRA 2021) Video : https://youtu.be/CC

Sachini Herath 68 Jan 3, 2023
Generalized hybrid model for mode-locked laser diodes with an extended passive cavity

GenHybridMLLmodel Generalized hybrid model for mode-locked laser diodes with an extended passive cavity This hybrid simulation strategy combines a tra

Stijn Cuyvers 3 Sep 21, 2022
Simulation of self-focusing of laser beams in condensed media

What is it? Program for scientific research, which allows to simulate the phenomenon of self-focusing of different laser beams (including Gaussian, ri

Evgeny Vasilyev 13 Dec 24, 2022
Tensorflow implementation of Human-Level Control through Deep Reinforcement Learning

Human-Level Control through Deep Reinforcement Learning Tensorflow implementation of Human-Level Control through Deep Reinforcement Learning. This imp

Devsisters Corp. 2.4k Dec 26, 2022
A Moonraker plug-in for real-time compensation of frame thermal expansion

Frame Expansion Compensation A Moonraker plug-in for real-time compensation of frame thermal expansion. Installation Credit to protoloft, from whom I

null 58 Jan 2, 2023
Self-Correcting Quantum Many-Body Control using Reinforcement Learning with Tensor Networks

Self-Correcting Quantum Many-Body Control using Reinforcement Learning with Tensor Networks This repository contains the code and data for the corresp

Friederike Metz 7 Apr 23, 2022