![Metz Connect EWIO 2 Скачать руководство пользователя страница 89](http://html.mh-extra.com/html/metz-connect/ewio-2/ewio-2_user-manual_1781387089.webp)
EWIO
2
User Manual
V 1.1 | Stand 10/2020
Seite 89 von 96
METZ CONNECT GmbH | Im Tal 2 | 78176 Blumberg | Germany
Tel. +49 7702 533-0 | Fax +49 7702 533-433
For additional documentations look at www.metz-connect.com
11.6.
Shell Script example (measuring and control)
The following example shell script illustrates the usage of the „ewioIOControl“ tool for
measuring and control purposes.
The analog input 1 (at address „0_00“) will be queried in a loop every second.
If the value of the input falls below the defined lower limit (here 3.5 Volt), the digital output 1
(at „0_00“) will be set to 1, otherwise to 0.
If the value of AI1 rises over the defined upper limit (here 7.5 Volt) the second digital output
(„0_01“) will be set to 1, otherwise to 0.
#!/bin/sh
ai_monitor_addr="0_00"
do_under_range_sig_addr="0_00"
do_over_range_sig_addr="0_01"
lower_voltage_limit="3.5"
upper_voltage_limit="7.5"
while true; do
current_in_voltage=$(ewioIOControl get_ai_$ai_monitor_addr)
cmp_lower=`echo "$current_in_voltage >= $lower_voltage_limit" | bc`
if [ $cmp_lower == 1 ]; then
#over the lower limit, turn do 0 off
ewioIOControl set_do_${do_under_range_sig_addr}_0 >/dev/null
else
#under the lower limit, turn do 0 on
ewioIOControl set_do_${do_under_range_sig_addr}_1 >/dev/null
fi
cmp_upper=`echo "$current_in_voltage <= $upper_voltage_limit" | bc`
if [ $cmp_upper == 1 ]; then
#under the upper limit, turn do 1 off
ewioIOControl set_do_${do_over_range_sig_addr}_0 >/dev/null
else
#over the upper limit, turn do 1 on
ewioIOControl set_do_${do_over_range_sig_addr}_1 >/dev/null
fi
sleep 1
done