本文整理汇总了Python中pymodbus.device.ModbusDeviceIdentification.VendorUrl方法的典型用法代码示例。如果您正苦于以下问题:Python ModbusDeviceIdentification.VendorUrl方法的具体用法?Python ModbusDeviceIdentification.VendorUrl怎么用?Python ModbusDeviceIdentification.VendorUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodbus.device.ModbusDeviceIdentification
的用法示例。
在下文中一共展示了ModbusDeviceIdentification.VendorUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_dbstore_update_server
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def run_dbstore_update_server():
# ----------------------------------------------------------------------- #
# initialize your data store
# ----------------------------------------------------------------------- #
block = ModbusSequentialDataBlock(0x00, [0] * 0xff)
store = SqlSlaveContext(block)
context = ModbusServerContext(slaves={1: store}, single=False)
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification()
identity.VendorName = 'pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'pymodbus Server'
identity.ModelName = 'pymodbus Server'
identity.MajorMinorRevision = '2.2.0'
# ----------------------------------------------------------------------- #
# run the server you want
# ----------------------------------------------------------------------- #
time = 5 # 5 seconds delay
loop = LoopingCall(f=updating_writer, a=(context,))
loop.start(time, now=False) # initially delay by time
loop.stop()
StartTcpServer(context, identity=identity, address=("", 5020))
示例2: modbus_master
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def modbus_master(module, properties):
log.debug('Modbus master module : ' + str(module))
# Modbus Master
#--------------------------------------------------------------------------#
# initialize your data store
#--------------------------------------------------------------------------#
store = ModbusSlaveContext(
co = ModbusSequentialDataBlock(0, [0]*100),
hr = ModbusSequentialDataBlock(0, [0]*100))
context = ModbusServerContext(slaves=store, single=True)
#--------------------------------------------------------------------------#
# initialize the server information
#--------------------------------------------------------------------------#
identity = ModbusDeviceIdentification()
identity.VendorName = 'ASO+AKO'
identity.ProductCode = 'DYODE'
identity.VendorUrl = 'yoloswag'
identity.ProductName = 'DYODE'
identity.ModelName = 'BSides LV release'
identity.MajorMinorRevision = '0.9'
#--------------------------------------------------------------------------#
# run the server you want
#--------------------------------------------------------------------------#
time = 1 # 5 seconds delay
loop = LoopingCall(f=modbus_master_update, a=(module, properties, context))
loop.start(time, now=False) # initially delay by time
StartTcpServer(context, identity=identity, address=("0.0.0.0", \
properties['port_out']))
示例3: main
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def main():
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [0]*100),
co = ModbusSequentialDataBlock(0, [0]*100),
hr = ModbusSequentialDataBlock(0, [0]*100),
ir = ModbusSequentialDataBlock(0, [0]*100))
context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/simplyautomationized'
identity.ProductName = 'pymodbus Server'
identity.ModelName = 'pymodbus Server'
identity.MajorMinorRevision = '1.0'
time = 5 # 5 seconds delaytime = 5 # 5 seconds delay
writer = LoopingCall(read_context,a=(context,))
loop = LoopingCall(updating_writer, a=(context,))
loop.start(.5) # initially delay by time
writer.start(.1)
StartTcpServer(context, identity=identity)#, address=("localhost", 502))
#cleanup async tasks
temp.setEnabled(False)
loop.stop()
writer.stop()
GPIO.cleanup()
示例4: run_updating_server
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def run_updating_server():
# ----------------------------------------------------------------------- #
# initialize your data store
# ----------------------------------------------------------------------- #
store = ModbusSlaveContext(
di=ModbusSequentialDataBlock(0, [17]*100),
co=ModbusSequentialDataBlock(0, [17]*100),
hr=ModbusSequentialDataBlock(0, [17]*100),
ir=ModbusSequentialDataBlock(0, [17]*100))
context = ModbusServerContext(slaves=store, single=True)
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification()
identity.VendorName = 'pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'pymodbus Server'
identity.ModelName = 'pymodbus Server'
identity.MajorMinorRevision = '2.2.0'
# ----------------------------------------------------------------------- #
# run the server you want
# ----------------------------------------------------------------------- #
time = 5 # 5 seconds delay
loop = LoopingCall(f=updating_writer, a=(context,))
loop.start(time, now=False) # initially delay by time
StartTcpServer(context, identity=identity, address=("localhost", 5020))
示例5: run_custom_db_server
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def run_custom_db_server():
# ----------------------------------------------------------------------- #
# initialize your data store
# ----------------------------------------------------------------------- #
block = CustomDataBlock([0]*100)
store = ModbusSlaveContext(di=block, co=block, hr=block, ir=block)
context = ModbusServerContext(slaves=store, single=True)
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification()
identity.VendorName = 'pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'pymodbus Server'
identity.ModelName = 'pymodbus Server'
identity.MajorMinorRevision = '2.2.0'
# ----------------------------------------------------------------------- #
# run the server you want
# ----------------------------------------------------------------------- #
# p = Process(target=device_writer, args=(queue,))
# p.start()
StartTcpServer(context, identity=identity, address=("localhost", 5020))
示例6: ServerThread
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def ServerThread(e):
global server
# Configure the service logging
#import logging
#logging.basicConfig()
#log = logging.getLogger()
#log.setLevel(logging.DEBUG)
# Initialize your data store
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [17]*100),
co = ModbusSequentialDataBlock(0, [17]*100),
hr = ModbusSequentialDataBlock(0, [17]*100),
ir = ModbusSequentialDataBlock(0, [17]*100))
context = ModbusServerContext(slaves=store, single=True)
# Initialize the server information
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'Pymodbus Server'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.0'
# Run the server
# StartTcpServer(context, identity=identity, address=(args.ip, 502))
server = ModbusTcpServer(context, identity=identity, address=(ip, 502))
print 'Server started'
server.serve_forever(0.1)
print 'Server stopped'
示例7: identity_factory
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def identity_factory():
identity = ModbusDeviceIdentification()
identity.VendorName = 'pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/andreadanzi/pymodbus/'
identity.ProductName = 'pymodbus Pump Server'
identity.ModelName = 'pymodbus Pump Server'
identity.MajorMinorRevision = '1.0'
示例8: run_server
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def run_server():
# ----------------------------------------------------------------------- #
# initialize your data store
# ----------------------------------------------------------------------- #
store = ModbusSlaveContext()
context = ModbusServerContext(slaves=store, single=True)
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/riptideio/pymodbus/'
identity.ProductName = 'Pymodbus Server'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.5'
# ----------------------------------------------------------------------- #
# Add an example which is long enough to force the ReadDeviceInformation
# request / response to require multiple responses to send back all of the
# information.
# ----------------------------------------------------------------------- #
identity[0x80] = "Lorem ipsum dolor sit amet, consectetur adipiscing " \
"elit. Vivamus rhoncus massa turpis, sit amet " \
"ultrices orci semper ut. Aliquam tristique sapien in " \
"lacus pharetra, in convallis nunc consectetur. Nunc " \
"velit elit, vehicula tempus tempus sed. "
# ----------------------------------------------------------------------- #
# Add an example with repeated object IDs. The MODBUS specification is
# entirely silent on whether or not this is allowed. In practice, this
# should be assumed to be contrary to the MODBUS specification and other
# clients (other than pymodbus) might behave differently when presented
# with an object ID occurring twice in the returned information.
#
# Use this at your discretion, and at the very least ensure that all
# objects which share a single object ID can fit together within a single
# ADU unit. In the case of Modbus RTU, this is about 240 bytes or so. In
# other words, when the spec says "An object is indivisible, therefore
# any object must have a size consistent with the size of transaction
# response", if you use repeated OIDs, apply that rule to the entire
# grouping of objects with the repeated OID.
# ----------------------------------------------------------------------- #
identity[0x81] = ['pymodbus {0}'.format(pymodbus_version),
'pyserial {0}'.format(pyserial_version)]
# ----------------------------------------------------------------------- #
# run the server you want
# ----------------------------------------------------------------------- #
# Tcp:
StartTcpServer(context, identity=identity, address=("localhost", 5020))
示例9: run_payload_server
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def run_payload_server():
# ----------------------------------------------------------------------- #
# build your payload
# ----------------------------------------------------------------------- #
builder = BinaryPayloadBuilder(byteorder=Endian.Little,
wordorder=Endian.Little)
builder.add_string('abcdefgh')
builder.add_bits([0, 1, 0, 1, 1, 0, 1, 0])
builder.add_8bit_int(-0x12)
builder.add_8bit_uint(0x12)
builder.add_16bit_int(-0x5678)
builder.add_16bit_uint(0x1234)
builder.add_32bit_int(-0x1234)
builder.add_32bit_uint(0x12345678)
builder.add_32bit_float(22.34)
builder.add_32bit_float(-22.34)
builder.add_64bit_int(-0xDEADBEEF)
builder.add_64bit_uint(0x12345678DEADBEEF)
builder.add_64bit_uint(0xDEADBEEFDEADBEED)
builder.add_64bit_float(123.45)
builder.add_64bit_float(-123.45)
# ----------------------------------------------------------------------- #
# use that payload in the data store
# ----------------------------------------------------------------------- #
# Here we use the same reference block for each underlying store.
# ----------------------------------------------------------------------- #
block = ModbusSequentialDataBlock(1, builder.to_registers())
store = ModbusSlaveContext(di=block, co=block, hr=block, ir=block)
context = ModbusServerContext(slaves=store, single=True)
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'Pymodbus Server'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.5'
# ----------------------------------------------------------------------- #
# run the server you want
# ----------------------------------------------------------------------- #
StartTcpServer(context, identity=identity, address=("localhost", 5020))
示例10: __init__
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def __init__(self, address, port = MODBUS_PORT):
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [0]*100),
co = ModbusSequentialDataBlock(0, [0]*100),
hr = ModbusSequentialDataBlock(0, [0]*100),
ir = ModbusSequentialDataBlock(0, [0]*100))
self.context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'MockPLCs'
identity.ProductCode = 'MP'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'MockPLC 3000'
identity.ModelName = 'MockPLC Ultimate'
identity.MajorMinorRevision = '1.0'
ModbusServerFactory.__init__(self, self.context, ModbusSocketFramer, identity)
示例11: main
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def main():
# initialize the four register types
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [0]*100),
co = ModbusSequentialDataBlock(0, [0]*100),
hr = ModbusSequentialDataBlock(0, [0]*100),
ir = ModbusSequentialDataBlock(0, [0]*100))
context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'SPARSA'
identity.ProductCode = 'SP'
identity.VendorUrl = 'http://gentoocloud.com/bitchimabus'
identity.ProductName = 'SPARSA Temperature Sensor'
identity.ModelName = 'SP_1337'
identity.MajorMinorRevision = '1.0'
pi.start()
time = 5 # 5 seconds delaytime = 5 # 5 seconds delay
loop = LoopingCall(f=updating_writer, a=(context,))
loop.start(time, now=False) # initially delay by time
StartTcpServer(context, identity=identity, address=(args.address, 502))
示例12: main
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
def main():
logging.basicConfig()
#server_log = logging.getLogger("pymodbus.server")
#protocol_log = logging.getLogger("pymodbus.protocol")
""" Server launcher """
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-D", "--debug",
help="Turn on to enable tracing",
action="store_true", dest="debug", default=False)
(opt, arg) = parser.parse_args()
# enable debugging information
if opt.debug:
try:
_logger.setLevel(logging.DEBUG)
except Exception:
print "Logging is not supported on this system"
# Create store context
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [17]*100),
co = ModbusSequentialDataBlock(0, [17]*100),
hr = ModbusSequentialDataBlock(0, [17]*100),
ir = ModbusSequentialDataBlock(0, [17]*100))
context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://unipi.technology'
identity.ProductName = 'Pymodbus Server on IOLoop'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.0'
StartTcpServer(context, identity=identity, address=("localhost", 5020))
示例13: ModbusSlaveContext
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
###############################################################################
# Modbus Datastore Configuration
###############################################################################
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [17]*100),
co = ModbusSequentialDataBlock(0, [17]*100),
hr = ModbusSequentialDataBlock(0, [17]*100),
ir = ModbusSequentialDataBlock(0, [17]*100))
context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'ITI'
identity.ProductCode = 'PM'
identity.VendorUrl = 'code.iti.illinois.edu'
identity.ProductName = 'Server Instance'
identity.ModelName = 'ITI Test'
identity.MajorMinorRevision = '1.0'
###############################################################################
# Functions
###############################################################################
def validateIface(iface):
if not (iface in netifaces.interfaces()):
print iface + " is not a valid interface"
exit()
示例14: ModbusDeviceIdentification
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
# ------------------------------------------------------------
from pymodbus.server.async import ModbusServerFactory
from pymodbus.constants import Defaults
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from twisted.internet import reactor
# ------------------------------------------------------------
# initialize the identity
# ------------------------------------------------------------
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'Pymodbus Server'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.0'
# ------------------------------------------------------------
# initialize the datastore
# ------------------------------------------------------------
store = ModbusSlaveContext(
di = ModbusSequentialDataBlock(0, [17]*100),
co = ModbusSequentialDataBlock(0, [17]*100),
hr = ModbusSequentialDataBlock(0, [17]*100),
ir = ModbusSequentialDataBlock(0, [17]*100))
context = ModbusServerContext(slaves=store, single=True)
# ------------------------------------------------------------
示例15: ModbusDeviceIdentification
# 需要导入模块: from pymodbus.device import ModbusDeviceIdentification [as 别名]
# 或者: from pymodbus.device.ModbusDeviceIdentification import VendorUrl [as 别名]
from pymodbus.server.sync import StartTcpServer
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
identity = ModbusDeviceIdentification()
identity.VendorName = 'Joac-Automation'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/joac/ArakurWW/'
identity.ProductName = 'Servidor Test Arakur'
identity.ModelName = 'Servidor Test Arakur'
identity.MajorMinorRevision = '0.1'
marcas = ModbusSequentialDataBlock(0, [0] * 34)
registros = ModbusSequentialDataBlock(0, [0] * 34)
store = ModbusSlaveContext(di = marcas, co= marcas, hr = registros, ir =registros)
context = ModbusServerContext(slaves=store, single=True)
StartTcpServer(context, identity=identity, address=("localhost", 5020))