EIBD installation and usage

Aug 03 2012
 

As already mentioned in our previous post  introduction to EIB/KNX, the physical connectivity to the bus can be done in different ways, by means of a serial port, a USB port or else via IP network.

EIBD is a software development that presents the users with a unified interface to access the bus. EIBD implements internally the several KNX protocols used in the different physical media used to access the bus. This is a very useful component in the development of client applications to access and control the home automation network.

In this post we will explain how to install and use this software in a Linux Debian computer.

1. EIBD installation:

As a prerequisite, we install the pthsem package, downloading it from www.auto.tuwien.ac.at:

$ apt-get  install build-essential
  
-------------------------------------
$ cd EIBD
$ wget http: //www .auto.tuwien.ac.at/~mkoegler /pth/pthsem_2 .0.8. tar .gz
tar  zxvf pthsem_2.0.8. tar .gz
cd  pthsem-2.0.8/
$ . /configure
make
$ sudo  make  install

Next, we perform the installation of eibd downloading the bcusdk package from sourceforge:

$ tar  -zxvf bcusdk_0.0.5. tar .gz
cd  bcusdk-0.0.5/
export  LD_LIBRARY_PATH= /usr/local/lib
$ . /configure -- enable -onlyeibd -- enable -eibnetiptunnel -- enable -usb -- enable -eibnetipserver -- enable -ft12 
$ sudo ln  -s  /usr/local/lib/libeibclient .so.0 /usr/lib/libeibclient .so.0
sudo ln  -s  /usr/local/lib/libeibclient .so.0  /lib/libeibclient .so.0
$ make
$ make install

When executing  ”./configure”, we must specify by means of switches the bus connectivity interfaces we want to be enabled.

Once installed, we can display the available options with the –help switch:

$ eibd --help
Usage: eibd [OPTION...] URL
eibd -- a communication stack for EIB
(C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
supported URLs are:
ft12: /dev/ttySx
ip:[multicast_addr[:port]]
ipt:router-ip[:dest-port[:src-port[:nat-ip[:data-port]]]]]
iptn:router-ip[:dest-port[:src-port]]
usb:[bus[:device[:config[:interface]]]]
  
ft12 connects over a serial line without any driver with the FT1.2 Protocol to
a BCU 2
  
ip connects with the EIBnet /IP Routing protocol over an EIBnet /IP gateway. The
gateway must be so configured, that it routes the necessary addresses
  
ipt connects with the EIBnet /IP Tunneling protocol over an EIBnet /IP gateway.
The gateway must be so configured, that it routes the necessary addresses
  
iptn connects with the EIBnet /IP Tunneling protocol over an EIBnet /IP gateway
using the NAT mode
  
usb connects over a KNX USB interface
  
   -c, --GroupCache           enable caching of group communication network
                              state
   -d, --daemon[=FILE]        start the programm as daemon, the output will be
                              written to FILE, if the argument present
   -D, --Discovery            enable the EIBnet /IP server to answer discovery
                              and description requests (SEARCH, DESCRIPTION)
   -e, --eibaddr=EIBADDR      set our own EIB-address to EIBADDR (default
                              0.0.1), for drivers, which need an address
   -f, --error=LEVEL          set error level
   -i, --listen-tcp[=PORT]    listen at TCP port PORT (default 6720)
       --no-tunnel-client-queuing   do not assume KNXnet /IP Tunneling bus
                              interface can handle parallel cEMI requests
   -p, --pid- file =FILE        write the PID of the process to FILE
   -R, --Routing              enable EIBnet /IP Routing in the EIBnet /IP server
   -S, --Server[=ip[:port]]   starts the EIBnet /IP server part
   -t, --trace=LEVEL          set trace level
   -T, --Tunnelling           enable EIBnet /IP Tunneling in the EIBnet /IP
                              server
   -u, --listen- local [=FILE]  listen at Unix domain socket FILE (default
                              /tmp/eib )
   -?, --help                 Give this help list
       --usage                Give a short usage message
   -V, --version              Print program version
  
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
$

In the output from “eibd –help” we can see that our eibd server can connect to the bus by means of  BCU2/ft1.2, IP multicast, IP tunneling, IP tunneling in NAT mode, and USB.

Executing eibd connected through EIBnet/IP

First, we execute in another window a TCP/IP packet sniffer to dump the packets transmitted to/from the multicast address used by KNX.

Then we start eibd in IP multicast mode:

$ eibd --trace=5 --listen- local ip:
Layer 2(01FBBC00,5019291E) Open
Layer 0(01FBBD00,5019291E) Open
Creado socket...
Layer 0(01FBBD00,5019291E) Openend
Layer 2(01FBBC00,5019291E) Opened

 

Then, from a third window we execute the demo command “groupswrite” to send a telegram to the bus that writes the value “1″ to the group address  ”2/3/4″:

$ groupswrite local : /tmp/eib 2 /3/4 1

and check the trace being written by eibd. In it, the KNX telegram sent to the bus is displayed:

Layer 2(01FBBC00,50192A09) Send L_Data low from 0.0.1 to 2 /3/4 hops: 07 T_DATA_XXX_REQ A_GroupValue_Write (small) 01 
Layer 0(01FBBD00,50192A09) Send(017): 06 10 05 30 00 11 29 00 BC F0 00 01 13 04 01 00 81
Layer 2(01FBBC00,50192A09) Recv L_Data low from 0.0.1 to 2 /3/4 hops: 07 T_DATA_XXX_REQ A_GroupValue_Write (small) 01

 

The frame starts with a 6-byte header (see the cEMI format description in introduction to EIB/KNX) :

06:   length of header: 6 bytes
10:   protocol version (1.0)
0530: Service Type Descriptor: 0530=ROUTING_INDICATION
0011: Total length: 17 bytes

The header is followed by the message code 0×29 (L_Data.ind) and the additional information length (0×00)

Finally comes the KNX command itself :

BCF0: Control bytes
0001: source address 0 /0/1
1304: destination address 2 /3/4
01:   Data length: 1 byte
0081: APDU (TPCI+APCI+Datos)
Executing eibd connected through BCU2/FT1.2

Although our machines is not equipped with serial ports, we can simulate in software a pair of serial ports connected in “piggyback” using the linux command  ’socat’

$ socat -d -d pty,raw, echo =0 pty,raw, echo =0
2012 /08/01 15:14:40 socat[18599] N PTY is /dev/pts/5
2012 /08/01 15:14:40 socat[18599] N PTY is /dev/pts/6
2012 /08/01 15:14:40 socat[18599] N starting data transfer loop with FDs [3,3] and [5,5]

socat has created serial ports /dev/pts/5 and /dev/pts/6. Anything written to serial port 5 will appear as input in serial port 6, and viceversa (the actual port numbers can change every time socat is run).

Once we have socat running in a window, we execute eibd in another window, asking it to connect to one of the newly created serial ports:

$ eibd --trace=5 --listen-local ft12:/dev/pts/5

In the trace dumped by eibd, we see that an initialization message “10 40 40 16″ is sent. The message is sent over and over because eibd does not receive the expected ACK response (a single byte 0xE5, as specified in the ft1.2 protocol):

$ eibd --trace=5 --listen- local ft12: /dev/pts/5
Layer 2(013813A0,50193A2E) Open
Layer 2(013813A0,50193A2E) Opened
Layer 2(013813A0,50193A2E) OpenL2
Layer 0(01370C00,50193A2E) Send(004): 10 40 40 16
Layer 0(01370C00,50193A2E) Send(004): 10 40 40 16
Layer 0(01370C00,50193A2E) Send(004): 10 40 40 16
Layer 0(01370C00,50193A2F) Send(004): 10 40 40 16
....

We stop the execution of eibd with ^C. Next, we write an small program that listens for incoming messages in the “/dev/pts/6″ serial port, and sends “0xE5″ ACK messages in response (socat ensures that anything written to serial port 6 appears as incoming data in serial port 5).

Executing again eibd, the trace dumped this time is:

$ eibd --trace=5 --listen- local ft12: /dev/pts/5
Layer 2(01C983A0,50193B04) Open
Layer 2(01C983A0,50193B04) Opened
Layer 2(01C983A0,50193B04) OpenL2
Layer 0(01C87C00,50193B04) Send(004): 10 40 40 16
Layer 0(01C87C00,50193B04) Recv(001): E5
Layer 0(01C87C00,50193B04) Send(014): 68 08 08 68 73 A9 1E 12 34 56 78 9A E8 16
Layer 0(01C87C00,50193B04) Recv(001): E5
Layer 0(01C87C00,50193B04) Send(014): 68 08 08 68 53 A9 00 18 34 56 78 0A 20 16
Layer 0(01C87C00,50193B04) Recv(001): E5

This time, the reset message “10 40 40 16″ gets the expected 0xE5 ACK, and eibd sends a couple more initialization messages, encoded in FT1.2/EMI2.

Now, if we execute the “groupswrite” command in another window:

$ groupswrite local:/tmp/eib 2/3/4 1

we can see in the trace being written by eibd a new message, also encoded in FT1.2 format.

Layer 2(01C983A0,50193FFA) Send L_Data low from 0.0.0 to 6 /1/5 hops: 07 T_DATA_XXX_REQ A_GroupValue_Write (small) 01 
Layer 0(01C87C00,50193FFA) Send(016): 68 0A 0A 68 73 11 0C 00 00 31 05 F1 00 81 38 16
Layer 2(01C983A0,50193FFA) Recv L_Data low from 0.0.0 to 6 /1/5 hops: 07 T_DATA_XXX_REQ A_GroupValue_Write (small) 01 
Layer 0(01C87C00,50193FFA) Recv(001): E5
深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值