C2A_Core
time_manager.h ファイル

OBC時刻のカウントアップと,各種衛星時刻関連処理 [詳解]

time_manager.h の依存先関係図:
被依存関係図:

[ソースコード]

データ構造

struct  TimeManager
 master_clock_ で OBC 時刻情報を保持するとともに, unixtime との紐づけや初期化情報の記録を行う [詳解]
 

マクロ定義

#define TMGR_DEFAULT_UNIXTIME_EPOCH_FOR_UTL   (1577836800.0)
 

列挙型

enum  TMGR_ACK { TMGR_ACK_OK = 0 , TMGR_ACK_PARAM_ERR }
 Time Manager の汎用返り値 [詳解]
 

関数

void TMGR_init (void)
 TimeManager 構造体を初期化する [詳解]
 
void TMGR_clear (void)
 master_clock_ と unixtime_info_ をクリアし全てゼロにする [詳解]
 
void TMGR_clear_master_mode_cycle (void)
 master_clock_ の mode_cycle をゼロにする [詳解]
 
void TMGR_count_up_master_clock (void)
 master_clock_ をstep刻みでインクリメントする [詳解]
 
void TMGR_down_initializing_flag (void)
 C2Aの初期化終了時に呼び出し, 初期化flagを下げ, TMGRをもう一度クリアする [詳解]
 
ObcTime TMGR_get_master_clock (void)
 現在の master_clock_ を取得する [詳解]
 
ObcTime TMGR_get_master_clock_from_boot (void)
 初期化にかかった時間も加算した master_clock_ を返す [詳解]
 
cycle_t TMGR_get_master_total_cycle (void)
 現在の total_cycle を返す [詳解]
 
cycle_t TMGR_get_master_mode_cycle (void)
 現在の mode_cycle を返す [詳解]
 
step_t TMGR_get_master_step (void)
 現在の step を返す [詳解]
 
uint32_t TMGR_get_master_total_cycle_in_msec (void)
 現在の total_cycle をミリ秒単位で返す [詳解]
 
uint32_t TMGR_get_master_mode_cycle_in_msec (void)
 現在の mode_cycle をミリ秒単位で返す [詳解]
 
void TMGR_clear_unixtime_info (void)
 unixtime_info_ を初期化する [詳解]
 
TMGR_ACK TMGR_update_unixtime (const double unixtime, const ObcTime *time)
 unixtime と TI の紐づき情報を更新する [詳解]
 
double TMGR_get_unixtime_at_ti0 (void)
 unixtime_at_ti0 を取得する [詳解]
 
double TMGR_get_utl_unixtime_epoch (void)
 utl_unixtime_epoch を取得する [詳解]
 
double TMGR_get_precise_cycles_per_sec (void)
 OBC のクロック誤差を反映した cycles_per_sec を返す [詳解]
 
double TMGR_get_precise_ti_in_sec (const ObcTime *time)
 OBC のクロック誤差を反映した正確な ti を秒単位で返す [詳解]
 
double TMGR_get_current_unixtime (void)
 現在の unixtime を OBC の ti をもとに計算して返す [詳解]
 
double TMGR_get_unixtime_from_obc_time (const ObcTime *time)
 ObcTime を unixtime に変換する [詳解]
 
double TMGR_get_unixtime_from_utl_unixtime (const cycle_t utl_unixtime)
 UTL_cmdで用いる utl_unixtime を 一般的なunixtimeに変換する [詳解]
 
double TMGR_get_precise_ti_from_unixtime (const double unixtime)
 unixtime を TI (cycle単位) に変換する [詳解]
 
ObcTime TMGR_get_obc_time_from_unixtime (const double unixtime)
 unixtime を ObcTime に変換する [詳解]
 
cycle_t TMGR_get_ti_from_utl_unixtime (const cycle_t utl_unixtime)
 引数で指定された utl_unixtime に対応する TI を返す [詳解]
 
CCP_CmdRet Cmd_TMGR_SET_TIME (const CommonCmdPacket *packet)
 
CCP_CmdRet Cmd_TMGR_UPDATE_UNIXTIME (const CommonCmdPacket *packet)
 
CCP_CmdRet Cmd_TMGR_SET_UTL_UNIXTIME_EPOCH (const CommonCmdPacket *packet)
 
CCP_CmdRet Cmd_TMGR_SET_CYCLE_CORRECTION (const CommonCmdPacket *packet)
 
CCP_CmdRet Cmd_TMGR_RESET_CYCLE_CORRECTION (const CommonCmdPacket *packet)
 
CCP_CmdRet Cmd_TMGR_CLEAR_UNIXTIME_INFO (const CommonCmdPacket *packet)
 

変数

const TimeManager *const time_manager
 

詳解

OBC時刻のカウントアップと,各種衛星時刻関連処理

time_manager.h に定義があります。

マクロ定義詳解

◆ TMGR_DEFAULT_UNIXTIME_EPOCH_FOR_UTL

#define TMGR_DEFAULT_UNIXTIME_EPOCH_FOR_UTL   (1577836800.0)

2020-01-01T00:00:00Z 時点の unixtime. utl_unixtime_epoch のデフォルト値

time_manager.h12 行目に定義があります。

列挙型詳解

◆ TMGR_ACK

enum TMGR_ACK

Time Manager の汎用返り値

覚え書き
uint8_t を想定
列挙値
TMGR_ACK_OK 

正常終了

TMGR_ACK_PARAM_ERR 

パラメタエラー

time_manager.h19 行目に定義があります。

関数詳解

◆ Cmd_TMGR_CLEAR_UNIXTIME_INFO()

CCP_CmdRet Cmd_TMGR_CLEAR_UNIXTIME_INFO ( const CommonCmdPacket packet)

time_manager.c302 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ Cmd_TMGR_RESET_CYCLE_CORRECTION()

CCP_CmdRet Cmd_TMGR_RESET_CYCLE_CORRECTION ( const CommonCmdPacket packet)

time_manager.c294 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ Cmd_TMGR_SET_CYCLE_CORRECTION()

CCP_CmdRet Cmd_TMGR_SET_CYCLE_CORRECTION ( const CommonCmdPacket packet)

time_manager.c286 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ Cmd_TMGR_SET_TIME()

CCP_CmdRet Cmd_TMGR_SET_TIME ( const CommonCmdPacket packet)

time_manager.c249 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ Cmd_TMGR_SET_UTL_UNIXTIME_EPOCH()

CCP_CmdRet Cmd_TMGR_SET_UTL_UNIXTIME_EPOCH ( const CommonCmdPacket packet)

time_manager.c278 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ Cmd_TMGR_UPDATE_UNIXTIME()

CCP_CmdRet Cmd_TMGR_UPDATE_UNIXTIME ( const CommonCmdPacket packet)

time_manager.c257 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_clear()

void TMGR_clear ( void  )

master_clock_ と unixtime_info_ をクリアし全てゼロにする

引数
void
戻り値
void

time_manager.c51 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_clear_master_mode_cycle()

void TMGR_clear_master_mode_cycle ( void  )

master_clock_ の mode_cycle をゼロにする

引数
void
戻り値
void

time_manager.c57 行目に定義があります。

被呼び出し関係図:

◆ TMGR_clear_unixtime_info()

void TMGR_clear_unixtime_info ( void  )

unixtime_info_ を初期化する

引数
void
戻り値
void

time_manager.c128 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_count_up_master_clock()

void TMGR_count_up_master_clock ( void  )

master_clock_ をstep刻みでインクリメントする

引数
void
戻り値
void

time_manager.c65 行目に定義があります。

呼び出し関係図:

◆ TMGR_down_initializing_flag()

void TMGR_down_initializing_flag ( void  )

C2Aの初期化終了時に呼び出し, 初期化flagを下げ, TMGRをもう一度クリアする

引数
void
戻り値
void

time_manager.c72 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_current_unixtime()

double TMGR_get_current_unixtime ( void  )

現在の unixtime を OBC の ti をもとに計算して返す

引数
void
戻り値
unixtime

time_manager.c169 行目に定義があります。

呼び出し関係図:

◆ TMGR_get_master_clock()

ObcTime TMGR_get_master_clock ( void  )

現在の master_clock_ を取得する

引数
void
戻り値
{0,0,0}: C2A初期化中の場合
master_clock_: それ以外

time_manager.c80 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_master_clock_from_boot()

ObcTime TMGR_get_master_clock_from_boot ( void  )

初期化にかかった時間も加算した master_clock_ を返す

引数
void
戻り値
master_clock_ + initializing_time

time_manager.c92 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_master_mode_cycle()

cycle_t TMGR_get_master_mode_cycle ( void  )

現在の mode_cycle を返す

引数
void
戻り値
master_clock_ の mode_cycle

time_manager.c101 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_master_mode_cycle_in_msec()

uint32_t TMGR_get_master_mode_cycle_in_msec ( void  )

現在の mode_cycle をミリ秒単位で返す

覚え書き
uint32_t がオーバーフローする可能性があるので注意
計算上はstepも考慮
引数
void
戻り値
ミリ秒単位の mode_cycle

time_manager.c114 行目に定義があります。

呼び出し関係図:

◆ TMGR_get_master_step()

step_t TMGR_get_master_step ( void  )

現在の step を返す

引数
void
戻り値
master_clock_ の step

time_manager.c105 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_master_total_cycle()

cycle_t TMGR_get_master_total_cycle ( void  )

現在の total_cycle を返す

引数
void
戻り値
master_clock_ の total_cycle

time_manager.c97 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_master_total_cycle_in_msec()

uint32_t TMGR_get_master_total_cycle_in_msec ( void  )

現在の total_cycle をミリ秒単位で返す

覚え書き
uint32_t がオーバーフローする可能性があるので注意
計算上はstepも考慮
引数
void
戻り値
ミリ秒単位の total_cycle

time_manager.c109 行目に定義があります。

呼び出し関係図:

◆ TMGR_get_obc_time_from_unixtime()

ObcTime TMGR_get_obc_time_from_unixtime ( const double  unixtime)

unixtime を ObcTime に変換する

引数
[in]unixtime
戻り値
{0,0,0}: 引数の unixtime が unixtime_at_ti0 より小さいとき
ObcTime: それ以外

time_manager.c194 行目に定義があります。

呼び出し関係図:

◆ TMGR_get_precise_cycles_per_sec()

double TMGR_get_precise_cycles_per_sec ( void  )

OBC のクロック誤差を反映した cycles_per_sec を返す

引数
void
戻り値
cycles_per_sec

time_manager.c158 行目に定義があります。

被呼び出し関係図:

◆ TMGR_get_precise_ti_from_unixtime()

double TMGR_get_precise_ti_from_unixtime ( const double  unixtime)

unixtime を TI (cycle単位) に変換する

引数
[in]unixtime
戻り値
0: 引数の unixtime が unixtime_at_ti0 より小さいとき
TI: それ以外. 整数に丸めず double のまま返す

time_manager.c184 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_precise_ti_in_sec()

double TMGR_get_precise_ti_in_sec ( const ObcTime time)

OBC のクロック誤差を反映した正確な ti を秒単位で返す

引数
[in]timeti を保持している OBCTime
戻り値
ti(秒単位, 小数点以下も保持)

time_manager.c163 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_ti_from_utl_unixtime()

cycle_t TMGR_get_ti_from_utl_unixtime ( const cycle_t  utl_unixtime)

引数で指定された utl_unixtime に対応する TI を返す

覚え書き
UTL_cmd で実行時刻情報を TI に変換する際に用いる
引数
[in]utl_unixtime
戻り値
0: 引数の utl_unixtime が unixtime_at_ti0 より小さい場合
TI(total_cycleのこと) : それ以外の場合

time_manager.c211 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_unixtime_at_ti0()

double TMGR_get_unixtime_at_ti0 ( void  )

unixtime_at_ti0 を取得する

引数
void
戻り値
unixtime_at_ti0

time_manager.c148 行目に定義があります。

被呼び出し関係図:

◆ TMGR_get_unixtime_from_obc_time()

double TMGR_get_unixtime_from_obc_time ( const ObcTime time)

ObcTime を unixtime に変換する

引数
[in]ObcTime
戻り値
unixtime

time_manager.c174 行目に定義があります。

呼び出し関係図:

◆ TMGR_get_unixtime_from_utl_unixtime()

double TMGR_get_unixtime_from_utl_unixtime ( const cycle_t  utl_unixtime)

UTL_cmdで用いる utl_unixtime を 一般的なunixtimeに変換する

覚え書き
utl_unixtime の単位としての cycle は, OBC のクロック誤差を含まない定義通りの値であることに注意
引数
[in]utl_unixtime
戻り値
unixtime

time_manager.c179 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_get_utl_unixtime_epoch()

double TMGR_get_utl_unixtime_epoch ( void  )

utl_unixtime_epoch を取得する

引数
void
戻り値
utl_unixtime_epoch

time_manager.c153 行目に定義があります。

被呼び出し関係図:

◆ TMGR_init()

void TMGR_init ( void  )

TimeManager 構造体を初期化する

引数
void
戻り値
void

time_manager.c44 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TMGR_update_unixtime()

TMGR_ACK TMGR_update_unixtime ( const double  unixtime,
const ObcTime time 
)

unixtime と TI の紐づき情報を更新する

引数
[in]unixtime(GPS 等から観測した) unixtime
[in]time(GPS 等から) unixtime を観測した時の ObcTime
戻り値
TMGR_ACK

time_manager.c136 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

変数詳解

◆ time_manager

const TimeManager* const time_manager
extern

time_manager.c14 行目に定義があります。