plc

How to Convert pythons Decimal() type into an INT and exponent

…衆ロ難τιáo~ 提交于 2020-01-01 08:38:09
问题 I would like to use the Decimal() data type in python and convert it to an integer and exponent so I can send that data to a microcontroller/plc with full precision and decimal control. https://docs.python.org/2/library/decimal.html I have got it to work, but it is hackish; does anyone know a better way? If not what path would I take to write a lower level "as_int()" function myself? Example code: from decimal import * d=Decimal('3.14159') t=d.as_tuple() if t[0] == 0: sign=1 else: sign=-1

C++ MFC在子对话框中操作三菱PLC

喜夏-厌秋 提交于 2019-12-30 19:09:43
前面有一篇文章讲过C++和三菱plc的通讯: https://blog.csdn.net/V_Gogol/article/details/103389983 ,本文是其拓展。 背景 前面讲过在工程中添加Activex控件,并使用控件创建变量,此对象包含了PLC的多个操作函数。但是在实际项目中遇到了一个问题,就是只能在主对话框放入activex控件,相当于这个对象的作用域仅限于主对话框对应的头文件和源文件,如果要在其他类中对PLC进行操作(例如设置或读取指定端口的值)就会显得比较麻烦。本文讲的是编写一个专门的PLC操作类包含回调函数来实现其他类里也可以方便的对plc进行操作。 实现 直接贴代码: 这个类是为了方便复用和全局范围操作plc编写的,声明了几个回调函数,下面主要讲设置端口值和读取端口值的封装操作。 下面是回调函数,在主对话框初始化函数中注册,就能够实现plc类里进行设置和读取操作时自动执行主对话框中实际的plc操作相关代码 这个是设置和读取端口值函数 以上是声明,下面才是函数实现: 设置和读取差不多,下面以设置值为例对代码进行详细讲解 这个函数在主对话框调用,注册回调函数,相当于通知主对话框,只要调用CFXPlc这个类中的设置端口值函数,就会自动执行主对话框的的对应函数。 ////回调--设置指定端口值 BOOL CFXPlc::C_SetPortValue(BOOL

Get multiple OPC values

為{幸葍}努か 提交于 2019-12-25 03:10:56
问题 Here is the code to get the multiple values from OPC Server. private void getData() { try { int count = 1; opcServer.Connect("OPCTechs.SiemensNet30DA", ""); opcGroup = opcServer.OPCGroups.Add("MP"); opcGroup.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup_DataChange); //Get First String for (int i = 40; i <= 47; i++) opcGroup.OPCItems.AddItem("D104.B" + i, count++); //Get Second String for (int i = 80; i <= 91; i++) opcGroup.OPCItems.AddItem("D104.B" + i, count++); opcGroup

How to write to PLC input registers using pymodbus

我的梦境 提交于 2019-12-22 10:31:38
问题 I want to write to PLC input registers using pymodbus. I am able to read them : from pymodbus.client.sync import ModbusTcpClient client = ModbusTcpClient('10.10.10.32') client.connect() reg = client.read_input_registers(1,5) print(reg.registers) But I still did not found any way how to write any value to them. I appreciate any help. Thanks. 回答1: Input registers are read-only. You can write to holding registers, using Modbus functions Write Single Register or Write Multiple Registers

Communicate with CoDeSys program on a Linux-based WAGO PFC200 PLC

心不动则不痛 提交于 2019-12-21 05:56:24
问题 I'm currently getting familiar with PLC's, the WAGO 750-8206 PLC in particular. It offers a linux OS and can run CoDeSys programs. There are some I/O modules attached to the controller: 750-530, 750-430 and 750-600. What I would like to know is this: Is it possible to write a C++ linux application that runs on the PLC and gets/sets the digital inputs and outputs? Even better: can I write a CoDeSys program that "talks to the I/O's" and handles all the logic and at the same time can be accessed

Send FINS command from C# to PLC

筅森魡賤 提交于 2019-12-20 11:31:33
问题 I try to send FINS commands through UDP from PC (C#.NET) to PLC Ethernet module (Omron), but is not getting any responds from the PLC and have no clue where I can start troubleshooting. PLC has a very simple ladder logic as follow: If DM100 has value of #0001 , then trigger on output 101.00 . (Here, "Trigger" is just a symbol name for memory area D100 , and "Output" is a symbol for output 101.00 ) Then I wrote a piece of C# that performs FINS command of "Memory Area Write" which has command

Any successful profibus communications from .NET?

早过忘川 提交于 2019-12-20 09:45:46
问题 Has anyone successfully talked profibus from a .NET application? If you did, what device/card did you use to accomplish this, what was the application, and did you use any kind of preexisting or available code? 回答1: We've not used Profibus, but have used DeviceNET (another CAN based protocol), Ethernet/IP and ControlNet which all have similar challenges. We've been doing this since the late 1990's and therefore rely mainly on our own generated code using off-the-shelf hardware. The companies

Wonderware-InTouch与PLC的冗余配置

坚强是说给别人听的谎言 提交于 2019-12-16 06:03:43
【Intouch】与PLC的冗余有多种方式,根据PLC的不同,基本分为三类,分别为:PLC间冗余,Intouch间冗余,PLC与Intouch间互相冗余。 现在分配通信架构:PLC1,PLC2,Intouch。IP地址分别为:192.168.10.1,192.168.10.2,192.168.10.3 一.,AB的PLC Intouch与AB的2个PLC冗余通信的时候,Intouch无需配置冗余,这个冗余的过程是在PLC之间完成的,需要在PLC里面进行配置。若PLC1为主PLC,PLC2为备PLC,则在Intouch的SMC中只需填写PLC1的IP地址就好了,当进行冗余切换的时候,PLC2的IP地址会自动的变为PLC1的IP地址。此时Intouch只指向一个IP通道,按正常配置SMC就行。 二,西门子的PLC Intouch与西门子的PLC冗余通信的时候,光在PLC之间做冗余还是不够的,同时还要在SMC中做相应的通道冗余。如下图示:右键新建一个New_S7Cp_000,填写PLC1的IP地址以及CPU的槽号,保存一下。 右键再新建一个New_S7Cp_001,填写PLC2的IP地址以及CPU的槽号,保存一下。 以上两个通道建立完成,再需要新建一个冗余端口New_REDUNDANT_DEVICE_000,如下图所示:在右侧Primary Device栏填写主通道,在Second

Pointer and reference behavour during online change

社会主义新天地 提交于 2019-12-11 16:32:46
问题 could anyone please help me with more information about how pointers, references and interface references behave during an online change? What do I have do watch out for? I understand from other answers that pointers may be dangerous if these are not written during each cycle, but I will primarily use Interfaces and References. 回答1: When an online change is made, variables, function blocks and other program parts may move in a different memory location. Therefore, if the pointer address is

How to get Ubuntu/Raspian to recognise a Crouzet Millenium 3 PLC as tty device

一个人想着一个人 提交于 2019-12-11 15:17:41
问题 When I connect the 'Crouzet - Millenium 3 PLC' to my Ubuntu laptop via a USB serial cable the following dmesg output is given: [ 3494.555189] usb 1-2: new full-speed USB device number 21 using xhci_hcd [ 3494.711593] usb 1-2: New USB device found, idVendor=0403, idProduct=7d51, bcdDevice= 6.00 [ 3494.711596] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 3494.711598] usb 1-2: Product: Millenium 3 USB cable [ 3494.711600] usb 1-2: Manufacturer: Crouzet Automatisme SAS [