Calculating Bridge Condition Scores
Background
Several months ago, the Texas Department of Transportation (TxDOT) released a report on the condition of every bridge in Texas. Some UT community memberswere concerned because a bridge on campus, the Moody pedestrian walkway, got a bridge rating score of 47.4 out of 100.
Normally, this low of a score means that the bridge is in a dangerous condition, and is about to collapse. However, the Moody bridge is very new (built in 2016) and should not be in this bad of a condition. Did an engineer somewhere do their job wrong, or is something else going on with the bridge ratings?
In order to find out, I wrote a simple Python program which would calculate the bridge rating, and then tried a few numbers to see what might be causing the low score. You will do a similar thing in this assignment.
Useful functions in Python
The following functions in Python may be useful to you in this assignment. You are not required to use them.
round(x,n)
: rounds x to n decimal places.min(x1,x2,...)
: returns the smallest value of all its arguments. Unlike most functions we have seen so far,min
takes any number of argumentsmax(x1,x2,...)
: same as min, but returns the largest value.x ** y
: computes x to the power of y. Note thatx ^ y
does not work in Python. Instead of calculating numerical power, it computes something know as the "exclusive-or" of its two inputs. You will need to do some translating between mathematical notation of power (^
) and the Python notation of power (**
).
Assignment
In this assignment, you will write a Python script that calculates the bridge sufficiency rating for a given structure. You will then use this script to determine what the cause of the low structure rating of the Moody bridge is.
A bridge sufficiency rating is split into three parts: structural adequacy, which is worth 55 points, serviceability, which is worth 30 points, and essentiality, which is worth 15 points. Adding all three subsections together gives a final score, which can be 100 points at most.
Calculating Structural Adequacy
Structural adequacy is calculated by finding the penalties A
and B
and subtracting them
from the maximum score of 55. Use the following rules for A
and B
:
- Calculate
A
by the following rules:- Find the lowest value of the superstructure rating (
SUPER_RTNG
), the substructure rating (SUB_RTNG
), and the culvert rating (CULV_RTNG
). - If this lowest value is 2 or lower, then
A
is 55. - If this lowest value is 3, then
A
is 40. - If this lowest value is 4, then
A
is 25. - If this lowest value is 5, then
A
is 10. - Otherwise,
A
is zero.
- Find the lowest value of the superstructure rating (
- Calculate
B
by the following rules:- If the Inventory Rating (
INV_RTNG
) of the bridge is greater than 32.4 tons,B
is zero. - Otherwise,
B
is (32.4 - Inventory Rating) ^ 1.5 * 0.3254
- If the Inventory Rating (
To calculate the final structural adequacy rating, use the formula 55 - (A + B)
. The structural adequacy
rating must not be less than zero or greater than 55. If it is outside these boundaries, set it to the closer
boundary (e.g. if it is 65, set it to 55).
Calculating Serviceability
Serviceability is calculated using a similar method to above: finding penalties J
, G
, and
I
and subtracting them from the maximum score of 30:
- For each of the following categories, add 4 to
J
if it is less than four, add 2 toJ
if it is equal to 4, and add 1 toJ
if it is equal to 5. Do not add anything toJ
if the value is greater than 5:- Deck Condition (
DECK_RTNG
) - Structural Evaluation (
STRUCT_EVAL
) - Deck Geometry (
DECK_GEOM
) After this step, make sureJ
is between 0 and 12.
- Deck Condition (
- The roadway width calculation,
G
, is very tricky to compute. For the purposes of this homework, assumeG
is always zero. - The vertical clearance penalty
I
cannot be computed for most bridges on campus. You may assume it is always 1.
Use the formula 30 - (J + G + I)
. Like with the structural adequacy rating, you should clamp this value
between 0 and 30.
Calculating Essentiality
This homework is long enough. Assume the essentiality score for a bridge is always its maximum value of 15.
Final Score
To find the final score of a bridge, add together its structural adequacy, serviceability, and essentiality scores.
You should print this out in a message, e.g. "The score of this bridge is 94.3". Print the scores out to some
reasonable number of significant figures (e.g. you should not print out ten digits after the decimal point). You may
find the function round()
useful for this.
Input Values
You may use the following input values for your code:
# These are the scores for the Moody Pedestrian Bridge, out of a max of 10.
SUPER_RTNG = 9
SUB_RTNG = 8
CULV_RTNG = 10
INV_RTNG = 10.0
DECK_RTNG = 9
STRUCT_EVAL = 3
DECK_GEOM = 6
Make sure to try several values to make sure they all make sense! For example, if any of your sub-part scores go below zero for any values, you probably have an error in your code.
Insight
Try changing the ratings of the superstructure and substructure (SUPER_RTNG
and SUB_RTNG
)
to see whether improving them improves the score of the bridge.
Now try increasing the inventory rating (INV_RTNG
) and see whether this improves the score of the
bridge. What happens when you double it? Triple it?
Keep in mind that the inventory rating is a measure of how much weight (in tons) the bridge is designed to bear at one time. Considering this is a pedestrian bridge, should we be worried about the low bridge rating score?
Submission
Submit a single file named Bridge.py
(pay attention to capitalization!) on Canvas. Your file needs to
compile and run. It should also have a header with the following information (this goes in your source file, not in
the program output):
# File: Bridge.py
# Student:
# Course: CS303E
#
# Date:
# Description of Program:
# Describe how much changing `SUPER_RTNG` and `SUB_RTNG` changes the bridge score
# Describe how much changing the `INV_RTNG` changes the bridge score.
The description should be a short (1-3 sentence) description of what the program does. Do not describe how it's written! (Think back to HW 0 to see the difference). Similarly, the two sections after this should also be short.
Make sure to include comments that explain what the code is doing, at at level such that someone who is not 100% familiar with this process could work out what the code is trying to do.