ewdy / structural-design Goto Github PK
View Code? Open in Web Editor NEWA Collection of structural design calculations
License: MIT License
A Collection of structural design calculations
License: MIT License
At present, Beam_2.ipynb calculates the shear and moment for simply supported beam with partially distributed load. It does not yet calculate deflection. I believe that I can easily implement this using Moment-Area Theorems where the change in slope between any two points is equal to the area of the M/EI diagram between these two points. See Structural Analysis by R.C. Hibbeler 4th Edition, pages 280 to 288.
Notebook Beam_1.1.ipynb does its intended job of deriving shear, moment and deflection when given acceptable user values. What it presently lacks is a nice, printable output. Currently, exporting the notebook to pdf yields all of the hidden code and test data. Add feature to output results to some other format cleanly.
Beam_1.ipynb calculates and plots shear, moment and deflection for a concentrated load on a simply supported beam. At present, it lacks a test case with known results for evaluating and verifying code. Need to find a sample case in published literature and add to notebook so others can independently verify results.
I have found that the notebook "beam_1.ipynb" runs without error on my desktop (python 3.7.something) installation of jupyter lab but it returns errors (see quote below) when run on CoCalc (python 3.6.something). I may need to specify requirements for running notebooks and/or add testing of required libraries at the top of notebooks.
# create beam array and load with position, shear, moment and deflection values
beam = np.zeros((4, SAMPLE_SIZE))
beam[0, : ] = np.linspace(0, L.magnitude, SAMPLE_SIZE) # position
for i in range(SAMPLE_SIZE):
beam[1, i] = shear_x(beam[0, i]*L.units, P, a, L).magnitude # stuff shear values
beam[2, i] = moment_x(beam[0, i]*L.units, P, a, L).magnitude # stuff moment values
beam[3, i] = deflection_x(beam[0, i]*L.units, P, a, L, EI).magnitude # stuff deflection values
# beam[0:]
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-3cac110d7e7a> in <module>()
3 beam[0, : ] = np.linspace(0, L.magnitude, SAMPLE_SIZE) # position
4 for i in range(SAMPLE_SIZE):
----> 5 beam[1, i] = shear_x(beam[0, i]*L.units, P, a, L).magnitude # stuff shear values
6 beam[2, i] = moment_x(beam[0, i]*L.units, P, a, L).magnitude # stuff moment values
7 beam[3, i] = deflection_x(beam[0, i]*L.units, P, a, L, EI).magnitude # stuff deflection values
<ipython-input-5-787cab1916c6> in shear_x(x, P, a, L)
15 """
16 b = L - a # derive b given a and L
---> 17 if x >= 0 and x <= a:
18 V_x = (P*b)/L
19 elif x > a and x <= L:
/usr/local/lib/python3.6/dist-packages/pint/quantity.py in <lambda>(self, other)
1077 __lt__ = lambda self, other: self.compare(other, op=operator.lt)
1078 __le__ = lambda self, other: self.compare(other, op=operator.le)
-> 1079 __ge__ = lambda self, other: self.compare(other, op=operator.ge)
1080 __gt__ = lambda self, other: self.compare(other, op=operator.gt)
1081
/usr/local/lib/python3.6/dist-packages/pint/quantity.py in compare(self, other, op)
1065 return op(self._convert_magnitude_not_inplace(UnitsContainer()), other)
1066 else:
-> 1067 raise ValueError('Cannot compare Quantity and {0}'.format(type(other)))
1068
1069 if self._units == other._units:
ValueError: Cannot compare Quantity and <class 'int'>
At present, Beam_1.ipynb calculates shear, moment and deflection using values sans units supplied by the user. This forces the user to use consistent and appropriate units. Adding support for units would relieve much of this error prone burden from the user. I plan to do this using the PINT module as I have in several other notebooks. See https://pypi.org/project/Pint/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.