Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Conversation

@om-deshmukh-dev
Copy link
Member

Summary

This is the first implementation of the propulsion model. Given the current state, the propulsion model outputs an average force outputted by the cubesat since the last prop model call.

This PR addresses Jira ticket CISLUNAR-445

Testing

Testing of the calculations & formulas was done by hand and in matlab, however actual test cases have yet to be implemented as we don't have propulsion data to compare against. In a future pull request, I will include test cases to ensure values are within reasonable ranges.

Notes

State variables in this iteration are updated by the integrator.

Comments

  • Add an x between the brackets if you commented your code well!

Copy link
Member

@tmf97 tmf97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty dang good! Didn't have the chance to dive into the "meat" of the evaluate step yet - will try to get to that tonight.

Please fix the failing unit test.

Comment on lines +34 to +47
d = 3 * 0.0254 # (m)
h = (3.968 + 1.618) * 0.0254 # (m)
d2 = 0.05 * 0.0254 # (m)
#d2mm = d2 * 1000
d3 = 0.305 * 0.0254 # (m)
#A1 = np.pi * d ** 2 / 4 #Cross-sectional area of the nozzle throat (m^2)
A2 = np.pi * d2 ** 2 / 4 #Cross-sectional area of the nozzle exit (m^2)
A3 = np.pi * d3 ** 2 / 4 # Cross-sectional area of the combustion chamber (m^2)
vc = h * np.pi * d ** 2 / 4
plim1 = 45 * 6894.76 # Pascals
plim2 = 100 * 6894.76 # Pascals
#RH2 = 4.124e3 # J/kg*K
#RO2 = 0.2598e3 # J/kg*K
RH2O = 0.4615e3 # J/kg*K
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are any of these values look like system parameters rather than a state the needs to be propagated as part of the sim. Please put all numerical parameters into parameters.py, update the parameters in the config JSONs, and get the values here with self.parameters...

For fundamental physical/chemical constants, we might want to make a constants.py file or something and import it here.

gamma = CpH2O / CvH2O # Ratio of specific heats for water vapor
calc = (gamma + 1) / (2 * (gamma - 1))
arearatio = A2 / A3
int = arearatio * 1 / ((1 + (gamma - 1) / 2) ** calc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't overwrite the standard python int

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha my bad I was trying to write a shorthand for intermediate and choose int. I'll fix that

a = np.sqrt(gamma * RH2O * T3) #Local speed of sound
v_eq = M3*a*np.sqrt(gamma*RH2O*T3) #Equivalent velocity
F = mdot * v_eq #Array storing force at each dt time interval
Pc = P[-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please use more descriptive variable names. chamber_pressure_in_pascals or chamber_pressure is clunkier but more understandable that Pc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update, thanks


force_propulsion_thrusters: float = 0.0
fuel_mass: float = 0.0
dry_mass: float = 0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we/are there plans to do anything with the dry_mass state?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be useful for the integrator when updating the position, velocity, and angular velocity to know the current mass of the cubesat (dry mass + fuel mass)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. The reason I asked is because the dry mass of the spacecraft really should not change throughout the mission (unless you're simulating some truly bizarre mission cases, like having a micrometeoroid cleave off some of the spacecraft's brackets) so having it in state.py seemed a bit strange to me at first since every variable in there is constantly changing. However, even if it's not changing, the dry mass is still a fundamental state of the system so I think it should stay here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants