From 9d53c5dae760e891d9cfc7cc4cf4b484261c19e7 Mon Sep 17 00:00:00 2001 From: 95384 <664090429@qq.com> Date: Sat, 23 Nov 2024 09:56:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=A3=8E=E9=80=9F?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Inc/anemometer_dev.h | 1 + App/Src/anemometer_dev.c | 16 ++++++++++------ EWARM/micro_climate.ewp | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/App/Inc/anemometer_dev.h b/App/Inc/anemometer_dev.h index 8e17b96..b71bd05 100644 --- a/App/Inc/anemometer_dev.h +++ b/App/Inc/anemometer_dev.h @@ -42,6 +42,7 @@ // 传播距离 风速计算公式中的L参数 //探头表面距离115.12mm(57.56mm*2),换能器探头到探头表面距离暂定2mm(1mm*2) //#define DISTANCE ((float32_t)115120.0 + (float32_t)2000.0) +//探头表面距离115.12mm(57.56mm*2),换能器内部2mm速度2000,时间算2us减在tof上 #define DISTANCE ((float32_t)115120.0) // 传播距离 风速计算公式中的L参数 //#define DISTANCE ((float32_t)120000.0) diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index 86df5c6..d353f3d 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -434,13 +434,15 @@ void wind_task(void const * argument) tof_error_log_NS = 0; g_error_log.tof_error_NS = 0; // 计算成us - tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f - 2.0; - tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f - 2.0; + tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f - 2.0f; + tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.0001f - 2.0f; // 通过各通道渡越时间求时间差 dtof = tofx-tofy; weather_info.wind_c = DISTANCE/2.0f*(1.0f/tofx+1.0f/tofy); - weather_info.wind_velocity_x = 0-DISTANCE*dtof/1.41422f/tofx/tofx; +// weather_info.wind_velocity_x = 0-DISTANCE*dtof/1.41422f/tofx/tofx; +// 修正公式 + weather_info.wind_velocity_x = 0-DISTANCE*dtof/1.41422f/tofx/tofy; } // 通道3 通道4 测试东西风速 @@ -492,13 +494,15 @@ void wind_task(void const * argument) tof_error_log_WE = 0; g_error_log.tof_error_WE = 0; // 计算成us - tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f - 2.0; - tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f - 2.0; + tofx = ((tofx-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f - 2.0f; + tofy = ((tofy-FIR_PHASE_DELAY)/ADC_SAMP_RATE_MHz)+REV_MUTE_DELAY_US-1.0f/DRIVE_FREQ_MHz+0.000001f - 2.0f; // 通过各通道渡越时间求时间差 dtof = tofx-tofy; weather_info.wind_c = DISTANCE/2.0f*(1.0f/tofx+1.0f/tofy); - weather_info.wind_velocity_y = DISTANCE*dtof/1.41422f/tofx/tofx; +// weather_info.wind_velocity_y = DISTANCE*dtof/1.41422f/tofx/tofx; +// 修正公式 + weather_info.wind_velocity_y = DISTANCE*dtof/1.41422f/tofx/tofy; } weather_info.wind_velocity = sqrtf(weather_info.wind_velocity_x*weather_info.wind_velocity_x + weather_info.wind_velocity_y*weather_info.wind_velocity_y); diff --git a/EWARM/micro_climate.ewp b/EWARM/micro_climate.ewp index 7e6f260..39e17c8 100644 --- a/EWARM/micro_climate.ewp +++ b/EWARM/micro_climate.ewp @@ -701,7 +701,7 @@ - 1 + 232 inputOutputBased