-------------------------Monitor------------------------ The Newsletter for PC-Based Data Acquisition and Control Issue 56 www.windmill.co.uk March 2003 --------------------ISSN 1472-0221---------------------- Welcome to the Monitor newsletter. Last month we had a complaint about the lack of information about our products in the newsletter. This month, in contrast, we're concentrating on Windmill software. We only send Monitor to people who have subscribed - should you wish to cancel your free subscription please do so at http://www.windmill.co.uk/newsletter.html CONTENTS ======== * Windmill News - Utility Meter Monitoring - Testing Food Processing Equipment via I2C Bus * What are all these Windmill files? * Excel Corner: Logging only when new data arrives ________________________________________________________ ________________________________________________________ Windmill News ________________________________________________________ Utility Meter Monitoring Package now Available from our 0n-Line Catalogue The new Windmill 826 package logs data from utility meters - sending the consumption readings to a central PC running Windows. It lets you monitor demand in real- time and identify patterns of use of electricity, gas, water and so on. The majority of meters using contact-closure pulses are supported. You can now buy the complete monitoring package, including connection lead, logging unit and Windmill software, from our on-line catalogue. For more details visit https://www.windmillsoft.com/ * Windmill Tests Food Processing Equipment via I2C Bus During high quality chicken processing, carcasses are scalded in a bath of hot water to loosen the feathers. The temperature of the scalder needs to be controlled and SenTrolSMB are developing an I2C-based thermostat to do so. They have chosen Windmill data acquisition software to help them with this, and to verify that the scalder is working properly. Windmill captures and displays temperature data before passing it to an Excel spreadsheet for later analysis. SenTrolSMB are intending to develop a complete I2C network using Windmill as the PC data collection and control software. They made the decision to use Windmill partly because of the Graphics program, which will let them quickly build an individual control panel interface for each customer. The I2C bus, developed by Philips, is a 2-wire serial bus. SenTrolSMB uses Windmill with I2C devices by means of an RS232 to I2C converter. There is a choice of two Windmill serial drivers: the latest one, called COMIML, is available from https://www.windmillsoft.com/daqshop/rs232-modbus.html The older one, LabIML, is free to Monitor subscribers. For more on the Windmill Graphics process mimic software see http://www.windmill.co.uk/graphics.html ________________________________________________________ ________________________________________________________ What are all these Windmill files? ________________________________________________________ Our survey in January showed that some people were confused by all the different files that were produced by Windmill. We've therefore compiled this guide to the Windmill programs and their files. (If you haven't yet filled in our survey you can still do so at http://www.windmill.co.uk/monitor54.html) * Logger: *.wlg, *.wl, *.wlh Logger records instrument readings in ASCII files. The logged data is generally stored in a *.wl file. This contains both header information - such as channel names and units - and logged data. However, you can choose to keep the header information separate, in which case it will be saved in a *.wlh file. The *.wlg file is created by Logger when you save its settings. This file contains information about your logging choices, such as the data sampling interval, the format of the time stamp and the position of the window on the screen. As with the other Windmill programs, you can set Logger to automatically load this file when it starts, reinstating all your settings. For more information on all the Logger files, see its on-line Help (logger.hlp). For tips on using Logger see Issue 20 of Monitor - http://www.windmill.co.uk/monitor20.html * Chart: *.wch The *.wch file is created by Windmill Chart when you save its settings. It includes grid setting, the title of the window and background colour of the chart. For the full list of contents see the Chart's on-line Help (chart.hlp). * DDE Panel: *.wdp This is DDE Panel's settings file. It lists the channels that are being displayed by DDE Panel, DDE service name, and so on. For the full list see the DDE Panel's on-line Help (wmdde.hlp) * SetupIML: *.ims SetupIML lets you specify how you want to use your sensors and instruments. For example, you can choose which channels you want to use, give names to the channels and set alarm thresholds. When you first load SetupIML it interrogates your hardware and builds a default setup file (*.ims). You can then edit this file, tailoring the system to your needs. You can build a library of *.ims files, with different setups for different applications. For more information see the SetupIML on-line Help (setupiml.hlp). * COMIML and ComDebug: *.imd COMIML is the Windmill serial driver. It acquires data from instruments over RS232, RS422, RS485 and Modbus. ComDebug lets you configure these instruments, setting such things as the baud rate and how to extract data from the instrument's messages. These details are saved in an instrument file, *.imd, which is later used by COMIML to regularly read data from your instrument. Each instrument has its own *.imd file. For more information see https://www.windmillsoft.com/daqshop/rs232-modbus.html and the ComDebug on-line Help (ComDebug.hlp). * ConfIML and LabIML: *.aid LabIML is the Windmill 4.3 serial driver for RS232 instruments. You use ConfIML to tell the LabIML driver about your RS232 instrument's settings: baud rate, COM port, how to extract data from the instrument's message, etc. These settings are stored in the *.aid file. For more information see the LabIML on-line Help (labiml.hlp). Note: Windmill 4.3 and LabIML are free to subscribers. * You can download the latest version of any of the Windmill Help files from http://www.windmill.co.uk/help.html For more about the Windmill programs see http://www.windmill.co.uk/programs.html ________________________________________________________ ________________________________________________________ Excel Corner: Logging only when New Data Arrives ________________________________________________________ Some measurement instruments send data at irregular intervals. When collecting data from these, therefore, many of the readings may be taken when no data is available. In this case Excel might show "READ failed". The question is, how to record only new data without any failure messages? 1. A simple way to do this is to overwrite failed readings. 2. Alternatively, you could use Excel's SetLinkOnData method. When Excel detects new data from the DDE link, it will run a macro or procedure which can write the data into the spreadsheet. 3. If you don't need the data in Excel in real-time, you could use Logger to record the data but set it to skip empty scans. You could then load the data into Excel once collection had finished. Overwriting Failed Readings =========================== Here is an example macro which repeatedly obtains instrument readings from Windmill. It asks you for the number of valid readings to be collected and the interval between readings. It assumes you are collecting data from one channel called 00000. To use this code create an empty macro and copy and paste it into it the subroutine. Change "00000" to match the name of your channel. (Be careful of any extra line breaks that might have been inserted by your e-mail system - check especially that the NoOfSamples and SamplePeriod lines are complete.) Before running the macro from Excel, start DDE Panel. * Sub SampleData() NoOfRows = 1 'Ask for the number of valid readings to be collected 'and the interval between readings. NoOfSamples = Val(InputBox("Please enter no of readings to collect", "No of Samples")) SamplePeriod = InputBox("Please enter interval between readings in seconds", "Sample Interval") 'Coverts interval to fraction of 24 hours '(Excel expects times in this format). SamplePeriod = (Val(SamplePeriod)) / 86400 'Initiates conversation with Windmill DDE Panel ddeChan = DDEInitiate("Windmill", "Data") 'Keeps conversation open until the required 'number of samples have been collected. While NoOfRows < NoOfSamples + 1 'Requests data from channel 00000 and stores it in 'memory under mydata. mydata = DDERequest(ddeChan, "00000") 'Selects the first sheet in the default workbook. Sheets("Sheet1").Select 'Inserts data into the 1st column Cells(NoOfRows, 1).Value = mydata 'If data is valid increments number of rows, so 'the next set of samples is inserted in the next 'row down. If (Cells(NoOfRows, 1).Value <> "READ failed") Then NoOfRows = NoOfRows + 1 Else NoOfRows = NoOfRows End If 'Waits for the specified interval between readings. Application.Wait (Now + SamplePeriod) 'Stops loop when required sets of samples collected. Wend DDETerminate (ddeChan) End Sub * You may like to use data from the Windmill Signal Generator to practice with DDE links, before trying with your hardware. The Signal Generator simulates a device with seven channels, each channel producing a different signal and is part of the Windmill data acquisition software suite. Using SetLinkOnData =================== A more sophisticated solution to the problem of intermittent data is to use Excel's SetLinkOnData method. For a channel called "00000" this takes the form ActiveWorkbook.SetLinkOnData "Windmill|Data!00000", "Macro1" It sets the name of a macro or procedure to run whenever the DDE link is updated. "Windmill|Data!00000" is the DDE link. "Windmill" is the DDE Server name, "Data" is the DDE topic and "00000" is the name of the channel from which you are acquiring data. This example collects new data from a channel called "00000" and writes it into cell A1 of the spreadsheet. We've kept it simple to demonstrate how SetLinkOnData works. Start DDE Panel before running this procedure. * Sub AutoStart() ActiveWorkbook.SetLinkOnData "Windmill|Data!00000", "WriteData" End Sub Sub WriteData() 'Initiates conversation with Windmill DDE Panel ddechan = DDEInitiate("Windmill", "Data") 'Requests data from 00000 and stores it in 'memory under mydata. mydata = DDERequest(ddechan, "00000") 'Selects first sheet in default workbook. Sheets("Sheet1").Select 'Inserts data into cell A1 Cells(1, 1).Value = mydata 'Ends DDE conversation DDETerminate (ddechan) End Sub * Note: See the next issue of Monitor for details of logging from all channels in Excel. For more tips on using Excel with Windmill see http://www.windmill.co.uk/excel/ http://www.windmill.co.uk/excel/excel-charting.html http://www.windmill.co.uk/monitor57.html ________________________________________________________ * Copyright Windmill Software Ltd * Reprinting permitted with this notice included * For more articles see http://www.windmill.co.uk We are happy for you to copy and distribute this newsletter, and use extracts from it on your own web site or publication, providing the above notice is included and a link back to our website is in place. An archive of previous issues is at http://www.windmill.co.uk/newsletter.html and an index of articles at http://www.windmill.co.uk/newsletter.html Windmill Software Ltd, PO Box 58, North District Office, Manchester, M8 8QR, UK Telephone: +44 (0)161 833 2782 Facsimile: +44 (0)161 833 2190 E-mail: [email protected] http://www.windmill.co.uk/ https://www.windmillsoft.com/
To receive Monitor every month please fill in your e-mail address below. We will not pass your address to any third parties, nor send you any unsolicited e-mail.