From 112c00592c750d0b9c93d08db2ca5c88e1e2fed0 Mon Sep 17 00:00:00 2001 From: zhaohe <1013909206@qq.com> Date: Sun, 14 Aug 2022 17:38:09 +0800 Subject: [PATCH] cache --- APP/main.c | 2 +- APP/service/ozone_control_service.h | 51 +++++++++++++++++++++++++++++++++++++ APP/service/thisdevice.h | 7 +++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/APP/main.c b/APP/main.c index 6a9be69..8cfe0e7 100644 --- a/APP/main.c +++ b/APP/main.c @@ -207,6 +207,7 @@ float get_ozone_power() { } return powersum / 5; } +#if 0 typedef struct { float LastP; //上次估算协方差 初始化值为0.02 @@ -245,7 +246,6 @@ float derivative(float now) { return diff; } -#if 0 void printf_ozone_freq_and_power_table() { /** * @brief 打印臭氧发生器和频率之间的关系 diff --git a/APP/service/ozone_control_service.h b/APP/service/ozone_control_service.h index e69de29..0b860a7 100644 --- a/APP/service/ozone_control_service.h +++ b/APP/service/ozone_control_service.h @@ -0,0 +1,51 @@ +#pragma once +#include +#include + +#include "thisdevice.h" + +typedef void (*ozone_onexception_cb_t)(error_t error); + +typedef struct { + uint32_t minfreq; // + uint32_t maxfreq; + uint32_t stepfreq; + + float level1_expect_power; + float level2_expect_power; + + ozone_onexception_cb_t onexception; + +} ozone_control_config_t; + +void ozone_control_init(ozone_control_config_t *config); + +void ozone_control_set_level(level_t level); +void ozone_control_start(); +void ozone_control_stop(); + +float ozone_control_get_power(); + +void ozone_control_schedule(); + +/** + * + * 策略1 + * 先扫频扫到谐振频率点,在频率点后面,找到拼配功率的频率,并设置频率 + * + * 运行中: + * 如果频率大于 (期望频率+窗口/2),减小频率,直到功率小于期望功率 + * 如果频率小于 (期望频率-窗口/2),增加频率,直到功率大于期望功率 + * + * + * 正常情况: + * 滑窗找到最小值,第一最小值,和第二最小值,就是第一个频率,和第二个频率。 + * + * 非正常情况 + * + * + * + * + * + * + */ \ No newline at end of file diff --git a/APP/service/thisdevice.h b/APP/service/thisdevice.h index b69f516..9a0db26 100644 --- a/APP/service/thisdevice.h +++ b/APP/service/thisdevice.h @@ -19,6 +19,13 @@ typedef enum { kchange_intermittentmode_time_input, } active_input_t; +typedef enum { + knoneException, + kOzonePrimaryCircuitAnomaly, //臭氧一级回路异常,MOS断路,或者变压器断路,如果MOS短路,设备会直接无法启动 + kOzoneSecondaryCircuitAnomaly, //臭氧二级回路异常,臭氧发生棒无法击穿产生臭氧,可能是焊接问题,或者接触不良 + kfanIsBroken, //风扇故障 +} error_t; + typedef struct { bool poweron; mode_t mode;