Skip to content

Conversation

bradNASA
Copy link
Contributor

@bradNASA bradNASA commented Nov 19, 2024

This PR adds linear resources and a config option to switch between linear vs discrete resources. It also allows for plans to start before spice data is available by returning a value at a valid time in the future by default. There are also some unrelated improvements to PointingActivity.

Linear resources are computed from approximations on Unstructured, time-based resources.

Linear resources are yet slow because they are not reusing past computations where they could. This is because approximations are on Double values and not Vector3D, which are often the preferred data structure for things like angle calculations. So, some refactoring is needed to speed this up.

Consider also adding sample-based approximations in addition to the existing secant/error-based approximations.

…bleResource

- Convert from 3 separate fields (discrete, linear, unstructured) to single DoubleResource
- Maintain backward compatibility through updated getter methods
- Clean up field declarations and initialization
- All tests passing
- Remove IlluminationAnglesByBody_p, EarthRaDecByBody_p, EarthRaDeltaWithSCByBody_p
- Remove BodySubSolarPoint_p, BodySubSCPoint_p, orbitInclinationByBody_p, orbitPeriodByBody_p
- These fields were never populated with data and served no purpose
- Keep only fields that are actually used (SpacecraftBodyRange_p, SpacecraftBodySpeed_p, SpacecraftAltitude_p)
- Significantly cleaner code with no dead code
- All tests passing
- Convert 8 fields to local variables (bodyPositionAndVelocityWRTSpacecraft_u/a,
  sunPositionAndVelocityWRTBody_u/a, bodyPositionAndVelocityWRTEarth_u/a,
  BODY_POS_ICRF_u/a, BODY_VEL_ICRF_u/a, SpacecraftBodyRange_p,
  SpacecraftBodySpeed_p, SpacecraftAltitude_p)
- Remove 20+ unused getter methods (_u and _p variants)
- Improve code quality: method references, better generics, Collections.addAll
- Remove commented-out dead code
- Maintain backward compatibility for all active functionality
- Significantly cleaner architecture with better separation of concerns
- All tests passing
- Convert SpacecraftBodyRange, SpacecraftBodySpeed, SpacecraftAltitude, BodyHalfAngleSize, and BetaAngleByBody to use DoubleResource
- Implement proper linear resources using Unstructured.timeBased() + maybeApproximateAsLinear() pattern
- Add time-based calculation methods to GenericGeometryCalculator
- Create helper methods to eliminate code duplication
- Organize related methods together in GenericGeometryCalculator
- Update GenericGeometryCalculator to use .discrete() accessors
- Fix test to use .discrete() accessor for DoubleResource
- Convert all remaining resources to use DoubleResource with proper linear resources
- Add time-based computation methods to GenericGeometryCalculator for all resources
- Implement Unstructured.timeBased() + maybeApproximateAsLinear() pattern for all resources
- Refactor all discrete calculations to use time-based methods, eliminating code duplication
- Update GenericGeometryCalculator to use .discrete() accessors consistently
- Fix test to use .discrete() accessor for DoubleResource
- All tests passing successfully
- Convert BodySubSCPoint to use DoubleResource (Map<String, Map<String, DoubleResource>>)
- Create SubSCPointData record to hold all subSC values in one place
- Implement time-based helper functions in GenericGeometryCalculator
- Eliminate redundant SPICE calls: single getSubPointInformation() per body instead of 5
- Complete linear resource pattern: discrete -> unstructured -> linear -> DoubleResource
- Use register_p() for proper resource registration with appropriate units
- Convert SubSCPointData to Java record for cleaner, more modern code
- Maintain backward compatibility with existing API
- 80% reduction in SPICE calls for subSC point calculations
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant