Logo¶
-
class
snap7.logo.
Logo
[source]¶ A snap7 Siemens Logo client: There are two main comfort functions available
Logo.read()
andLogo.write()
. This functions realize a high level access to the VM addresses of the Siemens Logo just use the form:Notes
V10.3 for bit values V10 for the complete byte VW12 for a word (used for analog values) For more information see examples for Siemens Logo 7 and 8
-
connect
(ip_address: str, tsap_snap7: int, tsap_logo: int, tcpport: int = 102) → int[source]¶ Connect to a Siemens LOGO server.
Notes
Howto setup Logo communication configuration see: https://snap7.sourceforge.net/logo.html
Parameters: - ip_address – IP ip_address of server
- tsap_snap7 – TSAP SNAP7 Client (e.g. 10.00 = 0x1000)
- tsap_logo – TSAP Logo Server (e.g. 20.00 = 0x2000)
Returns: Error code from snap7 library.
-
db_read
(db_number: int, start: int, size: int) → bytearray[source]¶ This is a lean function of Cli_ReadArea() to read PLC DB.
Parameters: - db_number – for Logo only DB=1
- start – start address for Logo7 0..951 / Logo8 0..1469
- size – in bytes
Returns: Array of bytes
-
db_write
(db_number: int, start: int, data: bytearray) → int[source]¶ Writes to a DB object.
Parameters: - db_number – for Logo only DB=1
- start – start address for Logo7 0..951 / Logo8 0..1469
- data – bytearray
Returns: Error code from snap7 library.
-
get_connected
() → bool[source]¶ Returns the connection status
Notes
- This function has a bug, that returns True when the connection
- is lost. This comes from the original snap7 library.
Returns: True if connected.
-
get_param
(number) → int[source]¶ Reads an internal Logo object parameter.
Parameters: number – Parameter type number Returns: Parameter value
-
read
(vm_address: str)[source]¶ Reads from VM addresses of Siemens Logo. Examples: read(“V40”) / read(“VW64”) / read(“V10.2”)
Parameters: vm_address – of Logo memory (e.g. V30.1, VW32, V24) Returns: integer
-
set_connection_params
(ip_address: str, tsap_snap7: int, tsap_logo: int)[source]¶ Sets internally (IP, LocalTSAP, RemoteTSAP) Coordinates.
Notes
This function must be called just before Cli_Connect().
Parameters: - ip_address – IP ip_address of server
- tsap_snap7 – TSAP SNAP7 Client (e.g. 10.00 = 0x1000)
- tsap_logo – TSAP Logo Server (e.g. 20.00 = 0x2000)
Raises: ValueError
– if the ip_address is not an IPV4.ValueError
– if the snap7 error code is diferent from 0.
-
set_connection_type
(connection_type: int)[source]¶ - Sets the connection resource type, i.e the way in which the Clients
- connects to a PLC.
Parameters: connection_type – 1 for PG, 2 for OP, 3 to 10 for S7 Basic Raises: ValueError
– if the snap7 error code is diferent from 0.
-