WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
TorqueCoilModel.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/*
17Reaction wheel model header file
18
19Author: Alex Jackson
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "Torque Coil",
24 "exclude" : False,
25 "category" : "Actuators"
26}
27aliases = {"sc_body" : "Spacecraft Body",
28 "torque_vector__body" : "Torque Vector",
29 "current_noise_std" : "Noise",
30 "seed_value" : "EXCLUDE",
31 "area" : "Area",
32 "mom_inertia" : "Moment of Inertia",
33 "loops" : "Number of Loops",
34 "misalignment_std" : "Misalignment",
35 "input_current" : "Input Current",
36 "mag_field_vec__NED" : "Mag Field Vec",
37 "power_draw" : "Power Draw",
38 "applied_torque_body__body" : "Applied Torque",
39}
40*/
41
42#ifndef MODELS_ACTUATORS_TORQUE_COIL_MODEL_H
43#define MODELS_ACTUATORS_TORQUE_COIL_MODEL_H
44
45#include "simulation/Model.h"
47#include "frames/Joint.h"
49
50namespace warptwin {
64 MODEL(TorqueCoilModel)
65 public:
66 // Model params
67 // NAME TYPE DEFAULT VALUE
71 SIGNAL(sc_body, Body*, nullptr)
74 SIGNAL(mag_frame, Frame*, nullptr)
77 SIGNAL(torque_vector__body, CartesianVector3, CartesianVector3({1.0, 0.0, 0.0}))
80 SIGNAL(current_noise_std, double, 0.0)
82 SIGNAL(seed_value, int, 0)
84 SIGNAL(area, double, 1.0)
86 SIGNAL(loops, double, 1.0)
88 SIGNAL(misalignment_std, double, 0.0)
90 SIGNAL(resistance, double, 0.0)
92 SIGNAL(idle_power, double, 0.0)
94
95 // Model inputs
96 // NAME TYPE DEFAULT VALUE
99 SIGNAL(input_current, double, 0.0)
101 SIGNAL(mag_field_vec__mag, CartesianVector3, CartesianVector3({1.0, 0.0, 0.0}))
103
104 // Model outputs
105 // NAME TYPE DEFAULT VALUE
108 SIGNAL(power_draw, double, 0.0)
110 SIGNAL(applied_torque_body__body, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
112
113 int16 activate() override;
114 int16 deactivate() override;
115
116 protected:
117 int16 start() override;
118 int16 execute() override;
119
121 BiasNoiseModel _current_bias_noise;
122
125
127 double _perturbation = 0.0;
128
131
134
137
139 double _misalignment_x = 0.0;
140 double _misalignment_y = 0.0;
141 double _misalignment_z = 0.0;
142
144 clockwerk::Quaternion _tempQuat;
145
147 double _theta = 0.0;
149
152
153 };
154
155}
156
157#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
Class to define a body as a frame with mass and inertia.
Definition Body.h:44
Frame class definition.
Definition Frame.h:96
Node class to apply forces and moments to frames.
Definition Node.h:44
#define CartesianVector3
Definition mathmacros.h:43
Definition CircularBuffer.hpp:28
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
int16 start() override
Class to execute logging.
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
CartesianVector3 _mag_field_vec_body
Temporary DCM for magnetic field transformation.
Definition TorqueCoilModel.h:151
double _theta
Misalignment angle magnitude and unit vector.
Definition TorqueCoilModel.h:147
double _misalignment_z
Definition TorqueCoilModel.h:141
clockwerk::Quaternion _tempQuat
Temporary quaternion for misalignment calculation.
Definition TorqueCoilModel.h:144
double _perturbation
Value to hold perturbation to current command.
Definition TorqueCoilModel.h:127
double _misalignment_y
Definition TorqueCoilModel.h:140
CartesianVector3 _z_axis
Vector to hold temporary axes during orientation calculation.
Definition TorqueCoilModel.h:133
clockwerk::DCM _DCM_Body_Mag
Temporary DCM for quaternion calculation.
Definition TorqueCoilModel.h:136
BiasNoiseModel _current_bias_noise
The bias and noise model for current.
Definition TorqueCoilModel.h:121
int16 activate() override
MODEL(Servo) public int16 deactivate() override
Model to simulate a servo's motion.
Node _coil_node
The torque coil node.
Definition TorqueCoilModel.h:124
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31
CartesianVector3 _evec
Definition TorqueCoilModel.h:148
double _misalignment_x
Misalignment angle.
Definition TorqueCoilModel.h:139
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
CartesianVector3 _torque_vec
Value to hold total torque calculation.
Definition TorqueCoilModel.h:130