![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
for learning
Diff: setting.h
- Revision:
- 224:985dba42f261
- Parent:
- 218:066030f7951f
--- a/setting.h Mon Dec 28 12:10:50 2020 +0000 +++ b/setting.h Mon Dec 28 14:27:11 2020 +0000 @@ -4,10 +4,10 @@ // pwm #define PIN_V PB_7 #define PIN_W PB_6 -//#define PWM_ARR 0x465 // loop 80k, pwm 40k +//#define PWM_ARR 0x465 // loop 80k, pwm 40k //#define PWM_ARR 0x8CA // loop 40k, pwm 20k #define PWM_ARR 0x1194 // loop 20k, pwm 10k -//#define PWM_ARR 0x2328 // loop 10k, pwm 5k +//#define PWM_ARR 0x2328 // loop 10k, pwm 5k #define TMR3_COUNT 0x4650 // loop 5k #define TMR2_COUNT 0x2710 // loop 500hz with prescale 18 @@ -54,7 +54,6 @@ // User Function - void CurrentControl(); void ValveControl(unsigned int ControlMode); @@ -65,7 +64,6 @@ #define LATEST_VERSION 19032 - /******************************************************************************* * COMMON CONSTANTS ******************************************************************************/ @@ -442,100 +440,11 @@ extern float K_LPF; extern float D_LPF; -extern float totq_sen_past; +extern float torq_sen_past; extern float torq_ref_past; extern float output_normalized; -#define numpast_u 0 -#define numpast_x 5 -#define numfuture_x 0 -#define numpast_f 0 -#define numfuture_f 10 -//#define num_input 17 //numpast_x + 1 + numfuture_x + numpast_f + 1 + numfuture_f -#define num_input 16 //numpast_x + 1 + numfuture_x + numpast_f + numfuture_f - -#define num_array_u_past 1 // numpast_u * time_interval + 1 -#define num_array_f_future 11 // numfuture_f * time_interval + 1 -#define num_array_f_past 1 // numpast_f * time_interval + 1 -#define num_array_x_past 6 // numpast_x * time_interval + 1 -#define num_array_x_future 1 // numfuture_x * time_interval + 1 - -#define time_interval 1 - - - -/////////////RL -#define num_batch 10 -#define num_epoch 1 -#define batch_size 100 -#define num_input_RL 2 -#define num_hidden_unit1 10 -#define num_hidden_unit2 10 - -extern int batch; -extern float train_set_x[batch_size]; -extern float train_set_error[batch_size]; -extern float train_set_count[batch_size]; -extern float state_array[batch_size][num_input_RL]; -extern float V[batch_size]; -extern float r[batch_size]; -extern float td_target[batch_size]; -extern float delta[batch_size]; -extern float advantage[batch_size]; -extern float return_G[batch_size]; - -extern float mean; -extern float deviation; -extern float mean_old; -extern float deviation_old; -extern float mean_before_SP; -extern float deviation_before_SP; -extern float mean_before_SP_array[batch_size]; -extern float deviation_before_SP_array[batch_size]; -extern float mean_array[batch_size]; -extern float mean_array_old[batch_size]; -extern float deviation_array[batch_size]; -extern float deviation_array_old[batch_size]; - -extern float hx_c_sum[num_hidden_unit1]; -extern float hx_c_sum_array[batch_size][num_hidden_unit1]; -extern float hxh_c_sum[num_hidden_unit2]; -extern float hxh_c_sum_array[batch_size][num_hidden_unit2]; -extern float hxhh_c_sum; -extern float hxhh_c_sum_array[batch_size]; - -extern float hx_a_sum[num_hidden_unit1]; -extern float hx_a_sum_array[batch_size][num_hidden_unit1]; -extern float hxh_a_sum[num_hidden_unit2]; -extern float hxh_a_sum_array[batch_size][num_hidden_unit2]; -extern float hxhh_a_sum[2]; -extern float hxhh_a_sum_array[batch_size][2]; - -extern float action; -extern float action_array[batch_size]; -extern float ratio[batch_size]; -extern float pi[batch_size]; -extern float pi_old[batch_size]; -extern float epsilon; -extern float surr1[batch_size]; -extern float surr2[batch_size]; -extern float loss[batch_size]; -extern float loss_batch; -extern float gamma; -extern float lmbda; -extern char Update_Done_Flag; -extern char Update_Case; -extern float reward_sum; - -extern float virt_pos; -extern float logging1; -extern float logging2; -extern float logging3; -extern float logging4; -extern float logging5; - -