Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 300,
"initialPoint":
{
"lat": 53.06,
"lon": 8.97
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.06,
"lon": 8.97
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 301,
"initialPoint":
{
"lat": 53.061,
"lon": 8.971
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.061,
"lon": 8.971
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 302,
"initialPoint":
{
"lat": 53.062,
"lon": 8.972
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.062,
"lon": 8.972
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 303,
"initialPoint":
{
"lat": 53.0633,
"lon": 8.9733
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.0633,
"lon": 8.9733
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 304,
"initialPoint":
{
"lat": 53.0644,
"lon": 8.9744
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.0644,
"lon": 8.9744
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 110,
"headingLow": 130
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 133.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 305,
"initialPoint":
{
"lat": 53.0655,
"lon": 8.9755
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.0655,
"lon": 8.97455
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
+66
View File
@@ -0,0 +1,66 @@
# GUEZ NASAT Simulator
GUEZ NASAT Simulator is a Python script to simulate input telegrams from the GUEZ NASAT interface.
It has to be started on the same machine as the GuezNasatProxy (inside MeteoDataManagement)
Author: Filip Biedziak, SLTE (filip.biedziak@rheinmetall.com)
Date: 14 Dec 2020
## Open help / manual
python3 nasat_simulator.py -h
//if there is no pyhton3 available python2 works too
python2 nasat_simulator.py -h
## Prerequisites
On the Workstation:
You will need to create an aircraft first to send an associated telegram. This is how you do it:
1. Open the OperatorApplication
2. Go to ->Planning->Participants->Edit Participant and Add a new participant of Class Aircraft
3. Open a new Situation and choose Superordinate Config / Administation as exercise
4. Go to ->Planning->Participants / Aircraft->NASAT Aircrafts and Add a new aircraft
5. Make sure to set NASAT-Id to a value greater than 0
6. Go back to the Situation with the running exercise
7. Go to ->Planning->Participants / Aicraft->Assign NASAT Aircraft and Add a new one
8. Assign the participant and the aircraft you created to each other using the ComboBoxes
9. Now you can use the GUEZ NASAT Simulator
On the Server:
You need to enable the GNA Websocket interface:
1. Open the lts-cc.conf
2. Find the entry [GNA]
3. Enable websockets with: useWebSocket = true
a. If there is no [GNA] just add both lines to it
4. Restart the Server /or the svcMeteoDataManagement
Important
The software requires the python websocket-client library
NOT THE "websockets" package!
zypper in python3-websocket-client
#Using the Simulator
there are two modes for the Simulator:
Filebased which supports both; WeaponRelease and 9-Liner
#Connection Problems
##Check, if Port is listening
*ss -tuln | grep 8420*
tcp LISTEN 0 50 *:8420 *:*
##Disable proxy
**Disable Proxy**
*env|grep -in proxy*
*export http_proxy==""*
*export https_proxy==""*
#Open Logfile NASAT-Service
*tail -f ctc_mdm.log*
#Changelog
[2024.09.12]
Update with Server Prerequisites and new simulator style
P. Karwat, ESZS (patric.karwat@rheinmetall.com
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 13:41:22 2020
@author: Filip Biedziak
"""
NASATPOSITION = "NasatPosition"
NASAT9LINER = "NasatNineLiner"
NASATWEAPONRELEASE = "NasatWeaponRelease"
NASAT_TELEGRAM_TYPES = [NASATPOSITION, NASAT9LINER, NASATWEAPONRELEASE]
HOST = "ws://127.0.0.1"
PORT = 8420
LAT_BRE = 53.0694
LON_BRE = 8.89542
LAT_LTZ = 52.4879
LON_LTZ = 11.60961
R = 0.045
class Colors:
RESET = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
RED ='\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
+166
View File
@@ -0,0 +1,166 @@
# -*- coding: utf-8 -*-
"""
GUEZ NASAT Simulator
Via this script it is possible to communicate with the GUEZ NASAT Proxy Server
to send individual messages or make an aircraft fly in a circle.
@author: Filip Biedziak
"""
import sys
import argparse
from nasat_socket import NasatSocket
from signal_handler import SignalHandler
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="GUEZ NASAT Simulator - This script can be used to send messages to the GUEZ NASAT Proxy over a " +
"WebSocket. Using this method simulates the real life workflow with a real aircraft or by use of the " +
"simulator. The following telegram types a currently supported: NasatPosition and NasatNineLiner. If you " +
"want a new telegram type to be added to this script, feel free to contact Filip Biedziak " +
"(SLTE, filip.biedziak@rheinmetall.com)."
)
parser.add_argument(
"-a", "--aircraft",
action="store",
dest="aircraft",
type=int,
help="Aircraft ID (required for telegram type NasatPosition)"
)
parser.add_argument(
"-f", "--fname",
action="store",
dest="fname",
type=str,
help="JSON file with data for NasatNineLiner/WeaponRelease telegram"
)
parser.add_argument(
"-n", "--lon",
action="store",
dest="lon",
type=float,
help="replaces lon value in WeaponRelease Telegream"
)
parser.add_argument(
"-g", "--lat",
action="store",
dest="lat",
type=float,
help="replaces lat value in WeaponRelease Telegream"
)
parser.add_argument(
"-l", "--location",
action="store",
dest="location",
default="Bremen",
type=str,
help="Location used to send NasatPosition telegrams (either Bremen or Letzlingen, default=Bremen)"
)
parser.add_argument(
"-u", "--fusetype",
action="store",
dest="fusetype",
type=int,
help="replaces fusetype value in WeaponRelease Telegream 0=Unkwon, 1=Instand, 2=Delay, 3=Burst"
)
parser.add_argument(
"-i", "--flighttime",
action="store",
dest="flightTime",
type=float,
help="replaces flightTime value in WeaponRelease Telegream"
)
parser.add_argument(
"-m", "--munition",
action="store",
dest="mun",
type=int,
help="replaces munnition Code value in WeaponRelease Telegream ( 1-41)"
)
parser.add_argument(
"-t", "--type",
action="store",
dest="type",
default="NasatWeaponRelease",
type=str,
help="NASAT telegram type (default=NasatWeaponRelease). NasatPosition will send the given aircraft on an elliptical path " +
"around the training area. Requires options -a and -l to be specified."+
"NasatNineLiner sends the specified JSON file as NineLiner Telegram " +
"NasatWeaponRelease if -f specified it sends the given JSON file otherwise it used the default file and replaces gived attibutes (-m -i -u -g -n)"+
"Default = NasatWeaponRelease"
)
parser.add_argument(
"-v", "--verbose",
action="store",
dest="verbose",
default=1,
type=int,
help="Increase output verbosity (default=1)"
)
args = parser.parse_args(sys.argv[1:])
aircraft = args.aircraft
location = args.location
telegramType = args.type
verbose = args.verbose
lon = args.lon
lat = args.lat
fuseType = args.fusetype
muncode = args.mun
flightTime = args.flightTime
kwargs = {}
kwargs["fname"] = "nasat_weapon_release_template.json"
if args.fname is not None:
kwargs["fname"] = args.fname
print("================================ GUEZ NASAT Simulator ================================")
if telegramType != "NasatPosition":
if location is not None and verbose > 0:
print("Ignoring option -l/--location with value: ", location)
#aircraft = 0
else:
stop = False
if aircraft is None:
print("Please specify an aircraft ID.")
stop = True
if location is None:
print("Please specify a location (Bremen or Letzlingen).")
stop = True
elif location not in ("Bremen", "Letzlingen"):
print("Unknown location: %s" % location)
stop = True
if stop:
sys.exit(0)
socket = NasatSocket(telegramType, verbose)
if (lon is not None and lat is not None):
socket.setPosition(lon, lat)
print("SET LON " , lon)
print("SET LAT " , lat)
else:
print("NO LON LAT")
if (muncode is not None):
socket.setMunition(muncode)
print("our fusetype", fuseType)
if (fuseType is not None):
socket.setFuseType(fuseType)
if (flightTime is not None):
socket.setFlightTime(flightTime)
signalHandler = SignalHandler(socket)
if socket.telegramType() == "NasatPosition":
socket.setAircraftId(aircraft)
socket.setLocation(location)
elif aircraft is not None:
socket.setAircraftId(aircraft)
socket.connect()
socket.start(**kwargs)
@@ -0,0 +1,166 @@
# -*- coding: utf-8 -*-
"""
GUEZ NASAT Simulator
Via this script it is possible to communicate with the GUEZ NASAT Proxy Server
to send individual messages or make an aircraft fly in a circle.
@author: Filip Biedziak
"""
import sys
import argparse
from nasat_socket import NasatSocket
from signal_handler import SignalHandler
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="GUEZ NASAT Simulator - This script can be used to send messages to the GUEZ NASAT Proxy over a " +
"WebSocket. Using this method simulates the real life workflow with a real aircraft or by use of the " +
"simulator. The following telegram types a currently supported: NasatPosition and NasatNineLiner. If you " +
"want a new telegram type to be added to this script, feel free to contact Filip Biedziak " +
"(SLTE, filip.biedziak@rheinmetall.com)."
)
parser.add_argument(
"-a", "--aircraft",
action="store",
dest="aircraft",
type=int,
help="Aircraft ID (required for telegram type NasatPosition)"
)
parser.add_argument(
"-f", "--fname",
action="store",
dest="fname",
type=str,
help="JSON file with data for NasatNineLiner/WeaponRelease telegram"
)
parser.add_argument(
"-n", "--lon",
action="store",
dest="lon",
type=float,
help="replaces lon value in WeaponRelease Telegream"
)
parser.add_argument(
"-g", "--lat",
action="store",
dest="lat",
type=float,
help="replaces lat value in WeaponRelease Telegream"
)
parser.add_argument(
"-l", "--location",
action="store",
dest="location",
default="Letzlingen",
type=str,
help="Location used to send NasatPosition telegrams (either Bremen or Letzlingen, default=Letzlingen)"
)
parser.add_argument(
"-u", "--fusetype",
action="store",
dest="fusetype",
type=int,
help="replaces fusetype value in WeaponRelease Telegream 0=Unkwon, 1=Instand, 2=Delay, 3=Burst"
)
parser.add_argument(
"-i", "--flighttime",
action="store",
dest="flightTime",
type=float,
help="replaces flightTime value in WeaponRelease Telegream"
)
parser.add_argument(
"-m", "--munition",
action="store",
dest="mun",
type=int,
help="replaces munnition Code value in WeaponRelease Telegream ( 1-41)"
)
parser.add_argument(
"-t", "--type",
action="store",
dest="type",
default="NasatWeaponRelease",
type=str,
help="NASAT telegram type (default=NasatWeaponRelease). NasatPosition will send the given aircraft on an elliptical path " +
"around the training area. Requires options -a and -l to be specified."+
"NasatNineLiner sends the specified JSON file as NineLiner Telegram " +
"NasatWeaponRelease if -f specified it sends the given JSON file otherwise it used the default file and replaces gived attibutes (-m -i -u -g -n)"+
"Default = NasatWeaponRelease"
)
parser.add_argument(
"-v", "--verbose",
action="store",
dest="verbose",
default=1,
type=int,
help="Increase output verbosity (default=1)"
)
args = parser.parse_args(sys.argv[1:])
aircraft = args.aircraft
location = args.location
telegramType = args.type
verbose = args.verbose
lon = args.lon
lat = args.lat
fuseType = args.fusetype
muncode = args.mun
flightTime = args.flightTime
kwargs = {}
kwargs["fname"] = "nasat_weapon_release_template.json"
if args.fname is not None:
kwargs["fname"] = args.fname
print("================================ GUEZ NASAT Simulator ================================")
if telegramType != "NasatPosition":
if location is not None and verbose > 0:
print("Ignoring option -l/--location with value: ", location)
#aircraft = 0
else:
stop = False
if aircraft is None:
print("Please specify an aircraft ID.")
stop = True
if location is None:
print("Please specify a location (Bremen or Letzlingen).")
stop = True
elif location not in ("Bremen", "Letzlingen"):
print("Unknown location: %s" % location)
stop = True
if stop:
sys.exit(0)
socket = NasatSocket(telegramType, verbose)
if (lon is not None and lat is not None):
socket.setPosition(lon, lat)
print("SET LON " , lon)
print("SET LAT " , lat)
else:
print("NO LON LAT")
if (muncode is not None):
socket.setMunition(muncode)
print("our fusetype", fuseType)
if (fuseType is not None):
socket.setFuseType(fuseType)
if (flightTime is not None):
socket.setFlightTime(flightTime)
signalHandler = SignalHandler(socket)
if socket.telegramType() == "NasatPosition":
socket.setAircraftId(aircraft)
socket.setLocation(location)
elif aircraft is not None:
socket.setAircraftId(aircraft)
socket.connect()
socket.start(**kwargs)
+337
View File
@@ -0,0 +1,337 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 13:40:11 2020
@author: Filip Biedziak
"""
import os
import sys
import websocket
import threading
import time
import math
import json
from collections import OrderedDict
from constants import HOST, PORT, NASAT_TELEGRAM_TYPES, LAT_BRE, LON_BRE, LAT_LTZ, LON_LTZ, R, Colors
class NasatSocket(object):
_websocket = None
_host = HOST
_port = PORT
_status = False
_statusThread = None
_checkStatus = True
_interrupt = True
_verbose = 0
_telegram = OrderedDict()
_buffer = []
_aircraftId = None
_location = None
_telegramType = None
_timestamp = 0
_position = OrderedDict()
_phi = 0.0
_dPhi = 6.0 * math.pi / 360.0
_lon = None
_lat = None
_fuseType = None
_muncode = None
_flightTime = None
def __init__(self, telegramType, verbose):
"""Constructor."""
assert isinstance(telegramType, str)
assert isinstance(verbose, int)
if telegramType not in NASAT_TELEGRAM_TYPES:
self.error("Unknown telegram type: %s" % telegramType)
self._telegramType = telegramType
self._telegram["type"] = self._telegramType
self._telegram["data"] = OrderedDict()
self._telegram["data"]["aircraftId"] = self._aircraftId
self._verbose = verbose
def error(self, msg):
print("%s%sERROR%s: %s" % (Colors.BOLD, Colors.RED, Colors.RESET, msg))
self.close()
sys.exit(0)
def host(self):
return self._host
def setHost(self, host=None):
assert isinstance(host, str)
self._host = host
def port(self):
return self._port
def setPort(self, port=None):
assert isinstance(port, int)
self._port = port
def status(self):
return self._status
def checkStatus(self):
return self._checkStatus
def setCheckStatus(self, check):
assert isinstance(check, bool)
self._checkStatus = check
def interrupt(self):
return self._interrupt
def setInterrupt(self, interrupt):
assert isinstance(interrupt, bool)
self._interrupt = interrupt
def aircraftId(self):
return self._aircraftId
def setAircraftId(self, aircraftId):
assert isinstance(aircraftId, int)
if aircraftId < 0:
self.error("Invalid aircraft ID: %d" % aircraftId)
self._aircraftId = aircraftId
self._telegram["data"]["aircraftId"] = self._aircraftId
def telegramType(self):
return self._telegramType
def setPosition(self, lon, lat):
self._lon = lon
self._lat = lat
def setMunition(self, muncode):
self._muncode = muncode
def setFuseType(self, fuseType):
self._fuseType = fuseType
def setFlightTime(self, flightTime):
self._flightTime = flightTime
def location(self):
return self._location
def setLocation(self, location):
assert isinstance(location, str)
if location not in ["Bremen", "Letzlingen"]:
self.error("Unknown location: %s" % location)
self._location = location
# ==================================================== EXCON Connection ====================================================
def checkConnectionStatus(self):
startTime = time.time()
while self._checkStatus:
changed = False
# check if still connected
if self._status:
try:
self._websocket.send("") # send an empty message
except:
self._status = False
changed = True
# attempt to reconnect
else:
if self._verbose > 1:
print("Connecting to %s:%d" % (self._host, self._port))
try:
self._websocket = websocket.create_connection("%s:%d" % (self._host, self._port))
self._status = True
changed = True
except:
pass
# only show when status changes
if changed and self._verbose > 0:
color = Colors.GREEN if self._status else Colors.RED
status = "OK" if self._status else "not connected"
print("Connection status: %s%s%s%s" % (Colors.BOLD, color, status, Colors.RESET))
# check every second
time.sleep(1.0 - ((time.time() - startTime) % 1.0))
def connect(self):
self._statusThread = threading.Thread(target=self.checkConnectionStatus)
self._statusThread.start()
def close(self):
if self._verbose > 0:
print("Closing connection.")
self._checkStatus = False
self._status = False
if self._statusThread is not None:
self._statusThread.do_run = False
if self._websocket is not None:
self._websocket.close()
# ===================================================== NASAT Telegrams ====================================================
def start(self, **kwargs):
if self._verbose > 1:
print("Sending telegram of type: %s" % self._telegramType)
if self._telegramType == "NasatPosition":
if self._aircraftId is None:
self.error("Aircraft ID has not been set.")
elif self._location is None:
self.error("Location has not been set.")
self.simulateNasatPosition()
elif self._telegramType == "NasatNineLiner":
self.simulateNineLiner(**kwargs)
elif self._telegramType == "NasatWeaponRelease":
self.simulateWeaponRelease(**kwargs)
else:
self.error("Unknown telegram type: %s" % self._telegramType)
def send(self):
self._timestamp = time.time()
self._telegram["data"]["timestamp"] = self._timestamp
# print("send Telegram: %s" % self._telegram)
telegram = json.dumps(self._telegram)
if self._status:
try:
if self._verbose > 1:
print("Sending telegram: %s" % telegram)
self._websocket.send(telegram)
except:
self._buffer.append(telegram) # just in case of timing issues
else:
self._buffer.append(telegram)
def sendBuffer(self):
bufferCopy = [telegram for telegram in self._buffer]
for telegram in bufferCopy:
try:
self._websocket.send(telegram)
self._buffer = self._buffer[1:]
time.sleep(0.1)
except:
break
# ====================================================== NasatPosition =====================================================
def calculatePosition(self):
lat = LAT_BRE if self._location == "Bremen" else LAT_LTZ if self._location == "Letzlingen" else 0
lon = LON_BRE if self._location == "Bremen" else LON_LTZ if self._location == "Letzlingen" else 0
self._position["lat"] = lat + R * math.cos(self._phi)
self._position["lon"] = lon + R * math.sin(self._phi) * 1.7 # roughly a circle
self._position["height"] = 1000
self._telegram["data"]["position"] = self._position
self._phi += self._dPhi
def simulateNasatPosition(self):
startTime = time.time()
count = 0
while True:
if self._status and len(self._buffer) > 0:
self.sendBuffer()
self.calculatePosition() # update current telegram
self.send()
time.sleep(1.0 - ((time.time() - startTime) % 1.0))
if self._interrupt:
if count == 10:
self.close()
elif count == 20:
self.setCheckStatus(True)
self.connect()
count += 1
# ===================================================== NasatNineLiner =====================================================
def readNineLinerData(self, fname):
assert isinstance(fname, str)
if not os.path.exists(fname):
self.error("NasatNineLiner telegrams requires a JSON file with additional data.")
try:
with open(fname, 'r') as f:
data = json.load(f)
except:
self.error("Unable to read Nine Liner data from JSON file: %s" % fname)
if data["data"]["timestamp"] == -1:
data["data"]["timestamp"] = time.time()
return data
def simulateNineLiner(self, **kwargs):
if "fname" not in kwargs.keys():
self.error("Missing argument 'fname' with path to Nine Liner data.")
self._telegram = self.readNineLinerData(kwargs["fname"])
startTime = time.time()
while not self._status:
time.sleep(1.0 - ((time.time() - startTime) % 1.0)) # wait until connection has been established
self.send()
self.close()
# ================================================= NasatWeaponRelease =================================================
def readWeaponReleaseData(self, fname):
assert isinstance(fname, str)
if not os.path.exists(fname):
self.error("NasatWeaponRelease telegrams requires a JSON file with additional data. %s" % fname)
try:
with open(fname, 'r') as f:
data = json.load(f)
except:
self.error("Unable to read NasatWeaponRelease data from JSON file: %s" % fname)
if data["data"]["timestamp"] == -1:
data["data"]["timestamp"] = time.time()
return data
def simulateWeaponRelease(self, **kwargs):
if "fname" not in kwargs.keys():
self.error("Missing argument 'fname' with path to Weapon Release data.")
self._telegram = self.readWeaponReleaseData(kwargs["fname"])
if (self._lon is not None and self._lat is not None):
print("REPLACE pos")
self._telegram["data"]["impactPosition"]["lat"] = self._lat
self._telegram["data"]["impactPosition"]["lon"] = self._lon
if (self._muncode is not None):
print("Replace muncode")
self._telegram["data"]["munition"] = self._muncode
if (self._fuseType is not None):
print("Replace fusetype")
self._telegram["data"]["fuseType"] = self._fuseType
if (self._flightTime is not None):
print("Replace flightTime")
self._telegram["data"]["flightTime"] = self._flightTime
if (self._aircraftId is not None):
print("Replace aircraft")
self._telegram["data"]["aircraftId"] = self._aircraftId
startTime = time.time()
while not self._status:
time.sleep(1.0 - ((time.time() - startTime) % 1.0)) # wait until connection has been established
print("send NasatWeaponRelease with timestamp: %s" % self._telegram)
self.send()
self.close()
@@ -0,0 +1,2 @@
{"data":{"aircraftId":1,"flightTime":20.866775512695312,"fuseType":3,"impactPosition":{"lat":52.496913048935859,"lon":11.584327375871482},"munition":22,"releaseMode":0,"timestamp":-1},"type":"NasatWeaponRelease","uuid":"a70be051-4063-45db-8c3d-2a6d9ade02d4"}
+42
View File
@@ -0,0 +1,42 @@
{
"data":
{
"aircraftId": 1,
"altitudeTarget": 56,
"altitudeTargetMode": 1,
"distance2InitialPointMode": 1,
"distanceInitialPoint2Target": 925.9,
"finalAttackHeading":
{
"heading": 120,
"headingHigh": 270,
"headingLow": 10
},
"finalAttackHeadingMode": 2,
"friendlies":
{
"bearing": 88,
"distance": 333.6
},
"heading2InitialPointMode": 2,
"headingInitialPoint2Target": 315,
"initialPoint":
{
"lat": 53.06,
"lon": 8.97
},
"initialPointMode": 1,
"modeFriendlies": 1,
"targetPosition":
{
"lat": 53.06,
"lon": 8.971
},
"targetPositionMode": 1,
"timeForTarget": 57600,
"timeForTargetMode": 2,
"timestamp": -1
},
"type": "NasatNineLiner",
"uuid": "blasdbasd-kjladjaslasdklj"
}
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 13:44:45 2020
@author: Filip Biedziak
"""
import sys
import signal
class SignalHandler(object):
def __init__(self, socket):
self._socket = socket
signal.signal(signal.SIGINT, self.onSigint)
def onSigint(self, s, f):
"""Handler to gracefully exit on Ctrl+C."""
print("\nCtrl+C pressed")
self._socket.close()
sys.exit(0)
@@ -0,0 +1,15 @@
#! /bin/bash
#
# Dieses Script startet eine Abfolge von
# Es dient zur Prüfung der DDS-Telegramme, insbesondere in Hinblick auf Replay
#
# Ein Evtl. Wechsel der Zuorndung NasatAircraft zu Participant (NAP)
# kann während der Pausen manuell durchgeführt werden.
#
#python3 nasat_simulator.py -a1 -t NasatPositon
python3 nasat_simulator.py -a1 -l Letzlingen -t NasatPosition
echo "Ende"
+31
View File
@@ -0,0 +1,31 @@
#! /bin/bash
#
# Dieses Script startet eine Abfolge von NineLinern
# Es dient zur Prüfung der DDS-Telegramme, insbesondere in Hinblick auf Replay
#
# Ein Evtl. Wechsel der Zuorndung NasatAircraft zu Participant (NAP)
# kann während der Pausen manuell durchgeführt werden.
#
echo "Zuorndung NasatAircraft zu Participant (NAP) in Ordnung? Marke setzen? Weiter mit Eingabe..."
read
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_300.json
sleep 10
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_301.json
echo "Wechsel der Zuorndung NasatAircraft zu Participant (NAP)? Weiter mit Eingabe..."
read
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_302.json
sleep 10
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_303.json
echo "Wechsel der Zuorndung NasatAircraft zu Participant (NAP)? Weiter mit Eingabe..."
read
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_304.json
sleep 10
python2 nasat_simulator.py -a1 -t NasatNineLiner -f ./NineLiner/nine_liner_template_305.json
echo "Ende"
+24
View File
@@ -0,0 +1,24 @@
#! /bin/bash
#
# Dieses Script startet eine Abfolge von
# Es dient zur Prüfung der DDS-Telegramme, insbesondere in Hinblick auf Replay
#
# Ein Evtl. Wechsel der Zuorndung NasatAircraft zu Participant (NAP)
# kann während der Pausen manuell durchgeführt werden.
#
while [ 1 ]
do
python3 nasat_simulator.py -a1 -t NasatWeaponRelease -f nasat_weapon_release_template_1.json -v2
python3 nasat_simulator.py -a2 -t NasatWeaponRelease -f nasat_weapon_release_template_2.json -v2
python3 nasat_simulator.py -a3 -t NasatWeaponRelease -f nasat_weapon_release_template_3.json -v2
python3 nasat_simulator.py -a4 -t NasatWeaponRelease -f nasat_weapon_release_template_4.json -v2
sleep 30
done
echo "Ende"