Initial Commit

This commit is contained in:
Gregory Kenneth Bowne 2023-11-25 14:37:27 -08:00
parent 0db09007e8
commit e559c2d730
23 changed files with 329 additions and 0 deletions

BIN
.vscode/browse.vc.db vendored Normal file

Binary file not shown.

BIN
.vscode/browse.vc.db-shm vendored Normal file

Binary file not shown.

BIN
.vscode/browse.vc.db-wal vendored Normal file

Binary file not shown.

34
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
"env": {
"myDefaultIncludePath": [
"${workspaceFolder}/StarshipAscension/include"
],
"myCompilerPath": "/usr/bin/gcc"
},
"configurations": [
{
"name": "linux-gcc-x64",
"intelliSenseMode": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"compileCommands": "build/compile_commands.json",
"browse": {
"path": [
"${workspaceFolder}/**",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db"
},
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

24
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/home/gbowne1/Documents/BendCalc",
"program": "/home/gbowne1/Documents/BendCalc/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

59
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

22
CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.13.4)
project(BendCalc)
# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Include directories
include_directories(include)
# Source files
set(SOURCES
src/main.cpp
# Add other source files here
)
# Create executable
add_executable(bend_calc ${SOURCES})
# Add subdirectories for modules
add_subdirectory(tests)
add_subdirectory(docs)

12
docs/Tonnage.md Normal file
View File

@ -0,0 +1,12 @@
// Inputs for Bend Angle Tonnage required
// Material Type:L A
// Tensile Strength (if known) in Mpa
// Material Thickness
// K-Factor
// V die opening (print suggested v opening of 8x material thickness)
// Radius
// Minimum Flange
// {[(575 × Material thickness squared) / Die width] / 12} × Material factor
// Outputs for Bend Angle Tonnage
// P in kN/mt and convert to Tons (lb^2/i)

0
include/DataLoad.h Normal file
View File

0
include/DataSave.h Normal file
View File

12
include/Deserializer.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef DESERIALIZER_H
#define DESERIALIZER_H
#include <string>
#include <fstream>
class Deserializer {
public:
static bool deserializeData(const std::string& filename, std::string& data);
};
#endif

7
include/Kfactor.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef KFACTOR_H
#define KFACTOR_H
// Function declaration for calculating the K-factor
double calculateKFactor(double neutralAxisLocation, double materialThickness);
#endif

12
include/Serializer.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef SERIALIZER_H
#define SERIALIZER_H
#include <string>
#include <fstream>
class Serializer {
public:
static bool serializeData(const std::string& filename, const std::string& data);
};
#endif

0
include/Setback.h Normal file
View File

7
include/Tonnage.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef TONNAGE_H
#define TONNAGE_H
// Function declaration for calculating the press brake tonnage
double calculateTonnage(double materialThickness, double bendLength, double dieOpeningWidth, double materialFactor, double methodFactor, double multipleBendToolingFactor);
#endif

0
src/DataLoad.cpp Normal file
View File

1
src/DataSave.cpp Normal file
View File

@ -0,0 +1 @@
D

16
src/Deserializer.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "Deserializer.h"
bool Deserializer::deserializeData(const std::string& filename, std::string& data) {
std::ifstream file(filename, std::ios::binary);
if (file.is_open()) {
file.seekg(0, std::ios::end);
std::streampos fileSize = file.tellg();
file.seekg(0, std::ios::beg);
data.resize(fileSize);
file.read(&data[0], fileSize);
file.close();
return true;
}
return false;
}

7
src/Kfactor.cpp Normal file
View File

@ -0,0 +1,7 @@
#include "Kfactor.h"
// Function definition for calculating the K-factor
double calculateKFactor(double neutralAxisLocation, double materialThickness) {
double kFactor = neutralAxisLocation / materialThickness;
return kFactor;
}

11
src/Serializer.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "Serializer.h"
bool Serializer::serializeData(const std::string& filename, const std::string& data) {
std::ofstream file(filename, std::ios::binary);
if (file.is_open()) {
file.write(data.c_str(), data.size());
file.close();
return true;
}
return false;
}

0
src/Setback.cpp Normal file
View File

8
src/Tonnage.cpp Normal file
View File

@ -0,0 +1,8 @@
#include "Tonnage.h"
#include <cmath>
// Function definition for calculating the press brake tonnage
double calculateTonnage(double materialThickness, double bendLength, double dieOpeningWidth, double materialFactor, double methodFactor, double multipleBendToolingFactor) {
double formingTonnage = (575 * pow(materialThickness, 2) / (dieOpeningWidth / 12)) * bendLength * materialFactor * methodFactor * multipleBendToolingFactor;
return formingTonnage;
}

97
src/main.cpp Normal file
View File

@ -0,0 +1,97 @@
/*
* This file is part of <project name>.
*
* <project name> is free software: you can redistribute it and/or modify
* it under the terms of the <license name> as published by
* the <license organization>, either version <license version> of the License, or
* (at your option) any later version.
*
* <project name> is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* <license name> for more details.
*
* You should have received a copy of the <license name>
* along with <project name>. If not, see <license URL>.
*/
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <memory>
#include <mutex>
#include <random>
#include <regex>
#include <sstream>
#include <string>
#include <thread>
#include <vector>
#include "Tonnage.h"
#include "Kfactor.h"
int main()
{
/*
* Required Press Tonnage Calculation
*/
double materialThickness, bendLength, dieOpeningWidth, materialFactor, methodFactor, multipleBendToolingFactor;
// Get user inputs
std::cout << "Enter material thickness (in inches): ";
std::cin >> materialThickness;
std::cout << "Enter bend length (in inches): ";
std::cin >> bendLength;
std::cout << "Enter die opening width (in inches): ";
std::cin >> dieOpeningWidth;
std::cout << "Enter material factor: ";
std::cin >> materialFactor;
std::cout << "Enter method factor: ";
std::cin >> methodFactor;
std::cout << "Enter multiple-bend tooling factor: ";
std::cin >> multipleBendToolingFactor;
// Calculate the press brake tonnage using the module function
double tonnage = calculateTonnage(materialThickness, bendLength, dieOpeningWidth, materialFactor, methodFactor, multipleBendToolingFactor);
// Output the calculated tonnage
std::cout << "The required press brake tonnage is: " << tonnage << " tons" << std::endl;
return 0;
/*
* Kfactor calculation
*/
// User inputs for K-factor calculation
double neutralAxisLocation, materialThickness;
// Get user inputs
std::cout << "Enter neutral axis location: ";
std::cin >> neutralAxisLocation;
std::cout << "Enter material thickness: ";
std::cin >> materialThickness;
// Calculate the K-factor using the module function
double kFactor = calculateKFactor(neutralAxisLocation, materialThickness);
// Output the calculated K-factor
std::cout << "The calculated K-factor is: " << kFactor << std::endl;
return 0;
}