Energy Module Commands

From OpenMotics
Jump to navigation Jump to search

General

GST : GeneralStatus

Gives back the general status of the module.

  • Input
    • none
  • Output
    • status: 1xBYTE status
      • todo explain the status values.

TON : TimeOn

Gives back the time in seconds the module is running.

  • Input
    • none
  • Output
    • time : 1xUINT32 time running [s]


FIV : FirmwareIDVersion

Gives back the firmware ID and version. Depending if the module is in application or in bootloader mode, an other value is returned.

  • Input
    • none
  • Output
    • ID and version: 16 chars (ex. "OMFPC_3_2_1" or "OMFBC_1_2_3")

Power

FST : FeedStatus

Gives back the status of each currentFeeds in the energymodule. Normally the status will always be the same per 2 feeds because the status is the one per chip which is per 2 feeds.

  • Input
    • none
  • Output
    • feedstatus : 12xUINT32
      • The bits in each UINT32 are described in the manual of CS5480 with keyword STATUS0

FCO : FeedCounter

Gives back the number of currentFeeds in the energymodule. this should be fixed to 12.

  • Input
    • none
  • Output
    • feedcount : UINT16 number of feeds [#]

VOL : Voltage

Gives back the voltages that the energymodule measure.

  • Input
    • none
  • Output
    • Voltage : 3xFLOAT [V]

FRE : Frequency

Gives back the frequencies that the energymodule measure for the different voltage channels.

  • Input
    • none
  • Output
    • Freqency : 3xFLOAT [Hz]

CUR : Current

Gives back the current that the energymodule measure.

  • Input
    • none
  • Output
    • Current : 12xFLOAT [A]

POW : Power

Gives back the real power that the energymodule measure.

  • Input
    • none
  • Output
    • Power : 12xFLOAT [W]

ENE : Energy

Gives back the energy that the energymodule calculate.

  • Input
    • none
  • Output
    • Energy : 12xINT32 [kWh]

or set the energy to a specific value

  • Input
    • Fixed value : 1 BYTE set to 0xAA
    • EnergySetValue : 12xINT32 [kWh] set to 48x 0x00 if you want to reset all the energies
  • Output
    • none

EDA : EnergyDay

Gives back the energy that the energymodule calculate when the module is set to day mode (see [SDN : SetDayNight]).

  • Input
    • none
  • Output
    • EnergyDay : 12xINT32 [kWh]

or set the energy to a specific value

  • Input
    • Fixed value : 1 BYTE set to 0xAA
    • EnergySetValue : 12xINT32 [kWh] set to 48x 0x00 if you want to reset all the energies
  • Output
    • none

ENI : EnergyNight

Gives back the energy that the energymodule calculate when the module is set to night mode (see [SDN : SetDayNight]).

  • Input
    • none
  • Output
    • EnergyNight : 12xINT32 [kWh]

or set the energy to a specific value

  • Input
    • Fixed value : 1 BYTE set to 0xAA
    • EnergySetValue : 12xINT32 [kWh] set to 48x 0x00 if you want to reset all the energies
  • Output
    • none

VST : VoltageSampleTime

Gives back 1 period of a voltage channel. The phase is locked to a positive zerocross of the voltage. The data is given back in 2 parts because the data is to big for 1 call.

  • Input
    • channel : 1 BYTE [0-11] : [0-3] = voltage A; [4-8] = voltage B; [9-11] = voltage C
    • part : 1xBYTE [0-1] select if you want the first or last 50 samples of the voltage
  • Output
    • voltageSamples : 50xFLOAT [V] gives back NaN values if 1 period is done.

VSF : VoltageSampleFreq

Gives back the frequencycomponents of a voltage channel.

  • Input
    • channel : 1 BYTE [0-11] : [0-3] = voltage A; [4-8] = voltage B; [9-11] = voltage C
    • numof : 1xBYTE [0-20] select the number of frequency components you want to get from that voltage channel
  • Output
    • voltageComponents : [numof]xFLOAT [V] : first is DC, second sample is first harmonic
    • PhaseComponents : [numof]xFLOAT [rad]

CST : CurrentSampleTime

Gives back 1 period of a current channel. The phase is locked on the corresponding voltage for that channel. The data is given back in 2 parts because the data is to big for 1 call.

  • Input
    • channel : 1 BYTE [0-11] current channel
    • part : 1xBYTE [0-1] select if you want the first or last 50 samples of the current
  • Output
    • currentSamples : 50xFLOAT [A] gives back NaN values if 1 period is done.

CSF : CurrentSampleFreq

Gives back the frequency components of a current channel.

  • Input
    • channel : 1 BYTE [0-11]
    • numof : 1xBYTE [0-20] select the number of frequency components you want to get from that current channel
  • Output
    • CurrentComponents : [numof]xFLOAT [A] : first is DC, second sample is first harmonic
    • PhaseComponents : [numof]xFLOAT [rad]

PowerSettings

ENM : EnergyMode

  • The energy level is calculated from the power in time.
  • Depending on the energy mode, when power is negative, the energy level can decrease, hold or increase its value, depending on the amount of power.
  • modes:
    • 0 = Hold the energy level fixed when there is negative power on the channel.
    • 1 = Increase the energy level (use the abs value)
    • 2 = Decrease the energy level

Gives back the energy mode

  • Input
    • none
  • Output
    • EnergyMode : 12xBYTE

or set the energy mode

  • Input
    • EnergyMode : 12xBYTE
  • Output
    • none

EPT : EnergyPowerThreshold

Energy is increased depending on the amount of power. To avoid very small power levels to increase the energy level, a threshold can be set as a minimum amount of power needed to increase the energy level.

Gives back the power threshold.

  • Input
    • none
  • Output
    • PowerThreshold: 1xfloat [W]

or set the power threshold.

  • Input
    • PowerThreshold: 1xfloat [W]
  • Output
    • none

SDN : SetDayNight

Set the EnergyModule in day or nightmode. This is used if different rates are used for day and night. This value can be set per feed.

  • Input
    • DayNight : 12xBYTE [night:0,day:1]
  • Output
    • none

SCI : SetCurrentInverse

Per channel you can specify if the current signal should be interpreted inverse or not. This is important to have the right sign of the power calculated per channel.

Set the current inverse mode.

  • Input
    • CurrentInverse: 12xBYTE [not inverse:0,inverse:1]
  • Output
    • none

CCF: CurrentClampFactor

  • Per channel a different current clamp can be connected.
  • The calibration values are done for a 50A clamp.
  • If you connect a different type of current clamp a compensation can be set via the CurrentClampFactor.
    • ex. for a 25A current clamp a factor of 0.5 can be set.

Set the CurrentClampFactor.

  • Input
    • ClampFactor: 12xFLOAT
  • Output
    • none

Calibration

SVO : SetVoltage

  • There are 3 voltage channels that can be calibrated.
  • The parameter should be the voltage connected to one or more of the voltage channels.
  • Only the channels that have a voltage above 10V (before calibration) will be calibrated. This way you can calibrate every channel separately or in one shot.
  • If the calibrated value deviate more than factor 2 (in both directions), the value will also be 'floored'.
  • [edit] Calibration of the voltage
  • Input
    • Voltage : 1xFLOAT [V]
  • Output
    • none

SDV : SetDefaultVoltage

Sets all the calibration values for the voltage channels to the default value

  • Input
    • none
  • Output
    • none

SCU : SetCurrent

  • There are 12 current channels that can be calibrated.
  • The parameter should be the current connected to one or more of the current channels. <<-- what with different current-sensors? should be calibrated with 1 current sensor and an extra parameter should be used to have an extra * factor to use in the calculation.
  • Only the channels that have a current above 0.1A (before calibration) will be calibrated. This way you can calibrate every channel separately or in one shot.
  • If the calibrated value deviate more than factor 2 (in both directions), the value will also be 'floored'.
  • Input
    • Current : 1xFLOAT [A]
  • Output
    • none

SDC : SetDefaultCurrent

Sets all the calibration values for the current channels to the default value

  • Input
    • none
  • Output
    • none

COF : CalibrationOffset

Addressing

AGT : AddressmodeGoTo

WAD : WantAnAddress

Sends the firmware ID and version (like in the FIV command). This is the only command that asynchronously can be send from a module when in address mode.

  • Output
    • ID and version: 16 chars (ex. "OMFPC_3_2_1")

SAD : SetAddress

Bootloader

BGT : BootloaderGoTo

Go to bootloader, to check if the module is in bootloader mode, you can ask FIV : FirmwareIDVersion and see if OMFBC... is given back in stead of OMFPC...

  • Input
    • none
  • Output
    • none

BEC : Bootloader Erase Code

  • Input
    • page address : 1xUINT16
  • Output
    • none

value between 6 and 63 (first 6 pages are bootloader)

one page is 4096 bytes so if you delete 1 page you have to do some BWC's to fill it up

BWC : Bootloader Write Code

Before doing a write make sure that an erase is done with BEC

  • Input
    • start address : 1 UINT32
    • Code : 32xUINT32 with data
  • Output
    • none

BJA : Bootloader Jump Application

Go back to app if code is valid (checksum is ok) ACK if jump to app will be preformed, REPLY_NAK_INTERNAL if not ok

  • Input
    • none
  • Output
    • none

Special

EEP : EEPROMdata

Gives back some EEPROM bytes from a certain address

  • Input
    • Address : 1xUINT16
    • Length : 1xUINT16
  • Output
    • Data : <Length>xBYTE data starting from position <Address>

or set some bytes to the EEPROM

  • Input
    • Address : 1xUINT16
    • DataBytes : 1..NxBYTE
  • Output
    • none

EEC : EEPROMcleardata

Clear some pages in the EEPROM

  • Input
    • Page : 1..NxBYTE : always starting from page 0 to page N-1. Only the pages where the corresponding byte is set to 0x01 will be cleared.
  • Output
    • none

PageInfo:

  • Page 0 = General data
  • Page 1 = Calibration data
  • page 2-3 = kWh data

RIC : RAWICCommand [Don't use]

Info on how and what to send , see: manual of IC CS5480

send something to a specific IC some data (set).

  • Input
    • ChipNumber: 1xBYTE
    • Bank : 1xBYTE
    • Data : 4xBYTE
  • Output
    • none

If you send a read command, the data can be retrieved via this get. If the data is not yet ready a NAK is send

  • Input
    • none
  • Output
    • Data : 4xBYTE

STA : GetStates

Get all states of the statemachines internally.

  • Only the first x bytes are used:
    • [0]=I2C_1.State I2C_STATE
    • [1]=I2C_3.State I2C_STATE
    • [2]=spiState SPI_STATE
    • [3]=buttonmode BUTTON_STATE
    • [4]=DFTState DFT_STATE
    • [5]=CalibState CALIB_STATE
    • [6]=OscPostProcessState OSC_POSTPROCESS_STATE
    • [7]=SPISendOscState SPI_SEND_OSC_STATE
    • [8]=OscState OSC_STATE
    • [9]=EnergyState ENERGY_STATE
    • [10]=SpiRmsState SPI_RMS
    • [11]=FRAMState FRAM_STATE
    • [12]=CommunicationStatus COMMUNICATION_STATUS
    • [13]=CommState TSTATES
    • [14]-[31]= Not used yet
  • Input
    • none
  • Output
    • Data : 32xBYTE

NOS : NumOfStartups

Get the number of cold or hot resets of the device

  • Input
    • none
  • Output
    • Data : 1xUINT32

ELN : ErrorListNumOf

Get the number of errors in the error list

  • Input
    • none
  • Output
    • Data : 1xUINT16

or clear the errorlist by sending a Set command.

  • Input
    • none
  • Output
    • none

ELA : ErrorListAt

Get error from the errorlist at place: address (0 = oldest, ErrorListNumOf or size of list = newest error in errorlist)

  • Input
    • address :
  • Output
    • errorcode : 1xBYTE type of error , see errorcodelist
    • errorlevel : 1xBYTE 0=highest
    • numOfOoccur : 1xUINT16 of errorcode type
    • timestamp : 1xUINT32 occurance of this error based on TON : TimeOn time
    • text : 24xCHAR error explained in string format (can contain values in string format)
  • errorcodelist:
    • ERROR_CODE_NO_FRAM_DETECTED=10
    • ERROR_CODE_NO_TOPPANEL_DETECTED=11
    • ERROR_CODE_NO_POWERIC_DETECTED=12
    • ERROR_CODE_ERROR_IN_FRAM=100
    • ERROR_CODE_ERROR_IN_TOPPANEL=101

Error codes

  • REPLY_ACK = 0
  • REPLY_NAK_INTERNAL = 1
  • REPLY_NAK_FUNCTION_NOT_KNOWN = 2
  • REPLY_NAK_INDEX_NOT_OK = 3
  • REPLY_OUT_OF_BOUNCE = 4
  • REPLY_NAK_NO_SET = 5
  • REPLY_NAK_NO_GET = 6
  • REPLY_NO_REPLY = 7