Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linear resources #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ repositories {
}
}

tasks.named('test') {
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
minHeapSize = "512m" // initial heap size
maxHeapSize = "8g" // maximum heap size
}

def aerieVersion = "2.16.0" // getAerieVersion()
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
DEFAULT_JVM_OPTS='"-Xmx3g" "-Xms1g"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set APP_HOME=%DIRNAME%
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
set DEFAULT_JVM_OPTS="-Xmx3g" "-Xms1g"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/missionmodel/AbsoluteClock.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class AbsoluteClock {

private Instant startTime;
public Instant startTime;

public AbsoluteClock(final Instant startTime) {
this.startTime = startTime;
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/missionmodel/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ public record Configuration(int spacecraftId,
Path geometryPath,
List<Double> gncAngularVelocityLimit,
List<Double> gncAngularAccelerationLimit,
boolean gncRateMatching
boolean gncRateMatching,
boolean useLinearResources
) {
public static int DEFAULT_SPICE_SCID = -74;
public static String DEFAULT_SPICE_SCID_STR = "MRO";
public static Path DEFAULT_GEOM_PATH = Path.of("src/test/resources/default_geometry_config.json");
public static List<Double> ANGULAR_VELOCITY_LIMIT = List.of(5e-4, 5e-4, 5e-4);
public static List<Double> ANGULAR_VELOCITY_LIMIT = List.of(1e-3, 1e-3, 1e-3);
public static List<Double> ANGULAR_ACCELERATION_LIMIT = List.of(5e-6, 5e-6, 5e-6);
public static boolean DEFAULT_GNC_RATE_MATCHING = false;
public static boolean DEFAULT_USE_LINEAR_RESOURCES = false;
public static @Template Configuration defaultConfiguration() {
return new Configuration(DEFAULT_SPICE_SCID, DEFAULT_SPICE_SCID_STR, DEFAULT_GEOM_PATH,
ANGULAR_VELOCITY_LIMIT, ANGULAR_ACCELERATION_LIMIT, false);
ANGULAR_VELOCITY_LIMIT, ANGULAR_ACCELERATION_LIMIT, DEFAULT_GNC_RATE_MATCHING, DEFAULT_USE_LINEAR_RESOURCES);
}
public static @Template Configuration linearConfiguration() {
return new Configuration(DEFAULT_SPICE_SCID, DEFAULT_SPICE_SCID_STR, DEFAULT_GEOM_PATH,
ANGULAR_VELOCITY_LIMIT, ANGULAR_ACCELERATION_LIMIT, DEFAULT_GNC_RATE_MATCHING, true);
}
}
13 changes: 8 additions & 5 deletions src/main/java/missionmodel/Mission.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.nio.file.Path;
import java.time.Instant;
import java.util.Optional;

/**
* Top-level Mission Model Class
Expand All @@ -23,7 +24,7 @@ public final class Mission {
public final Configuration configuration;

// Special registrar class that handles simulation errors via auto-generated resources
public final Registrar errorRegistrar;
public final Registrar registrar;

public final AbsoluteClock absoluteClock;

Expand All @@ -46,7 +47,7 @@ public final class Mission {

public Mission(final gov.nasa.jpl.aerie.merlin.framework.Registrar registrar, final Instant planStart, final Configuration config) {
this.configuration = config;
this.errorRegistrar = new Registrar(registrar, Registrar.ErrorBehavior.Log);
this.registrar = new Registrar(registrar, Registrar.ErrorBehavior.Log);
this.absoluteClock = new AbsoluteClock(planStart);

try {
Expand All @@ -57,13 +58,15 @@ public Mission(final gov.nasa.jpl.aerie.merlin.framework.Registrar registrar, fi
}

// Initialize Geometry Model
this.geometryCalculator = new GenericGeometryCalculator(this.absoluteClock, SPICE_SCID, "LT+S", this.errorRegistrar);
this.geometryCalculator = new GenericGeometryCalculator(this.absoluteClock, SPICE_SCID, "LT+S", planStart, configuration.useLinearResources(), Optional.of(this.registrar));
this.spiceResPop = new SpiceResourcePopulater(this.geometryCalculator, this.absoluteClock);
this.geometryResources = this.geometryCalculator.getResources();
this.spiceResPop.calculateTimeDependentInformation();
if (!config.useLinearResources()) {
this.spiceResPop.calculateTimeDependentInformation();
}

// --------------------------------
// GNC Model Integration
this.gncDataModel = new GncDataModel(this.errorRegistrar);
this.gncDataModel = new GncDataModel(this.registrar);
}
}
Loading