Hi, I'm currently working on a project within MATLAB that involves the altitude adjustment of a balloon within Venus' atmosphere. In actuality this program would be taking inputs from a BME280 sensor, however, we do not have access to one physically so the program currently runs off user inputs and allows for manual or automatic altitude adjustment. It is a very simple program that adjusts the balloons altitude depending on the desired altitude range. However, I would like to add options to ascend the balloon and descend the balloon at a certain rate. I'd like implement a rate of ascent of 1000 feet per minute (I pulled this rate from NASA weather balloon speeds). I've attached the program below. Also I'm a freshman in college and honestly have no idea how to approach this step of my program so any help is appreciated. This is also my first post so let me now if more information is needed.
% Altitude Adjustment Program %
% Unit for altitude inputs is in kilometers (km)
althigh = input('Please enter the highest desired altitude:\n');
altlow = input('Please enter the lowest desired altitude:\n');
altnow = input('Please enter the current altitude:\n');
% Automatic altitude adjustment is performed according to the mean of the highest desired altitude and lowest desired altitude
% Manual altitude adjustment is performed according to user input
if altnow > altlow && altnow <althigh
fprintf('Balloon is within desired altitude range, no adjustments will be made.\n');
end
if altnow < altlow || altnow > althigh
mode = input('Balloon is outside of desired altitude range, please input whether adjustments should be made manually (1) or automatically (2)\n');
end
if mode == 1
fprintf('Manual altitude adjustment has been chosen.\n');
altnow = input('Please enter a desired altitude:\n');
fprintf('Adjustments have been made, the balloons altitude is now %.2fkm\n', altnow);
elseif mode == 2 && altnow < altlow
fprintf('Automatic altitude adjustment has been chosen.\n');
fprintf('Balloon is below desired altitude range, adjustments will be made.\n');
altnow = altnow+((altlow+althigh)/2)-altnow;
fprintf('Adjustments have been made, balloon is now within desired altitude range.\n');
elseif mode == 2 && altnow > althigh
fprintf('Automatic altitude adjustment has been chosen.\n');
fprintf('Balloon is above desired altitude range, adjustments will be made.\n');
altnow = altnow-(altnow-(altlow+althigh)/2);
fprintf('Adjustments have been made, balloon is now within desired altitude range.\n');
end
% Future changes:
% Find rate of ascent and descent
% Add ascent and descent (from ground and to ground) options
% Add error messages
% Look into adding RNG values to current altitude to help simulate atmospheric changes that may affect the balloons altitude.