Comments (6)
odd but it seems like its working im in SA with Amber and the battery charge events look to be optimal
I will close this one out as take the conversion back to the HA forums, thanks for your help @davidusb-geek @purcell-lab
from emhass.
These are very tricky.
Did you tried putting a |tojson
at the end of your soc_init
template.
Otherwise I think that another problem is your setting of SOC final which is lower than the SOC min defined in your configuration file
from emhass.
Yep same issue,
I set the MPC call to "def_load_end": [90] but the log still shows def_load_end': [96]
Also the load forcasts are different from whats in home assistant, for example the template render shows the correct cost forecast where EMHASS does not
curl -i -H "Content-Type: application/json" -X POST -d '{ "load_cost_forecast": [0.06, 0.1, 0.1, 0.13, 0.15, 0.29, 0.29, 0.55, 0.59, 0.55, 0.55, 0.48, 0.48, 0.39, 0.39, 0.16, 0.15, 0.12, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.11, 0.03, 0.03, 0.09, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.07, 0.07, 0.07, 0.08, 0.36, 0.08, 0.08, 0.06],
EMHASS Web Log
`2024-06-10 13:45:13,793 - web_server - INFO - Status: Infeasible
2024-06-10 13:45:13,793 - web_server - INFO - Total value of the Cost function = 42.40
2024-06-10 13:45:22,618 - web_server - INFO - Passed runtime parameters: {'load_cost_forecast': [0.15, 0.19, 0.22, 0.43, 0.37, 0.69, 0.68, 0.73, 0.73, 0.68, 0.71, 0.8, 0.75, 0.5, 0.57, 0.48, 0.36, 0.36, 0.36, 0.36, 0.31, 0.27, 0.44, 0.39, 0.36, 0.32, 0.27, 0.26, 0.26, 0.26, 0.29, 0.3, 0.36, 0.59, 0.82, 0.46, 0.4, 0.23, 0.22, 0.13, 0.12, 0.14, 0.09, 0.09, 0.09, 0.09, 0.09, 0.14], 'prod_price_forecast': [0.05, 0.09, 0.11, 0.26, 0.2, 0.28, 0.27, 0.32, 0.32, 0.27, 0.3, 0.39, 0.34, 0.32, 0.38, 0.3, 0.19, 0.19, 0.19, 0.19, 0.15, 0.11, 0.26, 0.22, 0.19, 0.15, 0.11, 0.1, 0.1, 0.1, 0.13, 0.14, 0.19, 0.4, 0.61, 0.28, 0.23, 0.08, 0.06, 0.03, 0.03, 0.04, -0.0, -0.0, -0.0, -0.0, -0.0, 0.05], 'pv_power_forecast': [0.9197, 0.3969, 0.7298, 0.5452, 0.2939, 0.0066, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0492, 1.6617, 3.1556, 4.4012, 5.5342, 6.3928, 7.0159, 7.6574, 7.9615, 8.0619, 7.7789, 7.1398, 6.4503, 5.6678, 4.9008, 4.0576], 'prediction_horizon': 24, 'soc_init': 1.0, 'soc_final': 0.2, 'def_total_hours': [24], 'def_load_start': [0], 'def_load_end': [96]}
2024-06-10 13:45:22,619 - web_server - INFO - >> Setting input data dict
2024-06-10 13:45:22,619 - web_server - INFO - Setting up needed data
2024-06-10 13:45:22,623 - web_server - INFO - Retrieve hass get data method initiated...
2024-06-10 13:45:23,064 - web_server - INFO - Retrieving weather forecast data using method = list
2024-06-10 13:45:23,065 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2024-06-10 13:45:23,066 - web_server - INFO - Retrieve hass get data method initiated...
2024-06-10 13:45:23,385 - web_server - INFO - >> Performing naive MPC optimization...
2024-06-10 13:45:23,385 - web_server - INFO - Performing naive MPC optimization
2024-06-10 13:45:23,396 - web_server - INFO - Perform an iteration of a naive MPC controller
2024-06-10 13:45:23,461 - web_server - DEBUG - Deferrable load 0: Proposed optimization window: 0 --> 0
2024-06-10 13:45:23,461 - web_server - DEBUG - Deferrable load 0: Validated optimization window: 0 --> 0
2024-06-10 13:45:23,471 - web_server - WARNING - Solver default unknown, using default
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - /usr/local/lib/python3.11/dist-packages/pulp/solverdir/cbc/linux/64/cbc /tmp/d64115d077194a7582bb81edc5a47375-pulp.mps -max -timeMode elapsed -branch -printingOptions all -solution /tmp/d64115d077194a7582bb81edc5a47375-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 435 COLUMNS
At line 2778 RHS
At line 3209 BOUNDS
At line 3498 ENDATA
Problem MODEL has 430 rows, 264 columns and 2030 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Problem is infeasible - 0.00 seconds
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00
2024-06-10 13:45:23,484 - web_server - INFO - Status: Infeasible
2024-06-10 13:45:23,484 - web_server - INFO - Total value of the Cost function = 42.40`
MPC Curl
service: shell_command.post_mpc_optim_solcast data: command: > curl -i -H "Content-Type: application/json" -X POST -d '{ "load_cost_forecast": {{ ( [states('sensor.general_price')|float(0)] + state_attr('sensor.general_forecast', 'forecasts')|map(attribute='per_kwh')|list )|tojson }}, "prod_price_forecast": {{ ( [states('sensor.feed_in_price')|float(0)] + state_attr('sensor.feed_in_forecast', 'forecasts')|map(attribute='per_kwh')|list )|tojson }}, "pv_power_forecast": {{ (state_attr('sensor.solcast_24hrs_forecast', 'forecasts')|map(attribute='pv_estimate')|list)|tojson }}, "prediction_horizon": 48, "soc_init": {{ ((states('sensor.powerwall_charge')|float(0)) / 100) | tojson }}, "soc_final": 0.2, # Adjusted to match the minimum SOC from your configuration "def_total_hours": [2], "def_load_start": [0], "def_load_end": [90] # Adjusted to match the prediction horizon }' http://localhost:5000/action/naive-mpc-optim
from emhass.
Something else is injecting those values into EMHASS, which normally should only be your automations.
How often are you calling the MPC command ( every minute/ five minutes) and does that correspond to you to logs?
Can you call the curl shell command from the developer tools: services menu and see what happens in your logs?
In your EMHASS configuration file, please add the following to the end.
continual_publish: false
Are you comfortable to manually call curl from a command line? You may need to change the escape `` characters to call from the command line. Then call from the command line and see what is happening in the logs.
The other thing to do is to switch from the curl command line to a REST POST service and then call that from developer tools.
from emhass.
I may of resovled the issue there seems to be an issue with the solcast forecast sensor being an intger and not a float. It seems to be publishing results now and indicates at 5:30am it wants the battery to charge (Amber price is 0.04 for 30 mins)
does look like the numbers are around the wrong way
from emhass.
Odd,
I run my solcast forecasts as int, but as whole W.
"pv_power_forecast": {{
([states('sensor.solaredge_nopowerlimit')|int(0)] +
state_attr('sensor.solcast_pv_forecast_forecast_today', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list +
state_attr('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list
)| tojson
}},
from emhass.
Related Issues (20)
- Documentation: The meaning of alpha and beta values ββis reversed HOT 1
- Documentation update to help find compatible modules and panels HOT 4
- Infeasible result with 0.10.1, optimal with 0.9.1 HOT 4
- Feature request: Provide p_hybrid_inverter as a sensor HOT 2
- Sensor unit: Unit is missing for 'Total cost function value' HOT 1
- load_cast_forecast nordpool fails, HOT 7
- pv_forecast is not aligning with JSON input for naive-mpc-optim command HOT 4
- Unable to connect to home assistant HOT 2
- Warning: deprecated lags_grid argument HOT 1
- Feature Request: Pd_max/Pc_max as runtime parameters HOT 3
- 400 error on call HOT 1
- Feature Request: Support solcast/Forecast.Solar
- Feature Request: Support dynamic electricity prices HOT 4
- Custom machine learning forecast model predict HOT 1
- Solcast shows values at night HOT 4
- Optimisation at times exceeds p_nom for deferrable loads HOT 1
- Cannot install add-on HOT 4
- Feature request: minimum continous runtime for each deferrable load HOT 1
- Same as 328 - missing image update to0.10.6 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emhass.