Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.msdos.programmer > #487
| From | Knut Schroder <Knut.Schroder@chem.ntnu.no> |
|---|---|
| Newsgroups | comp.os.msdos.programmer |
| Subject | Re: A Warning System |
| Date | 2012-02-29 13:41 +0100 |
| Organization | Norwegian university of science and technology |
| Message-ID | <jil6de$vna$1@orkan.itea.ntnu.no> (permalink) |
| References | (2 earlier) <jh8qjh$mu9$1@orkan.itea.ntnu.no> <Xns9FF7CFFA33A7Cauricauricauricauric@88.198.244.100> <Xns9FF7D0D25A845auricauricauricauric@88.198.244.100> <jhbg2e$dfs$1@orkan.itea.ntnu.no> <Xns9FF8E438C934Cauricauricauricauric@88.198.244.100> |
It seems now that the alarm system works fine.
I have now also connected a relay via an USB port. However, different
COM port is automatically assigned from one installation to another and
consequently I have to change the COM port in the freebasic program
accordingly. Of course this is inconvenient.
Is it possible to "force" this port to be a given one, say COM7?
Greetings from Knut
On 14.02.2012 06:25, Auric__ wrote:
> [Second attempt posting this.]
>
> Knut Schroder wrote:
>
>> Thanks to Pete, DOS Guy and Auric_ for all help, and in particular to
>> Auric_ for making the program.
>
> Np.
>
>> I have tested it and it seems to work fine.
>
> Good.
>
>> You have sent some questions:
>> - The measuring series can last over several months, and the file with
>> all the results has always the same name (Scan.log) and format (except
>> from the number of lines). If we start another measuring series later
>> on, we make another directory for it.
>
> Might I suggest renaming the log file (once it's no longer the "active"
> log) to a datestamp? (Something like "20120101-20120131.log" or whatever.)
> That way you can tell what dates are included in the file without the need
> to open it to check.
>
>> - Normally the measurements are unattended on a measuring station far
>> away with the PC there, or with a PC connected to the station via
>> internet. That is the reason for being so keen on SMS, email and relay
>> switching in additional to the beep.
>
> From what I've read, controlling a relay from the program shouldn't be too
> difficult if it is connected to the PC in some standard way. Many
> manufacturers supply sample code to show you how it's done.
>
>> - We have not control over the program that creates the file.
>>
>> - The time delay between the new data line is written to the file and
>> the run of the warning is normally not critical. However, as this could
>> be due to a damage, it should not be too long.
>
> As DOS Guy pointed out, the data seems to be added every 15 minutes.
> Therefore, running my program every 15 minutes seems to be all that's
> required. More often is fine; less often might miss a problem.
>
> Another thing that he pointed out is that the actual writing of the data to
> the file on disk might be delayed by the operating system, sometimes by
> seconds, but on rare occasions by *hours*.
>
>> I have one question:
>> What happens if the alarm program happens to run just when a new line is
>> inserted in the Scan.log?
>
> Hm... depends on the timing, and how the data program opens the log.
> Replace this block:
> '------------------------------------------
> OPEN "measurements.txt" FOR INPUT AS hnd
> LINE INPUT #hnd, i$
> split i$, ",", headers()
>
> DO UNTIL EOF(hnd)
> LINE INPUT #hnd, i$
> IF LEN(i$) THEN f$ = i$
> LOOP
> CLOSE hnd
> split f$, ",", datums()
> '------------------------------------------
>
> with this block:
>
> '------------------------------------------------
> DO
> IF OPEN ("scan.log", FOR INPUT, AS hnd) THEN
> SLEEP 1000
> ELSE
> EXIT DO
> END IF
> LOOP
>
> LINE INPUT #hnd, h$
>
> DO UNTIL EOF(hnd)
> LINE INPUT #hnd, i$
> IF LEN(i$) THEN f$ = i$
> LOOP
> CLOSE hnd
>
> split h$, ",", headers()
> split f$, ",", datums()
> '------------------------------------------------
>
> What this change does is, if there's an error opening the log, the program
> waits a second and then tries again, repeating until it succeeds. (I also
> moved a bit of data mangling to after the file is released to reduce the
> amount of time the file is actually open.)
>
> As for what might happen to the data program (the one that is logging) if
> it tries to open the log while my program is reading it, nothing should
> happen.
>
>> I will certainly have more questions later on after being more familiar
>> with all this.
>
> Ask away.
>
Back to comp.os.msdos.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
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