Jalkhov
Member in Training
██████████████████▓░ 99%
Posts: 41
|
Post by Jalkhov on Feb 19, 2021 16:06:40 GMT
again it is not an issue - it supposed to work like that it is way to write really small numbers for computer 5.245208740234375e-06 stands for 5.245208740234375/10^6, that is, 0.0000052452(...) This program works by repeatedly (loop by P) executing same computation During that some elements of C() gradually going to 0 Since it is already 0.0000052452, round to two digits shows 0.00 So "X>1" being XXe-6, actually pretty close to 0 too.
Glad you make it! However, I want to know what you say, can there be anything that will cause me problems later on? Any comments? Or is it already done?
|
|
|
Post by tsh73 on Feb 19, 2021 16:19:07 GMT
I have no idea. Civil engeneering is all Greek to me ;) You can run BASIC & python side by side a fiew times, providing same numbers to both, and see if results match. Besides, there is untested branch of an algorithm where you answer "SI".
|
|
Jalkhov
Member in Training
██████████████████▓░ 99%
Posts: 41
|
Post by Jalkhov on Feb 20, 2021 1:25:32 GMT
I have no idea. Civil engeneering is all Greek to me You can run BASIC & python side by side a fiew times, providing same numbers to both, and see if results match. Besides, there is untested branch of an algorithm where you answer "SI". Yes, I managed to perfect that part, precisely when I started to test that path, errors popped up everywhere haha, but it's already solved, thank you very much. By the way, if here it is done to close the threads when they are already solved, then this one can be closed without any problem
|
|
|
Post by tsh73 on Feb 20, 2021 9:10:57 GMT
I found one more typoo, just trying to figure out what X is (well, if (M+ = Maximum bending moment at the span), then X>M+ is X where it happens. But what is X1, X2, X3?)
Line 430
'IF X2 < X3 THEN X4 = X + X2:X5=L(I)-(X*X3): GOTO 440 should be
IF X2 < X3 THEN X4 = X + X2:X5=L(I)-(X+X3): GOTO 440
|
|
Jalkhov
Member in Training
██████████████████▓░ 99%
Posts: 41
|
Post by Jalkhov on Feb 21, 2021 11:17:35 GMT
Hello again haha I was testing the system and it gives an error when a calculation is made where the spans are less than the overhangs, the error occurs both in the BASIC program and in the Python program, that makes me think that it is more an error by logic than by the programming language, but as I am not an expert in the field I do not know if it is right that a slab has less spans than overhangs.
|
|
|
Post by tenochtitlanuk on Feb 22, 2021 14:14:43 GMT
I hope we can get this all a bit clearer- you are both doing well at finding what is going on. There are indeed on-line beam-bending calculators- I found several- but don't have the time to check them out. Type in dimensions and support and load positions/size and they do a black-box calculation and graph. BUt they do not help explain HOW they calculate. Try skyciv.com/free-beam-calculator/ WE need a good civil engineer's advice! I think I remember a beam bending example in a book called '101 problems in BASIC' or something similar. About 1980.. By chance yesterday, checking old backup files, I found the code below. I certainly didn't write it. Back in the days of LB1.4 I reckon. Not sure it will help understand what is going on, but a great example of old-style BASIC eith heavy use of goto!! 'total of 5 UDLs and point loads 'beam is 7 meters long 'distance to first load is 0 'size is 39583.3 'length is 0 'distance to second load is 0 'size is -20000 'length is 0 'distance to thrid load is 1 'size is -15000 'length is 3 (this is the only UDL) 'distance to fourth load is 6 'size is 65416.7 'length is 0 'distance to fifth point is 7 'size is -40000 'length is 0
'increments is your choice
nomainwin
WindowWidth = 1150 WindowHeight= 800
texteditor #1.txt1, 10, 175, 350, 550 graphicbox #1.gb1, 385, 10, 780, 800 textbox #1.tb1, 250, 50, 100, 25 statictext #1.st1, "", 10, 55, 190, 100 button #1.bn, "Next Step", [next], ul, 10, 10, 100, 25 button #1.bn2, "Reset", [reset], ul, 110, 10, 100, 25
open "Bending Moment and Shear Force Graph Input" for graphics_nsb as #1 ' Why 'fs' when you specified width/height?
#1 "trapclose [close]"
[resetstart] #1.st1 "Total number of point loads and UDLS" #1.tb1 "!setfocus" sn =1 wait
[next] #1.tb1 "!setfocus" if sn =1 then #1.tb1 "!contents? a" if sn =2 then #1.tb1 "!contents? b" #1.tb1 "!contents? c" ' Can you do this? #1.tb1 "" if sn =1 then goto [start] ' would be much neater with 'case' if sn =2 then goto [length] if sn =3 then goto [location] if sn =4 then goto [size] if sn =5 then goto [finishlocation] if sn =6 then goto [table] wait
[start] dim information( a +1, 3) sn =2 #1.st1 "Length of Beam (m)" wait
[length] information( 1, 1) =c sn =3 #1.st1 "Length to load 1 from left hand edge in metres" ' sp x =2 y =2 z =2 wait
[location] information( x, 1) =c x =x +1 sn =4 #1.st1 "Size of load "; x -2; " (if the force is downwards, input a negative) in newtons" wait
[size] information( y, 2) =c y =y +1 sn =5 #1.st1 "Length of load "; y -2; " (UDLs, enter 0 for point loads) in metres" wait
[finishlocation] information( z, 3) =c z =z +1 if ( y -2) =a then sn =6 else sn =3 if sn =3 then #1.st1 "Length to load "; z -1 if sn =6 then #1.st1 "Increment for table of results" ' sp wait
[table] inc =c
[draw] #1.gb1 "down" dim y1( ( b *1000) +1) for zz =0 to b step 0.001 ' ?? step size?? y2 =y1 y1 =0 zz$ =using( "######.###", zz) zz =val( zz$) if zz =0 then y1 =0
for za =2 to a +1
if zz >information( za, 1) then if information( za, 3) =0 then y1 =y1 +( ( zz -information( za, 1)) *information( za, 2)) else if zz <(information( za, 1) +information( za, 3)) then lengthofudl =( zz -information( za, 1)) forceofudl =lengthofudl *information( za, 2) distocentre =lengthofudl /2 y1 =y1 +distocentre *forceofudl else forceofudl =information( za, 2) *information( za, 3) distocentre =( zz -( information( za, 1) +information( za, 3))) +( information( za, 3) /2) y1 =y1 +distocentre *forceofudl end if
end if end if next za
if zx <y1 then zx =y1 if y1 <xz then xz =y1
y1( zz *1000) =y1
if zzz =zz then #1.txt1 zz; "m "; y1 zzz =zzz +inc end if
if ( (y1<0) AND ( y2>0) AND ( zz>0) AND ( zz<b)) then ' be careful over operator priority #1.txt1 "" #1.txt1 "Point of Contraflexture: "; zz; "m" #1.txt1 "" end if
next zz
yx =zx xy =xz xy =0 -xy if yx >xy then max =yx if xy >yx then max =xy #1.txt1 "" #1.txt1 "Largest bending moment: "; max; "Nm" #1.txt1 "Largest sag: "; yx #1.txt1 "Largest hog: "; xy
yscale =150/ max
#1.gb1, "line 50 175 680 175" if xz >-0.000000000001 then #1.gb1 "line 50 25 50 175" if xz <-0.000000000001 then #1.gb1, "line 50 25 50 350"
for zz =0 to b step 0.001 xscale= 630 /b #1.gb1 "set "; ( zz *xscale) +50; " "; 175 -( y1( zz *1000) *yscale) next zz
'===============================================================================================================
[shearforce] dim y3( (b *1000) +1) for aa =0 to b +0.001 step 0.001 aa$ =using( "######.###", aa) aa =val( aa$) for ab =2 to a +1 if information( ab, 1) =aa then if information( ab, 3) =0 then y3=y3+information( ab, 2) else if information(ab,1) +information(ab,3)<aa then y3=y3+(information(ab,2)*information(ab,3)) else y3=y3+((aa-information(ab,1))*information(ab,2)) end if end if end if next ab
y3( aa *1000) =y3 if zx1 <y3 then zx1 =y3 if y3 <xz1 then xz1 =y3 next aa #1.gb1 "line 50 525 680 525" if xz1 >-0.000000000001 then #1.gb1 "line 50 375 50 525" if xz1 <-0.000000000001 then #1.gb1 "line 50 375 50 675" if xz1 <0 then xz1 =0 -xz1 if zx1 >xz1 then max =zx1 if xz1 >zx1 then max =xz1 yscale =150/max
#1.gb1 "up" #1.gb1 "goto 50 525" #1.gb1 "down"
for zza =0 to b +0.001 step 0.001 ' ?? stepsize?? #1.gb1, "goto "; ( zza *xscale) +50; " "; 525 -( y3( zza *1000) *yscale) #1.gb1, "set "; ( zza *xscale) +50; " "; 525 -( y3( zza *1000) *yscale) #1.txt1, y3( zza *1000); " "; zza next zza
'===============================================================================================================
#1.gb1 "flush" wait
[reset] #1.txt1, "!cls" #1.gb1, "cls" goto [resetstart] wait
[close] close #1 end
I don't want to 'muddy the waters', but it shows how easy it is to give a GUI front end. What a pity the program wasn't written by someone who'd learned the hard way to 'self document' the code. Relevant file names and remark/comments make it so much easier to see what is going on in code. I try to write code that way- at least partly because early exposure to Forth made me realise that some languages use code which is one-way- understand an algorithm and you can almost always code it in Forth. But read someone lse's Forth code and you will really struggle to understand it!
|
|