public class YPower extends YSensor
| Modifier and Type | Class and Description |
|---|---|
static interface |
YPower.TimedReportCallback
TimedReportCallback for Power
|
static interface |
YPower.UpdateCallback
Deprecated UpdateCallback for Power
|
| Modifier and Type | Field and Description |
|---|---|
protected double |
_cosPhi |
protected double |
_deliveredEnergyMeter |
protected double |
_meter |
protected int |
_meterTimer |
protected double |
_powerFactor |
protected double |
_receivedEnergyMeter |
protected YPower.TimedReportCallback |
_timedReportCallbackPower |
protected YPower.UpdateCallback |
_valueCallbackPower |
static double |
COSPHI_INVALID
invalid cosPhi value
|
static double |
DELIVEREDENERGYMETER_INVALID
invalid deliveredEnergyMeter value
|
static double |
METER_INVALID
invalid meter value
|
static int |
METERTIMER_INVALID
invalid meterTimer value
|
static double |
POWERFACTOR_INVALID
invalid powerFactor value
|
static double |
RECEIVEDENERGYMETER_INVALID
invalid receivedEnergyMeter value
|
_advMode, _cal, _calibrationParam, _currentRawValue, _currentValue, _highestValue, _iresol, _logFrequency, _lowestValue, _prevTR, _reportFrequency, _resolution, _sensorState, _timedReportCallbackSensor, _unit, _valueCallbackSensor, ADVMODE_IMMEDIATE, ADVMODE_INVALID, ADVMODE_PERIOD_AVG, ADVMODE_PERIOD_MAX, ADVMODE_PERIOD_MIN, CALIBRATIONPARAM_INVALID, CURRENTRAWVALUE_INVALID, CURRENTVALUE_INVALID, HIGHESTVALUE_INVALID, LOGFREQUENCY_INVALID, LOWESTVALUE_INVALID, REPORTFREQUENCY_INVALID, RESOLUTION_INVALID, SENSORSTATE_INVALID, UNIT_INVALID_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID| Modifier | Constructor and Description |
|---|---|
protected |
YPower(String func) |
protected |
YPower(YAPIContext ctx,
String func) |
| Modifier and Type | Method and Description |
|---|---|
int |
_invokeTimedReportCallback(YMeasure value) |
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
static YPower |
FindPower(String func)
Retrieves a electrical power sensor for a given identifier.
|
static YPower |
FindPowerInContext(YAPIContext yctx,
String func)
Retrieves a electrical power sensor for a given identifier in a YAPI context.
|
static YPower |
FirstPower()
Starts the enumeration of electrical power sensors currently accessible.
|
static YPower |
FirstPowerInContext(YAPIContext yctx)
Starts the enumeration of electrical power sensors currently accessible.
|
double |
get_cosPhi()
Returns the Displacement Power factor (DPF), i.e.
|
double |
get_deliveredEnergyMeter()
Returns the energy counter, maintained by the wattmeter by integrating the power consumption over time,
but only when positive.
|
double |
get_meter()
Returns the energy counter, maintained by the wattmeter by integrating the
power consumption over time.
|
int |
get_meterTimer()
Returns the elapsed time since last energy counter reset, in seconds.
|
double |
get_powerFactor()
Returns the power factor (PF), i.e.
|
double |
get_receivedEnergyMeter()
Returns the energy counter, maintained by the wattmeter by integrating the power consumption over time,
but only when negative.
|
double |
getCosPhi()
Returns the Displacement Power factor (DPF), i.e.
|
double |
getDeliveredEnergyMeter()
Returns the energy counter, maintained by the wattmeter by integrating the power consumption over time,
but only when positive.
|
double |
getMeter()
Returns the energy counter, maintained by the wattmeter by integrating the
power consumption over time.
|
int |
getMeterTimer()
Returns the elapsed time since last energy counter reset, in seconds.
|
double |
getPowerFactor()
Returns the power factor (PF), i.e.
|
double |
getReceivedEnergyMeter()
Returns the energy counter, maintained by the wattmeter by integrating the power consumption over time,
but only when negative.
|
YPower |
nextPower()
Continues the enumeration of electrical power sensors started using yFirstPower().
|
int |
registerTimedReportCallback(YPower.TimedReportCallback callback)
Registers the callback function that is invoked on every periodic timed notification.
|
int |
registerValueCallback(YPower.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
reset()
Resets the energy counters.
|
int |
set_meter(double newval) |
_applyCalibration, _decodeAvg, _decodeTimedReport, _decodeVal, _encodeCalibrationPoints, _parseCalibStr, _parserHelper, calibrateFromPoints, FindSensor, FindSensorInContext, FirstSensor, FirstSensorInContext, get_advMode, get_calibrationParam, get_currentRawValue, get_currentValue, get_dataLogger, get_highestValue, get_logFrequency, get_lowestValue, get_recordedData, get_reportFrequency, get_resolution, get_sensorState, get_unit, getAdvMode, getCurrentRawValue, getCurrentValue, getHighestValue, getLogFrequency, getLowestValue, getReportFrequency, getResolution, getSensorState, getUnit, isSensorReady, loadCalibrationPoints, nextSensor, registerTimedReportCallback, registerValueCallback, set_advMode, set_calibrationParam, set_highestValue, set_logFrequency, set_lowestValue, set_reportFrequency, set_resolution, setAdvMode, setHighestValue, setLogFrequency, setLowestValue, setReportFrequency, setResolution, startDataLogger, stopDataLogger_AddToCache, _clearDataStreamCache, _decode_json_int, _decode_json_string, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _is_valid_pass, _json_get_array, _json_get_key, _json_get_string, _parse, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, _uploadEx, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userDatapublic static final double POWERFACTOR_INVALID
public static final double COSPHI_INVALID
public static final double METER_INVALID
public static final double DELIVEREDENERGYMETER_INVALID
public static final double RECEIVEDENERGYMETER_INVALID
public static final int METERTIMER_INVALID
protected double _powerFactor
protected double _cosPhi
protected double _meter
protected double _deliveredEnergyMeter
protected double _receivedEnergyMeter
protected int _meterTimer
protected YPower.UpdateCallback _valueCallbackPower
protected YPower.TimedReportCallback _timedReportCallbackPower
protected YPower(YAPIContext ctx, String func)
func - : functionidprotected YPower(String func)
func - : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val)
throws Exception
_parseAttr in class YSensorExceptionpublic double get_powerFactor()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getPowerFactor()
throws YAPI_Exception
YAPI_Exception - on errorpublic double get_cosPhi()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getCosPhi()
throws YAPI_Exception
YAPI_Exception - on errorpublic int set_meter(double newval)
throws YAPI_Exception
YAPI_Exceptionpublic double get_meter()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getMeter()
throws YAPI_Exception
YAPI_Exception - on errorpublic double get_deliveredEnergyMeter()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getDeliveredEnergyMeter()
throws YAPI_Exception
YAPI_Exception - on errorpublic double get_receivedEnergyMeter()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getReceivedEnergyMeter()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_meterTimer()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getMeterTimer()
throws YAPI_Exception
YAPI_Exception - on errorpublic static YPower FindPower(String func)
func - : a string that uniquely characterizes the electrical power sensor, for instance
YWATTMK1.power.public static YPower FindPowerInContext(YAPIContext yctx, String func)
yctx - : a YAPI contextfunc - : a string that uniquely characterizes the electrical power sensor, for instance
YWATTMK1.power.public int registerValueCallback(YPower.UpdateCallback callback)
callback - : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback in class YSensorpublic int registerTimedReportCallback(YPower.TimedReportCallback callback)
callback - : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and an YMeasure object describing
the new advertised value.public int _invokeTimedReportCallback(YMeasure value)
_invokeTimedReportCallback in class YSensorpublic int reset()
throws YAPI_Exception
YAPI_Exception - on errorpublic YPower nextPower()
public static YPower FirstPower()
public static YPower FirstPowerInContext(YAPIContext yctx)
yctx - : a YAPI context.Copyright © 2026. All rights reserved.