Hi,
I've been given this V.B.A. problem after about two and a half weeks introduction to programming [6 weeks prior of excel]. It really has thrown me and any help would be appreciated. I have a basic pseudocode answer to it and started trying out some code for it. Who knows it may actually be a fun problem to grapple over THANK YOU in advance!
Here is the link for the problem: http://mahler.orchestra.cse.unsw.edu.au/webcms2/course/index.php?cid=2133
------------------------------- and then go to Assignment 1 on the tree [lhs]
Here is my pseudocode:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> Pseudo code answer
For columns c and d from row 12 onwards
Column c = time for the plane to reach the corresponding distance in column a.
Found by using the speed and difference in distance. Time=delta distance/s
Column d = altitude at the corresponding column c time.
aircraft altitude = (5000-previous altitude)*(speed*delta time)
If altitude < elevation of terrain [column b] = plane has crashed
Possibly a message box to state this and no more values should be written to the sheet i.e. If altitude < elevation of terrain “”
If the runway is reached without crashing, calculate the height of the aircraft above the ground.
If this value is <= VBA constant SAFE_LANDING_HEIGHT = “landed” in B8 [flight termination cell].
Distance from runway = 0, aircraft altitude <= elevation of terrain
If the value is > VBA constant SAFE_LANDING_HEIGHT = “Overshot” in B8 [flight termination cell]
If it doesn’t reach the runway write “Crashed”. Distance from runway <> 0
LOOP STATEMENTS --- DATA CHECKS
If >= 1 of these conditions is false - Write a message to state this in B9
If =3 are true à leave cell B9 blank
ALGORITHM
The time calculation [column c] - see above
Altitude Calculation
Depends on knowing - glide angle / rate of descent & airspeed
Decide which is best
Convert the FCU value if the mode is different.
Thereafter - process the data until either the end of the data / crash occurs.
I've been given this V.B.A. problem after about two and a half weeks introduction to programming [6 weeks prior of excel]. It really has thrown me and any help would be appreciated. I have a basic pseudocode answer to it and started trying out some code for it. Who knows it may actually be a fun problem to grapple over THANK YOU in advance!
Here is the link for the problem: http://mahler.orchestra.cse.unsw.edu.au/webcms2/course/index.php?cid=2133
------------------------------- and then go to Assignment 1 on the tree [lhs]
Here is my pseudocode:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> Pseudo code answer
For columns c and d from row 12 onwards
Column c = time
Found by using the speed and difference in distance. Time=delta distance/s
Column d = altitude at the corresponding column c time.
aircraft altitude = (5000-previous altitude)*(speed*delta time)
If altitude < elevation of terrain [column b] = plane has crashed
Possibly a message box to state this and no more values should be written to the sheet i.e. If altitude < elevation of terrain “”
If the runway is reached without crashing, calculate the height of the aircraft above the ground.
If this value is <= VBA constant SAFE_LANDING_HEIGHT = “landed” in B8 [flight termination cell].
Distance from runway = 0, aircraft altitude <= elevation of terrain
If the value is > VBA constant SAFE_LANDING_HEIGHT = “Overshot” in B8 [flight termination cell]
If it doesn’t reach the runway write “Crashed”. Distance from runway <> 0
LOOP STATEMENTS --- DATA CHECKS
- Airspeed > 0
- Altitude<sub>0</sub> > (Elevation of terrain) <sub>0</sub>
- FCU value > 0 [B6] [> 0 = descent]
If >= 1 of these conditions is false - Write a message to state this in B9
If =3 are true à leave cell B9 blank
ALGORITHM
The time calculation [column c] - see above
Altitude Calculation
Depends on knowing - glide angle / rate of descent & airspeed
Decide which is best
Convert the FCU value if the mode is different.
Thereafter - process the data until either the end of the data / crash occurs.