From 3e3865af5cc5a0f7b4241b8da5ec5b716b0263be Mon Sep 17 00:00:00 2001 From: dernasherbrezon Date: Thu, 12 Oct 2023 19:40:45 +0100 Subject: [PATCH] add support for Sharjahsat-1 --- README.md | 5 + .../ru/r2cloud/jradio/sharjahsat/Adcs.java | 128 +++++ .../ru/r2cloud/jradio/sharjahsat/Battery.java | 117 +++++ .../ru/r2cloud/jradio/sharjahsat/Eps.java | 137 +++++ .../jradio/sharjahsat/InterfaceBrdRtc.java | 107 ++++ .../ru/r2cloud/jradio/sharjahsat/Obc.java | 127 +++++ .../ru/r2cloud/jradio/sharjahsat/OpMode.java | 26 + .../r2cloud/jradio/sharjahsat/SBandModem.java | 97 ++++ .../jradio/sharjahsat/Sharjahsat1Beacon.java | 54 ++ .../jradio/sharjahsat/Sharjahsat1Header.java | 57 ++ .../jradio/sharjahsat/SolarPanels.java | 492 ++++++++++++++++++ .../r2cloud/jradio/sharjahsat/SystemInfo.java | 192 +++++++ .../r2cloud/jradio/sharjahsat/Telemetry.java | 107 ++++ .../jradio/sharjahsat/UhfVhfModem.java | 77 +++ .../sharjahsat/Sharjahsat1BeaconTest.java | 47 ++ .../resources/expected/Sharjahsat1Beacon.json | 198 +++++++ .../expected/Sharjahsat1BeaconImage.json | 276 ++++++++++ 17 files changed, 2244 insertions(+) create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Adcs.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Battery.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Eps.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/InterfaceBrdRtc.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Obc.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/OpMode.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/SBandModem.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Beacon.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Header.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/SolarPanels.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/SystemInfo.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/Telemetry.java create mode 100644 src/main/java/ru/r2cloud/jradio/sharjahsat/UhfVhfModem.java create mode 100644 src/test/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1BeaconTest.java create mode 100644 src/test/resources/expected/Sharjahsat1Beacon.json create mode 100644 src/test/resources/expected/Sharjahsat1BeaconImage.json diff --git a/README.md b/README.md index ef390a4a..6df28c3d 100644 --- a/README.md +++ b/README.md @@ -559,6 +559,11 @@ jradio has lots of built-in satellite decoders. Some of them have non standard d 53384, 57172, 53383, 53373, 53381, 53375, 53377, 53374, 57189, 47952, 47951, 47960 ru.r2cloud.jradio.sputnix.SputnixBeacon + + Sharjahsat-1 + 55104 + ru.r2cloud.jradio.sharjahsat.Sharjahsat1Beacon + diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Adcs.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Adcs.java new file mode 100644 index 00000000..6f82d3a7 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Adcs.java @@ -0,0 +1,128 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Adcs { + + private int adcsState; + private float satPosLlhLat; + private float satPosLlhLon; + private float satPosLlhAlt; + private float estmAttAngleYaw; + private float estmAttAnglePitch; + private float estmAttAngleRoll; + private float estmAngRateYaw; + private float estmAngRatePitch; + private float estmAngRateRoll; + private byte[] dataB64T; + + public Adcs() { + // do nothing + } + + public Adcs(LittleEndianDataInputStream dis) throws IOException { + adcsState = dis.readUnsignedByte(); + satPosLlhLat = dis.readShort() * 0.01f; + satPosLlhLon = dis.readShort() * 0.01f; + satPosLlhAlt = dis.readShort() * 0.01f; + estmAttAngleYaw = dis.readShort() * 0.01f; + estmAttAnglePitch = dis.readShort() * 0.01f; + estmAttAngleRoll = dis.readShort() * 0.01f; + estmAngRateYaw = dis.readShort() * 0.01f; + estmAngRatePitch = dis.readShort() * 0.01f; + estmAngRateRoll = dis.readShort() * 0.01f; + dataB64T = new byte[18]; + dis.readFully(dataB64T); + } + + public int getAdcsState() { + return adcsState; + } + + public void setAdcsState(int adcsState) { + this.adcsState = adcsState; + } + + public float getSatPosLlhLat() { + return satPosLlhLat; + } + + public void setSatPosLlhLat(float satPosLlhLat) { + this.satPosLlhLat = satPosLlhLat; + } + + public float getSatPosLlhLon() { + return satPosLlhLon; + } + + public void setSatPosLlhLon(float satPosLlhLon) { + this.satPosLlhLon = satPosLlhLon; + } + + public float getSatPosLlhAlt() { + return satPosLlhAlt; + } + + public void setSatPosLlhAlt(float satPosLlhAlt) { + this.satPosLlhAlt = satPosLlhAlt; + } + + public float getEstmAttAngleYaw() { + return estmAttAngleYaw; + } + + public void setEstmAttAngleYaw(float estmAttAngleYaw) { + this.estmAttAngleYaw = estmAttAngleYaw; + } + + public float getEstmAttAnglePitch() { + return estmAttAnglePitch; + } + + public void setEstmAttAnglePitch(float estmAttAnglePitch) { + this.estmAttAnglePitch = estmAttAnglePitch; + } + + public float getEstmAttAngleRoll() { + return estmAttAngleRoll; + } + + public void setEstmAttAngleRoll(float estmAttAngleRoll) { + this.estmAttAngleRoll = estmAttAngleRoll; + } + + public float getEstmAngRateYaw() { + return estmAngRateYaw; + } + + public void setEstmAngRateYaw(float estmAngRateYaw) { + this.estmAngRateYaw = estmAngRateYaw; + } + + public float getEstmAngRatePitch() { + return estmAngRatePitch; + } + + public void setEstmAngRatePitch(float estmAngRatePitch) { + this.estmAngRatePitch = estmAngRatePitch; + } + + public float getEstmAngRateRoll() { + return estmAngRateRoll; + } + + public void setEstmAngRateRoll(float estmAngRateRoll) { + this.estmAngRateRoll = estmAngRateRoll; + } + + public byte[] getDataB64T() { + return dataB64T; + } + + public void setDataB64T(byte[] dataB64T) { + this.dataB64T = dataB64T; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Battery.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Battery.java new file mode 100644 index 00000000..168573e8 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Battery.java @@ -0,0 +1,117 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Battery { + + private float vbat; + private float ibat; + private float vpcm3v3; + private float vpcm5v; + private float ipcm3v3; + private float ipcm5v; + private float tbrd; + private float tbat1; + private float tbat2; + private float tbat3; + + public Battery() { + // do nothing + } + + public Battery(LittleEndianDataInputStream dis) throws IOException { + vbat = dis.readUnsignedShort() * 0.008993f; + ibat = dis.readShort() * 14.662757f; + vpcm3v3 = dis.readUnsignedShort() * 0.004311f; + vpcm5v = dis.readUnsignedShort() * 0.005865f; + ipcm3v3 = dis.readUnsignedShort() * 1.327547f; + ipcm5v = dis.readUnsignedShort() * 1.327547f; + tbrd = (dis.readShort() * 0.372434f) - 273.15f; + tbat1 = (dis.readShort() * 0.3976f) - 238.57f; + tbat2 = (dis.readShort() * 0.3976f) - 238.57f; + tbat3 = (dis.readShort() * 0.3976f) - 238.57f; + } + + public float getVbat() { + return vbat; + } + + public void setVbat(float vbat) { + this.vbat = vbat; + } + + public float getIbat() { + return ibat; + } + + public void setIbat(float ibat) { + this.ibat = ibat; + } + + public float getVpcm3v3() { + return vpcm3v3; + } + + public void setVpcm3v3(float vpcm3v3) { + this.vpcm3v3 = vpcm3v3; + } + + public float getVpcm5v() { + return vpcm5v; + } + + public void setVpcm5v(float vpcm5v) { + this.vpcm5v = vpcm5v; + } + + public float getIpcm3v3() { + return ipcm3v3; + } + + public void setIpcm3v3(float ipcm3v3) { + this.ipcm3v3 = ipcm3v3; + } + + public float getIpcm5v() { + return ipcm5v; + } + + public void setIpcm5v(float ipcm5v) { + this.ipcm5v = ipcm5v; + } + + public float getTbrd() { + return tbrd; + } + + public void setTbrd(float tbrd) { + this.tbrd = tbrd; + } + + public float getTbat1() { + return tbat1; + } + + public void setTbat1(float tbat1) { + this.tbat1 = tbat1; + } + + public float getTbat2() { + return tbat2; + } + + public void setTbat2(float tbat2) { + this.tbat2 = tbat2; + } + + public float getTbat3() { + return tbat3; + } + + public void setTbat3(float tbat3) { + this.tbat3 = tbat3; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Eps.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Eps.java new file mode 100644 index 00000000..ee2dc072 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Eps.java @@ -0,0 +1,137 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Eps { + + private float vpcmbatv; + private float ipcmbatv; + private float vpcm3v3; + private float ipcm3v3; + private float vpcm5v; + private float ipcm5v; + private float i3v3drw; + private float i5vdrw; + private float tbrd; + private float tbrdDb; + private float ipcm12v; + private float vpcm12v; + + public Eps() { + // do nothing + } + + public Eps(LittleEndianDataInputStream dis) throws IOException { + vpcmbatv = dis.readUnsignedShort() * 0.008978f; + ipcmbatv = dis.readShort() * 0.00681988679f; + vpcm3v3 = dis.readUnsignedShort() * 0.004311f; + ipcm3v3 = dis.readUnsignedShort() * 0.00681988679f; + vpcm5v = dis.readUnsignedShort() * 0.005865f; + ipcm5v = dis.readUnsignedShort() * 0.00681988679f; + i3v3drw = dis.readUnsignedShort() * 0.001327547f; + i5vdrw = dis.readUnsignedShort() * 0.001327547f; + tbrd = (dis.readUnsignedShort() * 0.372434f) - 273.15f; + tbrdDb = (dis.readUnsignedShort() * 0.372434f) - 273.15f; + ipcm12v = dis.readUnsignedShort() * 0.002066632361f; + vpcm12v = dis.readUnsignedShort() * 0.01349f; + } + + public float getVpcmbatv() { + return vpcmbatv; + } + + public void setVpcmbatv(float vpcmbatv) { + this.vpcmbatv = vpcmbatv; + } + + public float getIpcmbatv() { + return ipcmbatv; + } + + public void setIpcmbatv(float ipcmbatv) { + this.ipcmbatv = ipcmbatv; + } + + public float getVpcm3v3() { + return vpcm3v3; + } + + public void setVpcm3v3(float vpcm3v3) { + this.vpcm3v3 = vpcm3v3; + } + + public float getIpcm3v3() { + return ipcm3v3; + } + + public void setIpcm3v3(float ipcm3v3) { + this.ipcm3v3 = ipcm3v3; + } + + public float getVpcm5v() { + return vpcm5v; + } + + public void setVpcm5v(float vpcm5v) { + this.vpcm5v = vpcm5v; + } + + public float getIpcm5v() { + return ipcm5v; + } + + public void setIpcm5v(float ipcm5v) { + this.ipcm5v = ipcm5v; + } + + public float getI3v3drw() { + return i3v3drw; + } + + public void setI3v3drw(float i3v3drw) { + this.i3v3drw = i3v3drw; + } + + public float getI5vdrw() { + return i5vdrw; + } + + public void setI5vdrw(float i5vdrw) { + this.i5vdrw = i5vdrw; + } + + public float getTbrd() { + return tbrd; + } + + public void setTbrd(float tbrd) { + this.tbrd = tbrd; + } + + public float getTbrdDb() { + return tbrdDb; + } + + public void setTbrdDb(float tbrdDb) { + this.tbrdDb = tbrdDb; + } + + public float getIpcm12v() { + return ipcm12v; + } + + public void setIpcm12v(float ipcm12v) { + this.ipcm12v = ipcm12v; + } + + public float getVpcm12v() { + return vpcm12v; + } + + public void setVpcm12v(float vpcm12v) { + this.vpcm12v = vpcm12v; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/InterfaceBrdRtc.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/InterfaceBrdRtc.java new file mode 100644 index 00000000..60649213 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/InterfaceBrdRtc.java @@ -0,0 +1,107 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class InterfaceBrdRtc { + + private int timestampHh; + private int timestampMm; + private int timestampSs; + private int timestampDd; + private int timestampMo; + private int timestampYy; + private int timestampDow; + private short temperature; + private int antennaStatus; + + public InterfaceBrdRtc() { + // do nothing + } + + public InterfaceBrdRtc(LittleEndianDataInputStream dis) throws IOException { + timestampHh = dis.readUnsignedByte(); + timestampMm = dis.readUnsignedByte(); + timestampSs = dis.readUnsignedByte(); + timestampDd = dis.readUnsignedByte(); + timestampMo = dis.readUnsignedByte(); + timestampYy = dis.readUnsignedByte(); + timestampDow = dis.readUnsignedByte(); + temperature = dis.readShort(); + antennaStatus = dis.readUnsignedByte(); + } + + public int getTimestampHh() { + return timestampHh; + } + + public void setTimestampHh(int timestampHh) { + this.timestampHh = timestampHh; + } + + public int getTimestampMm() { + return timestampMm; + } + + public void setTimestampMm(int timestampMm) { + this.timestampMm = timestampMm; + } + + public int getTimestampSs() { + return timestampSs; + } + + public void setTimestampSs(int timestampSs) { + this.timestampSs = timestampSs; + } + + public int getTimestampDd() { + return timestampDd; + } + + public void setTimestampDd(int timestampDd) { + this.timestampDd = timestampDd; + } + + public int getTimestampMo() { + return timestampMo; + } + + public void setTimestampMo(int timestampMo) { + this.timestampMo = timestampMo; + } + + public int getTimestampYy() { + return timestampYy; + } + + public void setTimestampYy(int timestampYy) { + this.timestampYy = timestampYy; + } + + public int getTimestampDow() { + return timestampDow; + } + + public void setTimestampDow(int timestampDow) { + this.timestampDow = timestampDow; + } + + public short getTemperature() { + return temperature; + } + + public void setTemperature(short temperature) { + this.temperature = temperature; + } + + public int getAntennaStatus() { + return antennaStatus; + } + + public void setAntennaStatus(int antennaStatus) { + this.antennaStatus = antennaStatus; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Obc.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Obc.java new file mode 100644 index 00000000..456d7ac5 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Obc.java @@ -0,0 +1,127 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Obc { + + private float tlmBoardTemp1; + private float tlmBoardTemp2; + private float tlmBoardTemp3; + private float tlmVbatV; + private float tlmVbatI; + private float tlmVbatPlatV; + private float tlm3v3PlatV; + private float tlmVbatPeriphI; + private float tlm3v3PeriphI; + private float tlmVbatPeriphV; + private float tlm3v3PeriphV; + + public Obc() { + // do nothing + } + + public Obc(LittleEndianDataInputStream dis) throws IOException { + tlmBoardTemp1 = dis.readShort() / 100.0f; + tlmBoardTemp2 = dis.readShort() / 100.0f; + tlmBoardTemp3 = dis.readShort() / 100.0f; + tlmVbatV = dis.readUnsignedShort() / 1000.0f; + tlmVbatI = dis.readUnsignedShort() / 1000.0f; + tlmVbatPlatV = dis.readUnsignedShort() / 1000.0f; + tlm3v3PlatV = dis.readUnsignedShort() / 1000.0f; + tlmVbatPeriphI = dis.readUnsignedShort() / 100.0f; + tlm3v3PeriphI = dis.readUnsignedShort() / 100.0f; + tlmVbatPeriphV = dis.readUnsignedShort() / 1000.0f; + tlm3v3PeriphV = dis.readUnsignedShort() / 1000.0f; + } + + public float getTlmBoardTemp1() { + return tlmBoardTemp1; + } + + public void setTlmBoardTemp1(float tlmBoardTemp1) { + this.tlmBoardTemp1 = tlmBoardTemp1; + } + + public float getTlmBoardTemp2() { + return tlmBoardTemp2; + } + + public void setTlmBoardTemp2(float tlmBoardTemp2) { + this.tlmBoardTemp2 = tlmBoardTemp2; + } + + public float getTlmBoardTemp3() { + return tlmBoardTemp3; + } + + public void setTlmBoardTemp3(float tlmBoardTemp3) { + this.tlmBoardTemp3 = tlmBoardTemp3; + } + + public float getTlmVbatV() { + return tlmVbatV; + } + + public void setTlmVbatV(float tlmVbatV) { + this.tlmVbatV = tlmVbatV; + } + + public float getTlmVbatI() { + return tlmVbatI; + } + + public void setTlmVbatI(float tlmVbatI) { + this.tlmVbatI = tlmVbatI; + } + + public float getTlmVbatPlatV() { + return tlmVbatPlatV; + } + + public void setTlmVbatPlatV(float tlmVbatPlatV) { + this.tlmVbatPlatV = tlmVbatPlatV; + } + + public float getTlm3v3PlatV() { + return tlm3v3PlatV; + } + + public void setTlm3v3PlatV(float tlm3v3PlatV) { + this.tlm3v3PlatV = tlm3v3PlatV; + } + + public float getTlmVbatPeriphI() { + return tlmVbatPeriphI; + } + + public void setTlmVbatPeriphI(float tlmVbatPeriphI) { + this.tlmVbatPeriphI = tlmVbatPeriphI; + } + + public float getTlm3v3PeriphI() { + return tlm3v3PeriphI; + } + + public void setTlm3v3PeriphI(float tlm3v3PeriphI) { + this.tlm3v3PeriphI = tlm3v3PeriphI; + } + + public float getTlmVbatPeriphV() { + return tlmVbatPeriphV; + } + + public void setTlmVbatPeriphV(float tlmVbatPeriphV) { + this.tlmVbatPeriphV = tlmVbatPeriphV; + } + + public float getTlm3v3PeriphV() { + return tlm3v3PeriphV; + } + + public void setTlm3v3PeriphV(float tlm3v3PeriphV) { + this.tlm3v3PeriphV = tlm3v3PeriphV; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/OpMode.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/OpMode.java new file mode 100644 index 00000000..5d2e1a08 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/OpMode.java @@ -0,0 +1,26 @@ +package ru.r2cloud.jradio.sharjahsat; + +public enum OpMode { + + STARTUP(0), NOMINAL(1), SAFE(2), ADCS_CALIBRATION(3), RECOVERY(4), SUN_POINTING(5), CAMERA_OPERATION(6), XRD_OPERATION(7), DIAGNOSTICS(8), UNKNOWN(255); + + private final int code; + + private OpMode(int code) { + this.code = code; + } + + public int getCode() { + return code; + } + + public static OpMode valueOfCode(int code) { + for (OpMode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/SBandModem.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/SBandModem.java new file mode 100644 index 00000000..ab0378ca --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/SBandModem.java @@ -0,0 +1,97 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class SBandModem { + + private int batteryCurrent; + private int paCurrent; + private int batteryVoltage; + private int paVoltage; + private float paTemperature; + private float rfOutputPower; + private float boardTempTop; + private float boardTempBottom; + + public SBandModem() { + // do nothing + } + + public SBandModem(LittleEndianDataInputStream dis) throws IOException { + batteryCurrent = dis.readUnsignedShort() * 40; + paCurrent = dis.readUnsignedShort() * 40; + batteryVoltage = dis.readUnsignedShort() * 4; + paVoltage = dis.readUnsignedShort() * 4; + paTemperature = ((dis.readUnsignedShort() * 3.0f / 4096) - 0.5f) * 100; + rfOutputPower = dis.readUnsignedShort() * 0.00113932291f; + boardTempTop = dis.readShort() * 0.00390625f; + boardTempBottom = dis.readShort() * 0.00390625f; + } + + public int getBatteryCurrent() { + return batteryCurrent; + } + + public void setBatteryCurrent(int batteryCurrent) { + this.batteryCurrent = batteryCurrent; + } + + public int getPaCurrent() { + return paCurrent; + } + + public void setPaCurrent(int paCurrent) { + this.paCurrent = paCurrent; + } + + public int getBatteryVoltage() { + return batteryVoltage; + } + + public void setBatteryVoltage(int batteryVoltage) { + this.batteryVoltage = batteryVoltage; + } + + public int getPaVoltage() { + return paVoltage; + } + + public void setPaVoltage(int paVoltage) { + this.paVoltage = paVoltage; + } + + public float getPaTemperature() { + return paTemperature; + } + + public void setPaTemperature(float paTemperature) { + this.paTemperature = paTemperature; + } + + public float getRfOutputPower() { + return rfOutputPower; + } + + public void setRfOutputPower(float rfOutputPower) { + this.rfOutputPower = rfOutputPower; + } + + public float getBoardTempTop() { + return boardTempTop; + } + + public void setBoardTempTop(float boardTempTop) { + this.boardTempTop = boardTempTop; + } + + public float getBoardTempBottom() { + return boardTempBottom; + } + + public void setBoardTempBottom(float boardTempBottom) { + this.boardTempBottom = boardTempBottom; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Beacon.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Beacon.java new file mode 100644 index 00000000..4054d890 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Beacon.java @@ -0,0 +1,54 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.DataInputStream; +import java.io.IOException; + +import ru.r2cloud.jradio.ax25.Ax25Beacon; +import ru.r2cloud.jradio.fec.ccsds.UncorrectableException; +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Sharjahsat1Beacon extends Ax25Beacon { + + private Sharjahsat1Header sharjahsat1Header; + private byte[] imagePayload; + private Telemetry telemetry; + + @Override + public void readBeacon(DataInputStream dis) throws IOException, UncorrectableException { + LittleEndianDataInputStream ldis = new LittleEndianDataInputStream(dis); + sharjahsat1Header = new Sharjahsat1Header(ldis); + if (sharjahsat1Header.getTmId() == 0x41) { + imagePayload = new byte[dis.available()]; + dis.readFully(imagePayload); + } else if (sharjahsat1Header.getTmId() == 0x50) { + telemetry = new Telemetry(ldis); + } else { + super.readBeacon(dis); + } + } + + public Sharjahsat1Header getSharjahsat1Header() { + return sharjahsat1Header; + } + + public void setSharjahsat1Header(Sharjahsat1Header sharjahsat1Header) { + this.sharjahsat1Header = sharjahsat1Header; + } + + public byte[] getImagePayload() { + return imagePayload; + } + + public void setImagePayload(byte[] imagePayload) { + this.imagePayload = imagePayload; + } + + public Telemetry getTelemetry() { + return telemetry; + } + + public void setTelemetry(Telemetry telemetry) { + this.telemetry = telemetry; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Header.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Header.java new file mode 100644 index 00000000..1d972ec6 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1Header.java @@ -0,0 +1,57 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Sharjahsat1Header { + + private String identifier; + private int tmId; + private int dataLength; + private long packetCounter; + + public Sharjahsat1Header() { + // do nothing + } + + public Sharjahsat1Header(LittleEndianDataInputStream dis) throws IOException { + identifier = dis.readString(4); + tmId = dis.readUnsignedByte(); + dataLength = dis.readUnsignedByte(); + packetCounter = dis.readUnsignedInt(); + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public int getTmId() { + return tmId; + } + + public void setTmId(int tmId) { + this.tmId = tmId; + } + + public int getDataLength() { + return dataLength; + } + + public void setDataLength(int dataLength) { + this.dataLength = dataLength; + } + + public long getPacketCounter() { + return packetCounter; + } + + public void setPacketCounter(long packetCounter) { + this.packetCounter = packetCounter; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/SolarPanels.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/SolarPanels.java new file mode 100644 index 00000000..66572c57 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/SolarPanels.java @@ -0,0 +1,492 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class SolarPanels { + + private float vbcr1; + private float vbcr2; + private float vbcr3; + private float vbcr4; + private float vbcr5; + private float vbcr6; + private float vbcr7; + private float vbcr8; + private float vbcr9; + private float ibcra1; + private float ibcra2; + private float ibcra3; + private float ibcra4; + private float ibcra5; + private float ibcra6; + private float ibcra7; + private float ibcra8; + private float ibcra9; + private float ibcrb1; + private float ibcrb2; + private float ibcrb3; + private float ibcrb4; + private float ibcrb5; + private float ibcrb6; + private float ibcrb7; + private float ibcrb8; + private float ibcrb9; + private float tbcra1; + private float tbcra2; + private float tbcra3; + private float tbcra4; + private float tbcra5; + private float tbcra6; + private float tbcra7; + private float tbcra8; + private float tbcra9; + private float tbcrb1; + private float tbcrb2; + private float tbcrb3; + private float tbcrb4; + private float tbcrb5; + private float tbcrb6; + private float tbcrb7; + private float tbcrb8; + private float tbcrb9; + private float vidiodeout; + private float iidiodeout; + + public SolarPanels() { + // do nothing + } + + public SolarPanels(LittleEndianDataInputStream dis) throws IOException { + vbcr1 = dis.readUnsignedShort() * 0.0322581f; + vbcr2 = dis.readUnsignedShort() * 0.0322581f; + vbcr3 = dis.readUnsignedShort() * 0.0322581f; + vbcr4 = dis.readUnsignedShort() * 0.0322581f; + vbcr5 = dis.readUnsignedShort() * 0.0322581f; + vbcr6 = dis.readUnsignedShort() * 0.0322581f; + vbcr7 = dis.readUnsignedShort() * 0.0322581f; + vbcr8 = dis.readUnsignedShort() * 0.0322581f; + vbcr9 = dis.readUnsignedShort() * 0.0322581f; + + ibcra1 = dis.readUnsignedShort() * 0.0009775f; + ibcra2 = dis.readUnsignedShort() * 0.0009775f; + ibcra3 = dis.readUnsignedShort() * 0.0009775f; + ibcra4 = dis.readUnsignedShort() * 0.0009775f; + ibcra5 = dis.readUnsignedShort() * 0.0009775f; + ibcra6 = dis.readUnsignedShort() * 0.0009775f; + ibcra7 = dis.readUnsignedShort() * 0.0009775f; + ibcra8 = dis.readUnsignedShort() * 0.0009775f; + ibcra9 = dis.readUnsignedShort() * 0.0009775f; + + ibcrb1 = dis.readUnsignedShort() * 0.0009775f; + ibcrb2 = dis.readUnsignedShort() * 0.0009775f; + ibcrb3 = dis.readUnsignedShort() * 0.0009775f; + ibcrb4 = dis.readUnsignedShort() * 0.0009775f; + ibcrb5 = dis.readUnsignedShort() * 0.0009775f; + ibcrb6 = dis.readUnsignedShort() * 0.0009775f; + ibcrb7 = dis.readUnsignedShort() * 0.0009775f; + ibcrb8 = dis.readUnsignedShort() * 0.0009775f; + ibcrb9 = dis.readUnsignedShort() * 0.0009775f; + + tbcra1 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra2 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra3 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra4 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra5 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra6 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra7 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra8 = (dis.readShort() * 0.4963f) - 273.15f; + tbcra9 = (dis.readShort() * 0.4963f) - 273.15f; + + tbcrb1 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb2 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb3 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb4 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb5 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb6 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb7 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb8 = (dis.readShort() * 0.4963f) - 273.15f; + tbcrb9 = (dis.readShort() * 0.4963f) - 273.15f; + + vidiodeout = dis.readUnsignedShort() * 0.008993157f; + iidiodeout = dis.readUnsignedShort() * 0.014662757f; + } + + public float getVbcr1() { + return vbcr1; + } + + public void setVbcr1(float vbcr1) { + this.vbcr1 = vbcr1; + } + + public float getVbcr2() { + return vbcr2; + } + + public void setVbcr2(float vbcr2) { + this.vbcr2 = vbcr2; + } + + public float getVbcr3() { + return vbcr3; + } + + public void setVbcr3(float vbcr3) { + this.vbcr3 = vbcr3; + } + + public float getVbcr4() { + return vbcr4; + } + + public void setVbcr4(float vbcr4) { + this.vbcr4 = vbcr4; + } + + public float getVbcr5() { + return vbcr5; + } + + public void setVbcr5(float vbcr5) { + this.vbcr5 = vbcr5; + } + + public float getVbcr6() { + return vbcr6; + } + + public void setVbcr6(float vbcr6) { + this.vbcr6 = vbcr6; + } + + public float getVbcr7() { + return vbcr7; + } + + public void setVbcr7(float vbcr7) { + this.vbcr7 = vbcr7; + } + + public float getVbcr8() { + return vbcr8; + } + + public void setVbcr8(float vbcr8) { + this.vbcr8 = vbcr8; + } + + public float getVbcr9() { + return vbcr9; + } + + public void setVbcr9(float vbcr9) { + this.vbcr9 = vbcr9; + } + + public float getIbcra1() { + return ibcra1; + } + + public void setIbcra1(float ibcra1) { + this.ibcra1 = ibcra1; + } + + public float getIbcra2() { + return ibcra2; + } + + public void setIbcra2(float ibcra2) { + this.ibcra2 = ibcra2; + } + + public float getIbcra3() { + return ibcra3; + } + + public void setIbcra3(float ibcra3) { + this.ibcra3 = ibcra3; + } + + public float getIbcra4() { + return ibcra4; + } + + public void setIbcra4(float ibcra4) { + this.ibcra4 = ibcra4; + } + + public float getIbcra5() { + return ibcra5; + } + + public void setIbcra5(float ibcra5) { + this.ibcra5 = ibcra5; + } + + public float getIbcra6() { + return ibcra6; + } + + public void setIbcra6(float ibcra6) { + this.ibcra6 = ibcra6; + } + + public float getIbcra7() { + return ibcra7; + } + + public void setIbcra7(float ibcra7) { + this.ibcra7 = ibcra7; + } + + public float getIbcra8() { + return ibcra8; + } + + public void setIbcra8(float ibcra8) { + this.ibcra8 = ibcra8; + } + + public float getIbcra9() { + return ibcra9; + } + + public void setIbcra9(float ibcra9) { + this.ibcra9 = ibcra9; + } + + public float getIbcrb1() { + return ibcrb1; + } + + public void setIbcrb1(float ibcrb1) { + this.ibcrb1 = ibcrb1; + } + + public float getIbcrb2() { + return ibcrb2; + } + + public void setIbcrb2(float ibcrb2) { + this.ibcrb2 = ibcrb2; + } + + public float getIbcrb3() { + return ibcrb3; + } + + public void setIbcrb3(float ibcrb3) { + this.ibcrb3 = ibcrb3; + } + + public float getIbcrb4() { + return ibcrb4; + } + + public void setIbcrb4(float ibcrb4) { + this.ibcrb4 = ibcrb4; + } + + public float getIbcrb5() { + return ibcrb5; + } + + public void setIbcrb5(float ibcrb5) { + this.ibcrb5 = ibcrb5; + } + + public float getIbcrb6() { + return ibcrb6; + } + + public void setIbcrb6(float ibcrb6) { + this.ibcrb6 = ibcrb6; + } + + public float getIbcrb7() { + return ibcrb7; + } + + public void setIbcrb7(float ibcrb7) { + this.ibcrb7 = ibcrb7; + } + + public float getIbcrb8() { + return ibcrb8; + } + + public void setIbcrb8(float ibcrb8) { + this.ibcrb8 = ibcrb8; + } + + public float getIbcrb9() { + return ibcrb9; + } + + public void setIbcrb9(float ibcrb9) { + this.ibcrb9 = ibcrb9; + } + + public float getTbcra1() { + return tbcra1; + } + + public void setTbcra1(float tbcra1) { + this.tbcra1 = tbcra1; + } + + public float getTbcra2() { + return tbcra2; + } + + public void setTbcra2(float tbcra2) { + this.tbcra2 = tbcra2; + } + + public float getTbcra3() { + return tbcra3; + } + + public void setTbcra3(float tbcra3) { + this.tbcra3 = tbcra3; + } + + public float getTbcra4() { + return tbcra4; + } + + public void setTbcra4(float tbcra4) { + this.tbcra4 = tbcra4; + } + + public float getTbcra5() { + return tbcra5; + } + + public void setTbcra5(float tbcra5) { + this.tbcra5 = tbcra5; + } + + public float getTbcra6() { + return tbcra6; + } + + public void setTbcra6(float tbcra6) { + this.tbcra6 = tbcra6; + } + + public float getTbcra7() { + return tbcra7; + } + + public void setTbcra7(float tbcra7) { + this.tbcra7 = tbcra7; + } + + public float getTbcra8() { + return tbcra8; + } + + public void setTbcra8(float tbcra8) { + this.tbcra8 = tbcra8; + } + + public float getTbcra9() { + return tbcra9; + } + + public void setTbcra9(float tbcra9) { + this.tbcra9 = tbcra9; + } + + public float getTbcrb1() { + return tbcrb1; + } + + public void setTbcrb1(float tbcrb1) { + this.tbcrb1 = tbcrb1; + } + + public float getTbcrb2() { + return tbcrb2; + } + + public void setTbcrb2(float tbcrb2) { + this.tbcrb2 = tbcrb2; + } + + public float getTbcrb3() { + return tbcrb3; + } + + public void setTbcrb3(float tbcrb3) { + this.tbcrb3 = tbcrb3; + } + + public float getTbcrb4() { + return tbcrb4; + } + + public void setTbcrb4(float tbcrb4) { + this.tbcrb4 = tbcrb4; + } + + public float getTbcrb5() { + return tbcrb5; + } + + public void setTbcrb5(float tbcrb5) { + this.tbcrb5 = tbcrb5; + } + + public float getTbcrb6() { + return tbcrb6; + } + + public void setTbcrb6(float tbcrb6) { + this.tbcrb6 = tbcrb6; + } + + public float getTbcrb7() { + return tbcrb7; + } + + public void setTbcrb7(float tbcrb7) { + this.tbcrb7 = tbcrb7; + } + + public float getTbcrb8() { + return tbcrb8; + } + + public void setTbcrb8(float tbcrb8) { + this.tbcrb8 = tbcrb8; + } + + public float getTbcrb9() { + return tbcrb9; + } + + public void setTbcrb9(float tbcrb9) { + this.tbcrb9 = tbcrb9; + } + + public float getVidiodeout() { + return vidiodeout; + } + + public void setVidiodeout(float vidiodeout) { + this.vidiodeout = vidiodeout; + } + + public float getIidiodeout() { + return iidiodeout; + } + + public void setIidiodeout(float iidiodeout) { + this.iidiodeout = iidiodeout; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/SystemInfo.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/SystemInfo.java new file mode 100644 index 00000000..342db441 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/SystemInfo.java @@ -0,0 +1,192 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class SystemInfo { + + private boolean battery; + private boolean eps; + private boolean adcs; + private boolean uvModem; + private boolean sband; + private boolean ixrd; + private boolean cam2mp; + private boolean cam5mp; + private boolean ifBoard; + private boolean rtc; + private boolean beacon; + private boolean antennas; + private OpMode mode; + + private int restartCount; + private int lastResetCause; + private long systemUptime; + private long systemTime; + + public SystemInfo() { + // do nothing + } + + public SystemInfo(LittleEndianDataInputStream dis) throws IOException { + int raw = dis.readUnsignedByte(); + battery = ((raw >> 7) & 0x1) > 0; + eps = ((raw >> 6) & 0x1) > 0; + adcs = ((raw >> 5) & 0x1) > 0; + uvModem = ((raw >> 4) & 0x1) > 0; + sband = ((raw >> 3) & 0x1) > 0; + ixrd = ((raw >> 2) & 0x1) > 0; + cam2mp = ((raw >> 1) & 0x1) > 0; + cam5mp = (raw & 0x1) > 0; + + raw = dis.readUnsignedByte(); + ifBoard = ((raw >> 7) & 0x1) > 0; + rtc = ((raw >> 6) & 0x1) > 0; + beacon = ((raw >> 5) & 0x1) > 0; + antennas = ((raw >> 4) & 0x1) > 0; + mode = OpMode.valueOfCode(raw & 0b1111); + + restartCount = dis.readUnsignedShort(); + lastResetCause = dis.readUnsignedByte(); + systemUptime = dis.readUnsignedInt(); + systemTime = dis.readUnsignedInt(); + } + + public boolean isBattery() { + return battery; + } + + public void setBattery(boolean battery) { + this.battery = battery; + } + + public boolean isEps() { + return eps; + } + + public void setEps(boolean eps) { + this.eps = eps; + } + + public boolean isAdcs() { + return adcs; + } + + public void setAdcs(boolean adcs) { + this.adcs = adcs; + } + + public boolean isUvModem() { + return uvModem; + } + + public void setUvModem(boolean uvModem) { + this.uvModem = uvModem; + } + + public boolean isSband() { + return sband; + } + + public void setSband(boolean sband) { + this.sband = sband; + } + + public boolean isIxrd() { + return ixrd; + } + + public void setIxrd(boolean ixrd) { + this.ixrd = ixrd; + } + + public boolean isCam2mp() { + return cam2mp; + } + + public void setCam2mp(boolean cam2mp) { + this.cam2mp = cam2mp; + } + + public boolean isCam5mp() { + return cam5mp; + } + + public void setCam5mp(boolean cam5mp) { + this.cam5mp = cam5mp; + } + + public boolean isIfBoard() { + return ifBoard; + } + + public void setIfBoard(boolean ifBoard) { + this.ifBoard = ifBoard; + } + + public boolean isRtc() { + return rtc; + } + + public void setRtc(boolean rtc) { + this.rtc = rtc; + } + + public boolean isBeacon() { + return beacon; + } + + public void setBeacon(boolean beacon) { + this.beacon = beacon; + } + + public boolean isAntennas() { + return antennas; + } + + public void setAntennas(boolean antennas) { + this.antennas = antennas; + } + + public OpMode getMode() { + return mode; + } + + public void setMode(OpMode mode) { + this.mode = mode; + } + + public int getRestartCount() { + return restartCount; + } + + public void setRestartCount(int restartCount) { + this.restartCount = restartCount; + } + + public int getLastResetCause() { + return lastResetCause; + } + + public void setLastResetCause(int lastResetCause) { + this.lastResetCause = lastResetCause; + } + + public long getSystemUptime() { + return systemUptime; + } + + public void setSystemUptime(long systemUptime) { + this.systemUptime = systemUptime; + } + + public long getSystemTime() { + return systemTime; + } + + public void setSystemTime(long systemTime) { + this.systemTime = systemTime; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/Telemetry.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/Telemetry.java new file mode 100644 index 00000000..0331d872 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/Telemetry.java @@ -0,0 +1,107 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Telemetry { + + private SystemInfo systemInfo; + private Obc obc; + private InterfaceBrdRtc interfaceBrdRtc; + private Battery battery; + private Eps eps; + private Adcs adcs; + private UhfVhfModem uhfvhfModem; + private SBandModem sBandModem; + private SolarPanels solarPanels; + + public Telemetry() { + // do nothing + } + + public Telemetry(LittleEndianDataInputStream dis) throws IOException { + systemInfo = new SystemInfo(dis); + obc = new Obc(dis); + interfaceBrdRtc = new InterfaceBrdRtc(dis); + battery = new Battery(dis); + eps = new Eps(dis); + adcs = new Adcs(dis); + uhfvhfModem = new UhfVhfModem(dis); + sBandModem = new SBandModem(dis); + solarPanels = new SolarPanels(dis); + } + + public SystemInfo getSystemInfo() { + return systemInfo; + } + + public void setSystemInfo(SystemInfo systemInfo) { + this.systemInfo = systemInfo; + } + + public Obc getObc() { + return obc; + } + + public void setObc(Obc obc) { + this.obc = obc; + } + + public InterfaceBrdRtc getInterfaceBrdRtc() { + return interfaceBrdRtc; + } + + public void setInterfaceBrdRtc(InterfaceBrdRtc interfaceBrdRtc) { + this.interfaceBrdRtc = interfaceBrdRtc; + } + + public Battery getBattery() { + return battery; + } + + public void setBattery(Battery battery) { + this.battery = battery; + } + + public Eps getEps() { + return eps; + } + + public void setEps(Eps eps) { + this.eps = eps; + } + + public Adcs getAdcs() { + return adcs; + } + + public void setAdcs(Adcs adcs) { + this.adcs = adcs; + } + + public UhfVhfModem getUhfvhfModem() { + return uhfvhfModem; + } + + public void setUhfvhfModem(UhfVhfModem uhfvhfModem) { + this.uhfvhfModem = uhfvhfModem; + } + + public SBandModem getsBandModem() { + return sBandModem; + } + + public void setsBandModem(SBandModem sBandModem) { + this.sBandModem = sBandModem; + } + + public SolarPanels getSolarPanels() { + return solarPanels; + } + + public void setSolarPanels(SolarPanels solarPanels) { + this.solarPanels = solarPanels; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/sharjahsat/UhfVhfModem.java b/src/main/java/ru/r2cloud/jradio/sharjahsat/UhfVhfModem.java new file mode 100644 index 00000000..e8896850 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/sharjahsat/UhfVhfModem.java @@ -0,0 +1,77 @@ +package ru.r2cloud.jradio.sharjahsat; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class UhfVhfModem { + + private int smpsTemp; + private int paTemp; + private int current3v3; + private int voltage3v3; + private int current5v; + private int voltage5v; + + public UhfVhfModem() { + // do nothing + } + + public UhfVhfModem(LittleEndianDataInputStream dis) throws IOException { + smpsTemp = dis.readUnsignedByte(); + paTemp = dis.readUnsignedByte(); + current3v3 = dis.readUnsignedShort() * 3; + voltage3v3 = dis.readUnsignedShort() * 4; + current5v = dis.readUnsignedShort() * 62; + voltage5v = dis.readUnsignedShort() * 4; + } + + public int getSmpsTemp() { + return smpsTemp; + } + + public void setSmpsTemp(int smpsTemp) { + this.smpsTemp = smpsTemp; + } + + public int getPaTemp() { + return paTemp; + } + + public void setPaTemp(int paTemp) { + this.paTemp = paTemp; + } + + public int getCurrent3v3() { + return current3v3; + } + + public void setCurrent3v3(int current3v3) { + this.current3v3 = current3v3; + } + + public int getVoltage3v3() { + return voltage3v3; + } + + public void setVoltage3v3(int voltage3v3) { + this.voltage3v3 = voltage3v3; + } + + public int getCurrent5v() { + return current5v; + } + + public void setCurrent5v(int current5v) { + this.current5v = current5v; + } + + public int getVoltage5v() { + return voltage5v; + } + + public void setVoltage5v(int voltage5v) { + this.voltage5v = voltage5v; + } + +} diff --git a/src/test/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1BeaconTest.java b/src/test/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1BeaconTest.java new file mode 100644 index 00000000..9c86d3bc --- /dev/null +++ b/src/test/java/ru/r2cloud/jradio/sharjahsat/Sharjahsat1BeaconTest.java @@ -0,0 +1,47 @@ +package ru.r2cloud.jradio.sharjahsat; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.junit.Test; + +import ru.r2cloud.jradio.AssertJson; +import ru.r2cloud.jradio.fec.ViterbiTest; + +public class Sharjahsat1BeaconTest { + + @Test + public void testTelemetry() throws Exception { + byte[] data = ViterbiTest.hexStringToByteArray("826C64AA9EA6E0826C60AA9EA66103F04553455250F600000000FF1FA101023A440000382A276561058E055505810803028608340D2000090083082D0D27052303110A2300FF0F8703E9FF06035C0302000300E80263026102610285030D00050349005B03130011001700F102F502020082035504FB153C8ECFF1F995F402C2F4FFAA008E0100000000000000000000000000000000000000000C003E030000E904000000000000000000000000000000009B01AB01FD0051020601FC0007010701070103006C001400AD01020002000200010002000300020004000200020002000200020007002B022B0218021802A10223029C029F029D02F703F403F2039C029F029F029E029F029E0290034700"); + Sharjahsat1Beacon result = new Sharjahsat1Beacon(); + result.readBeacon(data); + AssertJson.assertObjectsEqual("Sharjahsat1Beacon.json", result); + } + + @Test + public void testImage() throws Exception { + byte[] data = ViterbiTest.hexStringToByteArray("826C64AA9EA6E0826C60AA9EA66103F04553455241F60D0000005A9868246E29B4C42534D310DA4A08128A620C538AD001B78A50B482C232E2A3340991914DAA24526973914806E29698006E08A9617DB52CA193C985ACDCFCCD5512645330E5AAC5BC78AD599246BDAC5D2B47EE8C0AE591D51562DC2D8879AACEFCD42DCD48CB51BB8AB20915EAC4736DA968D108F266888F1CD2026DC1451BF70A92C41270050F2E4629D8647BA9C1AA843852D228753A9943C53EA463C53C5234255152A8A451285A902D4964C169C16A4B24515328A45122AD4EA952325D94C993E5A64B39EC5262B73806E2A222801845466A84308A8CD0034D37EB4C421A69A42186A26A60308A61AA2469A650219498AA2069"); + Sharjahsat1Beacon result = new Sharjahsat1Beacon(); + result.readBeacon(data); + AssertJson.assertObjectsEqual("Sharjahsat1BeaconImage.json", result); + } + + @Test + public void testPojo() { + assertThat(Sharjahsat1Beacon.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Sharjahsat1Header.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Telemetry.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(SystemInfo.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Obc.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(InterfaceBrdRtc.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Battery.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Eps.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Adcs.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(UhfVhfModem.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(SBandModem.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(SolarPanels.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + } + +} diff --git a/src/test/resources/expected/Sharjahsat1Beacon.json b/src/test/resources/expected/Sharjahsat1Beacon.json new file mode 100644 index 00000000..eccefdee --- /dev/null +++ b/src/test/resources/expected/Sharjahsat1Beacon.json @@ -0,0 +1,198 @@ +{ + "sharjahsat1Header": { + "identifier": "ESER", + "tmId": 80, + "dataLength": 246, + "packetCounter": 0 + }, + "telemetry": { + "systemInfo": { + "battery": true, + "eps": true, + "adcs": true, + "uvModem": true, + "sband": true, + "ixrd": true, + "cam2mp": true, + "cam5mp": true, + "ifBoard": false, + "rtc": false, + "beacon": false, + "antennas": true, + "mode": "UNKNOWN", + "restartCount": 417, + "lastResetCause": 2, + "systemUptime": 17466, + "systemTime": 1697065528 + }, + "obc": { + "tlmBoardTemp1": 13.77, + "tlmBoardTemp2": 14.22, + "tlmBoardTemp3": 13.65, + "tlmVbatV": 2.177, + "tlmVbatI": 0.515, + "tlmVbatPlatV": 2.182, + "tlm3v3PlatV": 3.38, + "tlmVbatPeriphI": 0.32, + "tlm3v3PeriphI": 0.09, + "tlmVbatPeriphV": 2.179, + "tlm3v3PeriphV": 3.373 + }, + "interfaceBrdRtc": { + "timestampHh": 39, + "timestampMm": 5, + "timestampSs": 35, + "timestampDd": 3, + "timestampMo": 17, + "timestampYy": 10, + "timestampDow": 35, + "temperature": -256, + "antennaStatus": 15 + }, + "battery": { + "vbat": 8.120679, + "ibat": -337.2434, + "vpcm3v3": 3.336714, + "vpcm5v": 5.0439, + "ipcm3v3": 2.655094, + "ipcm5v": 3.9826407, + "tbrd": 3.9408875, + "tbat1": 4.3635864, + "tbat2": 3.56839, + "tbat3": 3.56839 + }, + "eps": { + "vpcmbatv": 8.089178, + "ipcmbatv": 0.08865853, + "vpcm3v3": 3.332403, + "ipcm3v3": 0.49785173, + "vpcm5v": 5.0380354, + "ipcm5v": 0.12957785, + "i3v3drw": 0.022568299, + "i5vdrw": 0.030533582, + "tbrd": 7.2927856, + "tbrdDb": 8.782532, + "ipcm12v": 0.0041332645, + "vpcm12v": 12.114019 + }, + "adcs": { + "adcsState": 85, + "satPosLlhLat": -12.759999, + "satPosLlhLon": 153.81, + "satPosLlhAlt": -124.02, + "estmAttAngleYaw": -15.509999, + "estmAttAnglePitch": -29.23, + "estmAttAngleRoll": -158.7, + "estmAngRateYaw": -0.12, + "estmAngRatePitch": 1.6999999, + "estmAngRateRoll": 3.98, + "dataB64T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "uhfvhfModem": { + "smpsTemp": 0, + "paTemp": 0, + "current3v3": 36, + "voltage3v3": 3320, + "current5v": 0, + "voltage5v": 5028 + }, + "sBandModem": { + "batteryCurrent": 0, + "paCurrent": 0, + "batteryVoltage": 0, + "paVoltage": 0, + "paTemperature": -50.0, + "rfOutputPower": 0.0, + "boardTempTop": 0.0, + "boardTempBottom": 0.0 + }, + "solarPanels": { + "vbcr1": 13.25808, + "vbcr2": 13.774209, + "vbcr3": 8.1613, + "vbcr4": 19.129053, + "vbcr5": 8.451622, + "vbcr6": 8.129042, + "vbcr7": 8.48388, + "vbcr8": 8.48388, + "vbcr9": 8.48388, + "ibcra1": 0.0029325, + "ibcra2": 0.105569996, + "ibcra3": 0.01955, + "ibcra4": 0.4193475, + "ibcra5": 0.001955, + "ibcra6": 0.001955, + "ibcra7": 0.001955, + "ibcra8": 9.775E-4, + "ibcra9": 0.001955, + "ibcrb1": 0.0029325, + "ibcrb2": 0.001955, + "ibcrb3": 0.00391, + "ibcrb4": 0.001955, + "ibcrb5": 0.001955, + "ibcrb6": 0.001955, + "ibcrb7": 0.001955, + "ibcrb8": 0.001955, + "ibcrb9": 0.0068425, + "tbcra1": 2.2965088, + "tbcra2": 2.2965088, + "tbcra3": -7.1331787, + "tbcra4": -7.1331787, + "tbcra5": 60.859924, + "tbcra6": -1.6738892, + "tbcra7": 58.378418, + "tbcra8": 59.86731, + "tbcra9": 58.874725, + "tbcrb1": 230.59451, + "tbcrb2": 229.10562, + "tbcrb3": 228.113, + "tbcrb4": 58.378418, + "tbcrb5": 59.86731, + "tbcrb6": 59.86731, + "tbcrb7": 59.371002, + "tbcrb8": 59.86731, + "tbcrb9": 59.371002, + "vidiodeout": 8.201759, + "iidiodeout": 1.0410557 + } + }, + "header": { + "destinationAddress": { + "callsign": "A62UOS", + "ssid": 0, + "extensionBit": 0 + }, + "sourceAddress": { + "callsign": "A60UOS", + "ssid": 0, + "extensionBit": 1 + }, + "frameType": "U", + "sendSequenceNumber": 0, + "receiveSequenceNumber": 0, + "uControlType": "UI", + "pid": 240 + }, + "beginSample": 0, + "beginMillis": 0, + "endSample": 0 +} \ No newline at end of file diff --git a/src/test/resources/expected/Sharjahsat1BeaconImage.json b/src/test/resources/expected/Sharjahsat1BeaconImage.json new file mode 100644 index 00000000..56d6a7a4 --- /dev/null +++ b/src/test/resources/expected/Sharjahsat1BeaconImage.json @@ -0,0 +1,276 @@ +{ + "sharjahsat1Header": { + "identifier": "ESER", + "tmId": 65, + "dataLength": 246, + "packetCounter": 13 + }, + "imagePayload": [ + 90, + -104, + 104, + 36, + 110, + 41, + -76, + -60, + 37, + 52, + -45, + 16, + -38, + 74, + 8, + 18, + -118, + 98, + 12, + 83, + -118, + -48, + 1, + -73, + -118, + 80, + -76, + -126, + -62, + 50, + -30, + -93, + 52, + 9, + -111, + -111, + 77, + -86, + 36, + 82, + 105, + 115, + -111, + 72, + 6, + -30, + -106, + -104, + 0, + 110, + 8, + -87, + 97, + 125, + -75, + 44, + -95, + -109, + -55, + -123, + -84, + -36, + -4, + -51, + 85, + 18, + 100, + 83, + 48, + -27, + -86, + -59, + -68, + 120, + -83, + 89, + -110, + 70, + -67, + -84, + 93, + 43, + 71, + -18, + -116, + 10, + -27, + -111, + -43, + 21, + 98, + -36, + 45, + -120, + 121, + -86, + -50, + -4, + -44, + 45, + -51, + 72, + -53, + 81, + -69, + -118, + -78, + 9, + 21, + -22, + -60, + 115, + 109, + -87, + 104, + -47, + 8, + -14, + 102, + -120, + -113, + 28, + -46, + 2, + 109, + -63, + 69, + 27, + -9, + 10, + -110, + -60, + 18, + 112, + 5, + 15, + 46, + 70, + 41, + -40, + 100, + 123, + -87, + -63, + -86, + -124, + 56, + 82, + -46, + 40, + 117, + 58, + -103, + 67, + -59, + 62, + -92, + 99, + -59, + 60, + 82, + 52, + 37, + 81, + 82, + -88, + -92, + 81, + 40, + 90, + -112, + 45, + 73, + 100, + -63, + 105, + -63, + 106, + 75, + 36, + 81, + 83, + 40, + -92, + 81, + 34, + -83, + 78, + -87, + 82, + 50, + 93, + -108, + -55, + -109, + -27, + -90, + 75, + 57, + -20, + 82, + 98, + -73, + 56, + 6, + -30, + -94, + 34, + -128, + 24, + 69, + 70, + 106, + -124, + 48, + -118, + -116, + -48, + 3, + 77, + 55, + -21, + 76, + 66, + 26, + 105, + -92, + 33, + -122, + -94, + 106, + 96, + 48, + -118, + 97, + -86, + 36, + 105, + -90, + 80, + 33, + -108, + -104, + -86, + 32, + 105 + ], + "header": { + "destinationAddress": { + "callsign": "A62UOS", + "ssid": 0, + "extensionBit": 0 + }, + "sourceAddress": { + "callsign": "A60UOS", + "ssid": 0, + "extensionBit": 1 + }, + "frameType": "U", + "sendSequenceNumber": 0, + "receiveSequenceNumber": 0, + "uControlType": "UI", + "pid": 240 + }, + "beginSample": 0, + "beginMillis": 0, + "endSample": 0 +} \ No newline at end of file