-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project approach / purpose discussion #1
Comments
Hi Jblance and others, Thank you Jblance for all the help. What is outlined in WIP discussion is something I have been thinking of since August of last year and is my ultimate goal for this year minus the electric car. The goal was to get one this year however due to virus outbreak that is placed on hold for now. However once solar panels are installed my goal would be to integrate different energy storage device instead of the car. Electric hot water heater inline with gas water heather already present in the home. During winter when sun is not as abundant as it is in summer use time of use tariff with power company to supplement power needs (charge batteries to certain level) which would help lower down the energy cost. What I have: Since Lithium chemistry has almost flat discharge curve at 0.2 C rate it is impossible to tell SOC by just looking at cell/power wall voltage. Reasonably accurate SOC device must be used in order to implement what is outlined in WIP discussion. Reasonably accurate SOC device must take in to account Voltage, Amperage and Temp from power wall according to documentation I have read. So far I have: All going to Raspberry Pi. I think with devices above I could implement majority of what is outlined in WIP discussion. I would preferably use solid state (SSR) relay to control when hot water heather would be operational depending on SOC of my power walls. i.e. if SOC=>85% then SSR=on When it comes to coding all of this in python, my skills are equal to .01% of jblance's. When it comes to physicaly integrating this properly I have no issues what so ever. I do enjoy DIY projects and have accomplished many of them. I prefer DIY over someone else's solution that might not be able to accomplish everything I needed to do. Thank you all, |
Sorry for the long delay. I was occupied with a new roof, a new greenhouse and lots of customer projects. Today I started to code an intergration in Homeassistant (HASS) for the MPP-solar code. So far I found no code samples to implement the device/subdevice structure we need for the modelling of mpp-solar devices. The developer documentation of HASS is more than sparse. I asked for advice on the HASS dev-code chat channel, still waiting for an answer. Meanwhile I will implement all the boilerplate for a Integration doing NOOP but works with the development system of HASS. Cheers, |
Hi I still think we need to do an inverter state model with configuration that allows different command protocols (as well as battery / battery monitor models) Relays etc are (should) be covered by the switch functionality - but we may need to extend the base switch to allow more separation / security / safe guards. "Alexa turn off all switches... Power goes off" |
For purpose of going in right direction here is what I have so far: Repurposed PC that has Ubuntu 20.04 installed. |
Does the mpp-solar code run on ESP32? |
While porting to ESP32 I run into some obstacles. I use the stock MicroPython ToolChain. I freeze the mppsolar package and bundle it into the MicroPython image. To get more libs I utilize https://github.com/micropython/micropython-lib to drag selected modules into the image. I already have MicroPython extended by the following libs from that source:
Now I run into this error:
This is a strong indicator that certain file system operations on ESP32 are not possible. These operations originate in your design decision to store the scheme of the Commands in JSON files. Does your heart really belong to these JSON files? Why not put them into a single well documented python file? Cheers, |
Just a quick question? I like idea of using ESP32 to handle Inverter commands and get data out of them. Would one ESP32 be able to handle 2 or 3 inverters in parallel? |
My knowledge on the ESP32 with Python is one day old. In general the ESP32 has a lot of computing power, more than an Arduino. I fought my first Doom multiplayer battles on hardware less powerfull :-). Do you mean b) is no problem and already covered by MPP-Solar. Utilizing ESP32 for data aquisition does not solve any problem with data management. We just push some functionality from the framework e.g. HASS or ESP HOME to the data aquisitioning device. The ongoing experiments will show if this approach is possible and worth the efford. |
My thought for the esp32 was to simplify it down to a serial sender / receiver with mqtt. Basically it would subscribe to a commands topic and (maybe with some security) send any commands that get published to the topic to the inverter (serial port). It would then publish the raw response. All the complicated bits could then be somewhere else. That's where my head was going anyway.... |
@volkerjaenisch single inverter stack with 3 inverters. Cost of ESP32 is not an issue however, My $0.00002 I might be wrong. |
@DMIINC I understand your concern. But on the other hand as @jblance said: "Then the complicated things have to be done elsewhere". This would be a distribution of complexity over several components. My approach aims to locate the "Inverter complexity" in the ESP32 and keep the other things as simple as possible. The ESP32-MPP-Solar module then can be included in any home automation much easier. At the curren tstate of project I cannot estimate how much of the internal state the inverters or other devices involved have to be distributet to the controlling software (e.g. home automatization). If it would be 100% of the state then probably the idea of @jblance is more fitting. If it is 20% my approach may be the sensible way to go. In general if you have a complex problem there are seldom simple ways to go. From my experience building complex systems with lots nines of reliability for a living is, that is a good approach is to not distribute the complexity. "Divide et impera" as the romas said :-). Of the ESP32s you can have a bunch lying around for small money. If one of them goes down, just flash another with the MPP-Solar-software-Image and be online as fast as you can replace it physically. If you have a more complex system like a Raspberry you will need more time to flash, configure etc. And while the ESP32 is down only the single device it controls is offline but the rest of the system is still online. You see that there are two sides of the coin and both are not shiny. I would suggest that we go for both approaches *1) *2) in parallel and look which one will develop better.
|
I agree on divide and rule approach and yes parallel development is a must. Those are basics. I also try to think of any projects in my home from standpoint of WAF or FAF. |
Hi can somebody please make a small test if the new commands_code in this branch runs. https://github.com/Inqbus/mpp-solar/tree/ESP32_support Has not to be run on a ESP32, any platform will do. Cheers, |
Commands will work the same as before from terminal? I will give it a try little bit later. Thanks, |
@DMIINC It should do so :-) |
I think if we go to having the commands in a python file then we may as well use 'proper' object orientation / abstraction. The json, was a quick way to allow testing / changing commands for different inverters (ie LV5048 uses slightly different commands compared to 4048 that I have (and the hybrid v2 uses a completely different set of commands) Otherwise we end up (well we already have some of this) with a bunch of if this type then do it this way.... |
@DMIINC re wanting every thing in one server. You are already not doing this with the ESP + shunt. A good example of this is the way modern cars are built. There are sensors and functions everywhere, mostly communicating via CAN. These sensors might just read a temp and put the result on the bus, or have enough intelligence to actually control an electric motor based on the commands from the VCU |
Another problem with mppsolar service approach, is that is monopolises the serial connection, so if you want to run a command to change a setting you need to stop the service first. Even if we have an ESP as a 'simple' inverter communicator, there is the question as to how much does it need to know about the inverter.
1 keeps the ESP very simple I'm still thinking closer to 2. Sorry for the rambling - just my thoughts |
Agree fully. Also more commitment to PEP8 would be nice. :-) Concerning CAN and vehicles: I am in between your options 2 and 3. If we choose option 2 we will have to port a good part of the mpp-solar code to ESP32 anyway. So if I succeed in porting the whole code we can strip the code we will not need. If we learn that we need to integrate more functionality (option 3) into the ESP32 we can do so since the whole code is already ported.
I am not getting your point here? Why does the service has to been stopped if I like to send a command? The ESP32 mpp-solar code will hold the serial port open it's whole lifetime. And it will communicate with the serial port in both directions. I do not see the problem here. Monopolizing the serial connection is IMHO not an issue. The ESP32 will only be connected to the inverter and has no other function. For other sensors there will be other ESP32 or whatever to collect the data. The central principles in running mpp-solar on the ESP32 are:
That's the really crucial question! I think we need to write a python state machine (Lets call this the SolarSimulation) for the controlling of the whole solar power system (Batteries, Inverters, Relais, current gauges, etc.) as a python package. This package should be agnostic to
To make such an optimization possible one will have to tag a fitness value (in fact it is a function of time) to each parameter (for instance a virtual price tag). Solar power has not a zero price. So the cost from Solar power directly from the panels is cheaper than power from the battery since the batteries have a finite life span which is shorter than that of the panels. Also solar power from the panels has an infinite price if the sun is not shining. Also the price of the battery power goes up if the load of the battery reaches critical limits (to low or to high load). Then integrations of this package can be produced for any number of systems in need for an intelligent simulation and steering module. At first I would think of HASS since it has the best python integration capabilities and favors exactly this approach (small integration, big python package). |
I do not understand this either. I am able to send different commands as it is now (switch from grid to batteries, change charging voltage, etc....) while mpp-solar service is running. @volkerjaenisch excellent write up!!!! In regards to me wanting everything one machine, well maybe I did not explain myself correctly. My apologies. WAF = Wife Acceptance Factor So question from @jblance is similar as to what I have been pondering on. Should battery SOC be on ESP32 or should ESP32 send raw sensor data to HASS and HASS makes calculation for SOC. Basicaly where does this logic live? What would be better? |
@jblance Can you give me write permission on this repository, please. I like to upload some graphics to illustrate. |
@jblance Thanks! https://github.com/jblance/solarman/blob/master/docs/solar1.pdf |
@DMIINC Any test results? My Customer has to buy a ESP32 for his inverter and I have to guide him to flash the thing. Cheers |
Some commands work and some don't. Limited test pi@raspberrypi:/dev $ sudo mpp-solar -c QPIGS -d /dev/hidraw0 pi@raspberrypi:/dev $ sudo mpp-solar -c QID -d /dev/hidraw0 pi@raspberrypi:/dev $ sudo mpp-solar -c QPGS0 -d /dev/hidraw0 |
@DMIINC Thank you so much! Cheers, |
you are welcome yes it does |
some of the other commands are not recognized either. such as QPIGS2 |
I’m trying to use Solarman open api to control devices settings. I do have the correct credentials(appId, appSecret, password). My issue is that I can’t manage to get the controlCode request params. This is a required field. There’s nowhere mentioned to retrieve the contolCode on the documentation. Note : |
Use this issue to further discuss purpose
I'll update the discussion doc with content from here
Also note here (or PR) any alterations needed in discussion doc
The text was updated successfully, but these errors were encountered: