WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
SunSensor.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, INC.
15******************************************************************************/
16/*
17Sun Sensor model header file
18
19Author: James Tabony
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "Sun Sensor",
24 "exclude" : False,
25 "category" : "Sensors"
26}
27aliases = {"pointing_bias" : "EXCLUDE",
28 "fov_horizontal" : "Horizontal FOV (degrees)",
29 "fov_vertical" : "Vertical FOV (degrees)",
30 "mount_frame" : "Spacecraft Body",
31 "mount_position__mf" : "EXCLUDE",
32 "mount_alignment_mf" : "EXCLUDE",
33 "rate_hz" : "EXCLUDE",
34 "seed_value" : "RNG Seed",
35 "sun_inertial_frame" : "Sun Inertial Frame",
36 "primary_inertial_frame" : "Earth Inertial Frame",
37 "primary_radius" : "EXCLUDE",
38 "latency" : "EXCLUDE",
39 "operational_power_draw" : "Operational Power Draw",
40 "mass" : "Mass",
41 "gaussian_noise" : "One-Sigma Noise (radians)",
42 "meas_sun_vector__ss" : "Measured Sun Vector",
43 "truth_sun_vector__ss" : "Truth Sun Vector",
44 "is_valid" : "Measurement Validity Boolean",
45 "current_power_draw" : "Current Power Draw",
46}
47*/
48
49#ifndef MODELS_SENSORS_SUN_SENSOR_H
50#define MODELS_SENSORS_SUN_SENSOR_H
51
52#include "simulation/Model.h"
53#include "frames/Frame.h"
56#include "utils/LatencyUtil.hpp"
61
62namespace warptwin {
63
83
88 // Default constuctor (should populate with model defualt outputs)
92 // Custom constructor
96 };
97
98 MODEL(SunSensor)
99 public:
100 // Model params
101 // NAME TYPE DEFAULT VALUE
105 SIGNAL(pointing_bias, clockwerk::Quaternion, clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
108 SIGNAL(fov_horizontal, double, 0.0)
111 SIGNAL(fov_vertical, double, 0.0)
115 SIGNAL(mount_frame, Frame*, nullptr)
117 SIGNAL(mount_position__mf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
119 SIGNAL(mount_alignment_mf, clockwerk::Quaternion, clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
122 SIGNAL(rate_hz, int, 0)
124 SIGNAL(seed_value, int, 0)
126 SIGNAL(sun_inertial_frame, Frame*, nullptr)
128 SIGNAL(primary_inertial_frame, Frame*, nullptr)
130 SIGNAL(primary_radius, double, warpos::earth_wgs84.eq_radius)
134 SIGNAL(latency, int, 0)
137 SIGNAL(operational_power_draw, double, 0.0)
139 SIGNAL(mass, double, 0.0)
141
142 // Model inputs
143 // NAME TYPE DEFAULT VALUE
148 SIGNAL(gaussian_noise, double, 0.0)
150
151 // Model outputs
152 // NAME TYPE DEFAULT VALUE
157 SIGNAL(output_time, clockwerk::Time, clockwerk::Time(0, 0))
161 SIGNAL(meas_sun_vector__ss, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
165 SIGNAL(truth_sun_vector__ss, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
169 SIGNAL(is_valid, bool, false)
172 SIGNAL(current_power_draw, double, 0.0)
174
176 clockwerk::DataIO<Frame*> sensor_frame = clockwerk::DataIO<Frame*>(this, "sensor_frame", &_sensor_frame);
177
180 warptwin::BiasNoiseModel* biasNoiseModel() {return &_sensor_noise_model;}
181
184 warptwin::RateMonitor* rateMonitor() {return &_rate_monitor;}
185
188 warptwin::OccultationModel* occultationModel() {return &_occult;}
189
190 int16 activate() override;
191 int16 deactivate() override;
192
193 protected:
194 int16 start() override;
195 int16 execute() override;
196
198 void _configureInternal();
199
201 Frame _sensor_frame;
202
204 BiasNoiseModel _sensor_noise_model;
205
207 RateMonitor _rate_monitor;
208
210 OccultationModel _occult;
211
213 FrameStateSensorModel _sun_relative_state;
214
216 FrameStateSensorModel _primary_orbiter_relative_state;
217
220
223
226
233
237 double _theta;
240 };
241
242}
243
244#endif
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_OUTPUTS
Definition appmacros.h:33
#define END_PARAMS
Definition appmacros.h:47
#define START_OUTPUTS
Definition appmacros.h:28
#define END_INPUTS
Definition appmacros.h:40
#define START_INPUTS
Definition appmacros.h:35
Quaternion class for attitude representation.
Definition Quaternion.h:68
Frame class definition.
Definition Frame.h:96
Latency model.
Definition LatencyUtil.hpp:41
Class to generate random numbers according to uniform distribution.
Definition UniformRandom.hpp:42
#define CartesianVector3
Definition mathmacros.h:43
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
CartesianVector3 _pos_SCI_ss__ss
Internal variable for the position of the Sun with respect to the sun sensor represented in sun senso...
Definition SunSensor.h:232
clockwerk::Quaternion _q
Temporary quaternion used for random rotations.
Definition SunSensor.h:239
int16 start() override
Class to execute logging.
CartesianVector3 _pos_ss_ss__ss
Internal variable for the position of the sun sensor with respect to the sun sensor represented in su...
Definition SunSensor.h:228
FrameStateSensorModel _primary_orbiter_relative_state
Model to compute the position of the primary orbiter relative to the sun sensor frame.
Definition SunSensor.h:216
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
CartesianVector3 _pos_PCI_ss__ss
Internal variable for the position of the primary orbiter with respect to the sun sensor represented ...
Definition SunSensor.h:230
double _theta
Misalignment angle magnitude and unit vector.
Definition TorqueCoilModel.h:147
MarkovUncertaintyModel _sensor_noise_model
The bias and noise model for sensor output.
Definition Accelerometer.h:240
UniformRandom< double > * _uniform_random_model
Interal model for generating a uniform random number.
Definition SunSensor.h:219
OccultationModel _occult
Occultation model.
Definition SunSensor.h:210
CartesianVector3 _pos_SCI_ss__ss_unit
Definition SunSensor.h:232
FrameStateSensorModel _sun_relative_state
Model to compute the position of the sun relative to the sun sensor frame.
Definition SunSensor.h:213
Frame _sensor_frame
The sensor frame in which all measurements will be taken.
Definition Accelerometer.h:237
void _configureInternal()
Function to configure sensor – runs in all constructors.
warptwin::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition Accelerometer.h:224
int16 activate() override
_accel_output_struct _last_output
Temporary variable for the latest recorded output added to latency model and dummy output for steppin...
Definition Accelerometer.h:264
MODEL(Servo) public int16 deactivate() override
Model to simulate a servo's motion.
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31
CartesianVector3 _w
Temporary vector used for random rotations.
Definition SunSensor.h:235
LatencyUtil< double > _latency_model
The latency model for servo angle output.
Definition Servo.h:116
MODEL(Magnetometer) public warptwin::MarkovUncertaintyModel * biasNoiseModel()
Accessor for the internal bias and noise model.
Definition Magnetometer.h:202
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition Accelerometer.h:243
double _latency_return
Temporary value for the return of the latency value.
Definition Servo.h:122
warptwin::OccultationModel * occultationModel()
Accessor for the internal occultation model.
Definition SunSensor.h:188
Model of sun sensor which produces look vector to the sun.
Definition SunSensor.h:85
_sunsensor_output_struct(CartesianVector3 meas_sun_vector__ss, bool is_valid)
Definition SunSensor.h:93
bool is_valid
Definition SunSensor.h:87
_sunsensor_output_struct()
Definition SunSensor.h:89
CartesianVector3 meas_sun_vector__ss
Definition SunSensor.h:86