Inside Systems Blog

VMWare isn't that special - Virtual Switching with FreeBSD

If you have ever used VMWare, you will no doubt be familiar with the concept of a *virtual switch*. In our application we had our VM Hosts in one private vlan, a few things like a PBX and document sharing in another, a public VLAN for mail/etc and a NAT firewall for public/private translation. While VMWare ended up not working out for us, we really liked the clean abstraction that this setup provided so we decided to replicate it with FreeBSD jails for virtualization.

Read the rest of this post »

Loading mentions Retweet

Filed under  //   freebsd   vmware  
Posted July 29, 2010 by Kelley Reynolds 
// 0 Comments

Modbus/RTU via TCP Serial Gateway with Ruby

We recently had a need to connect to a PowerLogic BCM42 through a Barionet-50 from Barix. While the Barionet-50 speaks Modbus/TCP for itself, it does not perform as a TCP/RTU gateway for devices hooked up to it via the RS485 port which is a straight serial gateway. Our project is being implemented in ruby so we started with the excellent RModbus gem and modified it to send Modbus/RTU commands via TCP and it works perfectly. This solution is also significantly cheaper than buying an off-the-shelf Modbus TCP/RTU gateway as those tend to *start* at about $400 and rapidly get more expensive.

 

require 'rubygems'
require 'rmodbus'
ModBus::RTUViaTCPClient.connect('10.10.100.33', '10002', 4) do |cl|
        total_ma = cl.read_holding_registers(0, 42).inject(0) { |acc, i| acc += i; acc}
        puts "Total mA: #{total_ma}"
end
$ ./test.rb
Total mA: 12510

Our code for accessing Modbus/RTU devices via TCP can be found at http://github.com/kreynolds/RModBus

Loading mentions Retweet

Filed under  //   modbus   monitoring   ruby  
Posted July 28, 2010 by Kelley Reynolds 
// 0 Comments