Weather casting with Machine Learning (SVM and SRNN).
Dependencies: EthernetInterface GraphicHandler NTPClient SRNN SVM SensorModule mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:f6cdb984f638
- Child:
- 1:8538381cae81
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 15 09:28:23 2015 +0000 @@ -0,0 +1,57 @@ +#include "main.hpp" + +LocalFileSystem local("local"); // マウントポイントを定義(ディレクトリパスになる) + +// 時間(global) +time_t global_time; // 現在時刻 +Mutex time_mutex; // 時間のMutex +// Pointer to Class instance (global) +SRNN *srnn; +MCSVM *mcsvm; +SensorModule *sm; +GraphicHandler *gh; + +// 系列データ +float* new_seqence_data; // 現在の(一番新しい)系列データ +float* new_predict_data; // 現在の予測結果 +int* new_predict_weather; // 現在の予測天気 +float* new_predict_probability; // 現在の予測天気の確率(厳密には,確率ではない...) +FILE* seqence_data_fp; // 系列データのファイルポインタ(SRNNと計器の記録に使う) +FILE* predict_data_fp; // 予測データ +Mutex seqence_data_mutex; // 系列データのMutex +Mutex predict_data_mutex; // 予測データのMutex + +// 計器/機械学習スレッド +void read_and_predict_thread(void const *arg) +{ + // 1. 定期的(周期はmainが指定)にセンサーから読み出す + // 2. 記録(記録ファイルが長くなっていたら, 削る) + // 3. SRNNに学習データを読み込ませる.(Mutexを使う) + // 4. SRNNの学習/予測結果から, MCSVMで天気識別 + // 5. 予測結果のセット, 書き込み +} + +// 描画スレッド : 優先度低め +void draw_thread(void const *arg) +{ + // 1. 1分に一回, 時間を取りにいく + // 2. 描画更新 <- 学習中は止めたい... +} + + +// ネットワークスレッド +void network_thread(void const *arg) +{ + // 1. たまに時間を更新 + // 2. ポート80のListen <- 学習中は止めたい... +} + +// エントリ. スレッドの生成, そして待つ +int main(void) +{ + set_new_handler(no_memory); + + setup(); + printf("EXIT SUCESS!! \r\n"); + return 0; +}