-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6d3da4
commit 24a5f19
Showing
33 changed files
with
1,746 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
from odbAccess import * | ||
from calcF import calcF, createField | ||
from math import sqrt | ||
from collections import defaultdict | ||
|
||
# | ||
instance='BOCHKA_FULL-1' | ||
frame=-1 | ||
# | ||
#----------- | ||
K=1 | ||
#----------- | ||
roving=dict() | ||
roving['s1p']=146.7e6/K | ||
roving['s1m']=67.0e6/K | ||
roving['s2p']=3.8e6/K | ||
roving['s2m']=18.9e6/K | ||
roving['s12']=9.0e6/K | ||
roving['s12p']=roving['s12m']=roving['s12'] | ||
|
||
rovingF=dict() | ||
rovingF['F1']=1.0/roving['s1p']-1.0/roving['s1m'] | ||
rovingF['F2']=1.0/roving['s2p']-1.0/roving['s2m'] | ||
rovingF['F11']=1.0/roving['s1p']/roving['s1m'] | ||
rovingF['F22']=1.0/roving['s2p']/roving['s2m'] | ||
rovingF['F33']=1.0/roving['s12']**2 | ||
rovingF['F12']=-0.5*sqrt(rovingF['F11']*rovingF['F22']) | ||
|
||
for k in rovingF.keys(): | ||
exec(k+'='+str(rovingF[k])) | ||
|
||
rovingF.update(roving) | ||
|
||
steklotk1=dict() | ||
steklotk1['s1p']=39.3e6/K | ||
steklotk1['s1m']=41.6e6/K | ||
steklotk1['s2p']=39.3e6/K | ||
steklotk1['s2m']=41.6e6/K | ||
steklotk1['s12']=30.9e6/K | ||
steklotk1['s12p']=steklotk1['s12m']=steklotk1['s12'] | ||
|
||
steklotk1F=dict() | ||
steklotk1F['F1']=1.0/steklotk1['s1p']-1.0/steklotk1['s1m'] | ||
steklotk1F['F2']=1.0/steklotk1['s2p']-1.0/steklotk1['s2m'] | ||
steklotk1F['F11']=1.0/steklotk1['s1p']/steklotk1['s1m'] | ||
steklotk1F['F22']=1.0/steklotk1['s2p']/steklotk1['s2m'] | ||
steklotk1F['F33']=1.0/steklotk1['s12']**2 | ||
steklotk1F['F12']=-0.5*sqrt(steklotk1F['F11']*steklotk1F['F22']) | ||
|
||
for k in steklotk1F.keys(): | ||
exec(k+'='+str(steklotk1F[k])) | ||
|
||
steklotk1F.update(steklotk1) | ||
|
||
steklotk2=dict() | ||
steklotk2['s1p']=53.7e6/K | ||
steklotk2['s1m']=47.7e6/K | ||
steklotk2['s2p']=53.7e6/K | ||
steklotk2['s2m']=47.7e6/K | ||
steklotk2['s12']=39.5e6/K | ||
steklotk2['s12p']=steklotk1['s12m']=steklotk1['s12'] | ||
|
||
steklotk2F=dict() | ||
steklotk2F['F1']=1.0/steklotk2['s1p']-1.0/steklotk2['s1m'] | ||
steklotk2F['F2']=1.0/steklotk2['s2p']-1.0/steklotk2['s2m'] | ||
steklotk2F['F11']=1.0/steklotk2['s1p']/steklotk2['s1m'] | ||
steklotk2F['F22']=1.0/steklotk2['s2p']/steklotk2['s2m'] | ||
steklotk2F['F33']=1.0/steklotk2['s12']**2 | ||
steklotk2F['F12']=-0.5*sqrt(steklotk2F['F11']*steklotk2F['F22']) | ||
|
||
for k in steklotk2F.keys(): | ||
exec(k+'='+str(steklotk2F[k])) | ||
|
||
steklotk2F.update(steklotk2) | ||
|
||
|
||
#------------------------------ | ||
odb=session.odbs.values()[-1] | ||
|
||
print 'Calculating F for DNO_TKAN-1...' | ||
crit=lambda n: steklotk2F | ||
setName='DNO_TKAN-1' | ||
ply=calcF(odb, instance, setName, crit, frame, '%s-F.txt' % setName) | ||
createField(odb, instance, setName, crit, ply, frame, '%s-F' % setName) | ||
|
||
print 'Calculating F for CYL-1...' | ||
setName='CYL-1' | ||
crit=lambda n: rovingF | ||
ply=calcF(odb, instance, setName, crit, frame, '%s-F.txt' % setName) | ||
createField(odb, instance, setName, crit, ply, frame, '%s-F' % setName) | ||
|
||
print 'Calculating F for DNO_ROVING...' | ||
setName='DNO_ROVING' | ||
crit=lambda n: rovingF | ||
ply=calcF(odb, instance, setName, crit, frame, '%s-F.txt' % setName) | ||
createField(odb, instance, setName, crit, ply, frame, '%s-F' % setName) | ||
|
||
print 'Calculating F for UBKA-1...' | ||
crit=lambda n: steklotk1F | ||
setName='UBKA-FAST' | ||
ply=calcF(odb, instance, setName, crit, frame, '%s-F.txt' % setName) | ||
createField(odb, instance, setName, crit, ply, frame, '%s-F' % setName) | ||
|
||
print 'Calculating F for USIL-1...' | ||
crit=lambda n: steklotk2F | ||
setName='USIL-FAST' | ||
ply=calcF(odb, instance, setName, crit, frame, '%s-F.txt' % setName) | ||
createField(odb, instance, setName, crit, ply, frame, '%s-F' % setName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from odbAccess import * | ||
from abaqusConstants import * | ||
from math import sqrt | ||
|
||
def calcF(odb, instance, setName, crit, frame=-1, fname='reportF.txt'): | ||
fl=open(fname, 'w') | ||
ss=odb.rootAssembly.instances[instance].elementSets | ||
fo=odb.steps.values()[0].frames[frame].fieldOutputs['S'] | ||
es=ss[setName] | ||
sp=es.elements[0].sectionCategory.sectionPoints | ||
fo1=fo.getSubset(region=es) | ||
maxF=-1e9 | ||
maxFply=-1 | ||
for i, p in enumerate(sp): | ||
m=crit(i) | ||
p1=fo1.getSubset(sectionPoint=p) | ||
ss11=p1.getScalarField(componentLabel='S11') | ||
ss22=p1.getScalarField(componentLabel='S22') | ||
ss12=p1.getScalarField(componentLabel='S12') | ||
mx=-1e20 | ||
for s1v, s2v, s12v in zip(ss11.values, ss22.values, ss12.values): | ||
s1=s1v.data | ||
s2=s2v.data | ||
s12=s12v.data | ||
f=m['F1']*s1+m['F2']*s2+m['F11']*s1**2\ | ||
+m['F22']*s2**2+m['F33']*s12**2\ | ||
+2*m['F12']*s1*s2 | ||
mx=max(mx, f) | ||
print 'ply ', i+1, ': fmax=', mx | ||
fl.write('ply {0}: Ifmax={1}\n'.format(i+1, mx)) | ||
if mx>maxF: | ||
maxF=mx | ||
maxFply=i+1 | ||
fl.write('maxF={}, in ply {}'.format(maxF, maxFply)) | ||
fl.close() | ||
print 'maxF={}, in ply {}'.format(maxF, maxFply) | ||
return maxFply | ||
|
||
def createField(odb, instance, setName, crit, ply=0, frame=-1, name='F'): | ||
ss=odb.rootAssembly.instances[instance].elementSets | ||
fo=odb.steps.values()[0].frames[frame].fieldOutputs['S'] | ||
if odb.steps.has_key('Session Step'): | ||
sessionStep=odb.steps['Session Step'] | ||
else: | ||
sessionStep = odb.Step(name='Session Step', | ||
description='Step for Viewer non-persistent fields', domain=TIME, | ||
timePeriod=1.0) | ||
if len(sessionStep.frames): | ||
sessionFrame=sessionStep.frames[0] | ||
else: | ||
sessionFrame = sessionStep.Frame(frameId=0, frameValue=0.0, | ||
description='Session Frame') | ||
|
||
es=ss[setName] | ||
sp=es.elements[0].sectionCategory.sectionPoints | ||
fo1=fo.getSubset(region=es) | ||
p=sp[ply-1] | ||
m=crit(ply-1) | ||
p1=fo1.getSubset(sectionPoint=p) | ||
s11=p1.getScalarField(componentLabel='S11') | ||
s22=p1.getScalarField(componentLabel='S22') | ||
s12=p1.getScalarField(componentLabel='S12') | ||
tmpfield=m['F1']*s11+m['F2']*s22+m['F11']*s11*s11+m['F22']*s22*s22\ | ||
+m['F33']*s12*s12+2*m['F12']*s11*s22 | ||
sessionField = sessionFrame.FieldOutput(name=name, | ||
description='', field=tmpfield) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
odb=session.odbs.values()[0] | ||
exclLabs=[] | ||
for i in range(4): | ||
name='CLOUD_NODES-FASTENERS-{}'.format(i+1) | ||
ns=odb.rootAssembly.nodeSets[name].nodes | ||
for n in ns: | ||
if n[0].instanceName=='BOCHKA_FULL-1': | ||
break | ||
for nn in n: | ||
exclLabs.append(nn.label) | ||
elLabs=[] | ||
dopN=[] | ||
es=odb.rootAssembly.instances['BOCHKA_FULL-1'].elementSets['UBKA'].elements | ||
for e in es: | ||
nns=e.connectivity | ||
c=0 | ||
for n in nns: | ||
if n in exclLabs: | ||
c+=1 | ||
if c>=3: | ||
dopN+=list(nns) | ||
if not c: | ||
elLabs.append(e.label) | ||
els=odb.rootAssembly.instances['BOCHKA_FULL-1'].ElementSetFromElementLabels(name='UBKA-FAST', elementLabels=elLabs) | ||
|
||
elLabs=[] | ||
dopN=[] | ||
es=odb.rootAssembly.instances['BOCHKA_FULL-1'].elementSets['USIL'].elements | ||
for e in es: | ||
nns=e.connectivity | ||
c=0 | ||
for n in nns: | ||
if n in exclLabs: | ||
c+=1 | ||
if c>=3: | ||
dopN+=list(nns) | ||
if not c: | ||
elLabs.append(e.label) | ||
els=odb.rootAssembly.instances['BOCHKA_FULL-1'].ElementSetFromElementLabels(name='USIL-FAST', elementLabels=elLabs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import odbAccess | ||
import re | ||
import json | ||
pattern = re.compile(r'SOF(\d).*H(\d+)') | ||
odb=session.odbs.values()[0] | ||
step=odb.steps.values()[0] | ||
reactions = {} | ||
for hr in step.historyRegions.values(): | ||
for k, v in hr.historyOutputs.items(): | ||
search_rez = pattern.search(k) | ||
if not search_rez: | ||
continue | ||
dof, hole_number = search_rez.groups(0) | ||
hole_name = 'H{}'.format(hole_number) | ||
if not hole_name in reactions: | ||
reactions[hole_name] = [0,0,0] | ||
reactions[hole_name][int(dof)-1] = hr.historyOutputs[k].data[-1][-1] | ||
json.dump(reactions, open('bolts.json', 'w')) | ||
# hr=step.historyRegions.values()[0] | ||
# hr.historyOutputs.keys() | ||
# ho=hr.historyOutputs.values()[0] | ||
# ho.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import numpy as np | ||
import matplotlib.pylab as plt | ||
|
||
def readData(fname): | ||
f=open(fname, 'r') | ||
rez=[] | ||
for l in f: | ||
if 'Ifmax' in l: | ||
rez.append(float(l.split('=')[-1])) | ||
f.close() | ||
r1=[] | ||
for i in range(0, len(rez), 3): | ||
r1.append(max(rez[i],rez[i+1],rez[i+2])) | ||
return r1 | ||
sosudParts=['CYL-1', 'DNO_ROVING', 'DNO_TKAN-1', 'UBKA-1', 'USIL-1'] | ||
|
||
for i, part in enumerate(sosudParts): | ||
plt.figure() | ||
b1=readData(part+'-F.txt') | ||
if max(b1)>=1.0: | ||
mx = max(b1) | ||
print('Превышение', part, ' max=', mx) | ||
b1 = [bb/mx for bb in b1] | ||
plt.bar(range(1,len(b1)+1), b1, color='b') | ||
plt.grid() | ||
plt.xlabel('Номер слоя') | ||
plt.ylabel('F') | ||
plt.title(part) | ||
plt.gcf().savefig('gist-%s.png' % part, ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import json | ||
from math import sqrt | ||
import docx | ||
|
||
doc = docx.Document() | ||
|
||
fasteners = json.load(open('fasteners.json')) | ||
doc.add_paragraph('Расчет крепления бочки к раме') | ||
|
||
r = 20e-3/2. | ||
h = 30.2e-3 | ||
st=230e6 | ||
ssh=115e6 | ||
ssm_ub = 47.6e6 | ||
ssm_usil = 61e6 | ||
|
||
st_mean = fasteners['fn_mean']/3.14/r**2 | ||
ssh_mean = fasteners['fsh_mean']/3.14/r**2 | ||
ssm_mean = fasteners['fsh_mean']/2./r/h | ||
|
||
K_st_mean=st/st_mean | ||
K_ssh_mean=ssh/ssh_mean | ||
K_ssm_mean_ub=ssm_ub/ssm_mean | ||
K_ssm_mean_usil=ssm_usil/ssm_mean | ||
|
||
table = doc.add_table(rows=2, cols=6) | ||
table.rows[0].cells[0].text = 'нормальное усилие, Н' | ||
table.rows[0].cells[1].text = 'перерезывающее усилие, Н' | ||
table.rows[0].cells[2].text = 'коэффициент запаса на разрыв' | ||
table.rows[0].cells[3].text = 'коэффициент запаса на срез' | ||
table.rows[0].cells[4].text = 'коэффициент запаса на смятие (юбка)' | ||
table.rows[0].cells[5].text = 'коэффициент запаса на смятие (оправка юбки)' | ||
|
||
table.rows[1].cells[0].text = '{:.1f}'.format(fasteners['fn_mean']) | ||
table.rows[1].cells[1].text = '{:.1f}'.format(fasteners['fsh_mean']) | ||
table.rows[1].cells[2].text = '{:.1f}'.format(K_st_mean) | ||
table.rows[1].cells[3].text = '{:.1f}'.format(K_ssh_mean) | ||
table.rows[1].cells[4].text = '{:.1f}'.format(K_ssm_mean_ub) | ||
table.rows[1].cells[5].text = '{:.1f}'.format(K_ssm_mean_usil) | ||
|
||
|
||
|
||
bolts = json.load(open('bolts.json')) | ||
def rb(Hname): | ||
N = int(Hname[1:]) | ||
if 1<=N<=4: | ||
return 10e-3/2. | ||
else: | ||
return 22e-3/2. | ||
def direction(Hmane): | ||
N = int(Hname[1:]) | ||
if 1<=N<=4: | ||
return 1 | ||
elif 5<=N<=8: | ||
return 2 | ||
else: | ||
return 0 | ||
|
||
def sign(Hname): | ||
N = int(Hname[1:]) | ||
if N in [7, 8]: | ||
return -1 | ||
else: | ||
return 1 | ||
|
||
sb_n = 230e6 | ||
sb_sh = 115e6 | ||
|
||
doc.add_paragraph('Расчет болтовых соединений') | ||
table = doc.add_table(rows=21, cols=5) | ||
table.rows[0].cells[0].text = '№' | ||
table.rows[0].cells[1].text = 'нормальное усилие, Н' | ||
table.rows[0].cells[2].text = 'перерезывающее усилие, Н' | ||
table.rows[0].cells[3].text = 'коэффициент запаса на разрыв' | ||
table.rows[0].cells[4].text = 'коэффициент запаса на срез' | ||
NR = 1 | ||
for Hname in sorted(bolts.keys(), key= lambda item: int(item[1:])): | ||
NN = direction(Hname) | ||
SS = [0,1,2] | ||
SS.pop(NN) | ||
ffn=sign(Hname)*bolts[Hname][NN] | ||
ffsh = sqrt(bolts[Hname][SS[0]]**2+bolts[Hname][SS[1]]**2) | ||
ssn = ffn/rb(Hname)**2/3.14 | ||
sssh = ffsh/rb(Hname)**2/3.14 | ||
Kn = sb_n/ssn if ffn>0 else 0 | ||
Ksh = sb_sh/sssh | ||
table.rows[NR].cells[0].text = Hname | ||
table.rows[NR].cells[1].text = '{:.1f}'.format(ffn) | ||
table.rows[NR].cells[2].text = '{:.1f}'.format(ffsh) | ||
table.rows[NR].cells[3].text = '{:.1f}'.format(Kn) | ||
table.rows[NR].cells[4].text = '{:.1f}'.format(Ksh) | ||
|
||
NR+=1 | ||
|
||
doc.save('1.docx') |
Oops, something went wrong.