User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

en:mag_subsys [2020/01/20 09:23]
en:mag_subsys [2020/03/25 16:28]
Line 1: Line 1:
-====== Magnetometer ====== 
-Virtual power draw: 40 mA 
-{{ :​ru:​магнитометр.png?​direct&​200| Магнитометр}} 
-Low-orbit spacecraft is most often designed with a magnetometer as one of positioning devices (usually complementing solar sensors). 
-The magnetometer senses the surrounding magnetic field and generates three components of the magnetic flux vector in teslas. In ideal conditions the magnetometer in the orbiter register’s Earth’s own geomagnetic field – the same field that turns the needle in the compass for a user on the ground. However, in the real life the design of any satellite includes magnetic materials (e.g. permanent magnets of electric drive motors), therefore the field registered by the magnetometer will comprise a so-called superposition of the Earth’s magnetic field and the magnetic field of the orbiter proper. 
-It is possible to determine the spatial orientation (and sometimes position as well) of spacecraft by comparing magnetometer readings with computed values from the geomagnetic field model. For experiments with the Orbicraft construction set it is assumed that the magnetometer will be used to sense both orientation and position of the satellite on the orbit i.e. for navigational purposes. In this case the “geomagnetic” field registered by the magnetometer onboard will be created by the special Terra laboratory setup and measured from the computer using a predetermined known control law. 
-The following function (in C) is used to obtain current magnetometer readings: 
-<code C>​int32_t magnetometer_request_raw(uint16_t num,int16_t *pRAW_dataX,​int16_t *pRAW_dataY,​int16_t *pRAW_dataZ);​ </​code> ​ 
-As would be the case with real-world spacecraft, magnetometer readings inside Orbicraft are not determined exclusively by the external geomagnetic field. Other instruments (mainly including reaction wheel motors and the power supply system) can interfere with readings. For that reason it is not recommended that the magnetometer be located immediately next to those devices. 
-==== Magnetometer Test Code in C ==== 
-<file c mag_test.c>​ 
-#define LSS_OK 0  
-#define LSS_ERROR 1  
-#define LSS_BREAK 2 
-#include <​stdio.h>​ 
-#include <​stdint.h>​ 
-#include "​libschsat.h"​ 
-int control() // Основная функция программы,​ в которой вызываем остальные функции 
- int16_t mgn_result[] = {0,0,0,0}; // Инициализируем mgn_result 
- uint16_t num = 1; // номер магнитометра 
- int i; 
- printf("​Rnable magnetometer №%d\n",​ num); 
- magnetometer_turn_on(num);​ 
- Sleep(1); 
- printf("​Get RAW data from magnetometer\n"​);​ 
- for (i = 0; i < 1000; i++) 
- { 
- mgn_result[0] = magnetometer_request_raw(num,&​ mgn_result[1],&​ mgn_result[2],&​ mgn_result[3]);​ 
- if (!mgn_result[0])//​ если датчик вернул сообщение об ошибке,​ 
- { 
- printf("​\nstate:​%d,​ \nx_raw =%d,\ny_raw =%d, \nz_raw =%d\n",​i,​ mgn_result[1],​ mgn_result[2],​ mgn_result[3]);​ //​Обратите внимание на символ переноса строки! 
- } 
- else if (mgn_result[0] == 1){ 
- printf("​Fail because of access error, check the connection"​);​ 
- } 
- else if (mgn_result[0] == 2){ 
- printf("​Fail because of interdace error, check your code"​);​ 
- } 
- Sleep(0.1);​ 
- } 
- printf("​Disable magnetometer №%d\n",​ num); 
- magnetometer_turn_off(num);​ 
- return 0; 
en/mag_subsys.txt · Last modified: 2020/03/25 16:28 (external edit)