Since I am still not totally sure how a compressed air (CA) fix could work, I want to discuss the algorithm BEFORE starting to program. This prevents me from wasting a lot of time: My idea for the fix (correct me if I am wrong):
Definition: dCA is the little amount of CA that is consumed for every depth change into surface direction.
1) The only affected dial is the depth gauge.
2) When a depth change via the depth gauge is ordered, do the following:
Check if ordered depth < current depth.
If no: Change depth
If yes:
Ckeck if speed <= 2kt
If no: Change depth
If yes:
Check if CA > dCA (is CA supply enough?)
If no: Ignore the change depth command.
If yes:
Calculate CA := CA - dCA (Subtract little amount dCA amount from CA supply)
AND
Change depth.
Is this okay?
|