Skip to content
Snippets Groups Projects
Commit 5d213f5f authored by noeljanes's avatar noeljanes
Browse files

Made a change to make the converter more efficient

parent 9c777d5b
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,21 @@ import java.io.FileWriter;
public class DopplerRangeRateConverter {
static double rRcalculator(String freq , double downlinkFreq, double c){
double f2 = Double.parseDouble(freq);
double dopplerFreq = f2 - downlinkFreq;
double rR = (-c) * (dopplerFreq / downlinkFreq);
rR = rR/1000;
return rR;
}
static AbsoluteDate mjdDate(String dateIn, TimeScale utc, AbsoluteDate mjdRefUTC){
double mjdDate = Double.parseDouble(dateIn);
AbsoluteDate date = new AbsoluteDate(mjdRefUTC,mjdDate* Constants.JULIAN_DAY, utc);
return date;
}
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
......@@ -42,7 +57,6 @@ public class DopplerRangeRateConverter {
/* Output data path */
File pathDataOut = new File("C:\\Users\\nolja\\Documents\\ESA Socis\\Orbit Determination\\orbitdetermination\\satnogs-orbit-determination\\src\\main\\resources");
//int secDay = 24*60*60 ; // Calculates the seconds in a day, used to calculate seconds between mesaurements (which are given in MJD)
......@@ -53,13 +67,12 @@ public class DopplerRangeRateConverter {
/* Setting up the initial parameters that are to be passed to the file */
String measType = " RANGE_RATE";
String antennaID = " 39-CGBSAT-VHF ";
//SString antennaID = " 39-CGBSAT-VHF ";
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate mjdRefUTC = new AbsoluteDate(1858,11,17,utc);
BufferedReader reader;
for(String filename : fileList) {
......@@ -96,25 +109,28 @@ public class DopplerRangeRateConverter {
while (line != null) {
//System.out.println(line); // Bugfixing extrodionaire
String[] columns = line.split(" ");
line = reader.readLine(); // Required to prevent the same line being run an infite number of times
double f2 = Double.parseDouble(columns[1]);
double dopplerFreq = f2 - downlinkFreq;
double rR = (-c) * (dopplerFreq / downlinkFreq);
rR = rR/1000; // To convert to km/s for use in the orbit determination programme
double mjdDate = Double.parseDouble(columns[0]);
AbsoluteDate date = new AbsoluteDate(mjdRefUTC,mjdDate* Constants.JULIAN_DAY, utc);
if(filename.startsWith("2019-06-11T19")){
String antennaID = " 39-CGBSAT-VHF-P1 ";
String outputline = mjdDate(columns[0],utc,mjdRefUTC) + measType + antennaID + rRcalculator(columns[1],downlinkFreq,c) + "\n";
bw.write(outputline);
}
else if (filename.startsWith("2019-06-11T21")){
String antennaID = " 39-CGBSAT-VHF-P2 ";
String outputline = mjdDate(columns[0],utc,mjdRefUTC) + measType + antennaID + rRcalculator(columns[1],downlinkFreq,c) + "\n";
bw.write(outputline);
}
else {
String antennaID = " 39-CGBSAT-VHF ";
String outputline = mjdDate(columns[0],utc,mjdRefUTC) + measType + antennaID + rRcalculator(columns[1],downlinkFreq,c) + "\n";
bw.write(outputline);
}
String outputLine = date + measType + antennaID + rR + "\n";
bw.write(outputLine);
}
......
......@@ -70,6 +70,7 @@ import org.orekit.models.earth.troposphere.ViennaModelType;
import org.orekit.models.earth.troposphere.ViennaThreeModel;
import org.orekit.orbits.CartesianOrbit;
import org.orekit.orbits.OrbitType;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.analytical.tle.TLE;
import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.propagation.events.ElevationDetector;
......@@ -157,7 +158,7 @@ public class MeasurementsGeneration {
// this orbit is a dummy one, close to the first results from orbit determination from Max Valier satellite
final NormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getNormalizedProvider(12, 12);
final AbsoluteDate tOrb = new AbsoluteDate("2019-06-11T16:35:29.149", utc);
final AbsoluteDate tOrb = new AbsoluteDate("2019-06-11T16:35:13.715", utc);
final TimeStampedPVCoordinates pvt = new TimeStampedPVCoordinates(tOrb,
new Vector3D(-5253194.0, -4400295.0, 80075.0),
new Vector3D(-559.0, 764.0, 7585.0));
......@@ -170,6 +171,10 @@ public class MeasurementsGeneration {
final NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(type);
propagator.setInitialState(new SpacecraftState(orbit, 16.0)); // the second argument is the spacecraft mass
// add a few realistic force models
final double cd = 2.0;
final double area = 0.25;
......@@ -240,15 +245,21 @@ public class MeasurementsGeneration {
// save measurement in a file
AbsoluteDate mjdRefUTC = new AbsoluteDate(DateComponents.MODIFIED_JULIAN_EPOCH, utc);
try (PrintWriter out = new PrintWriter(new File(home, "generated-doppler.dat"))) {
try (PrintWriter out = new PrintWriter(new File(home, "generated-doppler-"+station.getBaseFrame().getName()+".dat"))) {
measurements.
stream().
forEach(m -> out.format(Locale.US, "%s %14.8f %s %s %12.6f%n",
forEach(m -> out.format(Locale.US, "%s %s %s %12.6f%n", // Without MJD coloumn
m.getDate(),
"RANGE_RATE",
station.getBaseFrame().getName(),
m.getObservedValue()[0]));
// Uncomment to get mjd coloumn
/*forEach(m -> out.format(Locale.US, "%s %14.8f %s %s %12.6f%n",
m.getDate(),
m.getDate().offsetFrom(mjdRefUTC, utc) / Constants.JULIAN_DAY,
"RANGE-RATE",
station.getBaseFrame().getName(),
m.getObservedValue()[0]));
m.getObservedValue()[0]));*/
}
......
This diff is collapsed.
......@@ -199,7 +199,7 @@ ocean.loading.correction = false
## Ground stations (angles in degrees, altitude and range bias in meters)
ground.station.name [0] = 39-CGBSAT-VHF
ground.station.name [0] = 39-CGBSAT-VHF-P1
ground.station.latitude [0] = 52.834
ground.station.longitude [0] = 6.379
ground.station.altitude [0] = 10
......@@ -235,6 +235,79 @@ ground.station.global.mapping.function [0] = false
ground.station.niell.mapping.function [0] = false
ground.station.range.tropospheric.correction [0] = true
ground.station.name [1] = 39-CGBSAT-VHF-P2
ground.station.latitude [1] = 52.834
ground.station.longitude [1] = 6.379
ground.station.altitude [1] = 10
ground.station.clock.offset [1] = 0.0
ground.station.clock.offset.min [1] = -0.001
ground.station.clock.offset.max [1] = +0.001
ground.station.clock.offset.estimated [1] = false
ground.station.position.estimated [1] = false
ground.station.range.sigma [1] = 20.0
ground.station.range.bias [1] = 11473.623
ground.station.range.bias.min [1] = -50000.0
ground.station.range.bias.max [1] = +50000.0
ground.station.range.bias.estimated [1] = true
ground.station.range.rate.sigma [1] = 15
ground.station.range.rate.bias [1] = 375.0
ground.station.range.rate.bias.min [1] = -0.0
ground.station.range.rate.bias.max [1] = +500.0
ground.station.range.rate.bias.estimated [1] = true
ground.station.azimuth.sigma [1] = 0.02
ground.station.azimuth.bias [1] = 0.01
ground.station.azimuth.bias.min [1] = -0.50
ground.station.azimuth.bias.max [1] = +0.50
ground.station.elevation.sigma [1] = 0.02
ground.station.elevation.bias [1] = 0.01
ground.station.elevation.bias.min [1] = -0.50
ground.station.elevation.bias.max [1] = +0.50
ground.station.az.el.biases.estimated [1] = true
ground.station.elevation.refraction.correction [1] = true
ground.station.tropospheric.model.estimated [1] = false
ground.station.tropospheric.zenith.delay [1] = 2.0
ground.station.tropospheric.delay.estimated [1] = false
ground.station.global.mapping.function [1] = false
ground.station.niell.mapping.function [1] = false
ground.station.range.tropospheric.correction [1] = true
ground.station.name [2] = 39-CGBSAT-VHF
ground.station.latitude [2] = 52.834
ground.station.longitude [2] = 6.379
ground.station.altitude [2] = 10
ground.station.clock.offset [2] = 0.0
ground.station.clock.offset.min [2] = -0.001
ground.station.clock.offset.max [2] = +0.001
ground.station.clock.offset.estimated [2] = false
ground.station.position.estimated [2] = false
ground.station.range.sigma [2] = 20.0
ground.station.range.bias [2] = 11473.623
ground.station.range.bias.min [2] = -50000.0
ground.station.range.bias.max [2] = +50000.0
ground.station.range.bias.estimated [2] = true
ground.station.range.rate.sigma [2] = 15
ground.station.range.rate.bias [2] = 0
ground.station.range.rate.bias.min [2] = -0.0
ground.station.range.rate.bias.max [2] = +500.0
ground.station.range.rate.bias.estimated [2] = true
ground.station.azimuth.sigma [2] = 0.02
ground.station.azimuth.bias [2] = 0.01
ground.station.azimuth.bias.min [2] = -0.50
ground.station.azimuth.bias.max [2] = +0.50
ground.station.elevation.sigma [2] = 0.02
ground.station.elevation.bias [2] = 0.01
ground.station.elevation.bias.min [2] = -0.50
ground.station.elevation.bias.max [2] = +0.50
ground.station.az.el.biases.estimated [2] = true
ground.station.elevation.refraction.correction [2] = true
ground.station.tropospheric.model.estimated [2] = false
ground.station.tropospheric.zenith.delay [2] = 2.0
ground.station.tropospheric.delay.estimated [2] = false
ground.station.global.mapping.function [2] = false
ground.station.niell.mapping.function [2] = false
ground.station.range.tropospheric.correction [2] = true
### Measurements parameters
range.outlier.rejection.multiplier = 6
range.outlier.rejection.starting.iteration = 2
......@@ -290,9 +363,11 @@ estimator.max.iterations = 600
estimator.max.evaluations = 600
# comma-separated list of measurements files (in the same directory as this file)
measurements.files = 2019-06-11T19_58_49_145.961_4171_42778.dat , 2019-06-11T21_32_55_145.961_4171_42778.dat
measurements.files = generated-doppler-39-CGBSAT-VHF.dat
#2019-06-11T19_58_49_145.961_4171_42778.dat , 2019-06-11T21_32_55_145.961_4171_42778.dat
#, 2019-06-12T07_20_42_145.961_4171_42778.dat
# , 2019-06-12T07_20_42_145.961_4171_42778.dat
# base name of the output files (log and residuals), no files created if empty
output.base.name = orbit-determination
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment