Giter Site home page Giter Site logo

maamardli / simple-truss-calculator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lorcan2440/simple-truss-calculator

0.0 0.0 0.0 94.39 MB

Calculator and interactive program for finding internal/reaction forces, stresses and strains of a pin-jointed, straight-membered, plane truss.

Python 100.00%

simple-truss-calculator's Introduction

Simple Truss Calculator

Example Truss used in SDC

Calculator with display for finding internal/reaction forces, stresses and strains of a pin-jointed, straight-membered, plane truss. Assumes linear elasticity and small deflections.

100% Python. See src/truss.py for the program.

Truss Calculator CI Coverage Status

How to use

Installation

Copy the src/truss.py and src/utils.py files into your working directory.

Usage example

from truss import Result, init_truss, plot_diagram

# initialise Truss object
my_truss = init_truss('My first truss')

# set the (x, y) locations of the joints - places where bars, loads or supports can be placed
my_truss.add_joints([(0, 0), (290, -90), (815, 127.5), (290, 345), (0, 255), (220.836, 127.5)])

# join some joints together with bars - joints are named 
# 'A', 'B', 'C', ... automatically in the order they were listed
my_truss.add_bars(['AB', 'BC', 'CD', 'DE', 'EF', 'AF', 'DF', 'BF'])

# add a load at the named joint
my_truss.add_loads([('W', 'C', 0, -0.675)])

# add two supports at the named joints
my_truss.add_supports([('A', 'encastre'), ('E', 'pin', -math.pi / 2)])

# solve and plot
my_truss.solve_and_plot()

# get results in text form
results = Result(my_truss)
print(results)

For more detailed examples, see the complete test cases (src/tests/test_complete_examples.py).

To-do List and Future Aims

Create a basic program

Goal: to make a simple once-per-use calculator.

  • Create the core program using an object-oriented approach
  • Add factory functions to build the objects
  • Make it show the result on a static diagram with matplotlib
  • Add unit testing with PyTest

Make a Flask app for a GUI

Goal: to make an interactive app

Implement truss optimisation

Why I made this

The idea for creating this program came from the Structural Design Course (SDC) long lab project in Part IA (1st year) of the Engineering course at the University of Cambridge. I originally wrote about 30 lines of code just to check some calculations of my own, then thought about making it work for any truss so I could improve it. After the lab ended I continued working on it in my spare time just for fun. Maybe someone else can get some use out of it too..?

Donations

If you found this especially useful, you could consider giving me a cuppa โ˜• ๐Ÿ˜„

โ€ƒโ€ƒ

simple-truss-calculator's People

Contributors

lorcan2440 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.