NAME
Device::Inverter::Aurora - Module for communicating with Power-One Aurora inverters.
SYNOPSIS
use Device::Inverter::Aurora;
my $dev = new Device::Inverter::Aurora(port => '/dev/ttyUSB0');
if ($dev->commCheck()) {
my %version = $dev->$dev->getVersion();
print $version{model};
}
DESCRIPTION
Perl module for communicating with Power-One Aurora inverters.
Based on Curt Blank's Aurora program (http://www.curtronics.com/Solar/AuroraData.html) which is in turn based on Power One's 'Aurora Inverter Series - Communication Protocol -' document, Rel. 4.6 25/02/09.
Having not so far been able to obtain a copy of this document from Power One I've had to make some educated guesses as to some things, but for the most part this library should be functional to the point the original Aurora program is.
METHODS
new(%args)
Constructor for the module, accepts the following paramaters with defaults listed.
- debug => bool (0)
-
Set to 1 to output more data from this module.
- retries => int (0)
-
How many times to attempt to communicate with the inverter before giving up.
- address => int (2)
-
The default inverter address to use (passing an address to the functions is optional).
- port => string ('/dev/ttyS0')
-
The path to the serial device/port that the inverter is connected to.
- raw => bool (0)
-
Set this to true if you want to get raw binary data from some functions (useful for compact binary logging)
- baudrate => int (19200)
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- parity => string ('none')
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- databits => int (8)
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- stopbits => int (1)
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- datatype => string ('raw')
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- handshake => string ('none')
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
- read_const_time => int (150)
-
Passed directly to Device::SerialPort (or Win32::SerialPort for windows users)
raw([raw])
Setter getter for raw provided to constructor
communicate(address, command[, arg [, arg[, arg [, arg[, arg [, arg]]]]]] )
This method isn't really intended to be used directly but is provided all the same.
Send a command to the given inverter address, in this instance address must be provided, or set to undef. The last used argument must be followed by a 0 argument.
$obj->communicate(2, OP_GET_SOMETHING, 2, 4, 0);
$obj->communicate(undef, OP_GET_SOMETHING, 0);
Please be sure to include a 0 param as the last argument.
There is only one exception I know of to the 0 as last argument rule, that's OP_GET_VERSION.
translate(value, ref)
Check the given array or hashref for the given value, if no match found, returns "unknown"
transmissionCheck(status)
Used internally to check the transmission check byte (byte 0 from most replies) to make sure all is well.
You can use this function if you've been calling communicate directly but I suggest checking the source to work out which op codes do and don't return a transmission check byte.
commCheck([address])
Check that the we can talk to the inverter, and it's inclined to reply.
getState([address])
Get the current state of the inverter, returns a hash.
(
feature => [raw integer value, 'string translation'],
etc...
)
Features are globalState, inverterState, channel1DCDCState, channel2DCDCState, and alarmState
getLastAlarms([address])
Get the lsat 4 alarms from the inverter, returns an array
(
[raw integer value, 'string translation'],
etc...
)
getPartNumber([address])
Gets the part number from the inverter and returns it as a string.
getSerialNumber([address])
Gets the serial number from the inverter and returns it as a string.
getVersion([address])
Get the model of inverter, the spec it complies with, what type the inverter is (wind or photovoltic) and whether it is transformerless or not.
(
field => [raw integer value, 'string translation'],
etc...
)
Fields are model, regulation, transformer, and type
getManufactureDate([address])
Gets and returns the (2 digit) year and month of manufacture as a hash.
getFirmwareVersion([address])
Gets and returns the firmware version of the inverter as a string formatted 'a.b.c.d'
getConfiguration([address])
Get the string configuration from the inverter, returns an array containing the raw value from the inverter and the string translation
(raw integer value, 'string translation')
getCumulatedEnergy(period[, address])
Get the value (watts) from one of the energy cumulaters being daily, weekly, monthly, yearly, total, partial.
While you can call this method directly, and the constants for these cumulaters can be imported with the :CumulatedPeriod tag, you should probably just use the shortcuts below.
If the 'raw' is true then this function will return a 4 byte big-endian unsigned long as a binary string.
getDailyEnergy([address])
Shortcut for getCumulatedEnergy to get the daily value
getWeeklyEnergy([address])
Shortcut for getCumulatedEnergy to get the weekly value
getMonthlyEnergy([address])
Shortcut for getCumulatedEnergy to get the monthly value
getYearlyEnergy([address])
Shortcut for getCumulatedEnergy to get the yearly value
getTotalEnergy([address])
Shortcut for getCumulatedEnergy to get the total value (like forever man)
getPartialEnergy([address])
Shortcut for getCumulatedEnergy to get the partial value (since last reset)
getDSPData(parameter[, address])
Get one of the DSP parameters returned as a float. or in raw mode a 4 byte binary string representing a flot in 'native' format.
There are many DSP parameters available (see Device::Inverter::Aurora::Constants for a full list) which have defined constants importable with the :DSP tag.
The most basic and common DSP parameters have shortcut methods already as part of this module listed below.
getFrequency([address])
Shortcut to get and return the frequency detected on the grid (I think).
getGridVoltage([address])
Shortcut to get and return the voltage being pushed to the grid.
getGridCurrent([address])
Shortcut to get and return the amount of current (in amps) being pushed to the grid.
getGridPower([address])
Shortcut to get and return the amount of power (in watts) being pushed to the grid.
getInput1Voltage([address])
Shortcut to get and return the voltage received on input 1 from your solar array/wind turbine
getInput1Current([address])
Shortcut to get and return the amount of current (in amps) being received from input 1
getInput2Voltage([address])
Shortcut to get and return the voltage received on input 2 from your solar array/wind turbine
getInput2Current([address])
Shortcut to get and return the amount of current (in amps) being received from input 2
getInverterTemperature([address])
Shortcut to get and return the current temperature of the inverter in celsius.
getBoosterTemperature([address])
Shortcut to get and return the current temperature of the booster in celsius.
getJoules([address])
The amount of power produced in the last 10 seconds as Joules, in raw mode it returns a 2 byte big-endian binary short
getTime([address])
Get the current timestamp from the inverter, returns as a unix epoch based timestamp unless in raw mode, then it returns the 4 big-endian binary bytes containing the inverter time. This is not an unix timetamp rather it is a timestamp from 946706400 seconds later than epoch.
ie:
$obj->raw(1);
$t = $obj->getTime();
# $t is a binary timestamp that needs 946706400 seconds added to it
setTime(timestamp[, address])
Set the time in the inverter to the given timestamp.
Warning: this may result in the resetting of partial counters/cumulaters.
getCounterData(counter[, address])
Get the value (seconds?) from one of the counters being total, partial, grid, and reset runtimes.
While you can call this method directly, and the constants for these counters can be imported with the :Counters tag, you should probably just use the shortcuts below.
If the 'raw' is true then this function will return a 4 byte big-endian unsigned long as a binary string.
getTotalRunTime([address])
Get the total runtime for the inverter
getPartialRunTime([address])
Get the partial runtime of the inverter... since when?
getGridRunTime([address])
Get the amount of time the inverter has been on grid.
getResetRunTime([address])
Get a timer sine reset? of what?
lastError()
Returns the last error/warning and clears the buffer
EXPORT
None by default.
SEE ALSO
Device::SerialPort, Win32::SerialPort, Original Aurora program (http://www.curtronics.com/Solar/AuroraData.html)
AUTHOR
Shannon Wynter
COPYRIGHT AND LICENSE
Copyright (C) 2010 by Shannon Wynter (http://fremnet.net/contact)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.