Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #473

Re: A Warning System

From DOS Guy <DOS@Guy.com>
Newsgroups comp.os.msdos.programmer
Subject Re: A Warning System
Date 2012-02-11 08:33 -0500
Organization Aioe.org NNTP Server
Message-ID <4F366E45.556768C4@Guy.com> (permalink)
References <jh5ifv$f2a$1@orkan.itea.ntnu.no>

Show all headers | View raw


Knut Schroder wrote:
 
> We have developed a system for automatic monitoring of some
> pollutants in the environment.
> 
> The levels of the different pollutants are measured (typically
> every hour) and the results are calculated using a PC (WINDOWS XP
> or 7) and stored as a line in a text file. The results for the
> subsequent measurement is stored as a new line in the same file
> and so on.
> 
> What I want is a small program which runs in the background and
> monitors the last line in the text file, and if the results there
> exceed some given values, some action is taken (like sending the
> last line with SMS or switching a relay or giving a sound from
> the PC).
> 
> I am a chemist and not a programmer, but I assume that simple
> solutions are available. Can you help me with a link or other
> information.

It's trivial to write a basic program (gwbasic, powerbasic, etc) and
have it open a text file for read access and read the entire file - line
by line - until it reaches the end.  It would simply read in these
values into same variable or array (because it only has to know the last
value at the end of the file - not all preceeding values).

The easiest thing for a basic program to do is "BEEP" or send out
multiple beeps if your warning conditions are met.  Having the program
do anything else (like send an e-mail) is tricky, and sending an SMS is
really complicated.

So if an audible beep or series of beeps is satisfactory, then that's
easy to do.

I would suggest that if possible, that your pollution monitoring program
write the last measurement value to a separate text file so that the
warning program doesn't have to read through the entire log file every
time it wants to get to the last set of values.

The warning program can run continuously, and it can check your
pollution values on a fixed schedule (once per second, once per minute,
once per hour, etc) based on checking the $date and $time variables. 
The warning program could also open it's own log file to log the date
and time that it detected a warning condition.

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

A Warning System Knut Schroder <Knut.Schroder@chem.ntnu.no> - 2012-02-11 12:12 +0100
  Re: A Warning System DOS Guy <DOS@Guy.com> - 2012-02-11 08:33 -0500
  Re: A Warning System "Auric__" <not.my.real@email.address> - 2012-02-11 22:34 +0000
    Re: A Warning System Knut Schroder <Knut.Schroder@chem.ntnu.no> - 2012-02-12 17:49 +0100
      Re: A Warning System DOS Guy <DOS@Guy.com> - 2012-02-12 13:19 -0500
        Re: A Warning System DOS Guy <DOS@Guy.com> - 2012-02-12 17:12 -0500
      Re: A Warning System "Auric__" <not.my.real@email.address> - 2012-02-13 03:25 +0000
        Re: A Warning System "Auric__" <not.my.real@email.address> - 2012-02-13 03:30 +0000
          Re: A Warning System Knut Schroder <Knut.Schroder@chem.ntnu.no> - 2012-02-13 18:08 +0100
            Re: A Warning System "Auric__" <not.my.real@email.address> - 2012-02-14 05:25 +0000
              Re: A Warning System Knut Schroder <Knut.Schroder@chem.ntnu.no> - 2012-02-29 13:41 +0100
                Re: A Warning System "Auric__" <not.my.real@email.address> - 2012-02-29 13:20 +0000
                Re: A Warning System DOS Guy <DOS@Guy.com> - 2012-02-29 23:33 -0500
                Re: A Warning System Sjouke Burry <s@b> - 2012-03-01 05:04 +0000
                Re: A Warning System DOS Guy <DOS@Guy.com> - 2012-03-01 10:01 -0500
                Re: A Warning System Knut Schroder <Knut.Schroder@chem.ntnu.no> - 2012-03-11 09:51 +0100
  Re: A Warning System pete@nospam.demon.co.uk - 2012-02-12 15:20 +0000

csiph-web