File tree Expand file tree Collapse file tree 5 files changed +61
-12
lines changed
Expand file tree Collapse file tree 5 files changed +61
-12
lines changed Original file line number Diff line number Diff line change 1010
1111 * *** Activate Solar Routing***
1212 Control if Solar routing should be activated or not
13- * *** Reactivity***
14- How fast will be the solar routing
13+ * *** Down Reactivity***
14+ How fast will be the solar routing when real_power is more than target_grid_exchange.
15+ From 1 to 100. 1 is the slowest, 100 is the fastest.
16+ * *** Up Reactivity***
17+ How fast will be the solar routing when real_power is less than target_grid_exchange.
1518 From 1 to 100. 1 is the slowest, 100 is the fastest.
1619 * *** Router Level***
1720 What is the current percentage of energy sent to the load by the overall router
Original file line number Diff line number Diff line change 1010
1111 * *** Activer le routage solaire***
1212 Contrôle si le routage solaire doit être activé ou non
13- * *** Réactivité***
14- Vitesse du routage solaire.
13+ * *** Down Reactivity (Réactivité descendante)***
14+ Vitesse du routage solaire utilisée lorsque la puissance réelle est supérieure à l'échange réseau cible.
15+ De 1 à 100. 1 est le plus lent, 100 est le plus rapide.
16+ * *** Up Reactivity (Réactivité ascendante)***
17+ Vitesse du routage solaire utilisée lorsque la puissance réelle est inférieure à l'échange réseau cible.
1518 De 1 à 100. 1 est le plus lent, 100 est le plus rapide.
1619 * *** Ouverture du régulateur***
1720 Pourcentage actuel d'ouverture de la porte pour envoyer de l'énergie à la charge
Original file line number Diff line number Diff line change @@ -77,8 +77,19 @@ number:
7777
7878 # Define the reactivity of router level
7979 - platform : template
80- name : " Reactivity"
81- id : reactivity
80+ name : " Up Reactivity"
81+ id : up_reactivity
82+ optimistic : True
83+ restore_value : True
84+ mode : box
85+ min_value : 1
86+ max_value : 100
87+ initial_value : 10
88+ unit_of_measurement : " "
89+ step : 1
90+ - platform : template
91+ name : " Down Reactivity"
92+ id : down_reactivity
8293 optimistic : True
8394 restore_value : True
8495 mode : box
@@ -124,7 +135,19 @@ script:
124135 id(router_level).publish_state(0);
125136 return;
126137 }
127- double delta = -1*(id(real_power).state-id(target_grid_exchange).state)*id(reactivity).state/1000;
138+
139+ // Calculate the power difference and adjust the regulator opening percentage
140+ double real_power_state = id(real_power).state;
141+ double target_grid_exchange_state = id(target_grid_exchange).state;
142+ double reactivity_state = NAN;
143+ if (real_power_state >= target_grid_exchange_state) {
144+ reactivity_state = id(down_reactivity).state;
145+ } else {
146+ reactivity_state = id(up_reactivity).state;
147+ }
148+
149+ double delta = -1*(real_power_state-target_grid_exchange_state)*reactivity_state/1000;
150+ // Determine the new regulator status
128151 double new_router_level = id(router_level).state + delta;
129152 new_router_level = std::max(0.0, std::min(100.0, new_router_level));
130153 id(router_level).publish_state(new_router_level);
Original file line number Diff line number Diff line change @@ -114,10 +114,21 @@ number:
114114 initial_value : 30
115115 restore_value : True
116116
117- # Define the reactivity of router level
117+ # Define the reactivity of router level
118118 - platform : template
119- name : " Reactivity"
120- id : reactivity
119+ name : " Up Reactivity"
120+ id : up_reactivity
121+ optimistic : True
122+ restore_value : True
123+ mode : box
124+ min_value : 1
125+ max_value : 100
126+ initial_value : 10
127+ unit_of_measurement : " "
128+ step : 1
129+ - platform : template
130+ name : " Down Reactivity"
131+ id : down_reactivity
121132 optimistic : True
122133 restore_value : True
123134 mode : box
@@ -169,8 +180,17 @@ script:
169180 // If router is activated, calculate the power difference and adjust the regulator opening percentage
170181 if ((id(power_meter_activated) == 1))
171182 {
172- double delta = 0;
173- delta = -1*(id(real_power).state-id(target_grid_exchange).state)*id(reactivity).state/1000;
183+ // Calculate the power difference and adjust the regulator opening percentage
184+ double real_power_state = id(real_power).state;
185+ double target_grid_exchange_state = id(target_grid_exchange).state;
186+ double reactivity_state = NAN;
187+ if (real_power_state >= target_grid_exchange_state) {
188+ reactivity_state = id(down_reactivity).state;
189+ } else {
190+ reactivity_state = id(up_reactivity).state;
191+ }
192+
193+ double delta = -1*(real_power_state-target_grid_exchange_state)*reactivity_state/1000;
174194
175195 // Determine the new regulator status
176196 double new_router_level = id(router_level).state + delta;
You can’t perform that action at this time.
0 commit comments