spaceconcordia / rocketry-performance

2 stars 1 forks source link

ISA_Model function returning strange values #11

Closed SpaceShawn closed 8 years ago

SpaceShawn commented 8 years ago

The ISAModel function is returning negative values for Kinematic Viscosity, and increasing values for absolute viscosity when altitude is increasing

atmosphere_plot

Please have a look at this, I can help you run the model to produce more output, or setup a unit test to test this model in particular

neil1993 commented 8 years ago

I've gone over the model and everything seems to be working correctly. It's possible that either the units of the inputs are wrong or the inputs are being used incorrectly. Can you show me which module or modules are passing the data into this function?

SpaceShawn commented 8 years ago

The ISA Model output above was generated by the VerticalFlight_TestModel

To make testing easier I updated a test model just for ISA: ISAModel_TestModel.slx. It includes a built-in ISA model to compare to - temperature, pressure, and density, but unfortunately not for viscosity (otherwise I would be using it already)

The starting conditions are:

To run it, make sure you have the latest version of this repository, and that the rocketry-performance directory and all its subdirectories are added to your path. Then just run the script from the command line

ISAModel_TestModel
sim('ISAModel_TestModel')

You can view the output in the scopes, or plot them in Matlab, as I did below isa_test You can see that the kinematic and absolute viscosity give negative values, and that the other values don't seem to make much sense.

neil1993 commented 8 years ago

I took another look at the model that I put up on Github. I tried using your test model, but it wasn't working for me (stuff about unresolved links, etc.). So I just took the .m file and ran it with a script that inserted the starting conditions and a vehicle altitude that incremented from 1 to 4000. I got the following results:

image image image image

Bearing in mind that you had run your test with ISA standard conditions, I redid the test with those and obtained the following results:

image image image image

Hope that helps

SpaceShawn commented 8 years ago

Thanks for the quick response

The test model I provided simply provides a ramp function to increase altitude, and provide the starting conditions, nothing fancy. Did you add the rocketry-performance folder recursively to your Matlab path?

Your graphs look like they were plotted in excel, was the script logic in the matlab file run to produce this?

SpaceShawn commented 8 years ago

Your output does look a lot nicer, can you provide it so I can verify? You can commit it anywhere in the repo or just place as an attachment to the issue

Thanks

SpaceShawn commented 8 years ago

As we discussed, it would be really useful to compare the ISA model to experimental data.

Here are some links where altitude data is available:

http://weather.uwyo.edu/upperair/

Particularly useful, sounding measurements using (I believe) balloons: http://weather.uwyo.edu/upperair/sounding.html

Attached is a recent plot of pressure, density, temperature, and viscosity as a function of altitude.

atmosphere_v_altitude_plot