Processimage synchronisation via Modbus/TCP.
This device is derived from the signal based sDevice to read and write line levels via ethernet using the Modbus/TCP protocol; see also the Modbus Organization.
When configured as master, the mbDevice initiates commucation with a specified list of slaves in order to retrieve input line levels and to set output line levels. The latter are locally buffered and are propagated to the event-based interface inherited via the base class sDevice. When configured as slave, the mbDevice accepts connections from any Modbus master, will response to their request sand update the local line-level buffer accordingly.
Further dedatils on the configuration, incl. an example, are provided by the ModbusDevice user-reference
Technical details.
- The mbDevice slave implements reading and writing bits/coils/registers/holding registers, incl. the multi-read/write variants; regardless which commads you use, they all refer to the one process image implicitly defined by the event configuration.
- The mbDevice matser usees the commands read multiple bits and write multiple coils for process image synchonisation.
- All network communication come with quite relaxed timeouts. Please let us know, if you require more strict timeout behaviour.
- Network communication is currently implemented synchronous with the edge detection background task; this is restrictive and may be changed in future revisions.
- Communication uses an additional line-level buffer; a better solution would be to share the line buffer with the sDevice; however, this is not supported by the current sDevice interface.
- Programatic configuration is still incomplete.
- The mbDevice compiles with MinGW/Windows, however, it was not properly tested in this configuration; please let us know, if you plan to use mbDevice in a Windows context.
Note: This device must be explicitely enabled in Makefile.plugin.
Definition at line 72 of file iop_modbus.h.
|
| mbDevice (void) |
| Default constructor. More...
|
|
| mbDevice (const mbDevice &) |
| Copy constructor (not implemented!) More...
|
|
virtual | ~mbDevice (void) |
| Explicit destructor. More...
|
|
virtual void | Clear (void) |
| Clear all configuration (implies Stop) More...
|
|
virtual void | Compile (void) |
| Compile to internal data-structures. More...
|
|
void | AppendRemoteOutputs (int mbid, int mbaddr, int cnt, int fdaddr) |
| Append remotely implemented outputs. More...
|
|
void | AppendRemoteInputs (int mbid, int mbaddr, int cnt, int fdaddr) |
| Append remotely implemented inputs. More...
|
|
void | SlaveAddress (const std::string &rAddr) |
| Set server address of this node. More...
|
|
virtual void | Start (void) |
| Activate the device. More...
|
|
virtual void | Stop (void) |
| Deactivate the device. More...
|
|
| sDevice (void) |
| Default constructor. More...
|
|
| sDevice (const sDevice &rOtherDevice) |
| copy-constructor More...
|
|
virtual | ~sDevice (void) |
| Explicit destructor. More...
|
|
void | InsInputEvent (const std::string &event) |
| Insert event as input event. More...
|
|
void | AppendTrigger (const std::string &event, const Trigger &trigger) |
| Add a trigger condition. More...
|
|
void | InsOutputEvent (const std::string &event) |
| Insert event as output event. More...
|
|
void | AppendAction (const std::string &event, const Action &action) |
| Add an action. More...
|
|
int | MaxBitAddress (void) const |
| Report max bit address. More...
|
|
virtual void | Reset (void) |
| Clear dynamic data and restart device. More...
|
|
virtual void | WriteOutput (Idx output) |
| Run output command. More...
|
|
void | WriteSignal (int bitaddr, bool value) |
| Set output signal. More...
|
|
bool | ReadSignal (int bitaddr) |
| Get input signal. More...
|
|
virtual int | CycleTime () const |
| Report cycle time. More...
|
|
virtual void | CycleTime (int cycleTime) |
| Set cycle time. More...
|
|
| vDevice (void) |
| Default constructor. More...
|
|
virtual | ~vDevice (void) |
| Explicit destructor. More...
|
|
void | Name (const std::string &rName) |
| Set the device name. More...
|
|
const std::string & | Name (void) const |
| Get device name. More...
|
|
void | Tolerance (Time::Type maxgap) |
| Set tolerance for time synchonisation. More...
|
|
Time::Type | Tolerance (void) |
| Get tolerance. More...
|
|
virtual void | TimeScale (unsigned int scale) |
| Set timescale. More...
|
|
virtual int | TimeScale (void) |
| Get timescale. More...
|
|
virtual void | Configure (Idx event, const AttributeDeviceEvent &attr) |
| Insert/edit input or output configuration. More...
|
|
virtual void | Configure (const EventSet &rPhysicalEvents) |
| Configure by alphabet. More...
|
|
virtual const EventSet & | Outputs (void) const |
| Get outputs as plain set. More...
|
|
virtual const EventSet & | Inputs (void) const |
| Get inputs as plain set. More...
|
|
virtual bool | ResetRequest (void) |
| A device may ask for a reset by returning true for ResetRequest(). More...
|
|
virtual DeviceState | Status (void) |
| Get status. More...
|
|
virtual std::string | StatusString (void) |
| Get status as infromal string. More...
|
|
virtual void | FlushOutputs (void) |
| Flush pending IO Operations. More...
|
|
virtual Idx | ReadInput (void) |
| Read sensed input events. More...
|
|
virtual Idx | PeekInput (void) |
| Peek for sensed events. More...
|
|
virtual bool | InputReady (void) |
| Report whether a input-event is ready. More...
|
|
virtual bool | WaitInputs (Time::Type duration) |
| Wait for input trigger. More...
|
|
virtual bool | WaitInputsMs (long int duration) |
| Wait for input trigger. More...
|
|
virtual Time::Type | CurrentTime (void) |
| Report physical time in ftu. More...
|
|
virtual long int | CurrentTimeMs (void) |
| Report physical time in ms. More...
|
|
virtual void | CurrentTime (Time::Type now) |
| Set physical time in ftu. More...
|
|
virtual void | CurrentTimeMs (long int nowms) |
| Set physical time in ms. More...
|
|
virtual faudes_systime_t | FtuToSystemTime (Time::Type duration) |
| Convert faudes time unit duration to system time. More...
|
|
void | UseCondition (faudes_mutex_t *wmutex, faudes_cond_t *wcond) |
| Tell the device which condition to use for waiting. More...
|
|
void | UseBuffer (faudes_mutex_t *bmutex, std::deque< Idx > *bbuffer) |
| Tell the device which buffer to use for inputs. More...
|
|
virtual std::string | EStr (Idx ev) |
| Convenience method. More...
|
|
SampledDensityFunction | Performance (void) |
| Get performance (need compiletime option) More...
|
|
void | ResetPerformance (void) |
| Clear performance (need compiletime option) More...
|
|
void | WritePerformance (void) |
| Convenience method. More...
|
|
| Type (void) |
| Constructor. More...
|
|
| Type (const Type &rType) |
| Copy constructor. More...
|
|
virtual | ~Type (void) |
| Destructor. More...
|
|
virtual Type * | New (void) const |
| Construct on heap. More...
|
|
virtual Type * | Copy (void) const |
| Construct on heap. More...
|
|
virtual const Type * | Cast (const Type *pOther) const |
| Cast other object to this type. More...
|
|
virtual Type & | Assign (const Type &rSrc) |
| Assign configuration data from other object. More...
|
|
virtual Type & | operator= (const Type &rSrc) |
| Assign configurationdata from other object. More...
|
|
virtual bool | Equal (const Type &rOther) const |
| Test equality of configuration data. More...
|
|
virtual bool | operator== (const Type &rOther) const |
| Test equality of configuration data. More...
|
|
virtual bool | operator!= (const Type &rOther) const |
| Test equality of configuration data. More...
|
|
virtual const std::string & | TypeName (void) const |
| Get objects's type name. More...
|
|
void | Write (const Type *pContext=0) const |
| Write configuration data to console. More...
|
|
void | Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const |
| Write configuration data to a file. More...
|
|
void | Write (const std::string &pFileName, std::ios::openmode openmode) const |
| Write configuration data to a file. More...
|
|
void | Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data to TokenWriter. More...
|
|
virtual void | XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data to an XML file. More...
|
|
void | XWrite (const Type *pContext=0) const |
| Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
|
|
void | XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data in XML format to TokenWriter. More...
|
|
std::string | ToString (const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data to a string. More...
|
|
std::string | ToText (const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data to a formated string. More...
|
|
void | DWrite (const Type *pContext=0) const |
| Write configuration data to console, debugging format. More...
|
|
void | DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const |
| Write configuration data to a file, debugging format. More...
|
|
void | DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data in debug format to TokenWriter. More...
|
|
void | SWrite (TokenWriter &rTw) const |
| Write statistics comment to TokenWriter. More...
|
|
void | SWrite (void) const |
| Write statistics comment to console. More...
|
|
std::string | ToSText (void) const |
| Write statistics to a string. More...
|
|
void | Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0) |
| Read configuration data from file with label specified. More...
|
|
void | FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0) |
| Read configuration data from a string. More...
|
|
void | Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
| Read configuration data from TokenReader with label sepcified. More...
|
|
|
virtual bool | DoReadSignalsPre (void) |
| IO Hook, inputs. More...
|
|
virtual void | DoReadSignalsPost (void) |
| IO Hook, inputs. More...
|
|
virtual bool | DoReadSignal (int bitaddr) |
| Get input signal. More...
|
|
virtual bool | DoWriteSignalsPre (void) |
| IO Hook, outputs. More...
|
|
virtual void | DoWriteSignalsPost (void) |
| IO Hook, outputs. More...
|
|
virtual void | DoWriteSignal (int bitaddr, bool value) |
| Set output signal. More...
|
|
virtual void | DoLoopCallback (void) |
| Loop hook. More...
|
|
void | DoReadPreface (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
| Read non-event-related configuration data from tokenreader. More...
|
|
void | DoWritePreface (TokenWriter &rTw, const std::string &rLabel, const Type *pContext) const |
| Write non-event-related configuration data to tokenreader. More...
|
|
int | MbFlushBuffers (void) |
| I/O helper. More...
|
|
int | MbSendRequest (int id) |
|
int | MbReceiveResponse (void) |
|
int | MbReceiveRequest (int mastersock) |
|
int | MbSendResponse (int mastersock) |
|
void | DoWritePreface (TokenWriter &rTw, const std::string &rLabel, const Type *pContext=0) const |
| Writes non-event-related configuration to TokenWriter. More...
|
|
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Token output, see Type::Write for public wrappers. More...
|
|
virtual void | DoWriteConfiguration (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Writes event-configuration to TokenWriter. More...
|
|
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
| Token input, see Type::DRead for public wrappers. More...
|
|
virtual void | DoReadConfiguration (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
| Reads event-configuration data from TokenReader. More...
|
|
virtual long int | FtuToMs (Time::Type faudes_time) |
| convert duration from fauDES-time units to ms More...
|
|
virtual Time::Type | MsToFtu (long int real_time) |
| convert duration in ms to faudes-time units More...
|
|
void | DoAssign (const Type &rSrc) |
| Assign configuration data from other object. More...
|
|
bool | DoEqual (const Type &rOther) const |
| Test equality of configuration data. More...
|
|
virtual void | DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data of this object to TokenWriter in XML format. More...
|
|
virtual void | DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
| Write configuration data in debugging format to TokenWriter. More...
|
|
virtual void | DoSWrite (TokenWriter &rTw) const |
| Write statistical data as a comment to TokenWriter. More...
|
|
virtual const TypeDefinition * | TypeDefinitionp (void) const |
| Get objects's type definition. More...
|
|
virtual Token | XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const |
|