GIULIO VERDINI
Hi all,
I'm a beginner.
I'm trying to connect OpenPLC to Factory I / O (www.factoryio.com) with the ModBus protocol.
I tried all the combinations of classes / yipo / location with a simple program (scene in Factory "1 - From A2B"):
- a button start
- a sensor
- a conveyor
when the button is pressed, the conveyor starts and drags the box until the sensor signal is interrupted.
OpenPLC 1.jpg 
In factory simulating, the components of the scene do not perform as expected
OpenPLC 2.jpg  OpenPLC 3.jpg 


Has anyone tried to connect to Factory IO?

Best regards
Quote 0 0
thiagoralves
I haven't used Factory IO before, but from the screenshots I see that you're using Coils for the start button and sensor. Coils are outputs on Modbus (which makes sense because you cannot write to inputs using Modbus). Therefore, you need to change the location of your Start Button and your Sensor to something on the %QX range instead of %IX. Also, it looks like both your Start Button and your Conveyor are mapped to Coil 0 on the Factory IO. That certainly won't work. My suggestion is that you use a range of %QX for inputs (like from %QX0.0 to %QX2.0) and another range for outputs (like from %QX2.0 to %QX4.0).
Quote 0 0
thiagoralves
I ended up downloading Factory IO to try it out. I gotta say this is an impressive software! This is pretty cool!! I might even add information about it on OpenPLC website. So, the best way to setup OpenPLC and Factory IO together is to add Factory IO as a Slave Device on OpenPLC. First, in your Factory IO select the Modbus TCP/IP Server driver (not the client). Then on configuration, change the default port to 503 (or something else, except 502) to avoid it conflicting with OpenPLC own Modbus server running on port 502.
Capture1.png 
Then take note of the IP address and Slave ID of your Factory IO Modbus Server:
Capture2.png 
Finally, on the OpenPLC web interface, go to Slave Devices and add a new Generic Modbus TCP Device with the information from Factory IO (IP address, slave ID, number of IOs, etc)
Capture3.png 
Save the device and you're good to go. Make sure that you have started the server on the Factory IO before clicking on "Start PLC" on OpenPLC web interface. Your I/Os will be located in the %QX100 and %IX100 range.
Quote 1 0
GIULIO VERDINI
Hi Thiago,
thanks for your reply.
I have some issue usiing these information. 

I'm working with OpenPLC on PC and Factory IO on PC's VM Win10.
That's the screenshot of the configurations :

OpenPLC - Factory Server Configurazione.jpg OpenPLC - Slave Devices.jpg 

Using port 503 on Factory this is the result in Open PLC :

---
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Device FactoryIO Server is disconnected. Attempting to reconnect...
Connected to MB device FactoryIO Server
Issued start_modbus() command to start on port: 502
Modbus Server: Listening on port 502
Modbus Server: waiting for new client...
Issued stop_dnp3() command

---

I think I'm wrong in defining variables in OpenPLC and / or in Factory IO configuration.
OpenPLC - Program.jpg Factory IO - Variables.jpg 

Can you help me understand the mistake?
Thanks
Giulio
Quote 0 0
thiagoralves
It is working, just your variables that are wrong. Digital variables have the dot '.' notation, so it should be %QX100.0 and not just %QX100. The next variable then is %QX100.1 and not %QX101. Also, since you're using the server on the Factory I/O side, you can and must use inputs as %IX100.0 and so on...
Quote 0 0
GIULIO VERDINI
Thanks for the clarification. It seems to work even if I can not properly use the start button ðŸ˜…
I'll make more test.

Thank for your support
Quote 0 0
vinicius.martucci
Hi, I've created this configuration for a simple communication between the OpenPLC and the FactoryIO, but it did not work. I made the following configuration on the OpenPLC:
Capturar.png    On the Factory IO, the Modbus server's configuration is:
Capturar2.png  Capturar3.png
  It's a very simple program just for tests to turn HIGH the coil, that is a roller in the Factory IO. I'll be glad if you can help.
Thank you.
Quote 0 0
thiagoralves
Your start addresses on OpenPLC slave devices are wrong. It must start at zero
Quote 0 0
thiagoralves
Basic ladder logic concepts my friend. You have two rungs controlling conveyor. Since ladder logic works in scans from up to down in the diagram, your latest line on conveyor will prevail. This means that sensor will activate conveyor even if button is false.
Quote 0 0
adriano.mele

Trying to run a similar example, but I found out that the variable mapping has something strange.

For instance %QX100.9 goes on output 9 (correctly), but if I add %QX100.9 and %QX101.0 they get mapped on outputs 8 and 9, and if I add only %QX101.1 (for instance) it goes on output 9.

 

Any hint?

Quote 0 0
thiagoralves
%QX100.9 does not exist, and will get you in trouble. Usage of the dot notation follow the concept of bits in a byte. One byte has 8 bits, so your addressing should stop in %QX100.7 and continue in %QX101.0
Quote 1 0
adriano.mele

Basic ladder logic concepts my friend. You have two rungs controlling conveyor. Since ladder logic works in scans from up to down in the diagram, your latest line on conveyor will prevail. This means that sensor will activate conveyor even if button is false.


yes, I realized while posting (and thus deleted the comment before your reply). Thanks anyway.

Having copied the example from the forum I had a bias that it had to be correct 😃

Quote 0 0
adriano.mele

%QX100.9 does not exist, and will get you in trouble. Usage of the dot notation follow the concept of bits in a byte. One byte has 8 bits, so your addressing should stop in %QX100.7 and continue in %QX101.0

 

Ok, gotcha.

Thanks for clarifying this.

Quote 0 0