Skip to content

Allows an Ignition gateway to provide OREKIT (ORbits Extrapolation KIT) data for connected clients.

License

Notifications You must be signed in to change notification settings

benmusson/ignition-orekit-module

Repository files navigation

Orekit Ignition Module

Background

OREKIT (ORbits Extrapolation KIT) is a free low-level space dynamics library written in Java.

The Orekit library relies on external data for physical models; this module allows an Ignition gateway to provide this data to connected clients on an as-needed basis. Local caching is provided in order to reduce network load.

Typical data are the Earth Orientation Parameters, and the leap seconds history, both being provided by the IERS, or the planetary ephemerides provided by JPL or IMCCE.

Versions

Dependencies:

  1. Ignition 8.0.10 or newer (Maker Edition compatible).

This module also packages the following libraries:

  1. Orekit 10.3.1

  2. Hipparchus 1.8

Getting Started

Building

This module is built using gradle and Inductive Automation’s gradle-module-plugin.

External Data

Users of this module must provide their own data for the physical models. A starter dataset is currently provided on the Orekit forge and can be downloaded here. Extract these files anywhere on your file system that will be available to the Ignition gateway.

Use

Installation

See official Ignition documentation for details on Installing or Upgrading a Module.

Module Setup

The paths to the folders containing external data must be set on the Ignition gateway. The paths can be set on the gateway under Config/Orekit/Settings/External Data. Multiple folder paths can be set using ; as a delimiter.

Script Usage

This module includes all Orekit and Hipparchus .jars for use in all Ignition scripting contexts. Classes are mounted under system.orekit and system.hipparchus respectively.

See Orekit Technical Documentation and Javadocs for complete details and usage examples.

Import Example
from system.orekit.frames import FramesFactory, TopocentricFrame
from system.orekit.time import TimeScalesFactory, AbsoluteDate
from system.orekit.utils import PVCoordinates, Constants, IERSConventions
from system.orekit.orbits import CartesianOrbit
from system.orekit.propagation.analytical import KeplerianPropagator
from system.orekit.bodies import OneAxisEllipsoid, GeodeticPoint

from system.hipparchus.geometry.euclidean.threed import Vector3D

Additional Scripting Functions

Several additional scripting functions are provided through the system.orekit name space. These functions can be used to modify the data providers available to a client; for instance, to allow a client to use a local data directory.

The default providers vary per scope. In the Designer and Client scopes, the default provider is the GatewayEndpointCrawler that communicates with the Gateway. In the Gateway scope, the default providers are DirectoryCrawlers for the configured External Data paths.

Add/Removing Data Providers
system.orekit.addProvider(...)
system.orekit.removeProvider(...)
system.orekit.addDefaultProviders()
system.oreit.removeDefaultProviders()
Clearing Cached Files
system.orekit.clearCache()

Usage Example

This example has been adapted from the Orekit example VisibilityCheck.java.

VisibilityCheck.py
#/* Copyright 2002-2020 CS GROUP
# * Licensed to CS GROUP (CS) under one or more
# * contributor license agreements.  See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * CS licenses this file to You under the Apache License, Version 2.0
# * (the "License"); you may not use this file except in compliance with
# * the License.  You may obtain a copy of the License at
# *
# *   http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# */
from system.orekit.data import DataProvidersManager
from system.orekit.data import ZipJarCrawler
from system.hipparchus.geometry.euclidean.threed import Vector3D
from system.hipparchus.ode.events import Action
from system.orekit.bodies import BodyShape
from system.orekit.bodies import GeodeticPoint
from system.orekit.bodies import OneAxisEllipsoid
from system.orekit.errors import OrekitException;
from system.orekit.frames import Frame
from system.orekit.frames import FramesFactory
from system.orekit.frames import TopocentricFrame
from system.orekit.orbits import KeplerianOrbit
from system.orekit.orbits import Orbit
from system.orekit.propagation import Propagator
from system.orekit.propagation import SpacecraftState
from system.orekit.propagation.analytical import KeplerianPropagator
from system.orekit.propagation.events import ElevationDetector
from system.orekit.propagation.events import EventDetector
from system.orekit.time import AbsoluteDate
from system.orekit.time import TimeScalesFactory
from system.orekit.utils import PVCoordinates
from system.orekit.utils import IERSConventions

from math import degrees, radians, pi

# Initial state definition: date, orbit
initialDate = AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC())
mu =  3.986004415e+14
inertialFrame = FramesFactory.getEME2000() # inertial frame for orbit definition
position  = Vector3D(-6142438.668, 3492467.560, -25767.25680)
velocity  = Vector3D(505.8479685, 942.7809215, 7435.922231)
pvCoordinates = PVCoordinates(position, velocity)
initialOrbit = KeplerianOrbit(pvCoordinates, inertialFrame, initialDate, mu)

# Propagator : consider a simple Keplerian motion (could be more elaborate)
kepler = KeplerianPropagator(initialOrbit)

# Earth and frame
ae =  6378137.0 # equatorial radius in meter
f  =  1.0 / 298.257223563 # flattening
itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, True) # terrestrial frame at an arbitrary date
earth = OneAxisEllipsoid(ae, f, itrf)

# Station
longitude = radians(45.0)
latitude  = radians(25.0)
altitude  = 0.0
station1 = GeodeticPoint(latitude, longitude, altitude)
sta1Frame = TopocentricFrame(earth, station1, "station1")

# Event definition
maxcheck  = 1.0
elevation = radians(5.0)


class VisibilityDetector(ElevationDetector):
# Class for handling the eventOccured java. Example of subclassing a java class in jython
    def __init__(self,  maxCheck,  elevation, topo):
        ElevationDetector.__init__(self,maxCheck, elevation, topo)

    def eventOccurred(self, s, increasing):
        if (increasing):
            print "Visibility on", self.topocentricFrame.getName(), "begins at" , s.getDate()
        else:
            print "Visibility on",  self.topocentricFrame.getName(), "ends at" , s.getDate()
        return Action.CONTINUE

sta1Visi = VisibilityDetector(maxcheck, elevation, sta1Frame)

# Add event to be detected
kepler.addEventDetector(sta1Visi)

# Propagate from the initial date to the first raising or for the fixed duration
finalState = kepler.propagate(initialDate.shiftedBy(1500.0))

print "Final state : " , finalState.getDate().durationFrom(initialDate)
VisibilityCheck.py Output
>>>
Visibility on station1 begins at 2004-01-01T23:30:36.436
Visibility on station1 ends at 2004-01-01T23:44:05.224
Final state :  1500.0
>>>

Future Goals

  1. Role based security for API requests.

  2. Specify local Orekit data on a per-project basis.

  3. Share external Orekit data across the Gateway Area Network (GAN).

Copyright © 2021 Ben Musson

Free use of this software is granted under the terms of the MIT License.

About

Allows an Ignition gateway to provide OREKIT (ORbits Extrapolation KIT) data for connected clients.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages