Orekit .NET Wrapper

I am currently working on porting the latest Orekit to .NET (as a .dll).

To do this I am using IKVM to build the Orekit.java library into a .NET Orekit.dll.

After a bunch of trying and working through various issues, I was able to get this to work successfully and import Orekit into a .NET application as a .dll library.

I then call the code below as a test to create a new KeplerianOrbit. However, I am getting an exception with a call to TimeScalesFactory.getUTC() and the exception unfortunately is blank and contains no information. I checked the source code for the getUTC() method and can see that it indeed does throw an uncaught exception under certain conditions. I was planning on just adding a try/catch to this method to try and return more information on the error, however doing so, and then rebuilding Orekit causes it to fail the unit tests (as there is a test on this method that expects an exception to be thrown).

I just thought I would reach out to the communtiy here to see if
a) Anyone has a working build of Orekit for .NET
b) If anyone has any idea on what steps I could take to get this .getUTC() method working, does it require any other functions to be called beforehand to initialize certain variables or anything? I am new to Orekit so I might just be missing something.

P.S the other methods seem to complete normally, e.g getEME2000() returns successfully with the Frame object and the KeplerianOrbit constructor also appears to be working, so it is only this getUTC() method I am having trouble with.

static void Main(string[] args)
        {
            Frame inertialFrame = FramesFactory.getEME2000();
            TimeScale utc = TimeScalesFactory.getUTC(); //This throws an exception
            AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
       
            const double DEG_TO_RAD = (Math.PI / 180);
            double mu = 3.986004415e+14;
            double a = 24396159;                     // semi major axis in meters
            double e = 0.72831215;                   // eccentricity
            double i = 7 * DEG_TO_RAD;        // inclination
            double omega = 180 * DEG_TO_RAD;  // perigee argument
            double raan = 261 * DEG_TO_RAD;   // right ascension of ascending node
            double lM = 0;                           // mean anomaly

            Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu);
        }

Hi @Nathan,

I have no experience with .net, but looking at your code it seems that you do not load the required data before calling the getUTC() method. This is a very common issue when discovering Orekit, you can learn about it here for instance.

Good luck with your project, it’s always a great thing to bring Orekit capabilities to new ecosystems !

A few years ago I actually followed this exact same path to see if I could get it working. I actually was able to get Orekit working in IKVM at the time. If I recall correctly though I was having some less than tolerable performance problems with it though. It was part of a larger infrastructure conversion attempt so I don’t recall which parts were too much slower. IIRC The best performance I got was about a 20% slower with the worst being orders of magnitude slower. I know one area which was far slower was XML processing, which was not in the Orekit part of the code. I don’t recall what the benchmark on things like propagation were.

I’m curious how well it works with the latest IKVM and the latest Orekit.