zocker-160 / xcom-protocol

Python library implementing Studer-Innotec Xcom protocol used by Xcom-232i and Xcom-LAN
GNU General Public License v3.0
11 stars 3 forks source link

Multiple panel sets #4

Closed spinozarabel closed 7 months ago

spinozarabel commented 7 months ago

Greeting, Firstly, thank you very much for your work. It works beatifully. I have 2 sets of variotracs, one each for a differently oriented panel array. They are summed into the battery inverter junction. To get the data from the STuder API, say PV solar energy for current day I use the following in the parameter array in my PHP code: ["userRef" => 11007, "InfoAssembly" => 1], ["userRef" => 11007, "InfoAssembly" => 2] I then sum the values for the total. Using your library gives me only one of these values. Is it possible for you to modify your code to get all values installed?

It is the same story for parameters such as 11001 (DC current) and 11004 (power). Note that using the 11007 from the Studer Web Portal correctly sums both values from both sets of panels. It is only the API that gives values for the 1st array unless following explicit instructions such as indicated above.

Kind regards, Madhu

JeffersM1 commented 7 months ago

Are you addressing the Vario Tracks individually or using the default multicast address? To get the individual data from each, you need to use the individual addresses such as 301 and 302.
image

The addressing information is found in Technicalspecification-_Xtender_serialprotocol-_V1.6.32

JeffersM1 commented 7 months ago

As an example where I have two Vario Strings instead of the Vario Tracks that you have, my pyton script has the following two lines for reading the PV power:

solar_power_vs1 = xcom.getValue(param.VS_PV_POWER, dstAddr=701)                         # 22A
solar_power_vs2 = xcom.getValue(param.VS_PV_POWER, dstAddr=702)                         # 22B
zocker-160 commented 7 months ago

basically what @JeffersM1 said and yes I should add this info to the readme.

spinozarabel commented 7 months ago

Thank you both very much for clarifying. Once again, thank you for your effort. Please close.

Regards

zocker-160 commented 7 months ago

@spinozarabel I will only close the issue if you confirm that this is working for you :)

Also I will update the readme within the next hour or so.

JeffersM1 commented 7 months ago

@spinozarabel Just out of curiosity, which communication are you using: RS-232/485, UDP, or TCP Server? What SW are you interfacing to? I am using TCP Server, a python script, and Home Assistant.

spinozarabel commented 7 months ago

I use a WordPresss local site. I wrote a custom plugin in PHP. I have a graphical output on localhost using javascript. I use Shelly IOT devices for metering and controlling the Grid ACIN. I compute my own SOC since I don;t have a good BMS. Based on excess Solar beyond load and Battery charge needs, I use it for charging an EV. I can set the charge max current level using MQTT and an excellent level 2 charger (https://store.openevse.com/collections/all-products/products/advanced-station) I can charge my EV with solar. On cloudy days I have a shelly controlled COS for grid charging of the EV. All of this is on LAN since here in India the internet is not so reliable :-) as I live in the boonies. I am using TCP client mode for the Moxa so that I don't disturb the connection to the Studer portal. So both cloud based and local data is available to me thanks to zocker-160.

spinozarabel commented 7 months ago

@zocker-160, when I use the mult-cast virtual address of 300, it does not give me the total. I have to individualy use 301 and 302 addresses to get the data and sum it. So I am using it that way:

with XcomLANTCP(port=4001) as xcom: solar_kw_now1 = xcom.getValue(param.PV_POWER, dstAddr=301) # Solar power at Panel1 solar_kw_now2 = xcom.getValue(param.PV_POWER, dstAddr=302) # Solar power at Panel2 solar_kwh_today1 = xcom.getValue(param.PV_ENERGY_CURR_DAY, dstAddr=301)
solar_kwh_today2 = xcom.getValue(param.PV_ENERGY_CURR_DAY, dstAddr=302)
inverter_kwh_today = xcom.getValue(param.AC_ENERGY_OUT_CURR_DAY)
battery_voltage_xtender = xcom.getValue(param.BATT_VOLTAGE_XTENDER)

solar_kwh_today = solar_kwh_today1 + solar_kwh_today2 solar_kw_now = solar_kw_now1 + solar_kw_now2

zocker-160 commented 7 months ago

I have just updated the readme, which should hopefully clarify the points raised here. I am open to any suggestions if there is still missing something important.

Also I will push a new version later today improving some of the error messages, which seemed to have caused confusion in the Czech solar forum.

@spinozarabel yeah so the problem with the virtual addresses in the Studer internal CAN bus (which is what all the Xcom adapters are converting the data into) is that when requesting values, you get the answer of whatever device answers first. (usually it is the one with the lowest address)

xcom-protocol lib is only aiming to give an easy way to talk to those converters (Xcom-LAN / CAN / 232i), so in your case you will have to calculate the sum yourself.

PS:

set the charge max current level using MQTT and an excellent level 2 charger

Thank your for this btw, I have been searching for something like this for quite a while now lol.

JeffersM1 commented 7 months ago

@spinozarabel WordPress local site. So many ways of doing things that I never would have thought of. When I said that I am using TCP Server its the Xcom-LAN library that is running on a Raspberry Pi that also runs Home Assistant. The Moxa is in TCP Client mode so that it stays connected to the Studer portal. Although I do see that the portal doesn't seem to like to share the Moxa with the local Xcom-LAN communication. To get the nightly Datalog uploads to the portal to succeed, I have to pause Xcom-LAN communications or the upload won't work. For my system I have seen that so far the uploads always occur between 12 midnight and 00:45, and the upload takes a little more that 1.5 minutes. So I pause the communication starting at 12 midnight. Fortunately Studer has an API that tells the date of the last Datalog update which I monitor, and as soon as it changes, I unpause the communication instead of waiting until 00:45.

I don't have an EV yet and am still driving an almost 30 year old gasoline powered car. At about 7000 km/year, I don't do much driving. Not sure when I will switch to an EV. I am living in Portugal. (I retired about 5 years ago and moved from Puerto Rico, USA) From what I have seen so far in EVs here, the MGs (A Chinese acquisition of a former British company looks like the best value.) Who are the biggest players there in the India EV market? Do you expect any of them to get into the global export market?

spinozarabel commented 7 months ago

@JeffersM1, I started with WP because initially my control was cloud based. Now I have both. WHen the cloud based SOC goes below a preset the Grid is switched ON. If the local internet fails (but the intranet always works) then the cloud solution is offline and so the local control gets the priority. THis gives me exquisite control. I have nothing else to do but run, do philosophy and play with this as I too am retired :-) India is just starting out with EVs. Tata Motors (also owns Jaguar in the UK) is the biggest player. My EV us a cmall hatchback with 24KWH LiFe battery that gives a range of about 220KM. MG is also available here but I am avoiding it for the chinese connection. My car is Tata Tiago and costs about US$15K so quite a bargain. I am not sure if it is export material. I am happy that I with rain water harvesting, being 90% off-grid and driving an EV, I am doing my small bit to mother Earth. Thanks for the info about Studer daily uploads bit.

zocker-160 commented 7 months ago

new version 0.3.4 pushed, thank you for this report and discussion, closing