Submarines float or sink by increasing or decreasing the air in their ballast tanks. These tanks have valves that allow them to fill with water, increasing the overall weight of the submarine and causing it to sink. The valves fill the ballast with compressed air to surface.
The ballast tanks are located between the inner and outer hull of the submarine. Increasing or decreasing the air in these tanks affects the vessel's buoyancy. Increasing the air in the tank gives the submarine positive buoyancy and makes it less dense, so it rises to the surface. Increasing the water in the ballast tank makes it more dense, giving it a negative buoyancy and causes it to sink. In an emergency, the ballast tanks have the ability to fill rapidly with air, causing the vessel to surface quickly.
The submarine has two additional water tanks, one at the front and one at the rear. These trim tanks help to keep the vessel level during operation. As supplies and fuel are used, the operators change the amount of water in these tanks continually to maintain the trim. The planes of the submarine are horizontal rudders that help the vessel to change its level in the water while it is moving. Rudders control the movement of the unit to the left or right.