Skip to content
Guilherme Francescon edited this page Jul 9, 2018 · 3 revisions

For a 1.0 version, a discussion was started at #41 about what are the current needs and problems, and about how we'll do everything.

A major refactor of the source code is needed, splitting the module in mainly three different blocks:

  • S7 Protocol
  • Address translation
  • API

Regardless of which component, the development should consider the following points

  • Documentation: The code should be well documented. Consider using something like jsdoc or readthedocs.io
  • Testing: It should be possible and easy to write test, trying to assure some code quality. In the future we can even consider putting everything into a CI environment
  • ES6 / ESM: Use modern flavors of javascript development. Maybe use something like babel to be backwards compatible
  • whatelse?

S7 Protocol

Protocols encapsulation

This would handle all the low-level communication, being able to parse and serialize all the protocols involved (ISO-on-TCP, TPKT, COTP, and the S7 protocol itselt). Use (transform) streams to better handle packet splitting.

Address translation

This component must be designed in an exchangeable way, so we can develop different schema to translate to PLC memory areas. This could be useful in the following ways:

  • Provide a more direct way to interact with Logo8 PLCs, where an address translation to a VM area must be manually done
  • Provide different syntaxes, e.g. a step7-like DB1.DBX0.0 instead of DB1,X0.0
  • Provide the component in a stand-alone way, so it can be used for syntax validation in UIs

API

This should contain the rest of the logic of today's nodeS7. Some desired characteristics:

  • Should be a class that independently represents a connection to a PLC (no global configurations)
  • Should handle the connection to the PLC, reconnecting when the connection is lost (configurable)
  • Should be an EventEmitter (for status only - connected, disconnected, reconnected, error)
  • Should do the optimizations done today for readAllItems where applicable
  • Should be able to implement other functions, like CPU control, Block listting/download, a.s.o. - Maybe we need another layer of abstraction here, e.g. to ensure max in-transit packets, max PDU size, command queue, etc.

Open points

  • Library for logging? NODE_DEBUG?

Wishlist

The following items are to be implemented in the following 1.x versions

  • Add missing types and aliases (#3)
  • Errorcode and text instead of "BAD255"
  • Testing / Continuous Integration
Clone this wiki locally