Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: DOS Guy Newsgroups: comp.os.msdos.programmer Subject: Re: A Warning System Date: Sun, 12 Feb 2012 13:19:02 -0500 Organization: Aioe.org NNTP Server Lines: 76 Message-ID: <4F380296.4FB64DBF@Guy.com> References: NNTP-Posting-Host: ab5SJQcW0FP7usmhKjGv6A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.os.msdos.programmer:478 Knut Schroder wrote: > A typical txt file is like: > > Date/Time,Zn,Pb,Cu,All Units in ppb > 19.01.2012 13:27:43, 547.3, 19.4, 9.5 > ....... > ....... > 19.01.2012 16:00:42, 515.5, 20.5, 8.3 > 19.01.2012 16:15:42, 524.5, 17.4, 9.2 > 19.01.2012 16:30:42, 731.7, 28.0, 10.6 > > The first line is a heading with Date/Time and the different > polluting metals, and then the lines with the subsequent > measuring results. Is a new file created for each day, or is all of this being spewed into a single (and increasingly large) text file? Do you have any control over the design and programming of the program that creates this file? (I assume not). It looks like you have a new line being created every 15 minutes. The basic program could therefore open the file for read-only access maybe every 10 minutes (just so it doesn't miss any data) and read the file to the end each time. How critical is the time delay between when new data is written to the file and when the file is read by this hypothetical warning program? Also note this: It's not uncommon on NT-based systems for log data to be spooled to a file and NOT be "visible" or accessible to another program or process until the NTFS file system has performed some journaling action, which could happen maybe after an hour or more has passed. I see this a lot when it comes to web-server log files. > Say the legal maximum levels of the three metals are 650.0, 40.0 > and 20.0 respectively. Then the alarm should be given after the > last measurement. Auric__ kindly offered to adjust the program > appropriately. Now that we know the number of variables present on each line, crafting the proper code to read each line is easy. > The beeping is of course the easiest way to do this, but it will be > a great advantage if also a relay could be opened (or closed). > Could that be arranged through USB or another way? With such a relay, > a discharge of sewage to a lake can be stopped and it is also very > simple to connect it to a cheap alarm system using SMS-messages, I would think that the simplest way to operate a relay from a compiled basic program running under an NT-based OS is to send a control command out through a com port (RS-232 port) to a control board that has the appropriate relay. Could also be done by sending through the LPT printer port. (NT-based OS's will present a virtualized com port to any 16-bit DOS process or program, but in the end the DOS program will be able to send data out of the computer's com and LPT ports as if this virtualization layer is not present. This would not be the case for other hardware ports...) I'm sure there are dozens if not hundreds of possible retail solutions for this - here's the first one I found using a google search: http://www.controlanything.com/Relay/Relay/RS232_Relay_Controllers This assumes that the discharge valve to be controlled with the relay is located relatively close to the computer (maybe 100 yards or meters at maximum?). And again I note that you seem to want sms messages to be sent. It would be easier to automate the sending of an e-mail from the computer instead of an sms message. It's not an easy thing to set up a programatic interface to an sms message system.