For the safety of the workers and the protection of the equipment in a water tre
ID: 3727737 • Letter: F
Question
For the safety of the workers and the protection of the equipment in a water treatment facility, you want to develop a computer program that can determine whether operations are within safe limits or whether a potential shutdown is necessary to prevent catastrophic failures. The facility has a water level gauge, a pressure gauge and a thermometer installed to monitor the key operating conditions.
Write a MATLAB script incorporating IF-ELSE statements or IF-ELSEIF-ELSE statements that asks the user to enter the water level as measured by the fluid level gauge (in feet), the measured pressure in psi (pounds per square inch), and the temperature measured in degrees Fahrenheit. MATLAB must then use the entered inputs to determine whether any safety limits are violated. If a safety limit is violated, then MATLAB must display a specific message (see below) warning the user that a shutdown is necessary. Shutdown is recommended if any of the following combinations of conditions is satisfied:
• Fluid level exceeds 30 feet regardless of pressure and temperature (display message: “Fluid level is too high”)
• Pressure exceeds 175 psi regardless of fluid level and temperature (display message: “Pressure exceeding safe limits”)
• Temperature exceeds 200 degrees Fahrenheit regardless of fluid level and pressure (display message: “Temperature exceeding safe limits”)
• Fluid level exceeds 10 feet, pressure exceeds 100 psi, and temperature exceeds 130 degrees Fahrenheit (display message: “Tri-combo limit exceeded”) • Fluid level exceeds 20 feet and pressure exceeds 12 0 psi (display message: “Overflow risk”)
• Pressure exceeds 125 psi and temperature exceeds 150 degrees Fahrenheit (display message: “Pipe rupture risk”)
For all other cases, the facility is operating within safe limits and the computer should display the message “Operating within safe limits”.
Explanation / Answer
MATLAB code:
% input water level
waterLevel = input(" Enter the water level as measured by the fluid level gauge (in feet): ");
% input pressure
pressure = input(" Enter the measured pressure in psi (pounds per square inch): ");
% input temperature
temperature = input(" Enter the temperature measured in degrees Fahrenheit: ");
% Water Level exceeds 50 feet
if(waterLevel > 50)
% Printing error message
fprintf(" Fluid level is too high ");
% Pressure exceeds 250 psi
elseif(pressure > 250)
% Printing error message
fprintf(" Pressure exceeding safe limits ");
% Temperature exceeds 600 degrees Fahrenheit
elseif(temperature > 600)
% Printing error message
fprintf(" Temperature exceeding safe limits ");
% Fluid level exceeds 10 feet, pressure exceeds 100 psi and temperature exceeds 130 degrees Fahrenheit
elseif(waterLevel > 10 && pressure > 100 && temperature > 130)
% Printing error message
fprintf(" Tri-combo limit exceeded ");
% Fluid level exceeds 20 feet and pressure exceeds 120 psi
elseif(waterLevel > 20 && pressure > 120)
% Printing error message
fprintf(" Overflow risk ");
% Pressure exceeds 125 psi and temperature exceeds 150 degrees Fahrenheit
elseif(pressure > 125 && temperature > 150)
% Printing error message
fprintf(" Pipe rupture risk ");
% All other cases
else
% Printing message
fprintf(" Operating within safe limits ");
endif
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.