-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathSDRlimitTester.tcl
107 lines (91 loc) · 3.78 KB
/
SDRlimitTester.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# SDRlimitTester ########################################################################
#
# Procedure that checks if the Pre-Specified Collapse Drift Limit is reached and Generate
# a Flag
#
# Developed by Dimitrios G. Lignos, Ph.D
# Modified by Ahmed Elkady, Ph.D
#
# First Created: 04/20/2010
# Last Modified: 05/05/2020
#
# #######################################################################################
proc SDRlimitTester {numStories SDRlimit MFFloorNodes EGFFloorNodes h1 htyp TraceGFDrift} {
global CollapseFlag
set CollapseFlag "NO"
# set x [clock seconds];
# set RunTime [expr $x - $StartTime];
# Read the Floor Node Displacements and Deduce the Story Drift Ratio
for {set i 0} {$i<=$numStories-1} {incr i} {
if { $i==0 } {
set Node [lindex $MFFloorNodes $i]
set NodeDisplI [nodeDisp $Node 1]
set SDR_MF [expr $NodeDisplI/$h1]
lappend SMFDrift [list $SDR_MF]
# Addition by Ahmed Elkady 14 Dec 2016 for Tracing Drifts in EGF
if { $TraceGFDrift == 1} {
set Node [lindex $EGFFloorNodes $i]
set NodeDisplI [nodeDisp $Node 1]
set SDR_EGF [expr $NodeDisplI/$h1]
lappend GFDrift [list $SDR_EGF]
}
} elseif { $i > 0 } {
set NodeI [lindex $MFFloorNodes $i]
set NodeDisplI [nodeDisp $NodeI 1]
set NodeJ [lindex $MFFloorNodes [expr $i-1]]
set NodeDisplJ [nodeDisp $NodeJ 1]
set SDR_MF [expr ($NodeDisplI - $NodeDisplJ)/$htyp]
lappend SMFDrift [list $SDR_MF]
# Addition by Ahmed Elkady 14 Dec 2016 for Tracing Drifts in EGF
if { $TraceGFDrift == 1} {
set NodeI [lindex $EGFFloorNodes $i]
set NodeDisplI [nodeDisp $NodeI 1]
set NodeJ [lindex $EGFFloorNodes [expr $i-1]]
set NodeDisplJ [nodeDisp $NodeJ 1]
set SDR_EGF [expr ($NodeDisplI - $NodeDisplJ)/$htyp]
lappend GFDrift [list $SDR_EGF]
}
}
}
# Check if any Story Drift Ratio Exceeded the Drift Limit
for {set i 0} {$i <= $numStories-1} {incr i} {
set SMFTDrift [ lindex $SMFDrift [expr $i] ]
set SMFTDrift [expr abs($SMFTDrift)]
# Addition by Ahmed Elkady 14 Dec 2016 for Tracing Drifts in EGF
if { $TraceGFDrift == 1} {
set GFTDrift [ lindex $GFDrift [expr $i] ]
set GFTDrift [expr abs($GFTDrift)]
}
#set filename "CollapsedFrame.txt"
# IF the Story Drift Ratio at Current Story is Less than the Drift Limit then
# Open a file named "CollapsedFrame.txt" and write a value of "0" for no collapse
if {$SMFTDrift < $SDRlimit && $GFTDrift < $SDRlimit} {
set fileID2 [open CollapsedFrame.txt w]; # Create/Open CollapsedFrame.txt file (writing permission)
puts -nonewline $fileID2 0; # Write value of 0 in case of no collapse
close $fileID2;
}
# If Drift Limit was exceeded in MF
if {$SMFTDrift > $SDRlimit} {
puts "MF Collapse"
set fileID2 [open CollapsedFrame.txt w]; # Create/Open CollapsedFrame.txt file (writing permission)
puts -nonewline $fileID2 1; # Write value of 1 in case of collapse in SMF
close $fileID2;
}
# If Drift Limit was exceeded in EGF
if {$GFTDrift > $SDRlimit} {
puts "GF Collapse"
set fileID2 [open CollapsedFrame.txt w]; # Create/Open CollapsedFrame.txt file (writing permission)
puts -nonewline $fileID2 2; # Write value of 2 in case of collapse in GF
close $fileID2;
}
# If Drift Limit was exceeded in both MF and EGF
if { $SMFTDrift > $SDRlimit || $GFTDrift > $SDRlimit} {
set CollapseFlag "YES"
puts "Collapse"
# Addition by Ahmed Elkady 25 July 2012 for Tracing the Collapse Point
set fileID [open CollapseState.txt w]; # Create/Open CollapseState.txt file (writing permission)
puts -nonewline $fileID 1; # Write value of 1 in case of collapse in CollapseState.txt file (
close $fileID; # Close CollapseState.txt file
}
}
}