C Water Tank Pump Simulator

via Freelancer ·

Budget / Salary£10–20
TypeFreelance project
LocationRemote
Posted2 hours ago
Code requirements:
Write the program in C using only techniques covered in Lectures 1–4: variables, arithmetic,
conditional statements, loops, and formatted console input/output. Do not use arrays, strings,
structures, files or user-defined functions.
Reject invalid section counts, invalid material selections, and non-positive forces, lengths or
diameters. When an invalid value is entered, ask for that value again before proceeding.
Hint: The results for each section may be displayed as they are calculated. Store only the
running totals and the minimum factor of safety, rather than all section data.
Exercise B –20 Marks
Water Storage and Pump Control Simulation
Write a C program that simulates a 100 m³ water tank supplying an industrial facility.
Compare three independent pump operating strategies using hourly calculations over 1 to 3
days.
Water balance
Vnew = Vold + Vin + Vpump − Vdemand
V is stored water volume (m³). Natural inflow is constant at 2 m³/hour; the electrically
powered pump supplies 8 m³/hour when on and consumes 3 kW. The facility uses 5 m³/hour
between 07:00 and 21:59, and 3 m³/hour between 22:00 and 06:59. Each time step is one
hour, so the hourly transferred volume in m³ equals the numerical flow rate in m³/hour. An
operating pump uses 3 kWh in one hour.
If the calculated volume exceeds 100 m³, record the excess as overflow and set stored water
to 100 m³. If it is below 0 m³, record the deficit as unmet demand and set stored water to 0
m³. Track these two quantities separately for each strategy.
Pump control strategies
Strategy 1: Pump runs continuously.
Strategy 2: Pump runs if the volume at the BEGINNING of the hour is below 50 m³;
otherwise it remains off.
Strategy 3: Pump runs during 22:00–06:59. Outside these times, it runs only if the volume at
the BEGINNING of the hour is below 20 m³.
Determine the pump state at the beginning of each hour and keep it unchanged throughout
that hour. The first interval is 00:00–00:59. Calculate the final volume and any overflow or
unmet demand at the end of each hour.
Program requirements
1. Request the initial tank volume (0–100 m³) and the number of simulation days (1–3),
rejecting and re-requesting invalid values.
2. Initialise three separate tanks to the same initial volume. Use a single hourly loop to
update all three strategies, determining the time of day and demand for each hour.
3. For each strategy, decide whether to run the pump, calculate the updated volume, apply
the 0 and 100 m³ limits and accumulate overflow, unmet demand, operating hours and
electricity consumption.
4. For every hour, print the hour number, starting clock time and the stored volume for each
of the three strategies in a side-by-side table.
5. After all hours, show the final volume, total overflow, unmet demand, pump operating
hours and energy consumed for each strategy. Identify a strategy having the lowest
energy consumption (ties may be resolved arbitrarily).
6. Ask whether another simulation is required (1 = yes, 0 = no).
Comment and explain any loop conditions in your code using binary maths.Structure it vertically
Example of the first five hours
For initial water volume 35.00 m³:
Hour | Time | Strategy 1 | Strategy 2 | Strategy 3
1 | 00:00 | 42.00 | 42.00 | 42.00
2 | 01:00 | 49.00 | 49.00 | 49.00
3 | 02:00 | 56.00 | 56.00 | 56.00
4 | 03:00 | 63.00 | 55.00 | 63.00
5 | 04:00 | 70.00 | 54.00 | 70.00
For the final summary: display one row for each quantity and columns for Strategy 1,
Strategy 2 and Strategy 3.
Use C console programming techniques from Lectures 1–4 only.
Hints:
Use separate volume, energy, overflow and unmet-demand variables for each strategy. Name these Vst1o ld Vst2old Vs t3old.
The remainder operator (%) can be used to find the hour of the day. You shou ld overwrite the values
c programming python
Apply on Freelancer →

Project sourced from Freelancer.com. Applications happen directly on the original platform — we never collect your data.