How to use fix0 method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

modbus_sma_sb5.py

Source:modbus_sma_sb5.py Github

copy

Full Screen

1# https://github.com/TenySmart/ModbusTCP2MQTT/blob/main/models/modbus-sma-SBn_n-1AV-40.py2"""3values["msg"] = hexdata[24 + offset:28 + offset] # new4values["serial"] = binascii.unhexlify(hexdata[30 + offset:60 + offset]).decode('utf-8')5values["temperature"] = float(int(hexdata[62 + offset:66 + offset], 16)) / 10.06values["v_pv1"] = float(int(hexdata[66 + offset:70 + offset], 16)) / 10.07values["v_pv2"] = float(int(hexdata[70 + offset:74 + offset], 16)) / 10.08# values["v_pv3"] = float(int(hexdata[74:78], 16))/109values["i_pv1"] = float(int(hexdata[78 + offset:82 + offset], 16)) / 10.010values["i_pv2"] = float(int(hexdata[82 + offset:86 + offset], 16)) / 10.011# values["i_pv3"] = float(int(hexdata[86:90], 16))/1012values["i_ac1"] = int(hexdata[90 + offset:94 + offset], 16) / 10.013# values["i_ac2"] = float(int(hexdata[94:98], 16))/1014# values["i_ac3"] = float(int(hexdata[98:102], 16))/1015values["v_ac1"] = float(int(hexdata[102 + offset:106 + offset], 16)) / 10.016# values["v_ac2"] = float(int(hexdata[106:110], 16))/1017# values["v_ac3"] = float(int(hexdata[110:114], 16))/1018values["f_ac"] = float(int(hexdata[114 + offset:118 + offset], 16)) / 100.019values["p_ac1"] = int(hexdata[118 + offset:122 + offset], 16)20# values["p_ac2"] = float(int(hexdata[122:126], 16))21# values["p_ac3"] = float(int(hexdata[126:130], 16))22# unknown = float(int(hexdata[130:134],16))/10023values["yield_today"] = int(hexdata[138 + offset:142 + offset], 16) * 1024# values["yield_yesterday"] = int(hexdata[134+offset:138+offset], 16) * 10 # not implemented25values["yield_total"] = int(hexdata[142 + offset:150 + offset], 16) * 10026values["hrs_total"] = int(hexdata[150 + offset:158 + offset], 16)27values["runstate"] = int(hexdata[158 + offset:160 + offset], 16)28values["GVFault_1"] = int(hexdata[162 + offset:164 + offset], 16)29values["GVFault_2"] = int(hexdata[166 + offset:168 + offset], 16)30values["GZFault"] = int(hexdata[170 + offset:172 + offset], 16)31values["TmpFault"] = int(hexdata[174 + offset:176 + offset], 16)32values["PVFault"] = int(hexdata[178 + offset:180 + offset], 16)33values["GFCIFault"] = int(hexdata[182 + offset:184 + offset], 16)34"""35# Supported hardware and firmware:36# Sunny Boy 3.0 / 3.6 / 4.0 / 5.037# Sunny Boy: SB3.0-1AV-40 / SB3.6-1AV-40 / SB4.0-1AV-40 / SB5.0-1AV-4038# Starting with software package: 01.03.04.R39# Full list of readable registers - comment out registers you aren't interested in for faster performance40#41# Descriptions generated by using the following formula in SMA_Modbus-TI-en-26.xlsx - available from SMA web site42# =" ['"&A3&" - "&IFERROR(LEFT(B3,FIND(":",B3)-1),B3)&IF(C3<>""," ("&C3&")","")&"',"&A3&",'"&D3&"','"&E3&"'],"43#44# Note: The following manual updates were made:45# * Updates from STR32 to STR16 as the SMA doco appears to be wrong for 31017, 31025, 31033, 31041, 40159, 40167, 40175 and 4051346# * Remove extended characters from temperatures in 30953, 34109 and 3411347# * Comment out write only registers: 40015, 40016, 40018, 40022, 40023, 40024, 40025 and 4099948# Definition for sma_registers49# If JSONKEY is not defined, fall back to NAME50sma_definition = {51 "NAME" : 0,52 "REGISTER" : 1,53 "DATATYPE" : 2,54 "FORMAT" : 3,55 "JSONKEY" : 456}57# SMA datatypes and their register lengths58# S = Signed Number, U = Unsigned Number, STR = String59sma_moddatatype = {60 "S16": 1,61 "U16": 1,62 "S32": 2,63 "U32": 2,64 "U64": 4,65 "STR16": 8,66 "STR32": 16,67}68sma_registers = [69## ['30051 - Device class',30051,'U32','ENUM'],70## ['30053 - Device type',30053,'U32','ENUM'],71 ['*30057 - Serial number',30057,'U32','STRING','serial'],72## ['30059 - Software package',30059,'U32','FW'],73# ['30199 - Waiting time until feed-in (s)',30199,'U32','Duration'],74# ['30201 - Condition',30201,'U32','ENUM'],75# ['30203 - Nominal power in Ok Mode (W)',30203,'U32','FIX0'],76# ['30205 - Nominal power in Warning Mode (W)',30205,'U32','FIX0'],77# ['30207 - Nominal power in Fault Mode (W)',30207,'U32','FIX0'],78# ['30211 - Recommended action',30211,'U32','ENUM'],79# ['30213 - Message',30213,'U32','ENUM'],80# ['30215 - Fault correction measure',30215,'U32','ENUM'],81# ['30217 - Grid relay/contactor',30217,'U32','ENUM'],82# ['30225 - Insulation resistance (Ohms)',30225,'U32','FIX0'],83# ['30231 - Maximum active power device (W)',30231,'U32','FIX0'],84# ['30233 - Set active power limit (W)',30233,'U32','FIX0'],85# ['30247 - Current event number for manufacturer',30247,'U32','FIX0'],86 ['*30513 - Total yield (Wh)',30513,'U64','FIX0','yield_total'],87# ['30517 - Daily yield (Wh)',30517,'U64','FIX0'],88# ['30521 - Operating time (s)',30521,'U64','Duration'],89# ['30525 - Feed-in time (s)',30525,'U64','Duration'],90# ['30529 - Total yield (Wh)',30529,'U32','FIX0'],91# ['30531 - Total yield (kWh)',30531,'U32','FIX0'],92# ['30533 - Total yield (MWh)',30533,'U32','FIX0'],93# ['30535 - Daily yield (Wh)',30535,'U32','FIX0'],94# ['30537 - Daily yield (kWh)',30537,'U32','FIX0'],95# ['30539 - Daily yield (MWh)',30539,'U32','FIX0'],96# ['30541 - Operating time (s)',30541,'U32','Duration'],97# ['30543 - Feed-in time (s)',30543,'U32','Duration'],98# ['30559 - Number of events for user',30559,'U32','FIX0'],99# ['30561 - Number of events for installer',30561,'U32','FIX0'],100# ['30563 - Number of events for service',30563,'U32','FIX0'],101# ['30581 - Grid reference counter reading (Wh)',30581,'U32','FIX0'],102# ['30583 - Grid feed-in counter reading (Wh)',30583,'U32','FIX0'],103# ['30599 - Number of grid connections',30599,'U32','FIX0'],104 ['*30769 - DC current input [1] (A)',30769,'S32','FIX3','i_pv1'],105 ['*30771 - DC voltage input [1] (V)',30771,'S32','FIX2','v_pv1'],106 ['*30773 - DC power input [1] (W)',30773,'S32','FIX0','p_pv1'],107 ['*30775 - Power (W)',30775,'S32','FIX0','p_ac1'],108 ['*30783 - Grid voltage phase L1 (V)',30783,'U32','FIX2','v_ac1'],109# ['30785 - Grid voltage phase L2 (V)',30785,'U32','FIX2'],110# ['30787 - Grid voltage phase L3 (V)',30787,'U32','FIX2'],111 ['*30803 - Grid frequency (Hz)',30803,'U32','FIX2', 'f_ac'],112## ['30805 - Reactive power (VAr)',30805,'S32','FIX0'],113## ['30813 - Apparent power (VA)',30813,'S32','FIX0'],114## ['30823 - Excitation type of cosPhi',30823,'U32','ENUM'],115## ['30825 - Operating mode of stat.V stab., stat.V stab. config.',30825,'U32','ENUM'],116## ['30829 - Reactive power set value as a % (%)',30829,'S32','FIX1'],117## ['30831 - cosPhi setpoint, cosPhi config., direct specif.',30831,'S32','FIX2'],118## ['30833 - cosPhi excit.type, cosPhi config., direct spec.',30833,'U32','ENUM'],119## ['30835 - Operating mode of feed-in management',30835,'U32','ENUM'],120## ['30837 - Active power limitation P, active power configuration (W)',30837,'U32','FIX0'],121## ['30839 - Active power limitation P, active power configuration (%)',30839,'U32','FIX0'],122# ['30865 - Power grid reference (W)',30865,'S32','FIX0'],123# ['30867 - Power grid feed-in (W)',30867,'S32','FIX0'],124## ['30925 - Connection speed of SMACOM A',30925,'U32','ENUM'],125## ['30927 - Duplex mode of SMACOM A',30927,'U32','ENUM'],126## ['30929 - Speedwire connection status of SMACOM A',30929,'U32','ENUM'],127## ['30949 - Displacement power factor ',30949,'U32','FIX3'],128 ['*30953 - Internal temperature (C)',30953,'S32','FIX1','temperature'],129 ['*30957 - DC current input [2] (A)',30957,'S32','FIX3','i_pv2'],130 ['*30959 - DC voltage input [2] (V)',30959,'S32','FIX2','v_pv2'],131 ['*30961 - DC power input [2] (W)',30961,'S32','FIX0','p_pv2'],132# ['30975 - Intermediate circuit voltage (V)',30975,'S32','FIX2'],133 ['*30977 - Grid current phase L1 (A)',30977,'S32','FIX3','i_ac1'],134## ['30979 - Grid current phase L2 (A)',30979,'S32','FIX3'],135## ['30981 - Grid current phase L3 (A)',30981,'S32','FIX3'],136# ['31017 - Current speedwire IP address',31017,'STR16','UTF8'],137## ['31025 - Current speedwire subnet mask',31025,'STR16','UTF8'],138## ['31033 - Current speedwire gateway address',31033,'STR16','UTF8'],139## ['31041 - Current speedwire DNS server address',31041,'STR16','UTF8'],140# ['31085 - Nominal power in Ok Mode (W)',31085,'U32','FIX0'],141# ['31247 - Residual current (A)',31247,'S32','FIX3'],142# ['34109 - Heat sink temperature (C)',34109,'S32','TEMP'],143# ['34113 - Internal temperature (C)',34113,'S32','TEMP'],144# ['35377 - Number of events for user',35377,'U64','FIX0'],145# ['35381 - Number of events for installer',35381,'U64','FIX0'],146# ['35385 - Number of events for service',35385,'U64','FIX0'],147## ['40003 - Time zone',40003,'U32','ENUM'],148## ['40005 - Standard/Daylight saving time conversion on',40005,'U32','ENUM'],149## ['40009 - Operating condition',40009,'U32','ENUM'],150## ['40013 - Language of the user interface',40013,'U32','ENUM'],151## WRITE ONLY REGISTERS152## ['40015 - Normalized reactive power limitation by PV system ctrl (%)',40015,'S16','FIX1'], # Write only153## ['40016 - Normalized active power limitation by PV system ctrl (%)',40016,'S16','FIX0'], # Write only154## ['40018 - Fast shut-down',40018,'U32','ENUM'], # Write only155## ['40022 - Normalized reactive power limitation by PV system ctrl (%)',40022,'S16','FIX2'], # Write only156## ['40023 - Normalized active power limitation by PV system ctrl (%)',40023,'S16','FIX2'], # Write only157## ['40024 - Dis.pow.factor that can be changed via PV system ctrl',40024,'U16','FIX4'], # Write only158## ['40025 - Excitation type that can be changed by PV system ctrl',40025,'U32','ENUM'], # Write only159# ['40063 - Firmware version of the main processor',40063,'U32','FW'],160# ['40067 - Serial number',40067,'U32','RAW'],161## ['40109 - Country standard set',40109,'U32','ENUM'],162# ['40133 - Grid nominal voltage (V)',40133,'U32','FIX0'],163# ['40135 - Nominal frequency (Hz)',40135,'U32','FIX2'],164## ['40157 - Automatic speedwire configureation switched on',40157,'U32','ENUM'],165# ['40159 - Speedwire IP address',40159,'STR16','IP4'],166## ['40167 - Speedwire subnet mask',40167,'STR16','IP4'],167## ['40175 - Speedwire gateway address',40175,'STR16','IP4'],168## ['40183 - Phase assignment',40183,'U32','ENUM'],169# ['40185 - Maximum apparent power device (VA)',40185,'U32','FIX0'],170## ['40195 - Currently set apparent power limit (VA)',40195,'U32','FIX0'],171## ['40200 - Operating mode of stat.V stab., stat.V stab. config.',40200,'U32','ENUM'],172## ['40204 - Reactive power set value as a % (%)',40204,'S32','FIX1'],173## ['40206 - cosPhi setpoint, cosPhi config., direct specif.',40206,'S32','FIX2'],174## ['40208 - cosPhi excit.type, cosPhi config., direct spec.',40208,'U32','ENUM'],175## ['40210 - Operating mode of feed-in management',40210,'U32','ENUM'],176# ['40212 - Active power limitation P, active power configuration (W)',40212,'U32','FIX0'],177# ['40214 - Active power limitation P, active power configuration (%)',40214,'U32','FIX0'],178# ['40216 - Operating mode of active power reduction in case of overfrequency P(f)',40216,'U32','ENUM'],179# ['40218 - Difference between starting frequency and grid frequency, linear instantaneous power gradient configuration (Hz)',40218,'U32','FIX2'],180# ['40220 - Difference between reset frequency and grid frequency, linear instantaneous power gradient configuration (Hz)',40220,'U32','FIX2'],181## ['40222 - cosPhi at start point, cosPhi(P) char. config.',40222,'U32','FIX2'],182## ['40224 - Excit. type at start point, cosPhi(P) char. conf.',40224,'U32','ENUM'],183## ['40226 - cosPhi at end point, cosPhi(P) char. config.',40226,'U32','FIX2'],184## ['40228 - Excit. type at end point, cosPhi(P) char. config.',40228,'U32','ENUM'],185## ['40230 - Act. power at start point, cosPhi(P) char. config. (%)',40230,'U32','FIX0'],186## ['40232 - Act. power at end point, cosPhi(P) char. config. (%)',40232,'U32','FIX0'],187## ['40238 - Active power gradient, linear instantaneous power gradient configuration (%)',40238,'U32','FIX0'],188## ['40240 - Activation of stay-set indicator function, linear instantaneous power gradient configuration',40240,'U32','ENUM'],189## ['40242 - Active power gradient after reset frequency, linear instantaneous power gradient configuration (%)',40242,'U32','FIX0'],190## ['40428 - Frequency monitoring median maximum threshold (Hz)',40428,'U32','FIX2'],191## ['40430 - Frq. monitoring median max. threshold trip. time (ms)',40430,'U32','FIX0'],192## ['40432 - Frequency monitoring lower maximum threshold (Hz)',40432,'U32','FIX2'],193## ['40434 - Frq. monitoring lower max. threshold trip. time (ms)',40434,'U32','FIX0'],194## ['40436 - Frequency monitoring upper minimum threshold (Hz)',40436,'U32','FIX2'],195## ['40438 - Frq. monitoring upper min. threshold trip. time (ms)',40438,'U32','FIX0'],196## ['40440 - Frequency monitoring median minimum threshold (Hz)',40440,'U32','FIX2'],197## ['40442 - Frq. monitoring median min. threshold trip. time (ms)',40442,'U32','FIX0'],198## ['40448 - Voltage monitoring median maximum threshold (V)',40448,'U32','FIX2'],199## ['40450 - Voltage monitoring median max. threshold trip.time (ms)',40450,'U32','FIX0'],200## ['40452 - Voltage monitoring lower maximum threshold (V)',40452,'U32','FIX2'],201## ['40456 - Voltage monitoring lower max. threshold trip. time (ms)',40456,'U32','FIX0'],202## ['40458 - Voltage monitoring lower minimum threshold (V)',40458,'U32','FIX2'],203## ['40462 - Voltage monitoring lower min. threshold trip. time (ms)',40462,'U32','FIX0'],204## ['40464 - Voltage monitoring of median minimum threshold (V)',40464,'U32','FIX2'],205## ['40466 - Voltage monitoring median min. threshold trip.time (ms)',40466,'U32','FIX0'],206## ['40470 - Island network detect. status',40470,'U32','ENUM'],207## ['40484 - Activation of active power gradient',40484,'U32','ENUM'],208## ['40497 - MAC address',40497,'STR32','UTF8'],209## ['40513 - Speedwire DNS server address',40513,'STR16','IP4'],210# ['40631 - Device name',40631,'STR32','UTF8'],211## ['40789 - Communication version',40789,'U32','REV'],212## ['40915 - Set active power limit (W)',40915,'U32','FIX0'],213## ['40999 - Setpoint cos(phi) as per EEI convention',40999,'S32','FIX4'], # Write only214## ['41017 - Adjustment time of characteristic operating point, conf. of grid integr. char. 1 (s)',41017,'U32','FIX1'],215## ['41023 - Number of points to be used, conf. of grid integr. char. 1',41023,'U32','FIX0'],216## ['41025 - X-axes reference, conf. of grid integration char. 1',41025,'U32','ENUM'],217## ['41027 - Y-axes reference, conf. of grid integration char. 1',41027,'U32','ENUM'],218## ['41029 - X value 1, conf. of grid integr. char. 1',41029,'S32','FIX3'],219## ['41031 - Y value 1, conf. of grid integr. char. 1',41031,'S32','FIX3'],220## ['41033 - X value 2, conf. of grid integr. char. 1',41033,'S32','FIX3'],221## ['41035 - Y value 2, conf. of grid integr. char. 1',41035,'S32','FIX3'],222## ['41037 - X value 3, conf. of grid integr. char. 1',41037,'S32','FIX3'],223## ['41039 - Y value 3, conf. of grid integr. char. 1',41039,'S32','FIX3'],224## ['41041 - X value 4, conf. of grid integr. char. 1',41041,'S32','FIX3'],225## ['41043 - Y value 4, conf. of grid integr. char. 1',41043,'S32','FIX3'],226## ['41061 - 2nd characteristic curve number, configuration of characteristic curve mode',41061,'U32','FIX0'],227## ['41063 - 2nd activation of the characteristic curve, configuration of characteristic curve mode',41063,'U32','ENUM'],228## ['41065 - Adjustment time of char. operating point, conf. of grid integration char. 2 (s)',41065,'U32','FIX1'],229## ['41071 - Number of points to be used, conf. of grid integr. char. 2',41071,'U32','FIX0'],230## ['41073 - Input unit, conf. of grid integration char. 2',41073,'U32','ENUM'],231## ['41075 - Output frequency, conf. of grid integration char. 2',41075,'U32','ENUM'],232## ['41077 - X value 1, conf. of grid integr. char. 2',41077,'S32','FIX3'],233## ['41079 - Y value 1, conf. of grid integr. char. 2',41079,'S32','FIX3'],234## ['41081 - X value 2, conf. of grid integr. char. 2',41081,'S32','FIX3'],235## ['41083 - Y value 2, conf. of grid integr. char. 2',41083,'S32','FIX3'],236## ['41085 - X value 3, conf. of grid integr. char. 2',41085,'S32','FIX3'],237## ['41087 - Y value 3, conf. of grid integr. char. 2',41087,'S32','FIX3'],238## ['41089 - X value 4, conf. of grid integr. char. 2',41089,'S32','FIX3'],239## ['41091 - Y value 4, conf. of grid integr. char. 2',41091,'S32','FIX3'],240## ['41111 - Voltage monitoring of lower minimum threshold as RMS value (V)',41111,'U32','FIX2'],241## ['41113 - Voltage monitoring of lower min.threshold as RMS value for tripping time (ms)',41113,'U32','FIX0'],242## ['41115 - Voltage monitoring of upper maximum threshold as RMS value (V)',41115,'U32','FIX2'],243## ['41117 - Voltage monitoring of upper max. thresh. as RMS value for tripping time (ms)',41117,'U32','FIX0'],244## ['41121 - Set country standard',41121,'U32','FUNKTION_SEC'],245# ['41123 - Min. voltage for reconnection (V)',41123,'U32','FIX2'],246# ['41125 - Max. voltage for reconnection (V)',41125,'U32','FIX2'],247# ['41127 - Lower frequency for reconnection (Hz)',41127,'U32','FIX2'],248# ['41129 - Upper frequency for reconnection (Hz)',41129,'U32','FIX2'],249# ['41169 - Minimum insulation resistance (Ohms)',41169,'U32','FIX0'],250## ['41171 - Set total yield (kWh)',41171,'U32','FIX0'],251## ['41173 - Set total operating time at grid connection point (h)',41173,'U32','Duration'],252## ['41193 - Operating mode for absent active power limitation',41193,'U32','ENUM'],253## ['41195 - Timeout for absent active power limitation (s)',41195,'U32','Duration'],254## ['41197 - Fallback act power lmt P in % of WMax for absent act power lmt (%)',41197,'U32','FIX2'],255## ['41199 - Set active power limit at grid connection point (%)',41199,'U32','FIX0'],256## ['41203 - Nominal PV system power (W)',41203,'U32','FIX0'],257## ['41217 - Set active power limit at grid connection point (W)',41217,'U32','FIX0'],258## ['41219 - Operating mode for absent reactive power control',41219,'U32','ENUM'],259## ['41221 - Timeout for absent reactive power control (s)',41221,'U32','Duration'],260## ['41223 - Fallback react power Q in % of WMax for absent react power ctr (%)',41223,'S32','FIX2'],261## ['41225 - Operating mode for absent cos Phi spec',41225,'U32','ENUM'],262## ['41227 - Timeout for absent cos Phi spec (s)',41227,'U32','Duration'],263## ['41229 - Fallback cos Phi for absent cos Phi spec',41229,'S32','FIX4'],264## ['41253 - Fast shut-down',41253,'U32','ENUM'],265## ['41255 - Normalized active power limitation by PV system ctrl (%)',41255,'S16','FIX2'],266## ['41256 - Normalized reactive power limitation by PV system ctrl (%)',41256,'S16','FIX2'],267## ['41257 - Setpoint cos(phi) as per EEI convention',41257,'S32','FIX4'],268## ['43090 - Login with Grid Guard-Code',43090,'U32','FIX0']...

Full Screen

Full Screen

modbus-sma-SBn_n-1AV-40.py

Source:modbus-sma-SBn_n-1AV-40.py Github

copy

Full Screen

1# Supported hardware and firmware:2# Sunny Boy 3.0 / 3.6 / 4.0 / 5.03# Sunny Boy: SB3.0-1AV-40 / SB3.6-1AV-40 / SB4.0-1AV-40 / SB5.0-1AV-404# Starting with software package: 01.03.04.R5# Full list of readable registers - comment out registers you aren't interested in for faster performance6#7# Descriptions generated by using the following formula in SMA_Modbus-TI-en-26.xlsx - available from SMA web site8# =" ['"&A3&" - "&IFERROR(LEFT(B3,FIND(":",B3)-1),B3)&IF(C3<>""," ("&C3&")","")&"',"&A3&",'"&D3&"','"&E3&"'],"9#10# Note: The following manual updates were made:11# * Updates from STR32 to STR16 as the SMA doco appears to be wrong for 31017, 31025, 31033, 31041, 40159, 40167, 40175 and 4051312# * Remove extended characters from temperatures in 30953, 34109 and 3411313# * Comment out write only registers: 40015, 40016, 40018, 40022, 40023, 40024, 40025 and 4099914sma_registers = [15 ['30051 - Device class',30051,'U32','ENUM'],16 ['30053 - Device type',30053,'U32','ENUM'],17 ['30057 - Serial number',30057,'U32','RAW'],18 ['30059 - Software package',30059,'U32','FW'],19 ['30199 - Waiting time until feed-in (s)',30199,'U32','Duration'],20 ['30201 - Condition',30201,'U32','ENUM'],21 ['30203 - Nominal power in Ok Mode (W)',30203,'U32','FIX0'],22 ['30205 - Nominal power in Warning Mode (W)',30205,'U32','FIX0'],23 ['30207 - Nominal power in Fault Mode (W)',30207,'U32','FIX0'],24 ['30211 - Recommended action',30211,'U32','ENUM'],25 ['30213 - Message',30213,'U32','ENUM'],26 ['30215 - Fault correction measure',30215,'U32','ENUM'],27 ['30217 - Grid relay/contactor',30217,'U32','ENUM'],28 ['30225 - Insulation resistance (Ohms)',30225,'U32','FIX0'],29 ['30231 - Maximum active power device (W)',30231,'U32','FIX0'],30 ['30233 - Set active power limit (W)',30233,'U32','FIX0'],31 ['30247 - Current event number for manufacturer',30247,'U32','FIX0'],32 ['30513 - Total yield (Wh)',30513,'U64','FIX0'],33 ['30517 - Daily yield (Wh)',30517,'U64','FIX0'],34 ['30521 - Operating time (s)',30521,'U64','Duration'],35 ['30525 - Feed-in time (s)',30525,'U64','Duration'],36 ['30529 - Total yield (Wh)',30529,'U32','FIX0'],37 ['30531 - Total yield (kWh)',30531,'U32','FIX0'],38 ['30533 - Total yield (MWh)',30533,'U32','FIX0'],39 ['30535 - Daily yield (Wh)',30535,'U32','FIX0'],40 ['30537 - Daily yield (kWh)',30537,'U32','FIX0'],41 ['30539 - Daily yield (MWh)',30539,'U32','FIX0'],42 ['30541 - Operating time (s)',30541,'U32','Duration'],43 ['30543 - Feed-in time (s)',30543,'U32','Duration'],44 ['30559 - Number of events for user',30559,'U32','FIX0'],45 ['30561 - Number of events for installer',30561,'U32','FIX0'],46 ['30563 - Number of events for service',30563,'U32','FIX0'],47 ['30581 - Grid reference counter reading (Wh)',30581,'U32','FIX0'],48 ['30583 - Grid feed-in counter reading (Wh)',30583,'U32','FIX0'],49 ['30599 - Number of grid connections',30599,'U32','FIX0'],50 ['30769 - DC current input [1] (A)',30769,'S32','FIX3'],51 ['30771 - DC voltage input [1] (V)',30771,'S32','FIX2'],52 ['30773 - DC power input [1] (W)',30773,'S32','FIX0'],53 ['30775 - Power (W)',30775,'S32','FIX0'],54 ['30783 - Grid voltage phase L1 (V)',30783,'U32','FIX2'],55 ['30785 - Grid voltage phase L2 (V)',30785,'U32','FIX2'],56 ['30787 - Grid voltage phase L3 (V)',30787,'U32','FIX2'],57 ['30803 - Grid frequency (Hz)',30803,'U32','FIX2'],58 ['30805 - Reactive power (VAr)',30805,'S32','FIX0'],59 ['30813 - Apparent power (VA)',30813,'S32','FIX0'],60 ['30823 - Excitation type of cosPhi',30823,'U32','ENUM'],61 ['30825 - Operating mode of stat.V stab., stat.V stab. config.',30825,'U32','ENUM'],62 ['30829 - Reactive power set value as a % (%)',30829,'S32','FIX1'],63 ['30831 - cosPhi setpoint, cosPhi config., direct specif.',30831,'S32','FIX2'],64 ['30833 - cosPhi excit.type, cosPhi config., direct spec.',30833,'U32','ENUM'],65 ['30835 - Operating mode of feed-in management',30835,'U32','ENUM'],66 ['30837 - Active power limitation P, active power configuration (W)',30837,'U32','FIX0'],67 ['30839 - Active power limitation P, active power configuration (%)',30839,'U32','FIX0'],68 ['30865 - Power grid reference (W)',30865,'S32','FIX0'],69 ['30867 - Power grid feed-in (W)',30867,'S32','FIX0'],70 ['30925 - Connection speed of SMACOM A',30925,'U32','ENUM'],71 ['30927 - Duplex mode of SMACOM A',30927,'U32','ENUM'],72 ['30929 - Speedwire connection status of SMACOM A',30929,'U32','ENUM'],73 ['30949 - Displacement power factor ',30949,'U32','FIX3'],74 ['30953 - Internal temperature (C)',30953,'S32','TEMP'],75 ['30957 - DC current input [2] (A)',30957,'S32','FIX3'],76 ['30959 - DC voltage input [2] (V)',30959,'S32','FIX2'],77 ['30961 - DC power input [2] (W)',30961,'S32','FIX0'],78 ['30975 - Intermediate circuit voltage (V)',30975,'S32','FIX2'],79 ['30977 - Grid current phase L1 (A)',30977,'S32','FIX3'],80 ['30979 - Grid current phase L2 (A)',30979,'S32','FIX3'],81 ['30981 - Grid current phase L3 (A)',30981,'S32','FIX3'],82 ['31017 - Current speedwire IP address',31017,'STR16','UTF8'],83 ['31025 - Current speedwire subnet mask',31025,'STR16','UTF8'],84 ['31033 - Current speedwire gateway address',31033,'STR16','UTF8'],85 ['31041 - Current speedwire DNS server address',31041,'STR16','UTF8'],86 ['31085 - Nominal power in Ok Mode (W)',31085,'U32','FIX0'],87 ['31247 - Residual current (A)',31247,'S32','FIX3'],88 ['34109 - Heat sink temperature (C)',34109,'S32','TEMP'],89 ['34113 - Internal temperature (C)',34113,'S32','TEMP'],90 ['35377 - Number of events for user',35377,'U64','FIX0'],91 ['35381 - Number of events for installer',35381,'U64','FIX0'],92 ['35385 - Number of events for service',35385,'U64','FIX0'],93 ['40003 - Time zone',40003,'U32','ENUM'],94 ['40005 - Standard/Daylight saving time conversion on',40005,'U32','ENUM'],95 ['40009 - Operating condition',40009,'U32','ENUM'],96 ['40013 - Language of the user interface',40013,'U32','ENUM'],97# ['40015 - Normalized reactive power limitation by PV system ctrl (%)',40015,'S16','FIX1'], # Write only98# ['40016 - Normalized active power limitation by PV system ctrl (%)',40016,'S16','FIX0'], # Write only99# ['40018 - Fast shut-down',40018,'U32','ENUM'], # Write only100# ['40022 - Normalized reactive power limitation by PV system ctrl (%)',40022,'S16','FIX2'], # Write only101# ['40023 - Normalized active power limitation by PV system ctrl (%)',40023,'S16','FIX2'], # Write only102# ['40024 - Dis.pow.factor that can be changed via PV system ctrl',40024,'U16','FIX4'], # Write only103# ['40025 - Excitation type that can be changed by PV system ctrl',40025,'U32','ENUM'], # Write only104 ['40063 - Firmware version of the main processor',40063,'U32','FW'],105 ['40067 - Serial number',40067,'U32','RAW'],106 ['40109 - Country standard set',40109,'U32','ENUM'],107 ['40133 - Grid nominal voltage (V)',40133,'U32','FIX0'],108 ['40135 - Nominal frequency (Hz)',40135,'U32','FIX2'],109 ['40157 - Automatic speedwire configureation switched on',40157,'U32','ENUM'],110 ['40159 - Speedwire IP address',40159,'STR16','IP4'],111 ['40167 - Speedwire subnet mask',40167,'STR16','IP4'],112 ['40175 - Speedwire gateway address',40175,'STR16','IP4'],113 ['40183 - Phase assignment',40183,'U32','ENUM'],114 ['40185 - Maximum apparent power device (VA)',40185,'U32','FIX0'],115 ['40195 - Currently set apparent power limit (VA)',40195,'U32','FIX0'],116 ['40200 - Operating mode of stat.V stab., stat.V stab. config.',40200,'U32','ENUM'],117 ['40204 - Reactive power set value as a % (%)',40204,'S32','FIX1'],118 ['40206 - cosPhi setpoint, cosPhi config., direct specif.',40206,'S32','FIX2'],119 ['40208 - cosPhi excit.type, cosPhi config., direct spec.',40208,'U32','ENUM'],120 ['40210 - Operating mode of feed-in management',40210,'U32','ENUM'],121 ['40212 - Active power limitation P, active power configuration (W)',40212,'U32','FIX0'],122 ['40214 - Active power limitation P, active power configuration (%)',40214,'U32','FIX0'],123 ['40216 - Operating mode of active power reduction in case of overfrequency P(f)',40216,'U32','ENUM'],124 ['40218 - Difference between starting frequency and grid frequency, linear instantaneous power gradient configuration (Hz)',40218,'U32','FIX2'],125 ['40220 - Difference between reset frequency and grid frequency, linear instantaneous power gradient configuration (Hz)',40220,'U32','FIX2'],126 ['40222 - cosPhi at start point, cosPhi(P) char. config.',40222,'U32','FIX2'],127 ['40224 - Excit. type at start point, cosPhi(P) char. conf.',40224,'U32','ENUM'],128 ['40226 - cosPhi at end point, cosPhi(P) char. config.',40226,'U32','FIX2'],129 ['40228 - Excit. type at end point, cosPhi(P) char. config.',40228,'U32','ENUM'],130 ['40230 - Act. power at start point, cosPhi(P) char. config. (%)',40230,'U32','FIX0'],131 ['40232 - Act. power at end point, cosPhi(P) char. config. (%)',40232,'U32','FIX0'],132 ['40238 - Active power gradient, linear instantaneous power gradient configuration (%)',40238,'U32','FIX0'],133 ['40240 - Activation of stay-set indicator function, linear instantaneous power gradient configuration',40240,'U32','ENUM'],134 ['40242 - Active power gradient after reset frequency, linear instantaneous power gradient configuration (%)',40242,'U32','FIX0'],135 ['40428 - Frequency monitoring median maximum threshold (Hz)',40428,'U32','FIX2'],136 ['40430 - Frq. monitoring median max. threshold trip. time (ms)',40430,'U32','FIX0'],137 ['40432 - Frequency monitoring lower maximum threshold (Hz)',40432,'U32','FIX2'],138 ['40434 - Frq. monitoring lower max. threshold trip. time (ms)',40434,'U32','FIX0'],139 ['40436 - Frequency monitoring upper minimum threshold (Hz)',40436,'U32','FIX2'],140 ['40438 - Frq. monitoring upper min. threshold trip. time (ms)',40438,'U32','FIX0'],141 ['40440 - Frequency monitoring median minimum threshold (Hz)',40440,'U32','FIX2'],142 ['40442 - Frq. monitoring median min. threshold trip. time (ms)',40442,'U32','FIX0'],143 ['40448 - Voltage monitoring median maximum threshold (V)',40448,'U32','FIX2'],144 ['40450 - Voltage monitoring median max. threshold trip.time (ms)',40450,'U32','FIX0'],145 ['40452 - Voltage monitoring lower maximum threshold (V)',40452,'U32','FIX2'],146 ['40456 - Voltage monitoring lower max. threshold trip. time (ms)',40456,'U32','FIX0'],147 ['40458 - Voltage monitoring lower minimum threshold (V)',40458,'U32','FIX2'],148 ['40462 - Voltage monitoring lower min. threshold trip. time (ms)',40462,'U32','FIX0'],149 ['40464 - Voltage monitoring of median minimum threshold (V)',40464,'U32','FIX2'],150 ['40466 - Voltage monitoring median min. threshold trip.time (ms)',40466,'U32','FIX0'],151 ['40470 - Island network detect. status',40470,'U32','ENUM'],152 ['40484 - Activation of active power gradient',40484,'U32','ENUM'],153 ['40497 - MAC address',40497,'STR32','UTF8'],154 ['40513 - Speedwire DNS server address',40513,'STR16','IP4'],155 ['40631 - Device name',40631,'STR32','UTF8'],156 ['40789 - Communication version',40789,'U32','REV'],157 ['40915 - Set active power limit (W)',40915,'U32','FIX0'],158# ['40999 - Setpoint cos(phi) as per EEI convention',40999,'S32','FIX4'], # Write only159 ['41017 - Adjustment time of characteristic operating point, conf. of grid integr. char. 1 (s)',41017,'U32','FIX1'],160 ['41023 - Number of points to be used, conf. of grid integr. char. 1',41023,'U32','FIX0'],161 ['41025 - X-axes reference, conf. of grid integration char. 1',41025,'U32','ENUM'],162 ['41027 - Y-axes reference, conf. of grid integration char. 1',41027,'U32','ENUM'],163 ['41029 - X value 1, conf. of grid integr. char. 1',41029,'S32','FIX3'],164 ['41031 - Y value 1, conf. of grid integr. char. 1',41031,'S32','FIX3'],165 ['41033 - X value 2, conf. of grid integr. char. 1',41033,'S32','FIX3'],166 ['41035 - Y value 2, conf. of grid integr. char. 1',41035,'S32','FIX3'],167 ['41037 - X value 3, conf. of grid integr. char. 1',41037,'S32','FIX3'],168 ['41039 - Y value 3, conf. of grid integr. char. 1',41039,'S32','FIX3'],169 ['41041 - X value 4, conf. of grid integr. char. 1',41041,'S32','FIX3'],170 ['41043 - Y value 4, conf. of grid integr. char. 1',41043,'S32','FIX3'],171 ['41061 - 2nd characteristic curve number, configuration of characteristic curve mode',41061,'U32','FIX0'],172 ['41063 - 2nd activation of the characteristic curve, configuration of characteristic curve mode',41063,'U32','ENUM'],173 ['41065 - Adjustment time of char. operating point, conf. of grid integration char. 2 (s)',41065,'U32','FIX1'],174 ['41071 - Number of points to be used, conf. of grid integr. char. 2',41071,'U32','FIX0'],175 ['41073 - Input unit, conf. of grid integration char. 2',41073,'U32','ENUM'],176 ['41075 - Output frequency, conf. of grid integration char. 2',41075,'U32','ENUM'],177 ['41077 - X value 1, conf. of grid integr. char. 2',41077,'S32','FIX3'],178 ['41079 - Y value 1, conf. of grid integr. char. 2',41079,'S32','FIX3'],179 ['41081 - X value 2, conf. of grid integr. char. 2',41081,'S32','FIX3'],180 ['41083 - Y value 2, conf. of grid integr. char. 2',41083,'S32','FIX3'],181 ['41085 - X value 3, conf. of grid integr. char. 2',41085,'S32','FIX3'],182 ['41087 - Y value 3, conf. of grid integr. char. 2',41087,'S32','FIX3'],183 ['41089 - X value 4, conf. of grid integr. char. 2',41089,'S32','FIX3'],184 ['41091 - Y value 4, conf. of grid integr. char. 2',41091,'S32','FIX3'],185 ['41111 - Voltage monitoring of lower minimum threshold as RMS value (V)',41111,'U32','FIX2'],186 ['41113 - Voltage monitoring of lower min.threshold as RMS value for tripping time (ms)',41113,'U32','FIX0'],187 ['41115 - Voltage monitoring of upper maximum threshold as RMS value (V)',41115,'U32','FIX2'],188 ['41117 - Voltage monitoring of upper max. thresh. as RMS value for tripping time (ms)',41117,'U32','FIX0'],189 ['41121 - Set country standard',41121,'U32','FUNKTION_SEC'],190 ['41123 - Min. voltage for reconnection (V)',41123,'U32','FIX2'],191 ['41125 - Max. voltage for reconnection (V)',41125,'U32','FIX2'],192 ['41127 - Lower frequency for reconnection (Hz)',41127,'U32','FIX2'],193 ['41129 - Upper frequency for reconnection (Hz)',41129,'U32','FIX2'],194 ['41169 - Minimum insulation resistance (Ohms)',41169,'U32','FIX0'],195 ['41171 - Set total yield (kWh)',41171,'U32','FIX0'],196 ['41173 - Set total operating time at grid connection point (h)',41173,'U32','Duration'],197 ['41193 - Operating mode for absent active power limitation',41193,'U32','ENUM'],198 ['41195 - Timeout for absent active power limitation (s)',41195,'U32','Duration'],199 ['41197 - Fallback act power lmt P in % of WMax for absent act power lmt (%)',41197,'U32','FIX2'],200 ['41199 - Set active power limit at grid connection point (%)',41199,'U32','FIX0'],201 ['41203 - Nominal PV system power (W)',41203,'U32','FIX0'],202 ['41217 - Set active power limit at grid connection point (W)',41217,'U32','FIX0'],203 ['41219 - Operating mode for absent reactive power control',41219,'U32','ENUM'],204 ['41221 - Timeout for absent reactive power control (s)',41221,'U32','Duration'],205 ['41223 - Fallback react power Q in % of WMax for absent react power ctr (%)',41223,'S32','FIX2'],206 ['41225 - Operating mode for absent cos Phi spec',41225,'U32','ENUM'],207 ['41227 - Timeout for absent cos Phi spec (s)',41227,'U32','Duration'],208 ['41229 - Fallback cos Phi for absent cos Phi spec',41229,'S32','FIX4'],209 ['41253 - Fast shut-down',41253,'U32','ENUM'],210 ['41255 - Normalized active power limitation by PV system ctrl (%)',41255,'S16','FIX2'],211 ['41256 - Normalized reactive power limitation by PV system ctrl (%)',41256,'S16','FIX2'],212 ['41257 - Setpoint cos(phi) as per EEI convention',41257,'S32','FIX4'],213 ['43090 - Login with Grid Guard-Code',43090,'U32','FIX0']214 ]215# scan is not used for SMA inverters but solariot.py expects it to exist...

Full Screen

Full Screen

pvdata.py

Source:pvdata.py Github

copy

Full Screen

1"""2 Get inverter pv values via modbus3 2018-12-28 Tommi2Day4 2020-09-22 Tommi2Day fixes empty data exeptions5 2021-01-02 sellth added support for multiple inverters6 Configuration:7 pip3 install pymodbus8 [FEATURE-pvdata]9 # How frequently to send updates over (defaults to 20 sec)10 min_update=2011 #debug output12 debug=013 #inverter connection14 inv_host = <inverter ip>15 inv_port = 50216 inv_modbus_id = 317 inv_manufacturer = SMA18 #['address', 'type', 'format', 'description', 'unit', 'value']19 registers = [20 ['30057', 'U32', 'RAW', 'serial', ''],21 ['30201','U32','ENUM','Status',''],22 ['30051','U32','ENUM','DeviceClass',''],23 ['30053','U32','ENUM','DeviceID',''],24 ['40631', 'STR32', 'UTF8', 'Device Name', ''],25 ['30775', 'S32', 'FIX0', 'AC Power', 'W'],26 ['30813', 'S32', 'FIX0', 'AC apparent power', 'VA'],27 ['30977', 'S32', 'FIX3', 'AC current', 'A'],28 ['30783', 'S32', 'FIX2', 'AC voltage', 'V'],29 ['30803', 'U32', 'FIX2', 'grid frequency', 'Hz'],30 ['30773', 'S32', 'FIX0', 'DC power', 'W'],31 ['30771', 'S32', 'FIX2', 'DC input voltage', 'V'],32 ['30777', 'S32', 'FIX0', 'Power L1', 'W'],33 ['30779', 'S32', 'FIX0', 'Power L2', 'W'],34 ['30781', 'S32', 'FIX0', 'Power L3', 'W'],35 ['30953', 'S32', 'FIX1', u'device temperature', u'\xb0C'],36 ['30517', 'U64', 'FIX3', 'daily yield', 'kWh'],37 ['30513', 'U64', 'FIX3', 'total yield', 'kWh'],38 ['30521', 'U64', 'FIX0', 'operation time', 's'],39 ['30525', 'U64', 'FIX0', 'feed-in time', 's'],40 ['30975', 'S32', 'FIX2', 'intermediate voltage', 'V'],41 ['30225', 'S32', 'FIX0', 'Isolation resistance', u'\u03a9'],42 ['30581', 'U32', 'FIX0', u'energy from grid', 'Wh'],43 ['30583', 'U32', 'FIX0', u'energy to grid', 'Wh'],44 ['30865', 'S32', 'FIX0', 'Power from grid', 'W'],45 ['30867', 'S32', 'FIX0', 'Power to grid', 'W']46 ]47"""48import time49from features.smamodbus import get_device_class50from features.smamodbus import get_pv_data51pv_last_update = 052pv_debug = 053pv_data = []54def run(emparts, config):55 global pv_debug56 global pv_last_update57 global pv_data58 # Only update every X seconds59 if time.time() < pv_last_update + int(config.get('min_update', 20)):60 if (pv_debug > 1):61 print("pv: data skipping")62 return63 pv_last_update = time.time()64 registers = eval(config.get('registers'))65 pv_data = []66 for inv in eval(config.get('inverters')):67 host, port, modbusid, manufacturer = inv68 device_class = get_device_class(host, int(port), int(modbusid))69 if device_class == "Solar Inverter":70 relevant_registers = eval(config.get('registers'))71 mdata = get_pv_data(host, int(port), int(modbusid), relevant_registers)72 pv_data.append(mdata)73 elif device_class == "Battery Inverter":74 relevant_registers = eval(config.get('registers_batt'))75 mdata = get_pv_data(host, int(port), int(modbusid), relevant_registers)76 pv_data.append(mdata)77 else:78 if (pv_debug > 1):79 print("pv: unknown device class; skipping")80 pass81 # query82 if pv_data is None:83 if pv_debug > 0:84 print("PV: no data")85 return86 timestamp = time.time()87 for i in pv_data:88 i['timestamp'] = timestamp89 if pv_debug > 0:90 print("PV:" + format(i))91def stopping(emparts, config):92 pass93def on_publish(client, userdata, result):94 pass95def config(config):96 global pv_debug97 pv_debug = int(config.get('debug', 0))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful