Class: Phidgets::PowerGuard

Inherits:
Common
  • Object
show all
Defined in:
ext/phidgets/phidgets_power_guard.c

Instance Method Summary collapse

Methods inherited from Common

#close, #getAttached, #getChannel, #getChannelClass, #getChannelClassName, #getChannelName, #getChannelSubclass, #getDataInterval, #getDeviceChannelCount, #getDeviceClass, #getDeviceClassName, #getDeviceID, #getDeviceLabel, #getDeviceName, #getDeviceSKU, #getDeviceSerialNumber, #getDeviceVersion, #getHubPort, #getHubPortCount, #getIsChannel, #getIsHubPortDevice, #getIsLocal, #getIsRemote, #getServerHostname, #getServerName, #getServerPeerName, #getServerUniqueName, #open, #openWaitForAttachment, #setChannel, #setDataInterval, #setDeviceLabel, #setDeviceSerialNumber, #setHubPort, #setIsHubPortDevice, #setIsLocal, #setIsRemote, #setOnAttachHandler, #setOnDetachHandler, #setOnErrorHandler, #setOnPropertyChangeHandler, #setServerName, #writeDeviceLabel

Constructor Details

#newObject

Creates a Phidget PowerGuard object.



6
7
8
9
10
# File 'ext/phidgets/phidgets_power_guard.c', line 6

VALUE ph_power_guard_init(VALUE self) {
  ph_data_t *ph = get_ph_data(self);
  ph_raise(PhidgetPowerGuard_create((PhidgetPowerGuardHandle *)(&(ph->handle))));
  return self;
}

Instance Method Details

#getFanModeObject Also known as: fan_mode

The FanMode dictates the operating condition of the fan. Choose between on, off, or automatic (based on temperature). If the FanMode is set to automatic, the fan will turn on when the temperature reaches 70°C and it will remain on until the temperature falls below 55°C. If the FanMode is off, the device will still turn on the fan if the temperature reaches 85°C and it will remain on until it falls below 70°C.



12
13
14
# File 'ext/phidgets/phidgets_power_guard.c', line 12

VALUE ph_power_guard_get_fan_mode(VALUE self) {
  return ph_get_int(get_ph_handle(self), (phidget_get_int_func)PhidgetPowerGuard_getFanMode);
}

#getMaxOverVoltageObject Also known as: max_over_voltage

The maximum value that OverVoltage can be set to.



34
35
36
# File 'ext/phidgets/phidgets_power_guard.c', line 34

VALUE ph_power_guard_get_max_over_voltage(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPowerGuard_getMaxOverVoltage);
}

#getMinOverVoltageObject Also known as: min_over_voltage

The minimum value that OverVoltage can be set to.



30
31
32
# File 'ext/phidgets/phidgets_power_guard.c', line 30

VALUE ph_power_guard_get_min_over_voltage(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPowerGuard_getMinOverVoltage);
}

#getOverVoltageObject Also known as: over_voltage

The device constantly monitors the output voltage, and if it exceeds the OverVoltage value, it will disconnect the input from the output. This functionality is critical for protecting power supplies from regenerated voltage coming from motors. Many power supplies assume that a higher than output expected voltage is related to an internal failure to the power supply, and will permanently disable themselves to protect the system. A typical safe value is to set OverVoltage to 1-2 volts higher than the output voltage of the supply. For instance, a 12V supply would be protected by setting OverVoltage to 13V. The device will connect the input to the output again when the voltage drops to (OverVoltage - 1V).



21
22
23
# File 'ext/phidgets/phidgets_power_guard.c', line 21

VALUE ph_power_guard_get_over_voltage(VALUE self) {
  return ph_get_double(get_ph_handle(self), (phidget_get_double_func)PhidgetPowerGuard_getOverVoltage);
}

#getPowerEnabledBoolean Also known as: power_enabled

When PowerEnabled is true, the device will connect the input to the output and begin monitoring. The output voltage is constantly monitored and will be automatically disconnected from the input when the output exceeds the OverVoltage value. PowerEnabled allows the device to operate as a Solid State Relay, powering on or off all devices connected to the output.

Returns:

  • (Boolean)


38
39
40
# File 'ext/phidgets/phidgets_power_guard.c', line 38

VALUE ph_power_guard_get_power_enabled(VALUE self) {
  return ph_get_bool(get_ph_handle(self), (phidget_get_bool_func)PhidgetPowerGuard_getPowerEnabled);
}

#setFanMode(fan_mode) ⇒ Object Also known as: fan_mode=

The FanMode dictates the operating condition of the fan. Choose between on, off, or automatic (based on temperature). If the FanMode is set to automatic, the fan will turn on when the temperature reaches 70°C and it will remain on until the temperature falls below 55°C. If the FanMode is off, the device will still turn on the fan if the temperature reaches 85°C and it will remain on until it falls below 70°C.



16
17
18
19
# File 'ext/phidgets/phidgets_power_guard.c', line 16

VALUE ph_power_guard_set_fan_mode(VALUE self, VALUE mode) {
  ph_raise(PhidgetPowerGuard_setFanMode((PhidgetPowerGuardHandle)get_ph_handle(self), NUM2INT(mode)));
  return Qnil;
}

#setOverVoltage(over_voltage) ⇒ Object Also known as: over_voltage=

The device constantly monitors the output voltage, and if it exceeds the OverVoltage value, it will disconnect the input from the output. This functionality is critical for protecting power supplies from regenerated voltage coming from motors. Many power supplies assume that a higher than output expected voltage is related to an internal failure to the power supply, and will permanently disable themselves to protect the system. A typical safe value is to set OverVoltage to 1-2 volts higher than the output voltage of the supply. For instance, a 12V supply would be protected by setting OverVoltage to 13V. The device will connect the input to the output again when the voltage drops to (OverVoltage - 1V).



25
26
27
28
# File 'ext/phidgets/phidgets_power_guard.c', line 25

VALUE ph_power_guard_set_over_voltage(VALUE self, VALUE over_voltage) {
  ph_raise(PhidgetPowerGuard_setOverVoltage((PhidgetPowerGuardHandle)get_ph_handle(self), NUM2DBL(over_voltage)));
  return Qnil;
}

#setPowerEnabled(power_enabled) ⇒ Object Also known as: power_enabled=

When PowerEnabled is true, the device will connect the input to the output and begin monitoring. The output voltage is constantly monitored and will be automatically disconnected from the input when the output exceeds the OverVoltage value. PowerEnabled allows the device to operate as a Solid State Relay, powering on or off all devices connected to the output.



42
43
44
45
# File 'ext/phidgets/phidgets_power_guard.c', line 42

VALUE ph_power_guard_set_power_enabled(VALUE self, VALUE enabled) {
  ph_raise(PhidgetPowerGuard_setPowerEnabled((PhidgetPowerGuardHandle)get_ph_handle(self), TYPE(enabled) == T_TRUE ? PTRUE : PFALSE));
  return Qnil;
}