OptoMMP2
OptoMMP2.OptoMMP Class Reference

Object for communicating with Opto MMP Devices. More...

Classes

struct  stPid
 When reading or writing a PID, these are the available parameters returned or written. More...
 
struct  structBrainDiagnosticInformation
 Structure of information returned by ReadBrainDiagnosticInfo(). Added (April 4, 2011). More...
 

Public Types

enum  Connection { UdpIp = 1, TcpIp, UdpIpv6, TcpIpv6 }
 Connection Types for Opto MMP More...
 
enum  IoModel { IoModel64 = 64, IoModel512 = 512 }
 For some methods and properties, specifies when a point index is offered, which IoModel the index references. More...
 
enum  StatusWriteCommand {
  PowerUpClear = 1, ResetToDefaults, StoreToFlash, EraseFlash,
  ResetHardware, ClearDigitalEvents, ClearAlarmsConfig, ClearPPPConfig,
  ClearEMailConfig, ClearDigitalEventsExpanded, ClearPidLoops, ClearDataLog
}
 Command Values For the Status Area Write - Read/Write (see Opto 22 Form 1465). More...
 
enum  SerialParity { None = 0, Odd = 1, Even = 2 }
 Enumerations for a Serial Module's Parity Settings More...
 
enum  eDataCode { Binary = 0, GrayCode = 1, None = -1 }
 Probe data coding format enumerations. More...
 
enum  StrategyStreamObjectsBits {
  e64DigitalStatesandLatches = 0x00001, e64AnalogEngineeringUnits = 0x00002, e64AnalogEngMaxandMin = 0x0004, eHighDensityDigital = 0x0008,
  eAnalogLower256States = 0x0010, eAnalogUpper256States = 0x0020
}
 Bits used to select particular object types. More...
 
enum  AnalogWriteOptions { EngineeringUnits = 0, Counts, AnalogTpoResolution, AnalogTpoPeriod }
 Enumerations of the Analog Value Types That May Be Written. More...
 
enum  eDigitalFeature { None = 0, Counter = 0x1, QuadratureSimple = 0x4, QuadratureIndex = 0x41 }
 Digital features that may be configured in the 64-point memory map. More...
 
enum  TemperatureScale { Celsius = 0, Kelvin, Fahrenheit, Rankine }
 Selection of Temperature Scales for the Converter More...
 
enum  ePidAlgorithm {
  Disabled = 0, VelocityB, Isa, Parallel,
  Interacting, VelocityC
}
 Algorithm Options More...
 
enum  ePidWriteOptions {
  InitializeAll = 0, ProcessVariable, Setpoint, PCoefficient,
  ICoefficient, DCoefficient, FFGain, OutputChangesAllowed,
  ProcessVariableClamps, OutputClamps, Scantime, OutputForceValuesWhenInputOutOfRange,
  ProcessVariableOptoMmpAddress, SetpointOptoMmpAddress, OutputOptoMmpAddress, PidAlgorithm,
  PidAutoManualMode, ConfigurationFlags, SupervisorPidInput
}
 PID Write Options More...
 

Public Member Functions

 OptoMMP ()
 Constructor More...
 
int Open (string sHost, int i32Port, Connection eType, int i32InitialTimeoutMs, bool bPowerUpClear)
 Opens An OptoMMP Object More...
 
int ChangeTimeout (int i32TimeoutMs)
 Change the current timeout setting. More...
 
int GetCacheFreshness ()
 Retrieves the current data cache freshness setting. More...
 
void SetCacheFreshness (int i32FreshnessMs)
 Sets the data cache freshness value. More...
 
bool IsOpen ()
 Test if there is a possibility of communicating to the remote device. More...
 
void Close ()
 Close the OptoMMP Object. More...
 
int GetLastRCodeFault ()
 When a -10 Error is reported, this method returns the last Opto MMP RCode. Check Form 1465 for proper response. More...
 
int WriteStatusCommand (StatusWriteCommand eCommand)
 Writes a Status Command to Opto MMP Address 0xffff f038 0000 (see Opto 22 Form 1465, Section "Status Area Write - Read/Write") More...
 
int WriteFOrCStatus (bool bIsFahrenheit)
 Force Brain to Report Temperature as Celsius or Fahrenheit More...
 
int ReadFOrCStatus (out bool bIsFahrenheit)
 Read the Temperature Reporting Status of the Brain More...
 
int WriteWatchdogTime (int i32WatchdogTimeMs)
 Set the Communication Watchdog Timeout of the IO unit. More...
 
int ReadWatchdogTime (out int i32WatchdogTimeMs)
 Read the Device's Communication Watchdog Timeout More...
 
int ReadDateTime (out string sDateTime)
 Read the Date and Time of the I/O Unit More...
 
int WriteDateTime (string sDateTime)
 Write the Date-Time String to the IO Unit. More...
 
int WriteLocalDateTime ()
 Write Local Date-Time To The IO Unit. More...
 
int ReadScannerFlags (out int i32ScannerFlags)
 Read the scanner flags of the control engine. More...
 
int WriteScannerFlags (int i32ScannerFlags)
 Write the scanner flags to the OptoMMP device. More...
 
int ReadSerialModuleConfiguration (int i32PortNumber, out int i32TcpPort, out int i32BaudRate, out SerialParity eParity, out byte byDataBits, out byte byStopBits, out bool bHardwareFlowControl, out bool bTestMessage, out int i32Eom, out bool b4WireMode)
 Read the Serial (Module) Port Configuration. Only for Module based Serial Ports. More...
 
int WriteSerialModuleConfiguration (int i32PortNumber, int i32TcpPort, int i32BaudRate, SerialParity eParity, byte byDataBits, byte byStopBits, bool bHardwareFlowControl, bool bTestMessage, int i32Eom, bool b4WireMode)
 Write the Serial Port Configuration. Only for Module based Serial Ports. More...
 
int ReadSsiModuleConfiguration (int i32PortNumber, out int i32FrameSize, out Single f32ClockSpeedkHz, out Single f32InterFrameTimeUs, out int i32MsbOffset, out int i32DataBits, out int i32ErrorBitOffset, out bool bErrorBitLowIsError, out eDataCode eCoding, out bool bEnabled)
 Read the SSI module configuration More...
 
int WriteSsiModuleConfiguration (int i32PortNumber, int i32FrameSize, float f32ClockSpeedkHz, float f32InterFrameTimeUs, int i32MsbOffset, int i32DataBits, int i32ErrorBitOffset, bool bErrorBitLowIsError, eDataCode eCoding, bool bEnabled)
 Writes the SSI Module configuration More...
 
int WriteBrainStreamingConfiguration (int i32IntervalMs, int i32UdpPortDestination, string[] saryIpAddresses, long i64OptoMMPAddress, int i32LengthOfStream)
 Configure the brain streaming functionality. More...
 
int EnableBrainStreaming (bool bEnableStreaming)
 Controls the enable/disable functionality of brain streaming. More...
 
int ReadBrainStreamingConfiguration (out bool bIsEnabled, out int i32IntervalMs, out int i32UdpPortDestination, out string[] saryIpAddresses, out long i64OptoMMPAddress, out int i32LengthOfStream)
 Read the Brain Streaming configuration. More...
 
int WriteStrategyStreaming (string sCommHandle, Single fInterval, int i32Objects, bool bStoreToFlash)
 Write the "Strategy Streaming" Config. More...
 
int ReadStrategyStreaming (out string sCommHandle, out Single fInterval, out int i32Objects)
 Read the "Strategy Streaming" More...
 
int ScratchpadBitsRead (out UInt64 u64ScratchpadBitmask)
 Read scratchpad bits as a 64-bit bitmask. More...
 
int ScratchpadBitsRead (ref Boolean[] baryScratchpad, int i32StartIndex)
 Read Scratchpad Bits Into A Boolean Array More...
 
int ScratchpadBitRead (out Boolean bState, Int32 i32Index)
 Read Scratchpad Bit More...
 
int ScratchpadBitsWrite (UInt64 u64OnMask, UInt64 u64OffMask)
 Writes all 64 scratchpad bit states using turn-on and turn-off bitmasks. More...
 
int ScratchpadBitsWrite (bool[] baryOnStates, bool[] baryOffStates, int i32StartIndex)
 Writes All 64 Scratchpad Bitstates From "Must-On/Must-Off" (MoMo) Boolean Arrays More...
 
int ScratchpadBitWrite (Boolean bState, Int32 i32Index)
 Write Scratchpad Bit More...
 
int ScratchPadF32NumberofElements ()
 Maximum number of elements in the Float Scratchpad Array. More...
 
int ScratchpadFloatRead (ref Single[] fary, int i32StartFaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Read a block of 32-bit floating point (Single) scratchpad registers. More...
 
int ScratchpadFloatWrite (Single[] fary, int i32StartFaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Write a block of float scratchpad registers. More...
 
int ScratchPadI32NumberofElements ()
 Maximum number of elements in the 32-bit Integer Scratchpad Array. More...
 
int ScratchpadI32Read (ref int[] i32ary, int i32StartIaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Read a block of 32-bit signed-integer scratchpad registers. More...
 
int ScratchpadI32Write (int[] i32ary, int i32StartIaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Write a block of 32-bit signed-integer scratchpad registers. More...
 
int ScratchPadI64NumberofElements ()
 Maximum number of elements in the 64-bit Integer Scratchpad Array. More...
 
int ScratchpadI64Read (ref long[] i64ary, int i32StartIaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Read the 64-bit signed-integer (long) scratchpad registers More...
 
int ScratchpadI64Write (long[] i64ary, int i32StartIaryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Write a block of 64-bit signed integer scratchpad registers. More...
 
int ScratchPadStringNumberofElements ()
 Maximum number of elements in the String Scratchpad Array. More...
 
int ScratchpadStringRead (ref string[] strary, int i32StartStraryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Read the string scratchpad registers. More...
 
int ScratchpadStringWrite (string[] strary, int i32StartStraryIndex, int i32Length, int i32StartScratchpadStartIndex)
 Write a block of string scratchpad registers. More...
 
int ReadDigitalStates64 (ref long i64DigitalStatesBitmask)
 Read digital states as a 64-bit Bitmask. More...
 
int ReadDigitalStates64 (out UInt64 u64DigitalStatesBitmask)
 Read digital states as a 64-bit Bitmask as a UInt64 More...
 
int ReadDigitalStates64 (ref Boolean[] baryDigitalStates64, int i32StartIndex)
 Read 64 Digital States Into A Boolean Array More...
 
int ReadDigitalState64 (int i32PointNumber, ref bool bState)
 Read the individual digital state by specifying the point number. More...
 
int ReadDigitalLatches64 (out long i64OnLatchBitMask, out long i64OffLatchBitMask)
 Read all On and Off Latch States of the 64 Point I/O Unit Rack at Bitmasks. More...
 
int ReadDigitalLatches64 (out UInt64 u64OnLatchBitMask, out UInt64 u64OffLatchBitMask)
 Read all On and Off Latch States of the 64 Point I/O Unit Rack with Unsigned Bitmasks. More...
 
int ReadDigitalLatches64 (ref Boolean[] baryOnLatches, ref Boolean[] baryOffLatches, Int32 i32StartIndex)
 Read all On and Off Latch States of the 64 Point I/O Unit Rack with Boolean arrays. More...
 
int ReadDigitalLatch64 (int i32PointNumber, out bool bOnLatch, out bool bOffLatch)
 Read the Digital Latches Selected by a Point Number. More...
 
int ReadClearDigitalLatches64 (bool bOnLatch, out long i64LatchBitmask)
 Read and clear digital latches in the 64-point area. More...
 
int ReadClearDigitalLatches64 (bool bOnLatch, out UInt64 u64LatchBitmask)
 Read and clear digital latches in the 64-point area, with a UInt64 latch bitmask. More...
 
int ReadClearDigitalLatches64 (bool bOnLatch, ref Boolean[] baryLatches, Int32 i32StartIndex)
 Read and clear digital latches in the 64-point area, with a UInt64 latch bitmask. More...
 
int ReadClearDigitalLatch64 (int i32PointNumber, bool bOnLatch, out bool bLatchState)
 Read and clear a digital latch. More...
 
int ReadOptionallyClearCounters64 (bool bClear, ref UInt32[] u32aryCounters, int i32StartIndex)
 Read and optionally clear all 64 counters. More...
 
int ReadOptionallyClearCounter64 (int i32PointNumber, bool bClear, out UInt32 u32Counter)
 Read and optionally clear a counter on the 64 point rack. More...
 
int WriteDigitalStates64 (long i64StateBitMask)
 Sets all of the 4-channel digital states in the 64-point rack. More...
 
int WriteDigitalStates64 (ref bool[] baryStates, int i32StartIndex)
 Write All 64 Digital States Using A Boolean Array. More...
 
int WriteDigitalStatesMoMo64 (long i64OnMask, long i64OffMask)
 Writes All 64 Digital States From "Must-On/Must-Off" (MoMo) Bit Masks More...
 
int WriteDigitalStatesMoMo64 (bool[] baryOnStates, bool[] baryOffStates, int i32StartIndex)
 Writes All 64 Digital States From "Must-On/Must-Off" (MoMo) Boolean Arrays More...
 
int WriteDigitalState64 (int i32PointNumber, bool bOn)
 Set a single state of a 4-channel digital output, 64-point rack. More...
 
int WriteDigitalEnableorDisableCounters64 (long i64ActivateBitMask, long i64DeactivateBitMask)
 Enable or disable a bank of counters in the 64-point rack. More...
 
int WriteDigitalEnableorDisableCounters64 (bool[] baryActivate, bool[] baryDeactivate, int i32StartIndex)
 Enable or Disable All 64 Digital Counters From Boolean Arrays More...
 
int WriteDigitalEnableorDisableCounter64 (int i32PointNumber, bool bActivate)
 Enable or disable a digital counter, 64-point rack. More...
 
int ReadDigitalCountersStatus64 (out long i64ActivateBitMask)
 Reads All 64 Counter Status. More...
 
int ReadDigitalCountersStatus64 (ref bool[] baryActive, int i32StartIndex)
 Read All 64 Counter Status To A Boolean Array. More...
 
int ReadDigitalCounterStatus64 (int i32PointNumber, out bool bCounterStatus)
 Read a Counter Status in the 64 Point IO Unit Memory Map. More...
 
int ReadAnalogStates64 (ref Single[] fary, int i32StartingIndex)
 Read all low-density (64-point) Analog Input and Output States. More...
 
int ReadAnalogState64 (int i32PointNumber, ref Single fAnalogValue)
 Read an analog state via a point number. More...
 
int ReadOptionallyClearAnalogMaxMin64 (int i32PointNumber, bool bClear, out Single fMaximum, out Single fMinimum)
 Read and clear analog maximum and minimum value of a point on a 64-point rack. More...
 
int WriteAnalogStates64 (Single[] faryValues, bool bEngineeringUnits, int i32StartIndex)
 Set analog outputs in engineering units as a 64-point bank write. More...
 
int WriteAnalogState64 (int i32PointNumber, AnalogWriteOptions eOption, Single fWriteValue)
 Sets a Single Analog State in the 64-Point IO Unit Memory Map. More...
 
int WriteDigitalPointConfiguration64 (int i32PointNumber, bool bOutput, eDigitalFeature eFeature, bool bEnableWatchdog, bool bWatchdogValue)
 Write the digital point configuration. More...
 
int ReadDigitalPointConfiguration64 (int i32PointNumber, out int i32ModuleType, out int i32PointType, out int i32Feature, ref bool bWatchdogEnabled, ref bool bWatchdogValue)
 Read the Digital Point Configuration More...
 
int WritePointConfiguration64 (int i32PointNumber, int i32PointType)
 Write Analog Point configuration in 64 Point Area. More...
 
int WriteAnalogPointConfiguration64 (int i32PointNumber, int i32PointType, Single fHighScale, Single fLowScale, Single fOffset, Single fGain, Single fFilterWeight, bool bEnableWatchdog, Single fWatchdogValue)
 Write Analog Point configuration in 64 Point Area. More...
 
int ReadAnalogPointConfiguration64 (int i32PointNumber, out int i32ModuleType, out int i32PointType, out Single fHighScale, out Single fLowScale, out Single fOffset, out Single fGain, out Single fFilterWeight, out bool bEnableWatchdog, out Single fWatchdogValue)
 Read Analog Point Configuration in the 64-Point Area. More...
 
int WriteAnalogLoadCellConfiguration64 (int i32PointNumber, uint u32FastSettle, uint u32FilterWeight)
 Write analog load cell configuration in 64 Point Area. More...
 
int ReadAnalogLoadCellConfiguration64 (int i32PointNumber, out uint u32FastSettle, out uint u32FilterWeight)
 Read analog load cell configuration in the analog 64 point area (one point at a time). More...
 
int ReadHighDensityDigitalStates (ref bool[] baryStates, int i32StartIndex)
 Read All 512 High-Density Digital States (32 points per module times 16 modules). More...
 
int ReadHighDensityDigitalStates (ref uint[] u32aryBitStates, int i32StartIndex)
 Read All 512 High-Density Digital States To BitMask Array More...
 
int ReadHighDensityDigitalState (int i32PointNumber, out bool bState)
 Read a high-density digital state. More...
 
int ReadOptionallyClearHighDensityDigitalLatches (bool bClear, ref bool[] baryOnLatches, ref bool[] baryOffLatches, int i32StartIndex)
 Read and Optionally Clear All 512 High-Density Latches To Boolean Arrays (32 points per module times 16 modules) More...
 
int ReadOptionallyClearHighDensityDigitalLatches (bool bClear, ref uint[] u32aryOnLatches, ref uint[] u32aryOffLatches, int i32StartIndex)
 Read and Optionally Clear All 512 High-Density Latches To BitMasks (32 points per module times 16 modules) More...
 
int ReadOptionallyClearHighDensityDigitalLatches (int i32StartModule, int i32EndModule, bool bClear, ref bool[] baryOnLatches, ref bool[] baryOffLatches, int i32StartIndex)
 Read and Optionally Clear All 512 High-Density Latches To Boolean Arrays (32 points per module times 16 modules) More...
 
int ReadHighDensityDigitalLatch (int i32Module, int i32Channel, out bool bOnLatch, out bool bOffLatch)
 Read a single high-density digital latch. More...
 
int ReadOptionallyClearHighDensityDigitalCounters32 (bool bClear, ref UInt32[] u32aryCounters, int i32StartIndex)
 Read and Optionally clear High Density Digital Counters More...
 
int ReadHighDensityDigitalCounter (int i32Module, int i32Channel, out UInt32 u32Counter)
 Read a High-Density Digital Counter More...
 
int WriteHighDensityDigitalStates (int i32StartModule, int i32EndModule, bool[] baryStates, int i32StartIndex)
 Write High-Density Digital States, Module by Module Using A Boolean Array More...
 
int WriteHighDensityDigitalStates (int i32StartModule, int i32EndModule, int[] i32aryStates, int i32StartIndex)
 Write High-Density Digital States, Module by Module Using A Bitmask Array More...
 
int ReadAnalogEus512 (ref Single[] f32aryValues, int i32StartIndex)
 Read all Analog States as Engineering Units. More...
 
int ReadAnalogEu512 (int i32Point, ref Single f32Value)
 Read a single Analog Engineering Unit Value. More...
 
int WriteAnalogEu512 (int i32Point, Single f32Value)
 Write an analog output in the 512-Point IO Unit model. More...
 
int WriteAnalogPointConfiguration4096 (int i32PointNumber, int i32PointType, Single fHighScale, Single fLowScale, Single fOffset, Single fGain, Single fFilterWeight, bool bEnableWatchdog, Single fWatchdogValue)
 Write Analog Point configuration in 4096 Point Area. More...
 
int ReadAnalogPointConfiguration4096 (int i32PointNumber, out int i32PointType, out Single fHighScale, out Single fLowScale, out Single fOffset, out Single fGain, out Single fFilterWeight, out bool bEnableWatchdog, out Single fWatchdogValue)
 Read Analog Point configuration in 4096 Point Area. More...
 
int WriteAnalogPointConfiguration4096 (int i32PointNumber, int i32PointType)
 Write Point configuration in 4096 Point Area. More...
 
int WriteAnalogLoadCellConfiguration4096 (int i32PointNumber, uint u32FastSettle, uint u32FilterWeight)
 Write analog load cell configuration in 4,096 point area. More...
 
int ReadAnalogLoadCellConfiguration4096 (int i32PointNumber, out uint u32FastSettle, out uint u32FilterWeight)
 Reads analog load cell configuration in 4,096 point area. More...
 
int ReadInts (long i64MmpAddress, int i32Length, ref int[] i32aryInts, int i32StartingIndex)
 Read a block of integers (32-bit signed values) from the Memory Map More...
 
int WriteInts (long i64MmpAddress, int i32Length, int[] i32aryInts, int i32StartingIndex)
 Write a block of 32-bit integers to a specific Opto MMP Address. More...
 
int ReadSingles (long i64MmpAddress, int i32Length, ref Single[] f32arySingles, int i32StartingIndex)
 Read a block of Singles from the Opto MMP Device. More...
 
int WriteSingles (long i64MmpAddress, int i32Length, Single[] f32arySingles, int i32StartingIndex)
 Write a block of Singles to the Opto MMP Device. More...
 
int ReadLongs (long i64MmpAddress, int i32Length, ref long[] i64aryLongs, int i32StartingIndex)
 Read a block of longs (64-bit signed values) from the Opto MMP Device. More...
 
int WriteLongs (long i64MmpAddress, int i32Length, long[] i64aryLongs, int i32StartingIndex)
 Write a block of longs (64-bit signed values) to the Opto MMP Device. More...
 
void GetExtendedErrorInformation (out string strMessage, out bool bCommFault, out bool bProtocolFault, out bool bArgumentFault)
 Retrieves extended error information. This information is also logged in the computer's Application event log. More...
 
int ReadBrainDiagnosticInformation (out structBrainDiagnosticInformation info)
 Read the diagnostic information of the brain. Added (April 4, 2011). More...
 
Int32 ReadPidQuantity (out Int32 i32PidQuantity)
 Report supported PID quantity in the brain. More...
 
Int32 ReadPid (Int32 i32PidIndex, ref stPid PidData)
 Read the entire PID. More...
 
Int32 WritePid (Int32 i32PidIndex, stPid PidData, ePidWriteOptions eWriteOption)
 Write Pid (configure all or individual parameters [one at a time] of a PID) More...
 
void AboutPulses ()
 Information on generating discrete pulses. Method does not perform any operations. More...
 
Int32 ConfigureContinuousPulsesTime (Boolean bInvert, Single f32StartDelayTimeSeconds, Single f32OnTimeSeconds, Single f32OffTimeSeconds, IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512)
 Configure a continuous discrete pulse train with on-time and off-time values. More...
 
Int32 ConfigureContinuousPulsesDuration (Boolean bInvert, Single f32StartDelayTimeSeconds, Single f32OnPercent, Single f32PeriodSeconds, IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512)
 Configure a continuous discrete pulse train with percent-on and waveform period values. More...
 
Int32 ConfigureNPulsesTime (Boolean bInvert, Single f32StartDelayTimeSeconds, Single f32OnTimeSeconds, Single f32OffTimeSeconds, UInt32 u32PulseQuantity, IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512)
 Configure an "N" pulse train using on-time and off-time parameters. More...
 
Int32 ConfigureNPulsesDuration (Boolean bInvert, Single f32StartDelayTimeSeconds, Single f32OnPercent, Single f32PeriodSeconds, UInt32 u32PulseQuantity, IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512)
 Configure a continuous discrete pulse train using percent-on and wave period parameters. More...
 
Int32 StartPulse (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512)
 Start a pulse train. More...
 
Int32 StopPulse (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, Boolean bTurnOn)
 Stop a pulse. Note, writing a discrete point state cancels an operating pulse. More...
 
Int32 WritePulsePercentage (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, Single f32Percent)
 Write pulse percentage. Useful for continuous pulse trains... for example, time-proprotional outputs (e.g. heater applications). More...
 
Int32 ReadPulsePercentage (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, out Single f32Percent)
 Read pulse percentage. More...
 
Int32 WritePulsePeriod (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, Single f32Period)
 Write the pulse period. More...
 
Int32 ReadPulsePeriod (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, out Single f32Period)
 Read the pulse period. More...
 
Int32 WritePulseOnOffTime (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, Single f32OnTime, Single f32OffTime)
 Update a "time" configured pulse's on-time and off-time. Pulse must have been configured with either ConfigureContinuousPulsesTime() or ConfigureNPulsesTime() or unpredictable results will occur (even with a valid method result code). More...
 
Int32 ReadPulseOnOffTime (IoModel eIoModelOfPointIndex, Int32 i32PointIndex64or512, out Single f32OnTime, out Single f32OffTime)
 Read a "time" configured pulse's on- and off-time values. The pulse must have been configured using ConfigureContinuousPulsesTime() or ConfigureNPulsesTime() or unpredictable results will be reported on f32OnTime and f32Offtime (even with a successful result of this method). More...
 

Static Public Member Functions

static Single ConvertTemperature (Single f32InputTemp, TemperatureScale eInScale, TemperatureScale eOutScale)
 Converts temperatures. More...
 
static int GetPointNumberFor64 (int i32Module, int i32Channel)
 Converts Module and Channel to Point Number For 64 Point IO Unit Model. More...
 
static int GetPointNumberFor512 (int i32Module, int i32Channel)
 Converts Module and Channel to Point Number For 512 Point IO Unit Model. More...
 
static int GetPointNumberFor4096 (int i32Module, int i32Channel)
 Converts Module and Channel to Point Number For 4096 Point IO Unit Model. More...
 
static void GetModuleAndChannelFromPoint64 (int i32Point, out int i32Module, out int i32Channel)
 Converts A Point Number From The 64 Point Model To A Module And Channel Number. More...
 
static void GetModuleAndChannelFromPoint512 (int i32Point, out int i32Module, out int i32Channel)
 Converts A Point Number From The 512 Point Model To A Module And Channel Number. More...
 
static void GetModuleAndChannelFromPoint4096 (int i32Point, out int i32Module, out int i32Channel)
 Converts A Point Number From The 4096 Point Model To A Module And Channel Number. More...
 
static int GetSerialOrSsiPortIndexFromModuleAndChannel (int i32Module, int i32Channel)
 Computes A Serial Port "Index" on the rack, for serial and SSI modules. More...
 
static string ConvertNumberToFirmwareVersion (int i32Number)
 Converts an Opto 22 Version number (32-bit) to a version string like R8.5A. More...
 
static void Readme_WhenErrorsOccur ()
 Description of when errors occur. More...
 
static void Readme_AboutIOModules ()
 About SNAP IO Modules (added 02-23-2011) More...
 

Public Attributes

const Int32 i32cMaximumPulseObjects = 512
 SNAP-PAC-R1/2 and SNAP-PAC-EB1/2 have 512 pulse objects available. More...
 

Detailed Description

Object for communicating with Opto MMP Devices.

This object communicates to Ethernet connected Opto MMP devices, primarily the SNAP-PAC Ethernet product line. This includes the SNAP-PAC-S, SNAP-PAC-R, and SNAP-PAC-EB series of brain and controllers. The Opto MMP Protocol is documented in Opto 22 form 1465, it is a publically available, royalty-free data protocol.

An object is responsible for communicating to a single Opto MMP device connection. More than one object (meaning more than one connection) may be made to an Opto MMP device. The object contains thread synchronization but ideally, sharing an object amongst different threads of execution does not work effectively and is discouraged. The object is intended to be opened and left open as long as possible until the application terminates or a communication fault occurs to the device. The object may be reused to communicate to the same object. Do not rapidly open and close a single object to communicate to multiple Opto MMP devices. Instead, always create an object for each device. This will alleviate connection issues and simplify the code implementation.

All methods are blocked methods. This means execution within the method pauses while the code waits for a response or timeout to occur. Higher throughput apps should use multiple threads and multiple objects to accelerate data access. But using too many concurrent communication objects will degrade the performance of the SNAP-PAC device. If many concurrent connections seem to be required, consider creating a scanner thread to communicate with the PAC and allow other threads to access thread shared data amongst the scanning thread.

The methods of this SDK block (suspend thread execution) while the physical I/O unit is messaged across the network. While usually, this is a very fast operation, high-latency networks or communication failures make consume a considerable amount of time. Due to this, it is not recommended to implement the SDK within the context of a Windows Message handler. Examples of this are mouse, forms, buttons, or other application events.

Opto 22 strongly recommends the use of UDP when a single network segment (no routers) is used. In cases where wireless, lossy networks, or high-latency WANs are implemented, use TCP with a minimum timeout of 1 second (1,000 milliseconds). This minimum timeout is enforced by the library when using TCP. While there is a minimum TCP timeout, we recommend a much longer timeout, at least 3 seconds for very lossy connections. Longer timeouts allows TCP/IP to perform background retranmissions increasing probability of communication success.

Data access efficiency is via reading the I/O unit in "banks" or those methods that allow you to read all or chunks of the I/O data all at once. One note, if caching is enabled (non-zero time), point reads are converted into bank operations. So you won't have to rewrite "point" oriented code. If you disable caching, you should perform bank reads to reduce network traffic and reduce I/O access latencies that will accumulate with each I/O read operation.

This library is built with the 3.5 .Net Framework. Windows 8 Pro users will have to install the .Net 3.5 Framework to use this SDK or applications referencing it.

This SDK supports Windows Vista Business 64-Bit, Windows 7 Professional (32- or 64-bit versions) and Windows 8 Pro (Intel).

You should use an Intel "Core 2" or AMD Athlon II/Phenom (or newer) microprocessor.

Please see Readme_WhenErrorsOccur() to handle unexpected issues. When a method ever returns a negative result, close the object. This library will log the fault in the Application Event viewer.

Please see Readme_AboutIOModules() to have a brief introduction to the types of SNAP IO modules. Knowing what modules you have will allow you to quickly know how to read and write to them.

IPv6 connectivity options offered when users are accessing one of our devices over a network through some kind of IPv6 to IPv4 router. In the near future, the allocation of IPv4 addresses will likely become more and more expensive pressing remote IO users to select IPv6 addresses (due to lower costs). This library provides this connection alternative.

Typically, the OptoMMP device allows up to 16 TCP/IP connections simultaneously. UDP is different in that a single socket is used due to the connectionless nature. This interface will buffer several dozen message before the incoming queue is filled. Subsequent messages beyond the queue depth are dropped. In most applications, we recommend using as little TCP sessions as possible or minimal filling of the UDP queue. This is to maintain a responsive system.

Release Notes have been moved to ReleaseNotes.txt.

Member Enumeration Documentation

Enumerations of the Analog Value Types That May Be Written.

TPO Options are only for the Analog TPO Module, SNAP-AOD-29.

Enumerator
EngineeringUnits 

Write the point in Engineering Units. Most applications use this.

Counts 

Write the point in counts.

AnalogTpoResolution 

Sets the TPO Resolution of a SNAP-AOD-29

AnalogTpoPeriod 

Sets the TPO Period of a SNAP-AOD-29

Connection Types for Opto MMP

Enumerator
UdpIp 

Use a UDP/IP Connection for Opto MMP, most preferred data protocol.

TcpIp 

Use a TCP/IP Connection for Opto MMP, useful when going long distances through gateways and/or routers.

UdpIpv6 

Use a UDP/IPv6 Connection for Opto MMP, most preferred if you have an IPv6 remote NAT address

TcpIpv6 

Use a TCP/IPv6 Connection for Opto MMP, if you have an IPv6 remote NAT address

Probe data coding format enumerations.

Used to select how the module will detect the data format of the transducer. Note, Gray Code is more error tolerant. If you have a choice, use Gray Coding.

Enumerator
Binary 

The probe emits serial data that is binary encoded.

GrayCode 

Probe emits serial data in Gray code.

None 

No Assigned Code

Digital features that may be configured in the 64-point memory map.

Enumerator
None 

Ordinary digital point.

Counter 

Set up digital input as a counter.

QuadratureSimple 

Set up digital input as a quadrature counter, requires a SNAP-IDC5Q (quadrature module).

QuadratureIndex 

Set up a digital input as a quadrature counter with a separate input as an index. SNAP-IDC5Q and additional digital input module required.

Algorithm Options

Enumerator
Disabled 

Disables the PID. Only a disabled setting halts the operation of a PID.

VelocityB 

Velocity B Algorithm.

Isa 

ISA Algorithm.

Parallel 

Parallel Algorithm.

Interacting 

Interacting Algorithm.

VelocityC 

Velocity C Algorithm. Only available on R8.5e firmware and later; library does not check validity of this value with the firmware.

See notes regarding if the PID's input is supplied by a supervisory system (as opposed to an analog input).

PID Write Options

Use enumeration ePidWriteOptions.InitializeAll to first time initialize the PID. Leave the algorithm in the Disabled setting or the PID instantly starts. You may also want to leave the PID in manual mode as well. Set the algorithm and the auto/manual mode thereafter.

Enumerator
InitializeAll 

Only use when completely initializing the PID. This is not a gracious initialization. You'll really want to leave the algorithm as default and use one of the other options to set it.

ProcessVariable 

Set the process variable (input). Only use when the process variable OptoMMP address is set to zero otherwise, unpredictable results will occur. Uses f32ProcessVariableOrInput.

Setpoint 

Set the setpoint. Only use when the setpoint OptoMMP address is set to zero otherwise, unpredictable results will occur. Uses f32Setpoint.

PCoefficient 

Set the proportional, K, or gain coefficient. Uses f32GainParameter.

ICoefficient 

Set the integral or I coefficient. Uses f32IntegralParameter.

DCoefficient 

Set the derivative or D coefficient. Uses f32DerivativeParameter.

FFGain 

Set the feed forward gain coefficient. Uses f32FeedForwardGainParameter.

OutputChangesAllowed 

Set the maximum and minimum output change limits. Uses f32MaximumOutputChange and f32MinimumOutputChange.

ProcessVariableClamps 

Set the limits on the process variable. Uses f32InputLowRange and f32InputHighRange.

OutputClamps 

Set the limit on the output. Uses f32OutputLowerClamp and f32OutputUpperClamp.

Scantime 

Set the PID scan time. Uses f32PidScanTimeSeconds.

OutputForceValuesWhenInputOutOfRange 

Set the output forcing values when the input goes out of range. Uses f32InputLowOutputForceValue and f32InputHighOutputForceValue. This value is usually only initialized once.

ProcessVariableOptoMmpAddress 

Set the process variable OptoMMP address. Use zero if your application provides the process variable. Uses u32InputSourceOptoMmpAddress. Use the lower 32-bits of the 48-bit OptoMMP address.

SetpointOptoMmpAddress 

Set the setpoint variable OptoMMP address. Use zero if your application provides the setpoint. Uses u32SetpointSourceOptoMmpAddress. Use the lower 32-bits of the 48-bit OptoMMP address.

OutputOptoMmpAddress 

Set the output OptoMMP address. Use zero if your application reads and processes the output. Uses u32OutputDestinationOptoMmpAddress. Use the lower 32-bits of the 48-bit OptoMMP address.

PidAlgorithm 

The algorithm of the PID. Only use this after initializing the PID. Do not change thereafter or unpredictable results will occur. Use eAlgorithm. Use enumeration "Disabled" to shut down the PID functionality.

PidAutoManualMode 

Set the PID in auto or manual mode. Uses structure property bInManualMode. When Ethernet I/O based PID's are in manual mode and the PID output is linked to an analog output module, you may only change the output value by modifying the PID's output. Writing to the actual analog output is futile as the next scan of the PID will clobber the recently written value.

ConfigurationFlags 

The configuration flags. Uses bSquareRootOfInput, bForceOutputWhenInputOutOfRange, and bSwitchToManualWhenInputOutOfRange. This operation forces all three flags at once. These are typically only written at initialization. They aren't intended to be constant enabled/disabled.

SupervisorPidInput 

Use only for Velocity C, when the PID input is supplied by a supervisory system and the firmware version is R8.5e or later.

For some methods and properties, specifies when a point index is offered, which IoModel the index references.

Enumerator
IoModel64 

For a point index that references a 64-point bank area

IoModel512 

For a point index that references a 512-point bank area

Enumerations for a Serial Module's Parity Settings

Enumerator
None 

No Parity

Odd 

Odd Parity

Even 

Even Parity

Command Values For the Status Area Write - Read/Write (see Opto 22 Form 1465).

Enumerator
PowerUpClear 

Send a Power-Up-Clear command to the I/O unit. Normally when using Open(), set bPowerUpClear to true.

ResetToDefaults 

Erases the I/O Unit FLASH configurations and reboots. TCP connections will be severed. Device may take up to 10 seconds to recover.

StoreToFlash 

Store the current I/O unit configuration to flash. This includes I/O configuration, serial settings, scratchpad values, etc.

EraseFlash 

Erases the I/O unit's FLASH image. This does not erase the currently in use RAM image.

ResetHardware 

Trigger the Opto MMP device to reboot (like power-cycling).

ClearDigitalEvents 

Clear digital events.

ClearAlarmsConfig 

Clear alarm configuration.

ClearPPPConfig 

Clear PPP configuration.

ClearEMailConfig 

Clear EMail Configuration.

ClearDigitalEventsExpanded 

Clear digital events. For firmware 8.0 and lower, clears timer configuration.

ClearPidLoops 

Clears PID loop configuration.

ClearDataLog 

Clears the data log configuration.

Bits used to select particular object types.

Enumerator
e64DigitalStatesandLatches 

64-point digital states + on and off latches.

e64AnalogEngineeringUnits 

64-point analog engineering units.

e64AnalogEngMaxandMin 

64-point analog engineering units maximums and minimums.

eHighDensityDigital 

All 16 modules of high-density digital.

eAnalogLower256States 

Lower 256 analog channels of the 512 area.

eAnalogUpper256States 

Upper 256 analog channels of the 512 area.

Selection of Temperature Scales for the Converter

Enumerator
Celsius 

Celsius temperature.

Kelvin 

Kelvin temperature.

Fahrenheit 

Fahrenheit temperature.

Rankine 

Rankine temperature.

Constructor & Destructor Documentation

OptoMMP2.OptoMMP.OptoMMP ( )

Constructor

Member Function Documentation

void OptoMMP2.OptoMMP.AboutPulses ( )

Information on generating discrete pulses. Method does not perform any operations.

Caution, use pulses with only R9.0 or later firmware (SNAP-PAC-R or -EB devices only).

Pulses are intended for use on a discrete output point. This point may be either a 4-channel discrete output or with a "high-density" discrete output. High-Density is a discrete output module with more than 4 channels. Pulses are available in two formats, pulses defined by "on-time/off-time" or a percentage of on-time based on a time period.

For either type of pulse, there is a delay time in seconds that delays the actual pulse start.

For "time" based pulses, specify the "on-time" and the "off-time" in seconds. In this case, the resulting pulse time period is the sum of the on- and the off-times. This useful for generating pulsing claxons, alarms or indicators.

For "duration" based pulses, you will specify an initial "on-percentage" of the total pulse period. The remaining percentage of the period will be off.

A time-proportional output is a continuous duration based pulse. In this case, usually the on-percentage is modified to adjust how much of the pulse period is in the "on" state.

After a "configure" method is used, a pulse must be started using StartPulse(). A pulse may be stopped at any time using the StopPulse() method. In addition, forcing the discrete output on or off cancels a pulse operation.

When configuring a pulse for a 4-channel discrete module, ensure the point index is calculated using the GetPointIndexFor64() and set the point model type enumeration properly. For high-density discrete modules, use GetPointIndexFor512 and set the IoModel enumeration.

There are limits for 4-channel discrete output modules. SNAP-PAC-R1 has a minimum period of 0.006 seconds and an accuracy of 0.001 seconds. SNAP-PAC-R2 has a minimum period of 0.100 seconds and an accuracy of 0.001 seconds. SNAP-PAC-EB1 has a minimum period of 0.040 seconds and an accuracy of 0.005 seconds. SNAP-PAC-EB2 has a minimum period of 0.100 seconds and an accuracy of 0.005 seconds.

For high-density discrete outputs (modules with more than 4 discrete outputs), the minimum period is 1.00 seconds and a worse case accuracy of 1 second.

int OptoMMP2.OptoMMP.ChangeTimeout ( int  i32TimeoutMs)

Change the current timeout setting.

The minimum UDP/IP timeout is 100 milliseconds.

The minimum TCP/IP timeout is 1000 milliseconds. This typically one TCP/IP retransmission before a timeout is indicated.

Timeout values less than the minimum are forced to the minimum values mentioned.

Parameters
i32TimeoutMsNew timeout value in milliseconds.
Returns
Non-negative value is the timeout set, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
void OptoMMP2.OptoMMP.Close ( )

Close the OptoMMP Object.

Int32 OptoMMP2.OptoMMP.ConfigureContinuousPulsesDuration ( Boolean  bInvert,
Single  f32StartDelayTimeSeconds,
Single  f32OnPercent,
Single  f32PeriodSeconds,
IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512 
)

Configure a continuous discrete pulse train with percent-on and waveform period values.

Parameters
f32StartDelayTimeSecondsDelay start time in seconds.
bInvertTrue inverts logic levels, for example the on portion of the pulse is now off and vice versa.
f32OnPercentOn percent, values 0.0 to 100.0.
f32PeriodSecondsWaveform period in seconds.
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete point index to pulse too. Provide 64 point index for 4-channel discrete modules, 512- for high-density.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ConfigureContinuousPulsesTime ( Boolean  bInvert,
Single  f32StartDelayTimeSeconds,
Single  f32OnTimeSeconds,
Single  f32OffTimeSeconds,
IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512 
)

Configure a continuous discrete pulse train with on-time and off-time values.

Parameters
bInvertTrue inverts logic levels, for example the on portion of the pulse is now off and vice versa.
f32StartDelayTimeSecondsDelay start time in seconds.
f32OnTimeSecondsOn time in seconds.
f32OffTimeSecondsOff time in seconds.
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete point index to pulse too. Provide 64 point index for 4-channel discrete modules, 512- for high-density.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ConfigureNPulsesDuration ( Boolean  bInvert,
Single  f32StartDelayTimeSeconds,
Single  f32OnPercent,
Single  f32PeriodSeconds,
UInt32  u32PulseQuantity,
IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512 
)

Configure a continuous discrete pulse train using percent-on and wave period parameters.

Parameters
f32StartDelayTimeSecondsDelay start time in seconds.
bInvertTrue inverts logic levels, for example the on portion of the pulse is now off.
f32OnPercentOn percent, values 0.0 to 100.0.
f32PeriodSecondsTotal waveform period in seconds.
u32PulseQuantityNumber of pulses to generate.
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete point index to pulse too.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ConfigureNPulsesTime ( Boolean  bInvert,
Single  f32StartDelayTimeSeconds,
Single  f32OnTimeSeconds,
Single  f32OffTimeSeconds,
UInt32  u32PulseQuantity,
IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512 
)

Configure an "N" pulse train using on-time and off-time parameters.

Parameters
bInvertTrue inverts logic levels, for example the on portion of the pulse is now off.
f32StartDelayTimeSecondsDelay start time in seconds.
f32OnTimeSecondsOn time in seconds.
f32OffTimeSecondsOff time in seconds.
u32PulseQuantityNumber of pulses to generate.
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete point index to pulse too. Provide 64 point index for 4-channel discrete modules, 512- for high-density.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
static string OptoMMP2.OptoMMP.ConvertNumberToFirmwareVersion ( int  i32Number)
static

Converts an Opto 22 Version number (32-bit) to a version string like R8.5A.

This works with either the loader or firmware version numbers

Parameters
i32NumberThe Opto 22 version number read from an OptoMMP Device.
Returns
A user readable string of the version number
static Single OptoMMP2.OptoMMP.ConvertTemperature ( Single  f32InputTemp,
TemperatureScale  eInScale,
TemperatureScale  eOutScale 
)
static

Converts temperatures.

The brain is slow to change temperature scales. Depending on the application, temperatues may need to be changed depending on the specific system needs; in some cases, the same system may need to display more than one temperature scale. This method provides a faster and more efficient way of converting temperatures.

Parameters
f32InputTempInput temperature value.
eInScaleScale type the input temperature represents.
eOutScaleOutput temperature scale requested.
Returns
Temperature in units of eOutScale.
int OptoMMP2.OptoMMP.EnableBrainStreaming ( bool  bEnableStreaming)

Controls the enable/disable functionality of brain streaming.

This method didn't properly update the stream enabled flag. Corrected on 3-24-2011.

Parameters
bEnableStreamingtrue to enable stream.
Returns
0 for successful, negative for error, check with LogErrorInformation().
int OptoMMP2.OptoMMP.GetCacheFreshness ( )

Retrieves the current data cache freshness setting.

Additional notes on the cache implementation in SetCacheFreshness().

Returns
Freshness time in milliseconds.
void OptoMMP2.OptoMMP.GetExtendedErrorInformation ( out string  strMessage,
out bool  bCommFault,
out bool  bProtocolFault,
out bool  bArgumentFault 
)

Retrieves extended error information. This information is also logged in the computer's Application event log.

Parameters
strMessageString to store the message generated by the method.
bCommFaultTrue indicates a communication oriented fault. Close and reopen the object.
bProtocolFaultTrue indicates an Opto MMP oriented fault. More than likely, you're using UDP, and the I/O unit power cycled. Perform a WriteStatusCommand() and issue a "PowerUpClear". TCP connections will break when the I/O unit is reset so this code would not be returned.
bArgumentFaultTrue indicates a fault was generated by an improper argument. Inspect the argument values passed, a parameter is not correct.
int OptoMMP2.OptoMMP.GetLastRCodeFault ( )

When a -10 Error is reported, this method returns the last Opto MMP RCode. Check Form 1465 for proper response.

Returns
The last Opto MMP RCode generated.
static void OptoMMP2.OptoMMP.GetModuleAndChannelFromPoint4096 ( int  i32Point,
out int  i32Module,
out int  i32Channel 
)
static

Converts A Point Number From The 4096 Point Model To A Module And Channel Number.

Parameters
i32Point4096 model point number.
i32ModuleThe module number.
i32ChannelThe point number.
static void OptoMMP2.OptoMMP.GetModuleAndChannelFromPoint512 ( int  i32Point,
out int  i32Module,
out int  i32Channel 
)
static

Converts A Point Number From The 512 Point Model To A Module And Channel Number.

Parameters
i32Point512 model point number.
i32ModuleThe module number.
i32ChannelThe point number.
static void OptoMMP2.OptoMMP.GetModuleAndChannelFromPoint64 ( int  i32Point,
out int  i32Module,
out int  i32Channel 
)
static

Converts A Point Number From The 64 Point Model To A Module And Channel Number.

Parameters
i32Point64 model point number.
i32ModuleThe module number.
i32ChannelThe point number.
static int OptoMMP2.OptoMMP.GetPointNumberFor4096 ( int  i32Module,
int  i32Channel 
)
static

Converts Module and Channel to Point Number For 4096 Point IO Unit Model.

Parameters
i32ModuleModule number, values range from 0 to 63, no error checking provided.
i32ChannelChannel on the module, values range from 0 to 63, no error checking provided.
Returns
Point number for the 4096 point model.
static int OptoMMP2.OptoMMP.GetPointNumberFor512 ( int  i32Module,
int  i32Channel 
)
static

Converts Module and Channel to Point Number For 512 Point IO Unit Model.

Parameters
i32ModuleModule number, values range from 0 to 15, no error checking provided.
i32ChannelChannel on the module, values range from 0 to 31, no error checking provided.
Returns
Point number for the 512 point model.
static int OptoMMP2.OptoMMP.GetPointNumberFor64 ( int  i32Module,
int  i32Channel 
)
static

Converts Module and Channel to Point Number For 64 Point IO Unit Model.

Parameters
i32ModuleModule number, values range from 0 to 15, no error checking provided.
i32ChannelChannel on the module, values range from 0 to 3, no error checking provided.
Returns
Point number for the 512 point model.
static int OptoMMP2.OptoMMP.GetSerialOrSsiPortIndexFromModuleAndChannel ( int  i32Module,
int  i32Channel 
)
static

Computes A Serial Port "Index" on the rack, for serial and SSI modules.

Parameters
i32ModuleModule location on the rack, 0 to 15.
i32ChannelChannel on the module, 0 (Channel A) or 1 (Channel B).
Returns
0 to 31 for normal inputs, -1 for errant inputs.
bool OptoMMP2.OptoMMP.IsOpen ( )

Test if there is a possibility of communicating to the remote device.

For TCP sockets, this test to see if the computer "believes" the socket is writeable. It does not guarantee that the actual socket is actually "writeable." A true test of communication is to read a section of the memory-map to see if a valid networking path is available to the destination host.

For UDP sockets, if the Open() has been called, true is always returned. The only way to validate a UDP socket's ability to communicate is to read a section of the memory-map to see if a networking path is available.

Returns
True if writeable, false when closed or the socket is not writeable.
int OptoMMP2.OptoMMP.Open ( string  sHost,
int  i32Port,
Connection  eType,
int  i32InitialTimeoutMs,
bool  bPowerUpClear 
)

Opens An OptoMMP Object

The UDP/IP option is strongly recommended for single-segment networks.

Use TCP/IP when communicating over wireless and wide-area-network connections. For Wide-Area-Networks, larger timeouts may be needed.

If using TCP/IP, an internal reconnection backoff algorithm throttles how agressive reconnections will occur at.

Parameters
sHostHostname (DNS or "hosts") or IP Address in dot format.
i32PortThe UDP or TCP port, typically, 2001.
eTypeConnection Type, use UDP for most systems, TCP when internet connectivity is involved.
bPowerUpClearSet this to "true." True clears the "Powered Up" flag on the brain.
i32InitialTimeoutMsInitial timeout (ms) for messaging transactions. 1000 ms is typical.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogEu512 ( int  i32Point,
ref Single  f32Value 
)

Read a single Analog Engineering Unit Value.

May return a cached value.

Parameters
i32PointPoint number, range is 0 to 511.
f32ValueParameter to store the point value.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogEus512 ( ref Single[]  f32aryValues,
int  i32StartIndex 
)

Read all Analog States as Engineering Units.

This method may return cached values.

Parameters
f32aryValuesArray to store values retrieved from the IO unit. This array must be 512 elements larger than i32StartIndex in length.
i32StartIndexStarting index in the data array to store read values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogLoadCellConfiguration4096 ( int  i32PointNumber,
out uint  u32FastSettle,
out uint  u32FilterWeight 
)

Reads analog load cell configuration in 4,096 point area.

This just returns a single load-cell module's fast-settle and filter weight parameters.

While this is a configuration function, the data lies within the analog point write area (kind of unusual).

Parameters
i32PointNumberPoint Number, 0 to 511.
u32FastSettleLoad cell input fast settle value. See form 1465 for values.
u32FilterWeightFilter weight value. See form 1465 for values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogLoadCellConfiguration64 ( int  i32PointNumber,
out uint  u32FastSettle,
out uint  u32FilterWeight 
)

Read analog load cell configuration in the analog 64 point area (one point at a time).

Reads the analog load cell's parameters (fast-settle and filter weight).

While this is a configuration function, the data lies within the analog point write area (kind of unusual).

Parameters
i32PointNumberThe 64-point rack's number, from 0 to 63.
u32FastSettleThe fast settle parameter, see form 1465 for values.
u32FilterWeightThe filter weight setting, see form 1465 for values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogPointConfiguration4096 ( int  i32PointNumber,
out int  i32PointType,
out Single  fHighScale,
out Single  fLowScale,
out Single  fOffset,
out Single  fGain,
out Single  fFilterWeight,
out bool  bEnableWatchdog,
out Single  fWatchdogValue 
)

Read Analog Point configuration in 4096 Point Area.

This area must be configured before points may be read in the 512-point area.

Useful for setting all configuration values of an analog point (input or output).

Parameters
i32PointNumberPoint Number, 0 to 511.
i32PointTypeThe point type.
fHighScaleUpper Scale Value (when input is 100%).
fLowScaleLower Scale Value (when input is either 0% [unipolar] or -100% [bipolar]).
fOffsetOffset.
fGainGain.
fFilterWeightFilter Weight (0.0 disables or positive values).
bEnableWatchdogEnable analog communication watchdog.
fWatchdogValueThe value to force whhen communication watchdog occurs.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogPointConfiguration64 ( int  i32PointNumber,
out int  i32ModuleType,
out int  i32PointType,
out Single  fHighScale,
out Single  fLowScale,
out Single  fOffset,
out Single  fGain,
out Single  fFilterWeight,
out bool  bEnableWatchdog,
out Single  fWatchdogValue 
)

Read Analog Point Configuration in the 64-Point Area.

This method may return a cached value.

Parameters
i32PointNumberAnalog Point Number, 0 to 63.
i32ModuleTypeModule type.
i32PointTypePoint type.
fHighScale100% high-scale value.
fLowScale0% (unipolar) or -100% (bipolar) low-scale value.
fOffsetCalibration offset.
fGainCalibration gain.
fFilterWeightFilter weight.
bEnableWatchdogWatchdog enabled.
fWatchdogValueWatchdog value.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogState64 ( int  i32PointNumber,
ref Single  fAnalogValue 
)

Read an analog state via a point number.

If Freshness is set to a non zero value, this method may returned a cached value.

Parameters
i32PointNumberPoint number requested, range 0 to 63.
fAnalogValueCurrent value of the analog input or output.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadAnalogStates64 ( ref Single[]  fary,
int  i32StartingIndex 
)

Read all low-density (64-point) Analog Input and Output States.

May return cached values.

In assembly version 1.1.2.0, a fix was made that if fary wasn't exactly 64, a -1 would be returned.

Parameters
farySingle array to store the requested data. Must be preinitialized.
i32StartingIndexStarting index to store this data.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadBrainDiagnosticInformation ( out structBrainDiagnosticInformation  info)

Read the diagnostic information of the brain. Added (April 4, 2011).

Parameters
infoParameter package read from the brain.
Returns
If result returned in zero, info's data is valid.
int OptoMMP2.OptoMMP.ReadBrainStreamingConfiguration ( out bool  bIsEnabled,
out int  i32IntervalMs,
out int  i32UdpPortDestination,
out string[]  saryIpAddresses,
out long  i64OptoMMPAddress,
out int  i32LengthOfStream 
)

Read the Brain Streaming configuration.

Parameters
bIsEnabledWhen true, stream is enabled.
i32IntervalMsInterval of stream in milliseconds, 0 is as fast as possible.
i32UdpPortDestinationPort to stream to, this is the PC or client's destination port.
saryIpAddressesIP addresses configured in "dot" format.
i64OptoMMPAddressMMP address if not default stream. Note if set to zero, this will read as 0xffff00000000.
i32LengthOfStreamLength of the MMP stream (if not default).
Returns
0 for successful, negative for error, check with LogErrorInformation().
int OptoMMP2.OptoMMP.ReadClearDigitalLatch64 ( int  i32PointNumber,
bool  bOnLatch,
out bool  bLatchState 
)

Read and clear a digital latch.

This method does not return cached values.

This method only works with the 64-point I/O unit properties.

Parameters
i32PointNumberPoint number to read (0 through 63).
bOnLatchTrue, method reads and clears "on" latch. When False, reads and clears "off" latch.
bLatchStateThe state of the selected latch.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadClearDigitalLatches64 ( bool  bOnLatch,
out long  i64LatchBitmask 
)

Read and clear digital latches in the 64-point area.

This method does not return cached values.

This method only works with the 64-point I/O unit properties.

Parameters
bOnLatchTrue, method reads and clears "on" latch. When False, reads and clears "off" latch.
i64LatchBitmaskA long to store the latch state. Bit 0 is channel 0.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadClearDigitalLatches64 ( bool  bOnLatch,
out UInt64  u64LatchBitmask 
)

Read and clear digital latches in the 64-point area, with a UInt64 latch bitmask.

This method does not return cached values.

This method only works with the 64-point I/O unit properties.

Parameters
bOnLatchTrue, method reads and clears "on" latch. When False, reads and clears "off" latch.
u64LatchBitmaskA UInt64 to store the latch state. Bit 0 is channel 0.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadClearDigitalLatches64 ( bool  bOnLatch,
ref Boolean[]  baryLatches,
Int32  i32StartIndex 
)

Read and clear digital latches in the 64-point area, with a UInt64 latch bitmask.

This method does not return cached values.

This method only works with the 64-point I/O unit properties.

Parameters
bOnLatchTrue, method reads and clears "on" latch. When False, reads and clears "off" latch.
baryLatchesA boolean array to store the latch states. Bit 0 is channel 0.
i32StartIndexStart index of baryLatches to write latch states too.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDateTime ( out string  sDateTime)

Read the Date and Time of the I/O Unit

Parameters
sDateTimeDate Time String from the I/O Unit
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalCountersStatus64 ( out long  i64ActivateBitMask)

Reads All 64 Counter Status.

This may returned cached values.

Parameters
i64ActivateBitMaskStatus of the counters as a 64-bit mask.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalCountersStatus64 ( ref bool[]  baryActive,
int  i32StartIndex 
)

Read All 64 Counter Status To A Boolean Array.

Parameters
baryActiveStates of the counters, true is active counter. Array must be at least i32StartIndex + 64 in length.
i32StartIndexStarting index to store values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalCounterStatus64 ( int  i32PointNumber,
out bool  bCounterStatus 
)

Read a Counter Status in the 64 Point IO Unit Memory Map.

This may returned cached values.

Parameters
i32PointNumberPoint number to read, values 0 through 63.
bCounterStatusThe counter's status as a boolean.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalLatch64 ( int  i32PointNumber,
out bool  bOnLatch,
out bool  bOffLatch 
)

Read the Digital Latches Selected by a Point Number.

May return cached values.

This method only works with the 64-point I/O unit properties.

Parameters
i32PointNumberPoint number, range 0 to 63. 0 is point 0.
bOnLatchOn latch state.
bOffLatchOff latch state.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalLatches64 ( out long  i64OnLatchBitMask,
out long  i64OffLatchBitMask 
)

Read all On and Off Latch States of the 64 Point I/O Unit Rack at Bitmasks.

May return cached values.

Does not return the latch state of high-density digital modules.

This method only works with the 64-point I/O unit properties.

Parameters
i64OnLatchBitMaskBit packed mask of on-latches. Bit-0 coorelates to point 0.
i64OffLatchBitMaskBit packed mask of off-latches. Bit-0 coorelates to point 0.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalLatches64 ( out UInt64  u64OnLatchBitMask,
out UInt64  u64OffLatchBitMask 
)

Read all On and Off Latch States of the 64 Point I/O Unit Rack with Unsigned Bitmasks.

May return cached values.

Does not return the latch state of high-density digital modules.

This method only works with the 64-point I/O unit properties.

Parameters
u64OnLatchBitMaskBit packed mask of on-latches. Bit-0 coorelates to point 0.
u64OffLatchBitMaskBit packed mask of off-latches. Bit-0 coorelates to point 0.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalLatches64 ( ref Boolean[]  baryOnLatches,
ref Boolean[]  baryOffLatches,
Int32  i32StartIndex 
)

Read all On and Off Latch States of the 64 Point I/O Unit Rack with Boolean arrays.

May return cached values.

Does not return the latch state of high-density digital modules.

This method only works with the 64-point I/O unit properties.

Parameters
baryOnLatches64 element Boolean array of on-latches. Index 0 coorelates to point 0 when i32StartIndex == 0.
baryOffLatches64 element Boolean array of off-latches. Index 0 coorelates to point 0 when i32StartIndex == 0.
i32StartIndexStart index of the on-latch an off-latch arrays to store data.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalPointConfiguration64 ( int  i32PointNumber,
out int  i32ModuleType,
out int  i32PointType,
out int  i32Feature,
ref bool  bWatchdogEnabled,
ref bool  bWatchdogValue 
)

Read the Digital Point Configuration

Parameters
i32PointNumberPoint number, 0 to 63.
i32ModuleTypeModule installed in this location. See form 1465 for additional information.
i32PointTypePoint configured in this location.
i32FeatureFeature enabled (if any).
bWatchdogEnabledWatchdog enabled state.
bWatchdogValueWatchdog trigger state.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalState64 ( int  i32PointNumber,
ref bool  bState 
)

Read the individual digital state by specifying the point number.

May returned a cached value depending on the data freshness.

This method only works with the 64-point I/O unit properties.

Parameters
i32PointNumberPoint number, valid values range from 0 to 63.
bStateThe state of the digital point, true is "on."
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalStates64 ( ref long  i64DigitalStatesBitmask)

Read digital states as a 64-bit Bitmask.

Bit 0 coorelates to the first module, first channel of the rack.

Will report digital states, even when analog or serial modules are present.

May returned a cached value depending on the data freshness.

This method only works with the 64-point I/O unit properties.

This member only reads the states of 4-channel digital modules.

Parameters
i64DigitalStatesBitmaskReference to a long, to store the 64 digital states read.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalStates64 ( out UInt64  u64DigitalStatesBitmask)

Read digital states as a 64-bit Bitmask as a UInt64

Bit 0 coorelates to the first module, first channel of the rack.

Will report digital states, even when analog or serial modules are present.

May returned a cached value depending on the data freshness.

This method only works with the 64-point I/O unit properties.

This member only reads the states of 4-channel digital modules.

Parameters
u64DigitalStatesBitmaskReference to a long, to store the 64 digital states read.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadDigitalStates64 ( ref Boolean[]  baryDigitalStates64,
int  i32StartIndex 
)

Read 64 Digital States Into A Boolean Array

Parameters
baryDigitalStates64Array of booleans to store values. Length must be i32StartIndex + 64.
i32StartIndexStarting index to store values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadFOrCStatus ( out bool  bIsFahrenheit)

Read the Temperature Reporting Status of the Brain

Parameters
bIsFahrenheitAn out value of true is Fahrenheit, false is Celsius
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadHighDensityDigitalCounter ( int  i32Module,
int  i32Channel,
out UInt32  u32Counter 
)

Read a High-Density Digital Counter

This method may return a cached value.

Parameters
i32ModuleThe module number to read, 0 through 15.
i32ChannelThe channel number to read 0 through 31.
u32CounterThe counter value.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadHighDensityDigitalLatch ( int  i32Module,
int  i32Channel,
out bool  bOnLatch,
out bool  bOffLatch 
)

Read a single high-density digital latch.

method may return a cached value.

Parameters
i32ModuleModule number, 0 to 15.
i32ChannelChannel number, 0 to 31.
bOnLatchOn-latch state.
bOffLatchOff-latch state.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadHighDensityDigitalState ( int  i32PointNumber,
out bool  bState 
)

Read a high-density digital state.

This method may return a cached value.

Parameters
i32PointNumberHigh-Density Point number (0 through 511) to store the data in your boolean table.
bStateState of the digital point.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadHighDensityDigitalStates ( ref bool[]  baryStates,
int  i32StartIndex 
)

Read All 512 High-Density Digital States (32 points per module times 16 modules).

This method may return a cached values.

Ignore digital data returned for; channels that do not exist, empty module slots, or module slots with analog or serial I/O modules.

Parameters
i32StartIndexStarting index to store the data in your boolean table.
baryStatesBoolean array. May be "null" if not information is desired.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadHighDensityDigitalStates ( ref uint[]  u32aryBitStates,
int  i32StartIndex 
)

Read All 512 High-Density Digital States To BitMask Array

Parameters
u32aryBitStatesArray to store states, one element per module. Array must be at least i32StartIndex + 16 in length.
i32StartIndexStarting index to store values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadInts ( long  i64MmpAddress,
int  i32Length,
ref int[]  i32aryInts,
int  i32StartingIndex 
)

Read a block of integers (32-bit signed values) from the Memory Map

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 256.

This method does not return cached values.

Parameters
i64MmpAddressStarting Opto MMP Address.
i32LengthNumber of 32-bit integer values to read.
i32aryIntsArray of 32-bit integers.
i32StartingIndexStarting index of the 32-bit integer array to store values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadLongs ( long  i64MmpAddress,
int  i32Length,
ref long[]  i64aryLongs,
int  i32StartingIndex 
)

Read a block of longs (64-bit signed values) from the Opto MMP Device.

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 128.

Does not return cached values.

Parameters
i64MmpAddressOpto MMP Address.
i32LengthQuantity of longs to read.
i64aryLongsArray of longs to read.
i32StartingIndexStarting index of i64aryLongs to read too.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
static void OptoMMP2.OptoMMP.Readme_AboutIOModules ( )
static

About SNAP IO Modules (added 02-23-2011)

These are the types of SNAP IO Modules.

4-Channel Digital Input or Output

To access the data of these IO modules use the digital methods that end with a "64." To determine the mapping index [a number from 0 to 63] use the static helper GetPointNumberFor64().

(Up to) 4-Channel Analog Input or Outputs

To access the data of these IO modules, use analog methods that end with a "64." To determine the mapping index [a number from 0 to 63] use the static helper GetPointNumberFor64().

More than 4-Channel Digital Input or Output

To access the data of these IO modules, use digital methods like ReadHighDensityDigitalState(), ReadHighDensityDigitalStates(), WriteHighDensityDigitalState() or other member that include the "HighDensity" wording.

More than 4-Channel Analog Input or Output

To access input values from these modules, use ReadAnalogEu512(), ReadAnalogEus512() and other 512 point configurations. Use the helper GetPointNumberFor512() to determine the point's index you wish to retrieve.

Serial Communication Modules are different modules. These require configuration (baud, stop bits, EOM characters etc) using this toolkit. See WriteSerialModuleConfiguration(). This is specifically for SCM-232 or SCM-485/422 IO modules. The communication stream is handled by a TCP session. You may use the ip4.Tcp_Client to connect to a serial module. The TCP ports for serial modules range from 22500 through 22531. The port number is determined by using this method GetSerialOrSsiPortIndexFromModuleAndChannel() and add 22500. One connection is allow to a serial module at a time. New connection requests to a serial port already being used will automatically close the currently open session.

static void OptoMMP2.OptoMMP.Readme_WhenErrorsOccur ( )
static

Description of when errors occur.

This assembly logs events to the computer's application event log. When a fault occurs (and the application didn't handle the condition), review the application event log. This file may be e-mailed to Opto 22's support so we may review the conditions of the fault as well.

When a negative response occurs from any object, close the OptoMMP object. Attempts at continuing to use the object may be disastrous, especially when TCP/IP is used.

This method doesn't do anything, but to serve as a place to appear in the html documentation.

int OptoMMP2.OptoMMP.ReadOptionallyClearAnalogMaxMin64 ( int  i32PointNumber,
bool  bClear,
out Single  fMaximum,
out Single  fMinimum 
)

Read and clear analog maximum and minimum value of a point on a 64-point rack.

Parameters
i32PointNumberPoint number (0 through 63)
bClearWhen true, resets the value after being read.
fMaximumMaximum value read.
fMinimumMinimum value read.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearCounter64 ( int  i32PointNumber,
bool  bClear,
out UInt32  u32Counter 
)

Read and optionally clear a counter on the 64 point rack.

This method does not cache data.

This method only works with the 64-point I/O unit properties.

Reading and clearing counters may cause counts to be lost.

Parameters
i32PointNumberPoint number in the 64-point IO unit model.
bClearWhen true, clears the counter.
u32CounterStorage for counter value.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearCounters64 ( bool  bClear,
ref UInt32[]  u32aryCounters,
int  i32StartIndex 
)

Read and optionally clear all 64 counters.

This method does not return cached values.

This method only works with the 64-point I/O unit properties.

Reading and clearing counters may cause counts to be lost.

Parameters
bClearWhen true, clears the counters.
u32aryCountersStorage for counter values.
i32StartIndexStarting index in u32aryCounters to store data.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearHighDensityDigitalCounters32 ( bool  bClear,
ref UInt32[]  u32aryCounters,
int  i32StartIndex 
)

Read and Optionally clear High Density Digital Counters

When bClear is false, may return a cached value.

When bClear is true, all high-density counters are cleared with this method.

Parameters
i32StartIndexStart index of the point to read counters.
bClearWhen true, counters are cleared after reading.
u32aryCountersUnsigned array to store the value of the counters.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearHighDensityDigitalLatches ( bool  bClear,
ref bool[]  baryOnLatches,
ref bool[]  baryOffLatches,
int  i32StartIndex 
)

Read and Optionally Clear All 512 High-Density Latches To Boolean Arrays (32 points per module times 16 modules)

Parameters
i32StartIndexStart index to read and optionally clear.
bClearWhen true, clears the latch after being read.
baryOnLatchesArray to store on-latch states.
baryOffLatchesArray to store off-latch states.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearHighDensityDigitalLatches ( bool  bClear,
ref uint[]  u32aryOnLatches,
ref uint[]  u32aryOffLatches,
int  i32StartIndex 
)

Read and Optionally Clear All 512 High-Density Latches To BitMasks (32 points per module times 16 modules)

Method may return cached values if bClear is false.

Parameters
i32StartIndexStart index to read and optionally clear.
bClearWhen true, clears the latch after being read.
u32aryOnLatchesArray to store on-latch bitstates.
u32aryOffLatchesArray to store off-latch bitstates.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadOptionallyClearHighDensityDigitalLatches ( int  i32StartModule,
int  i32EndModule,
bool  bClear,
ref bool[]  baryOnLatches,
ref bool[]  baryOffLatches,
int  i32StartIndex 
)

Read and Optionally Clear All 512 High-Density Latches To Boolean Arrays (32 points per module times 16 modules)

Method may return cached values if bClear is false.

Parameters
i32StartModuleFirst High-Density module to read.
i32EndModuleLast High-Density module to read.
bClearWhen true, clears the latch after being read.
baryOnLatchesArray to store on-latch bitstates.
baryOffLatchesArray to store off-latch bitstates.
i32StartIndexStart index to read and optionally clear.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ReadPid ( Int32  i32PidIndex,
ref stPid  PidData 
)

Read the entire PID.

Under the hood, PIDs are read in blocks of 8 PIDs. Both configuration and data areas are read.

This method does not support the SNAP-PID-V module (a legacy product).

May return a cached value.

Parameters
i32PidIndexIndex of the PID to read. A zero to "one less" number returned by ReadPidQuantity(). Only negative indicies return a fault code.
PidDataThe parsed data reported by the brain.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ReadPidQuantity ( out Int32  i32PidQuantity)

Report supported PID quantity in the brain.

This value is a constant for each brain/controller and firmware version. This value may only be read on SNAP-PAC-R or SNAP-PAC-EB series brains (not supported in SNAP-PAC-S controllers).

May return a cached value.

Parameters
i32PidQuantityThe quantity of PIDs the brain supports. Only valid when the result code is zero.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ReadPulseOnOffTime ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
out Single  f32OnTime,
out Single  f32OffTime 
)

Read a "time" configured pulse's on- and off-time values. The pulse must have been configured using ConfigureContinuousPulsesTime() or ConfigureNPulsesTime() or unpredictable results will be reported on f32OnTime and f32Offtime (even with a successful result of this method).

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete output index.
f32OnTimePulse on-time in seconds.
f32OffTimePulse off-time in seconds.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ReadPulsePercentage ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
out Single  f32Percent 
)

Read pulse percentage.

The specified TPO must have been set using ConfigureContinuousPulsesDuration() or ConfigureNPulsesDuration() or the value returned in f32Percent is unpredictable (even when a successful result is returned by the method).

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Index for the 64 or 512 point model index for the specific discrete output used.
f32PercentCurrent percentage set for the pulse object.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.ReadPulsePeriod ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
out Single  f32Period 
)

Read the pulse period.

The specified TPO must have been set using ConfigureContinuousPulsesDuration() or ConfigureNPulsesDuration() or the result of this operation is unpredictable.

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Index for the 64 or 512 point model index for the specific discrete output used.
f32PeriodPulse period in seconds.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadScannerFlags ( out int  i32ScannerFlags)

Read the scanner flags of the control engine.

Added April 30, 2010.

Parameters
i32ScannerFlagsOut parameter when the return value is okay. Bit compressed value of the scanner flags.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadSerialModuleConfiguration ( int  i32PortNumber,
out int  i32TcpPort,
out int  i32BaudRate,
out SerialParity  eParity,
out byte  byDataBits,
out byte  byStopBits,
out bool  bHardwareFlowControl,
out bool  bTestMessage,
out int  i32Eom,
out bool  b4WireMode 
)

Read the Serial (Module) Port Configuration. Only for Module based Serial Ports.

Parameters
i32PortNumberSerial port number to read, values 0 through 31. See GetSerialOrSsiPortIndexFromModuleAndChannel().
i32TcpPortTCP/IP Service port this serial port is associated too.
i32BaudRateBaud rate of the serial port.
eParityParity enumeration the port.
byDataBitsNumber of Data Bits.
byStopBitsNumber of Stop Bits.
bHardwareFlowControlHardware Flow Control.
bTestMessagePowerup Test Message.
i32Eom32-bit Value of End-Of-Message.
b4WireModeTwo or Four-Wire Mode (for 485/422 serial modules).
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadSingles ( long  i64MmpAddress,
int  i32Length,
ref Single[]  f32arySingles,
int  i32StartingIndex 
)

Read a block of Singles from the Opto MMP Device.

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 256.

This method will not return cached values.

Parameters
i64MmpAddressOpto MMP Address.
i32LengthQuantity of Singles to read.
f32arySinglesArray of singles to read.
i32StartingIndexStarting index of f32arySingles to read too.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ReadSsiModuleConfiguration ( int  i32PortNumber,
out int  i32FrameSize,
out Single  f32ClockSpeedkHz,
out Single  f32InterFrameTimeUs,
out int  i32MsbOffset,
out int  i32DataBits,
out int  i32ErrorBitOffset,
out bool  bErrorBitLowIsError,
out eDataCode  eCoding,
out bool  bEnabled 
)

Read the SSI module configuration

This function requires SNAP-PAC firmware R8.5C or later.

Parameters
i32PortNumberThe SSI module port number, values range from 0 to 31. See GetSerialOrSsiPortIndexFromModuleAndChannel().
i32FrameSizeLength of the entire data frame in bits.
f32ClockSpeedkHzFrequency of the transducer (in kHz).
f32InterFrameTimeUsTime between data frames (in microseconds).
i32MsbOffsetLocation of the data MSB in the data frame. Starts from zero.
i32DataBitsLocation of the data bit in the frame. Starts from clock zero.
i32ErrorBitOffsetLocation of the error bit in the frame. Starts from clock zero.
bErrorBitLowIsErrorActive status of the error bit.
eCodingEncoding of the transducer.
bEnabledEnables the brain to scan the SNAP-SCM-SSI module.
Returns
-1 for any error, check extended error status.
int OptoMMP2.OptoMMP.ReadStrategyStreaming ( out string  sCommHandle,
out Single  fInterval,
out int  i32Objects 
)

Read the "Strategy Streaming"

Only used on SNAP-PAC-R controllers running the "streaming strategy" for additional I/O streaming capabilities.

Parameters
sCommHandleThe configured comm handle.
fIntervalInterval of streaming.
i32ObjectsObjects selected within the strategy.
Returns
0 for successful, negative for error, check with LogErrorInformation().
int OptoMMP2.OptoMMP.ReadWatchdogTime ( out int  i32WatchdogTimeMs)

Read the Device's Communication Watchdog Timeout

Parameters
i32WatchdogTimeMs[out] The timeout currently set at the IO unit. 0 is disabled.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitRead ( out Boolean  bState,
Int32  i32Index 
)

Read Scratchpad Bit

May return a cached value.

Parameters
bStateWhen true the bit is on. False, the bit is off.
i32IndexBit index, values 0 to 63.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitsRead ( out UInt64  u64ScratchpadBitmask)

Read scratchpad bits as a 64-bit bitmask.

Bit 0 coorelates to bit 0 in the scratchpad bits.

May returned a cached value depending on the data freshness value.

Parameters
u64ScratchpadBitmaskReference to a long, to store the 64 scratchpad bits.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitsRead ( ref Boolean[]  baryScratchpad,
int  i32StartIndex 
)

Read Scratchpad Bits Into A Boolean Array

May return a cached value.

Parameters
baryScratchpadArray of booleans to store values. Length must be at least i32StartIndex + 64.
i32StartIndexStarting index to store values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitsWrite ( UInt64  u64OnMask,
UInt64  u64OffMask 
)

Writes all 64 scratchpad bit states using turn-on and turn-off bitmasks.

Parameters
u64OnMaskThe states to be forced on. Bit value of 1 turns on, 0 leaves state unaffected.
u64OffMaskThe states to be forced off. Bit value of 1 turns off, 0 leaves state unaffected.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitsWrite ( bool[]  baryOnStates,
bool[]  baryOffStates,
int  i32StartIndex 
)

Writes All 64 Scratchpad Bitstates From "Must-On/Must-Off" (MoMo) Boolean Arrays

Parameters
baryOnStatesThe states to be forced on. True turns on, false leaves state unaffected.
baryOffStatesThe states to be forced off. True turns off, false leaves state unaffected.
i32StartIndexStarting index to read states from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadBitWrite ( Boolean  bState,
Int32  i32Index 
)

Write Scratchpad Bit

Parameters
bStateBoolean.
i32IndexBit index, values 0 to 63.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchPadF32NumberofElements ( )

Maximum number of elements in the Float Scratchpad Array.

Returns
Returns the constant number of float elements.
int OptoMMP2.OptoMMP.ScratchpadFloatRead ( ref Single[]  fary,
int  i32StartFaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Read a block of 32-bit floating point (Single) scratchpad registers.

Reads large blocks of scratchpads by breaking up large requests into multiple 256-element requests.

Only access the contents of fary when this method is completed.

If reading back a write that was recently performed, disable freshness by setting the time to zero before reading back the scratchpad.

In .Net an Opto 22 "float" is a "Single" precision data type.

SNAP-UP1-xxx family of controllers only support indices 0-1023.

May returned a cached value depending on the data freshness.

Parameters
faryFloat array to store the returned data.
i32StartFaryIndexStarting index of the float array to store the data.
i32LengthNumber of continuous floats to read.
i32StartScratchpadStartIndexStarting index of the float scratchpads to read from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadFloatWrite ( Single[]  fary,
int  i32StartFaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Write a block of float scratchpad registers.

In .Net an Opto 22 "32-bit float" is a "Single" precision data type.

Not cachable.

SNAP-UP1-xxx family of controllers only support indices 0-1023.

Parameters
faryArray of float values to write.
i32StartFaryIndexStart index of the float aray.
i32LengthNumber of float elements to write.
i32StartScratchpadStartIndexStarting float scratchpad element to write too.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchPadI32NumberofElements ( )

Maximum number of elements in the 32-bit Integer Scratchpad Array.

Returns
Returns the constant number of 32-bit Integer elements for a SNAP-PAC Ethernet brain/controller.
int OptoMMP2.OptoMMP.ScratchpadI32Read ( ref int[]  i32ary,
int  i32StartIaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Read a block of 32-bit signed-integer scratchpad registers.

Reads large blocks of scratchpads by breaking up large requests into multiple 256-element requests.

Only access the contents of i32ary when this method is completed.

If reading back a write that was recently performed, disable freshness by setting the time to zero before reading back the scratchpad.

SNAP-UP1-xxx family of controllers only support indices 0-1023.

May returned a cached value depending on the data freshness.

Parameters
i32ary32-bit integer array to store the returned data.
i32StartIaryIndexStarting index of the float array to store the data.
i32LengthNumber of continuous floats to read.
i32StartScratchpadStartIndexStarting index of the float scratchpads to read from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadI32Write ( int[]  i32ary,
int  i32StartIaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Write a block of 32-bit signed-integer scratchpad registers.

Divides the writes of up to 256 elements to satisfy the transfer.

Not cachable.

SNAP-UP1-xxx family of controllers only support indices 0-1023.

Parameters
i32aryArray of 32-bit integer values to write.
i32StartIaryIndexStart index of the 32-bit integer array.
i32LengthNumber of float elements to write.
i32StartScratchpadStartIndexStarting 32-bit integer scratchpad element to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchPadI64NumberofElements ( )

Maximum number of elements in the 64-bit Integer Scratchpad Array.

Returns
Returns the constant number of 64-bit Integer elements.
int OptoMMP2.OptoMMP.ScratchpadI64Read ( ref long[]  i64ary,
int  i32StartIaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Read the 64-bit signed-integer (long) scratchpad registers

Internally, this method reads 64-bit integers in 128 element blocks.

May returned a cached value depending on the data freshness.

Parameters
i64aryArray to store read values.
i32StartIaryIndexStarting index in i64ary to store values.
i32LengthLength of the read request.
i32StartScratchpadStartIndexFirst element of the scratchpad array to start reading from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadI64Write ( long[]  i64ary,
int  i32StartIaryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Write a block of 64-bit signed integer scratchpad registers.

Writes longer than 128 elements are divided into 128 maximum element sized writes.

Not cachable.

Parameters
i64aryArray of 64-bit integer values to write.
i32StartIaryIndexStart index of the 64-bit integer array.
i32LengthNumber of float elements to write.
i32StartScratchpadStartIndexStarting 64-bit integer scratchpad element to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchPadStringNumberofElements ( )

Maximum number of elements in the String Scratchpad Array.

Returns
Returns the constant number of String Scratchpad elements.
int OptoMMP2.OptoMMP.ScratchpadStringRead ( ref string[]  strary,
int  i32StartStraryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Read the string scratchpad registers.

Internally, this method reads strings in 8 string-element chunks.

May returned a cached value depending on the data freshness.

String scratchpads are intended for only ASCII based strings.

A correction to this method was made on 10-14-2011. Problems arose with 9.x firmware or later and if less than 64 scratchpad strings were read.

Parameters
straryArray of strings to read.
i32StartStraryIndexStarting index in string to store values.
i32LengthLength of the read request.
i32StartScratchpadStartIndexFirst element of the scratchpad array to start reading from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.ScratchpadStringWrite ( string[]  strary,
int  i32StartStraryIndex,
int  i32Length,
int  i32StartScratchpadStartIndex 
)

Write a block of string scratchpad registers.

Writes longer than 4 elements are divided into 4-element chunks.

String scratchpads are intended for only ASCII based strings.

Parameters
straryArray of strings to write.
i32StartStraryIndexStart index of the string array.
i32LengthNumber of strings elements to write.
i32StartScratchpadStartIndexStarting string scratchpad element to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
void OptoMMP2.OptoMMP.SetCacheFreshness ( int  i32FreshnessMs)

Sets the data cache freshness value.

This edition of the OptoMMP library supports data read caching. When certain areas of the Opto MMP memory map are read, the data reported may be cached. Subsequent accesses to the same Opto MMP address space may use the cached data if the freshness for the area has not expired.

Data caching is intended to reduce the amount of network traffic and messaging of the I/O unit. Experience shows us that many users use point type of access methods and not bank methods. This tends to generate an excessive amount of I/O traffic. Data caching will substantially reduce network rates and dramatically increase the application's throughput.

Freshness may not be acceptable in applications where fastest response time is needed. In these cases, setting the freshness to zero disables all caching. An application may choose when to enable or disable the read data cache... but you could generate a LOT of network traffic.

When this member is invoked, the entire data cache is invalidated.

Only analog and digital states, analog max-mins, and digital latches are cached. Read and clear options do not cache data.

The default freshness is 100ms.

Writes are not cached.

Negative freshness values will be treated as zero.

Parameters
i32FreshnessMsNew freshness value.
Int32 OptoMMP2.OptoMMP.StartPulse ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512 
)

Start a pulse train.

Parameters
eIoModelOfPointIndexSpecifies the point index of the model.
i32PointIndex64or512Poing index number for either the 64 or 512 point model.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.StopPulse ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
Boolean  bTurnOn 
)

Stop a pulse. Note, writing a discrete point state cancels an operating pulse.

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Poing index number for either the 64 or 512 point model.
bTurnOnWhen true, terminates the pulse and leave the output on. False terminates the pulse and leaves the output off.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogEu512 ( int  i32Point,
Single  f32Value 
)

Write an analog output in the 512-Point IO Unit model.

If you would like to write all analog outputs at once, use the WriteAnalogEu64 method.

Parameters
i32PointThe point number, range 0 to 511.
f32ValueThe value to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogLoadCellConfiguration4096 ( int  i32PointNumber,
uint  u32FastSettle,
uint  u32FilterWeight 
)

Write analog load cell configuration in 4,096 point area.

This just sets a load-cell module's fast-settle and filter weight parameters.

While this is a configuration function, the data lies within the analog point write area (kind of unusual).

Parameters
i32PointNumberPoint Number, 0 to 511.
u32FastSettleLoad cell input fast settle value. See form 1465 for values. Library does not check for invalid values.
u32FilterWeightFilter weight value. See form 1465 for values. Library does not check for invalid values.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogLoadCellConfiguration64 ( int  i32PointNumber,
uint  u32FastSettle,
uint  u32FilterWeight 
)

Write analog load cell configuration in 64 Point Area.

Configures the analog load cell's parameters (fast-settle and filter weight).

While this is a configuration function, the data lies within the analog point write area (kind of unusual).

Parameters
i32PointNumberThe 64-point rack's number, from 0 to 63.
u32FastSettleThe fast settle parameter, see form 1465 for values (this value is not checked by this library).
u32FilterWeightThe filter weight setting, see form 1465 for values (value is not check by this library).
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogPointConfiguration4096 ( int  i32PointNumber,
int  i32PointType,
Single  fHighScale,
Single  fLowScale,
Single  fOffset,
Single  fGain,
Single  fFilterWeight,
bool  bEnableWatchdog,
Single  fWatchdogValue 
)

Write Analog Point configuration in 4096 Point Area.

This area must be configured before points may be read in the 512-point area.

Useful for setting all configuration values of an analog point (input or output).

Parameters
i32PointNumberPoint Number, 0 to 511.
i32PointTypeThe point type.
fHighScaleUpper Scale Value (when input is 100%).
fLowScaleLower Scale Value (when input is either 0% [unipolar] or -100% [bipolar]).
fOffsetOffset.
fGainGain.
fFilterWeightFilter Weight (0.0 disables or positive values).
bEnableWatchdogEnable analog communication watchdog.
fWatchdogValueThe value to force whhen communication watchdog occurs.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogPointConfiguration4096 ( int  i32PointNumber,
int  i32PointType 
)

Write Point configuration in 4096 Point Area.

This area must be configured before points may be read in the 512-point area.

Useful for setting the point's type such as setting a linearized thermocouple's probe type, a digital input or output, or setting an analog input to a specific input range and want to read the input as measurement units (volts, amps, etc).

Parameters
i32PointNumberPoint Number, 0 to 4095.
i32PointTypeThe point type.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogPointConfiguration64 ( int  i32PointNumber,
int  i32PointType,
Single  fHighScale,
Single  fLowScale,
Single  fOffset,
Single  fGain,
Single  fFilterWeight,
bool  bEnableWatchdog,
Single  fWatchdogValue 
)

Write Analog Point configuration in 64 Point Area.

configures all the basic analog point configuration values.

Parameters
i32PointNumberPoint Number, 0 to 63.
i32PointTypeThe point type.
fHighScaleUpper Scale Value (when input is 100%).
fLowScaleLower Scale Value (when input is either 0% [unipolar] or -100% [bipolar]).
fOffsetOffset.
fGainGain.
fFilterWeightFilter Weight (0.0 disables or positive values).
bEnableWatchdogEnable analog communication watchdog.
fWatchdogValueThe value to force whhen communication watchdog occurs.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogState64 ( int  i32PointNumber,
AnalogWriteOptions  eOption,
Single  fWriteValue 
)

Sets a Single Analog State in the 64-Point IO Unit Memory Map.

This method does not cache values.

Parameters
i32PointNumberThe point number to write, 0 to 63.
eOptionThe enumeration of the value option to be written.
fWriteValueThe value to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteAnalogStates64 ( Single[]  faryValues,
bool  bEngineeringUnits,
int  i32StartIndex 
)

Set analog outputs in engineering units as a 64-point bank write.

Parameters
faryValuesArray storing values to write. Must contain at least i32StartIndex + 64 elements in length.
bEngineeringUnitsWhen true writes engineering units. False writes counts (typically 0 to 4095).
i32StartIndexStarting index in the array to write values from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteBrainStreamingConfiguration ( int  i32IntervalMs,
int  i32UdpPortDestination,
string[]  saryIpAddresses,
long  i64OptoMMPAddress,
int  i32LengthOfStream 
)

Configure the brain streaming functionality.

Once successfully using this method, you must use EnableBrainStreaming() to enable streaming. This method does not automatically enable streaming>

This function will disable streaming if it is enabled.

This function disables mirroring. If you want mirroring, use PAC Manager to configure the brain instead.

Parameters
i32IntervalMsInterval in milliseconds to stream.
i32UdpPortDestinationUDP Client port to use.
saryIpAddressesArray of IP addresses (in dot format) to stream too.
i64OptoMMPAddressIf not default, the OptoMMP address to use.
i32LengthOfStreamLength of the non-default OptoMMP area to use.
Returns
0 for successful, negative for error, check with LogErrorInformation().
int OptoMMP2.OptoMMP.WriteDateTime ( string  sDateTime)

Write the Date-Time String to the IO Unit.

The string format must be in this form, 'YYYY-MM-DD HH:MM:SS.00'.

Parameters
sDateTimeString with the date time to set.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalEnableorDisableCounter64 ( int  i32PointNumber,
bool  bActivate 
)

Enable or disable a digital counter, 64-point rack.

This method does not cache data.

This method only works with the 64-point I/O unit properties.

Parameters
i32PointNumberThe point number, 0 through 63.
bActivateWhen true, activates the counter.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalEnableorDisableCounters64 ( long  i64ActivateBitMask,
long  i64DeactivateBitMask 
)

Enable or disable a bank of counters in the 64-point rack.

This method does not cache data.

Warning. Enabling or disabling a counter at the same time has unpredictable results.

This method only works with the 64-point I/O unit properties.

Parameters
i64ActivateBitMaskBitmask to enable a counter. A bit value of one enables a counter.
i64DeactivateBitMaskBitmask to disable a counter. A bit value of one disables a counter.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalEnableorDisableCounters64 ( bool[]  baryActivate,
bool[]  baryDeactivate,
int  i32StartIndex 
)

Enable or Disable All 64 Digital Counters From Boolean Arrays

Parameters
baryActivateBoolean array to activate counters, length must be at least i32StartIndex + 64.
baryDeactivateBoolean array to deactivate counters, length must be at least i32StartIndex + 64.
i32StartIndexStarting index to retrieve states from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalPointConfiguration64 ( int  i32PointNumber,
bool  bOutput,
eDigitalFeature  eFeature,
bool  bEnableWatchdog,
bool  bWatchdogValue 
)

Write the digital point configuration.

Parameters
i32PointNumberPoint Number 0 to 63.
bOutputFor digital outputs, set true.
eFeatureDigital Feature To Set. If no feature, select None.
bEnableWatchdogEnable the communication watchdog.
bWatchdogValueThe state when the communication watchdog trigges, true is "on".
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalState64 ( int  i32PointNumber,
bool  bOn 
)

Set a single state of a 4-channel digital output, 64-point rack.

This method does not cache data.

The digital output must be configured before the output will turn on.

This method only works with the 64-point I/O unit properties.

Parameters
i32PointNumberDigital point number to set, 0 through 63.
bOnTrue, turns the output on, false turns the output off.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalStates64 ( long  i64StateBitMask)

Sets all of the 4-channel digital states in the 64-point rack.

The digital output must be configured before the output will turn on.

This method only works with the 64-point I/O unit properties.

Parameters
i64StateBitMask64-bit bitmask of states, a bit value of 1 is on, 0 is off.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalStates64 ( ref bool[]  baryStates,
int  i32StartIndex 
)

Write All 64 Digital States Using A Boolean Array.

The boolean array arguments must be at least i32StartIndex + 64 in length.

Parameters
baryStatesArray of states, true is on, false is off.
i32StartIndexStarting index of the array to begin using states.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalStatesMoMo64 ( long  i64OnMask,
long  i64OffMask 
)

Writes All 64 Digital States From "Must-On/Must-Off" (MoMo) Bit Masks

Parameters
i64OnMaskThe points to be forced on. Bit value of 1 turns on, 0 leaves point state unaffected.
i64OffMaskThe points to be forced off. Bit value of 1 turns off, 0 leaves point state unaffected.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteDigitalStatesMoMo64 ( bool[]  baryOnStates,
bool[]  baryOffStates,
int  i32StartIndex 
)

Writes All 64 Digital States From "Must-On/Must-Off" (MoMo) Boolean Arrays

Parameters
baryOnStatesThe points to be forced on. True turns on, false leaves point state unaffected.
baryOffStatesThe points to be forced off. True turns off, false leaves point state unaffected.
i32StartIndexStarting index to read states from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteFOrCStatus ( bool  bIsFahrenheit)

Force Brain to Report Temperature as Celsius or Fahrenheit

Temperature values should not be read within 1 to 3 seconds of this method. Reading too early may report the wrong temperature value. If you have an application that has to change temperature scale often or requires different temperature scale, do not constantly use this method due to update latency. Consider reading the temperature values in a constant setting and performing the conversions in your application.

Parameters
bIsFahrenheitTrue sets the brain to report Fahrenheit, False, Celsius.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteHighDensityDigitalStates ( int  i32StartModule,
int  i32EndModule,
bool[]  baryStates,
int  i32StartIndex 
)

Write High-Density Digital States, Module by Module Using A Boolean Array

Parameters
i32StartModuleStarting module number, values 0 through 15.
i32EndModuleLast module to write, values 0 through 15 (must be equal or higher to i32StartModule).
baryStatesArray of boolean states. Needs to be (i32EndModule - i32StartModule + 1) * 32 + i32ArrayStartIndex in length.
i32StartIndexStarting index in the boolean array retrieve states to be written.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteHighDensityDigitalStates ( int  i32StartModule,
int  i32EndModule,
int[]  i32aryStates,
int  i32StartIndex 
)

Write High-Density Digital States, Module by Module Using A Bitmask Array

Parameters
i32StartModuleStarting module number, values 0 through 15.
i32EndModuleLast module to write, values 0 through 15 (must be equal or higher to i32StartModule).
i32aryStatesArray of integer bit states. Needs to be (i32EndModule - i32StartModule + 1) + i32StartIndex in length.
i32StartIndexStarting index in the boolean array retrieve states to be written.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteInts ( long  i64MmpAddress,
int  i32Length,
int[]  i32aryInts,
int  i32StartingIndex 
)

Write a block of 32-bit integers to a specific Opto MMP Address.

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 256.

Parameters
i64MmpAddressStarting Opto MMP Address.
i32LengthLength of 32-bit integers to write.
i32aryIntsArray of 32-bit integers.
i32StartingIndexStarting index of the i32aryInts table to write from.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteLocalDateTime ( )

Write Local Date-Time To The IO Unit.

The PC's local date-time will be written to the I/O unit.

Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteLongs ( long  i64MmpAddress,
int  i32Length,
long[]  i64aryLongs,
int  i32StartingIndex 
)

Write a block of longs (64-bit signed values) to the Opto MMP Device.

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 128 64-bit values.

Parameters
i64MmpAddressOpto MMP Address.
i32LengthQuantity of longs to write.
i64aryLongsArray of longs to write.
i32StartingIndexStarting index of i64aryLongs to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.WritePid ( Int32  i32PidIndex,
stPid  PidData,
ePidWriteOptions  eWriteOption 
)

Write Pid (configure all or individual parameters [one at a time] of a PID)

This method does not support the SNAP-PID-V (a legacy product).

Parameters
i32PidIndexThe index of the PID.
PidDataThe data to modify the PID with.
eWriteOptionThe selected write to perform.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WritePointConfiguration64 ( int  i32PointNumber,
int  i32PointType 
)

Write Analog Point configuration in 64 Point Area.

Sets only the point area. This is useful for setting just the point types, like when reading linearized thermocouples (scaling not required), an alternate input range on an analog input, or setting a 4-channel digital point as an input or output (no features needed).

Parameters
i32PointNumberPoint Number, 0 to 63.
i32PointTypeThe point type.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.WritePulseOnOffTime ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
Single  f32OnTime,
Single  f32OffTime 
)

Update a "time" configured pulse's on-time and off-time. Pulse must have been configured with either ConfigureContinuousPulsesTime() or ConfigureNPulsesTime() or unpredictable results will occur (even with a valid method result code).

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Discrete output index.
f32OnTimeNew on-time value in seconds.
f32OffTimeNew off-time value in seconds.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.WritePulsePercentage ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
Single  f32Percent 
)

Write pulse percentage. Useful for continuous pulse trains... for example, time-proprotional outputs (e.g. heater applications).

Values less than 0.0 are treated as zero. Values above 100.0 are treated as 100.0.

The specified TPO must have been set using ConfigureContinuousPulsesDuration() or ConfigureNPulsesDuration(). Otherwise, the result of f32Percent is unpredictable even with a successful result code.

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Index for the 64 or 512 point model index for the specific discrete output used.
f32PercentPercentage to set the continuous pulse train.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
Int32 OptoMMP2.OptoMMP.WritePulsePeriod ( IoModel  eIoModelOfPointIndex,
Int32  i32PointIndex64or512,
Single  f32Period 
)

Write the pulse period.

The specified TPO must have been set using ConfigureContinuousPulsesDuration() or ConfigureNPulsesDuration() or the result of this operation is unpredictable.

Parameters
eIoModelOfPointIndexSpecifies the which model (64- or 512-point) the point index represents.
i32PointIndex64or512Index for the 64 or 512 point model index for the specific discrete output used.
f32PeriodPulse period in seconds.
Returns
0 is successful, negative values are faults. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteScannerFlags ( int  i32ScannerFlags)

Write the scanner flags to the OptoMMP device.

These parameters must be stored to flash. The device should also be rebooted for the flags to take effect.

Added April 30, 2010.

Parameters
i32ScannerFlagsBit packed array to write to location.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteSerialModuleConfiguration ( int  i32PortNumber,
int  i32TcpPort,
int  i32BaudRate,
SerialParity  eParity,
byte  byDataBits,
byte  byStopBits,
bool  bHardwareFlowControl,
bool  bTestMessage,
int  i32Eom,
bool  b4WireMode 
)

Write the Serial Port Configuration. Only for Module based Serial Ports.

Parameters
i32PortNumberSerial port number to write too, values 0 through 31. See GetSerialOrSsiPortIndexFromModuleAndChannel().
i32TcpPortTCP/IP Service port this serial port is associated too.
i32BaudRateBaud rate of the serial port.
eParityParity enumeration the port.
byDataBitsNumber of Data Bits.
byStopBitsNumber of Stop Bits.
bHardwareFlowControlHardware Flow Control.
bTestMessagePowerup Test Message.
i32Eom32-bit Value of End-Of-Message.
b4WireModeTwo or Four-Wire Mode (for 485/422 serial modules).
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteSingles ( long  i64MmpAddress,
int  i32Length,
Single[]  f32arySingles,
int  i32StartingIndex 
)

Write a block of Singles to the Opto MMP Device.

There are many areas this toolkit does not support with a direct method. Use this method to access these areas.

The maximum number of elements that may be transferred is 256.

Parameters
i64MmpAddressOpto MMP Address.
i32LengthQuantity of Singles to write.
f32arySinglesArray of singles to write.
i32StartingIndexStarting index of f32arySingles to write.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteSsiModuleConfiguration ( int  i32PortNumber,
int  i32FrameSize,
float  f32ClockSpeedkHz,
float  f32InterFrameTimeUs,
int  i32MsbOffset,
int  i32DataBits,
int  i32ErrorBitOffset,
bool  bErrorBitLowIsError,
eDataCode  eCoding,
bool  bEnabled 
)

Writes the SSI Module configuration

This function requires SNAP-PAC firmware R8.5C or later.

Parameters
i32PortNumberThe SSI module port number, values range from 0 to 31. See GetSerialOrSsiPortIndexFromModuleAndChannel().
i32FrameSizeLength of the entire data frame in bits.
f32ClockSpeedkHzFrequency of the transducer (in kHz).
f32InterFrameTimeUsTime between data frames (in microseconds).
i32MsbOffsetLocation of the data MSB in the data frame. Starts from zero.
i32DataBitsLocation of the data bit in the frame. Starts from clock zero.
i32ErrorBitOffsetLocation of the error bit in the frame. Starts from clock zero.
bErrorBitLowIsErrorActive status of the error bit.
eCodingEncoding of the transducer.
bEnabledEnables the brain to scan the SNAP-SCM-SSI module.
Returns
-1 for any error, check extended error status.
int OptoMMP2.OptoMMP.WriteStatusCommand ( StatusWriteCommand  eCommand)

Writes a Status Command to Opto MMP Address 0xffff f038 0000 (see Opto 22 Form 1465, Section "Status Area Write - Read/Write")

When using command type ResetHardware, the device will physically reboot. If you are using a TCPIP connection, it will be severed, close this session after this method returns.

Some commands like StoreToFlash and EraseFlash will take up to 5 seconds to complete. Update the timeout accordingly.

Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.
int OptoMMP2.OptoMMP.WriteStrategyStreaming ( string  sCommHandle,
Single  fInterval,
int  i32Objects,
bool  bStoreToFlash 
)

Write the "Strategy Streaming" Config.

Only used on SNAP-PAC-R controllers running the "streaming strategy" for additional I/O streaming capabilities.

Parameters
sCommHandleComm handle where to stream too. Handle looks like "udp:10.192.0.7:5002".
fIntervalTime interval in seconds to stream.
i32ObjectsBitmask of data objects to stream.
bStoreToFlashWhen true, store these parameters to non-volatile memory.
Returns
0 for successful, negative for error, check with LogErrorInformation().
int OptoMMP2.OptoMMP.WriteWatchdogTime ( int  i32WatchdogTimeMs)

Set the Communication Watchdog Timeout of the IO unit.

The only method an application may detect a timeout (or possibly the I/O unit resetting) is to configure a 4-channel digital output and turn it on. Should it go off, this would indicate a communication watchdog event or a power-cycling reset event.

Parameters
i32WatchdogTimeMsTime in milliseconds to set the timeout value.
Returns
0 is OK, negative numbers imply an error occurred. See GetExtendedErrorInformation() for more information.

Member Data Documentation

const Int32 OptoMMP2.OptoMMP.i32cMaximumPulseObjects = 512

SNAP-PAC-R1/2 and SNAP-PAC-EB1/2 have 512 pulse objects available.


The documentation for this class was generated from the following file: