Ewon TechForum
Providing technical solutions to technical requests


BASIC IDE script logging during specific process
DerekVH Offline
Junior Member
#1
Hi,
I'm new to eWon products and have an eWon Flexy. So far I managed to set it up to read 46x modbus-TCP tags from the PLC. Now I'm struggling with the coding in eWon BASIC IDE script. I think the best solution is to set up a BASIC IDE script which can do the following:
  1. Keep checking a specific PLC-process value (readable from integer PLC modbus-TCP tag) and start datalogging when specific PLC-process value is detected.
  2. Every second, read 46 x modbus-TCP tags from PLC.
  3. Write the 46x data tags to a *.txt in CSV format start with a timestamp every second.
  4. After two hours or so when the PLC-process value is detected that indicates that the PLC-process has ended, the datalogging must be stopped.
  5. To finish off, send e-mail to me with the datalog file attached.
Is there someone that could help me on the way with this?
 
Thanx in advance,
Derek
Reply

AngelaT Offline
Ewon Distributor
#2
Hi Derek,

There's a lot of this you can get for free/without scripting. Here's what I'd do

Configure your modbus tags w/ historical logging set with a logging interval of 1 second, but don't enable it. Also configure a tag to read your PLC-process tag. In your script, use an ONCHANGE to watch your PLC-process tag. Then when your process tag says the process has started, enable historical logging on your various tags and record the time when the process started. When your process tag says the process has stopped, disable logging, record the time the process ended, and then email the Historical Table EBD (with start and end times that correspond to your process start and process stop times). If you use the Historical Table instead of the Historical Log, your file will be
timestamp;tag1;tag2;etc

Alternatively, you could just keep historical logging enabled all the time and skip a step, but there may be some performance issues with logging that fast on a regular basis. Perhaps one of the eWON crew could chime in about that.

In either case, your script will really just watch for your process to start, watch for your process to end and then email the historical table.

Hope that helps,
Angela
Reply

simon Offline
eWON Support
#3
I would have suggested the same idea :-)
Reply

DerekVH Offline
Junior Member
#4
Thank you for the information.

I tried to set something up in the BASIC IDE script (please check out attachment), but I struggle with what code is required. Could you please show me an example of a working script which does about the same thing that I want to?

Thanx in advance,
Derek


Attached Files
.jpg   eWON_Flexy_BASIC_IDE_script_to_log_data.jpg (Size: 99,1 KB / Downloads: 117)
Reply

AngelaT Offline
Ewon Distributor
#5
You need to load the tag configuration into memory before you change the tag's setting and then you have to save your changes.

Check out page 50/51 of the programming reference guide:
https://developer.ewon.biz/system/files_...download=1
Reply

DerekVH Offline
Junior Member
#6
(13-10-2017, 09:59 PM)AngelaT Wrote: You need to load the tag configuration into memory before you change the tag's setting and then you have to save your changes.

Check out page 50/51 of the programming reference guide:
https://developer.ewon.biz/system/files_...download=1

Thanx AngelaT for the info. 

In the programming reference, the following basic code is described to load a tag:

Code:
SETSYS TAG,"load","myTag"


Is my assumption correct that I need to repeat this for all 46x tags?

Then I'm required to enable the log per tag, which I think is something like:
Code:
SETSYS TAG,"logEnabled",1

I just read in thread: https://techforum.ewon.biz/thread-256.html that Simon posted some example code to delete all tags. Will something like the following code work for my application? (if this can work, it'll save me a lot of typing ;-) )
Code:
LOGALLTAGS:

n% = GETSYS PRG,"NBTAGS"
PRINT "Nbr tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
   SETSYS TAG, "LOAD", -i%
   SETSYS TAG,"logEnabled",1
SETSYS TAG, "SAVE"
PRINT "tag : " + STR$ i%
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
END


How does the basic code look like to a record a time at start and end of the logging and then do a compare?

How does the basic code look like to make a Historical table?

How does the basic code look like to send the e-mail with Historical table attached?

Do I have to clear memory? How does this code look like?
 
Thank you in advance,
Derek
Reply

DerekVH Offline
Junior Member
#7
Hi,

Have been trying to code the required script by reading documents and various online examples. However the next code doesn't want to run. Is there something coded wrong in it?

Code:
REM Set variable which holds logstatus
isLogging% = 0

REM Trigger of the CheckProcessStateNumber section
ONCHANGE "oProcessStateNumber", "Goto CheckProcessStateNumber"
END
Rem --- eWON user (end)
End
Rem --- eWON end section: Init Section
Rem --- eWON start section: GetTime
Rem --- eWON user (start)
CheckProcessStateNumber:
IF ( (isLogging% = 0) AND (oProcessStateNumber@ >= 7) ) THEN
 REM start logging of tags
 isLogging% = 1
 GOSUB "EnableTagsLog"
 GOTO GenerateReport
ELSE
 IF ( (isLogging% = 1) AND (oProcessStateNumber@ < 7) ) THEN
   REM stop logging of tags and send report
   isLogging% = 0
   GOSUB "DisableTagsLog"
   ONSTATUS "GOTO ScheduleActionEnd"
   GOTO GenerateReport
   GOTO SendLogData
 ENDIF
ENDIF
END
Rem --- eWON user (end)
End
Rem --- eWON end section: GetTime
Rem --- eWON start section: SendLogData
Rem --- eWON user (start)
SendLogData:
REM Send mail with text file in attachment
Sendmail "info@resato.com", "", "Logged Values", "&[$dtUF]" FILENAME$
END
Rem --- eWON user (end)
End
Rem --- eWON end section: SendLogData
Rem --- eWON start section: EnableTagsLog
Rem --- eWON user (start)
EnableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "No. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",1
 SETSYS TAG, "SAVE"
 PRINT "tag : " + STR$ i%
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
RETURN
Rem --- eWON user (end)
End
Rem --- eWON end section: EnableTagsLog
Rem --- eWON start section: DisableTagsLog
Rem --- eWON user (start)
DisableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "No. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",0
 SETSYS TAG, "SAVE"
 PRINT "tag : " + STR$ i%
Next i%
CFGSAVE
PRINT "All Tags are set with log disabled"
RETURN
Rem --- eWON user (end)
End
Rem --- eWON end section: DisableTagsLog
Rem --- eWON start section: GenerateReport
Rem --- eWON user (start)
GenerateReport:
GOSUB READ_LASTTMS
LAST_TIME$ = @GetCurrentTimeStamp$()
EBD_STRING$ = "$dtHT$ftT$et" + LAST_TIME$ + "$st" + LASTTMS$
FILENAME$ = "/usr/Data_" + LAST_TIME$ + ".txt"
WRITEEBD  EBD_STRING$, FILENAME$
ActionID% = GETSYS Prg, "ACTIONID"
END
Rem --- eWON user (end)
End
Rem --- eWON end section: GenerateReport
Rem --- eWON start section: FUNCTION GetCurrentTimeStamp$()
Rem --- eWON user (start)
FUNCTION GetCurrentTimeStamp$()
REM TIME$ = 19/12/2014 10:03:01
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + "_" + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16)+ $EWON_TIME$(18 To 19)
ENDFN
Rem --- eWON user (end)
End
Rem --- eWON end section: FUNCTION GetCurrentTimeStamp$()
Rem --- eWON start section: FUNCTION WriteTMS($LastTimeStamp$)
Rem --- eWON user (start)
FUNCTION WriteTMS($LastTimeStamp$):
OPEN "file:/usr/tms.dat" FOR BINARY OUTPUT AS 1
 PUT 1,$LastTimeStamp$
CLOSE 1
ENDFN
Rem --- eWON user (end)
End
Rem --- eWON end section: FUNCTION WriteTMS($LastTimeStamp$)
Rem --- eWON start section: READ_LASTTMS
Rem --- eWON user (start)
READ_LASTTMS:
SETSYS PRG,"RESUMENEXT",1
REM GET LAST TIMESTAMP
OPEN "file:/usr/tms.dat" FOR BINARY INPUT AS 1
 LASTTMS$ = GET 1,15
CLOSE 1
Cur_Err% = GETSYS PRG,"LSTERR"
IF Cur_Err% = 33 THEN //REM File does not exist
 LASTTMS$= "01011970_000000"
 SETSYS PRG,"LSTERR",0
ENDIF
SETSYS PRG,"RESUMENEXT",0
CLS
RETURN
Rem --- eWON user (end)
End
Rem --- eWON end section: READ_LASTTMS
Rem --- eWON start section: ScheduleActionEnd
Rem --- eWON user (start)
ScheduleActionEnd:
CurID% = GETSYS Prg,"EVTINFO" : REM Get ActionID
  REM : Check if it is the right schedule action to save last timestamp otherwize do nothing
  If ActionID% = CurID% THEN
    SETSYS Prg, "ACTIONID", CurID%
    CurID_Status% = GETSYS Prg,"ACTIONSTAT"
    REM Action successfully done --> Write last timestamp in file
    IF CurID_Status% = 0 THEN
      LOGEVENT "FILE " + FILENAME$ + " SUCCESSFULLY EXPORTED", 100
      @WRITETMS(LAST_TIME$)
     ELSE
       LOGEVENT "FILE " + FILENAME$ + " NOT SUCCESSFULLY EXPORTED", 0
    ENDIF
  ENDIF
END
Reply

DerekVH Offline
Junior Member
#8
Hi,

After the eWon Flexy didn't even run a very simple script, I rebooted it which was the trick to be able to run the script.

However it now has a problem with command WriteEBD: 
" '=' expected (3) 87 : WRITEEBD  EBD_STRING$, FILENAME$" 

This is probably due to the eWon Flexy's firmware version which is 11.2s2 and not the required 12...

Is there another command (or combination of commands) which I can use instead to have the same results as WriteEBD?

Thanx in advance,
Derek
Reply

simon Offline
eWON Support
#9
Derek,

Indeed the function "WriteEBD" is supported from the firmware 12.0

From your example, I do not quite understand why you are not emailing the file directly instead of using WriteEBD first and then email the file generated ?


See my modifications (I did not test it) :

Code:
REM Set variable which holds logstatus
isLogging% = 0

REM Trigger of the CheckProcessStateNumber section
ONCHANGE "oProcessStateNumber", "Goto CheckProcessStateNumber"
END
CheckProcessStateNumber:
IF ( (isLogging% = 0) AND (oProcessStateNumber@ >= 7) ) THEN
REM start logging of tags
isLogging% = 1
GOSUB "EnableTagsLog"
ELSE
IF ( (isLogging% = 1) AND (oProcessStateNumber@ < 7) ) THEN
  REM stop logging of tags and send report
  isLogging% = 0
  GOSUB "DisableTagsLog"
  ONSTATUS "GOTO ScheduleActionEnd"
  GOSUB READ_LASTTMS
  LAST_TIME$ = @GetCurrentTimeStamp$()
  Sendmail "info@resato.com", "", "Logged Values", "&[$dtHT$ftT$et" + LAST_TIME$ + "$st" + LASTTMS$ + "]"
ENDIF
ENDIF
END

EnableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "No. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
SETSYS TAG, "LOAD", -i%
SETSYS TAG,"logEnabled",1
SETSYS TAG, "SAVE"
PRINT "tag : " + STR$ i%
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
RETURN

DisableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "No. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
SETSYS TAG, "LOAD", -i%
SETSYS TAG,"logEnabled",0
SETSYS TAG, "SAVE"
PRINT "tag : " + STR$ i%
Next i%
CFGSAVE
PRINT "All Tags are set with log disabled"
RETURN

READ_LASTTMS:
SETSYS PRG,"RESUMENEXT",1
REM GET LAST TIMESTAMP
OPEN "file:/usr/tms.dat" FOR BINARY INPUT AS 1
 LASTTMS$ = GET 1,15
CLOSE 1
Cur_Err% = GETSYS PRG,"LSTERR"
IF Cur_Err% = 33 THEN //REM File does not exist
 LASTTMS$= "01011970_000000"
 SETSYS PRG,"LSTERR",0
ENDIF
SETSYS PRG,"RESUMENEXT",0
CLS
RETURN

FUNCTION WriteTMS($LastTimeStamp$):
OPEN "file:/usr/tms.dat" FOR BINARY OUTPUT AS 1
 PUT 1,$LastTimeStamp$
CLOSE 1
ENDFN

FUNCTION GetCurrentTimeStamp$()
REM TIME$ = 19/12/2014 10:03:01
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + "_" + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16)+ $EWON_TIME$(18 To 19)
ENDFN
Reply

DerekVH Offline
Junior Member
#10
Thank you for the information Simon,

I have worked with the code you provided and changed things around and sort of got it to work. 

What the eWon Flexy does now:
  1. At process start: save start time
  2. Enable historical logging of all the the 46x tags
  3. At process stop: save stop time
  4. Send e-mail with logfile attached
  5. Disable historical logging of all the the 46x tags
However the number of tags in the attached datalogfile is not consistant. I've sent more than 20 e-mails from eWon to myself with different script coding, but the one time it generates data of 30 tags and the next time 32 tags. The maximum number of tags I got in the datalogfile is 40, thus I'm still missing the data of 6 tags! This datalogfile I received by repeating the 'logEnabled' command a couple of times as shown in code below, but it still is not consistant:

Code:
EnableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "EnableTagsLog no. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",1
 SETSYS TAG, "SAVE"
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",1
 SETSYS TAG, "SAVE"
 PRINT "tag no.: " + STR$ i% "'s historical log is enabled"
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
RETURN

I can't pinpoint the actual script-command which is causing this problem, but do you have a way to form a consistant datalogfile (in my case: "TimeInt";"TimeStr"; and then 46 tags)? 

Thanx in advance,
Derek
Reply

simon Offline
eWON Support
#11
Derek,

For sure repeating the "enabling log" sequence is not the solution. :-)
Can I have the list of 46 tags (var_lst.txt) ? Can tell me how the Tag oProcessStateNumber is moving ? I would like to simulate here.

Simon
Reply

DerekVH Offline
Junior Member
#12
Hi Simon,

Hereby I attached the 'var_lst.txt'. Because the system where the eWon Flexy is connected to is installed, operational, an hour's drive from me and it isn't allowed for me to start it's intended process from this distance, I currently also simulate the script program. The system's 'oProcessStateNumber' is now constantly value 200. 

So I added two timers and code to activate the logging and also added section 'SimulateEndOfLog' to stop the log once after pressing the RUN script button.

Here is the current code:
Code:
Rem --- eWON start section: Cyclic Section
eWON_cyclic_section:
Rem --- eWON user (start)

Rem --- eWON user (end)
End
Rem --- eWON end section: Cyclic Section
Rem --- eWON start section: Init Section
eWON_init_section:
Rem --- eWON user (start)
REM Set variable which holds logstatus
isLogging% = 0
simulateNoTimes% = 1
simulateStartCount% = 0
simulateEndCount% = 0
REM Trigger of the CheckProcessStateNumber section
REM ONCHANGE "oProcessStateNumber", "GOTO CheckProcessStateNumber"
REM ONCHANGE "oP021H2Inlet", "GOTO CheckProcessStateNumber"
TSET 1,1
ONTIMER 1,"GOTO CheckProcessStateNumber"
TSET 2,31
ONTIMER 2,"GOTO SimulateEndOfLog"

END
Rem --- eWON user (end)
End
Rem --- eWON end section: Init Section
Rem --- eWON start section: CheckProcessStateNumber
Rem --- eWON user (start)
CheckProcessStateNumber:
REM IF ( (isLogging% = 0) AND (oProcessStateNumber@ >= 7) ) THEN
simulateStartCount% = simulateStartCount% + 1
IF (simulateNoTimes% >= simulateStartCount%) THEN
IF ( (isLogging% = 0) AND (oProcessStateNumber@ = 200) ) THEN
 REM start logging of tags
 isLogging% = 1
 GOSUB "EnableTagsLog"
 REM GOSUB "EnableTagsLog"
 START_TIME$ = @GetCurrentTimeStamp$()
 Print "START_TIME$ = " START_TIME$
REM ELSE
REM  IF ( (isLogging% = 1) AND (oProcessStateNumber@ < 7) ) THEN
   REM stop logging of tags and send report
REM    isLogging% = 0
REM    LAST_TIME$ = @GetCurrentTimeStamp$()
REM    Sendmail "info@resato.com", "", "Logged data from " + START_TIME$ + " to " + LAST_TIME$, "Logged data are attached to this mail &[$dtHT $ftT $st" + START_TIME$ + " $et" + LAST_TIME$ + "]"
REM    GOSUB "DisableTagsLog"
 ENDIF
ENDIF
ENDIF
END
Rem --- eWON user (end)
End
Rem --- eWON end section: CheckProcessStateNumber
Rem --- eWON start section: EnableTagsLog
Rem --- eWON user (start)
EnableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "EnableTagsLog no. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",1
 SETSYS TAG, "SAVE"
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",1
 SETSYS TAG, "SAVE"
 PRINT "tag no.: " + STR$ i% "'s historical log is enabled"
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
RETURN
Rem --- eWON user (end)
End
Rem --- eWON end section: EnableTagsLog
Rem --- eWON start section: DisableTagsLog
Rem --- eWON user (start)
DisableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "DisableTagsLog no. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
 SETSYS TAG, "LOAD", -i%
 SETSYS TAG,"logEnabled",0
 SETSYS TAG, "SAVE"
 PRINT "tag no.: " + STR$ i% "'s historical log is disabled"
Next i%
CFGSAVE
PRINT "All Tags are set with log disabled"
RETURN
Rem --- eWON user (end)
End
Rem --- eWON end section: DisableTagsLog
Rem --- eWON start section: FUNCTION GetCurrentTimeStamp$()
Rem --- eWON user (start)
FUNCTION GetCurrentTimeStamp$()
REM TIME$ = 19/12/2014 10:03:01
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + "_" + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16) + $EWON_TIME$(18 To 19)
ENDFN
Rem --- eWON user (end)
End
Rem --- eWON end section: FUNCTION GetCurrentTimeStamp$()
SimulateEndOfLog:
simulateEndCount% = simulateEndCount% + 1
IF (simulateNoTimes% >= simulateEndCount%) THEN
   REM stop logging of tags and send report
   isLogging% = 0
   LAST_TIME$ = @GetCurrentTimeStamp$()
   PRINT "LAST_TIME$ = " LAST_TIME$
   PRINT "Sendmail Logged data are attached to this mail &[$dtHT $ftT  $st" + START_TIME$ + " $et" + LAST_TIME$ + " $fnData.txt" + "]"
   Sendmail "info@resato.com", "", "Logged data from " + START_TIME$ + " to " + LAST_TIME$, "Logged data are attached to this mail &[$dtHT$ftT$st" + START_TIME$ + "$et" + LAST_TIME$ + "$fnData.txt" + "]"
   GOSUB "DisableTagsLog"
 ENDIF
END

Thanx in advance,
Derek


Attached Files
.txt   var_lst.txt (Size: 13,23 KB / Downloads: 18)
Reply

simon Offline
eWON Support
#13
Derek,

I think I found out what is going on.

The problem is that the Historical table cannot be displayed when the Tag option "LogEnabled" is deactivated.

So as an alternative, I always keep the Tags with "LogEnabled" activated but I play with the Logging Interval to disable/enable the logging (SETSYS TAG,"LogTimer",0 or 1).  If only set the Log Interval for Tags that have the LogEnabled parameter activated.

Code:
Rem --- eWON start section: Cyclic Section
eWON_cyclic_section:
Rem --- eWON user (start)

Rem --- eWON user (end)
End
Rem --- eWON end section: Cyclic Section
Rem --- eWON start section: Init Section
eWON_init_section:
Rem --- eWON user (start)

REM Set variable which holds logstatus
isLogging% = 0
simulateNoTimes% = 1
simulateStartCount% = 0
simulateEndCount% = 0
REM Trigger of the CheckProcessStateNumber section
REM ONCHANGE "oProcessStateNumber", "GOTO CheckProcessStateNumber"
REM ONCHANGE "oP021H2Inlet", "GOTO CheckProcessStateNumber"
TSET 1,1
ONTIMER 1,"GOTO CheckProcessStateNumber"
TSET 2,31
ONTIMER 2,"GOTO SimulateEndOfLog"

END
CheckProcessStateNumber:
REM IF ( (isLogging% = 0) AND (oProcessStateNumber@ >= 7) ) THEN
simulateStartCount% = simulateStartCount% + 1
IF (simulateNoTimes% >= simulateStartCount%) THEN
IF (isLogging% = 0) THEN
REM start logging of tags
isLogging% = 1
GOSUB "EnableTagsLog"
REM GOSUB "EnableTagsLog"
START_TIME$ = @GetCurrentTimeStamp$()
Print "START_TIME$ = " START_TIME$
REM ELSE
REM  IF ( (isLogging% = 1) AND (oProcessStateNumber@ < 7) ) THEN
  REM stop logging of tags and send report
REM    isLogging% = 0
REM    LAST_TIME$ = @GetCurrentTimeStamp$()
REM    Sendmail "info@resato.com", "", "Logged data from " + START_TIME$ + " to " + LAST_TIME$, "Logged data are attached to this mail &[$dtHT $ftT $st" + START_TIME$ + " $et" + LAST_TIME$ + "]"
REM    GOSUB "DisableTagsLog"
ENDIF
ENDIF
ENDIF
END
EnableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "EnableTagsLog no. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
SETSYS TAG, "LOAD", -i%
LogEnabled$ = GETSYS TAG, "LogEnabled"
IF LogEnabled$ = "1" THEN
  SETSYS TAG,"LogTimer",1
  SETSYS TAG, "SAVE"
ENDIF
PRINT "tag no.: " + STR$ i% "'s historical log is enabled"
Next i%
CFGSAVE
PRINT "All Tags are set with log enabled"
RETURN
DisableTagsLog:
n% = GETSYS PRG,"NBTAGS"
PRINT "DisableTagsLog no. tags : " + STR$ n%
For i%=n%-1 To 0 STEP -1
SETSYS TAG, "LOAD", -i%
SETSYS TAG,"LogTimer",0
SETSYS TAG, "SAVE"
PRINT "tag no.: " + STR$ i% "'s historical log is disabled"
Next i%
CFGSAVE
PRINT "All Tags are set with log disabled"
RETURN
FUNCTION GetCurrentTimeStamp$()
REM TIME$ = 19/12/2014 10:03:01
$EWON_TIME$ = TIME$
$GetCurrentTimeStamp$ = $EWON_TIME$(1 To 2) + $EWON_TIME$(4 To 5) + $EWON_TIME$(7 To 10) + "_" + $EWON_TIME$(12 To 13) + $EWON_TIME$(15 To 16) + $EWON_TIME$(18 To 19)
ENDFN
SimulateEndOfLog:
simulateEndCount% = simulateEndCount% + 1
IF (simulateNoTimes% >= simulateEndCount%) THEN
  REM stop logging of tags and send report
  isLogging% = 0
  LAST_TIME$ = @GetCurrentTimeStamp$()
  PRINT "LAST_TIME$ = " LAST_TIME$
  PRINT "Sendmail Logged data are attached to this mail &[$dtHT $ftT  $st" + START_TIME$ + " $et" + LAST_TIME$ + " $fnData.txt" + "]"
  Sendmail "side@hms.se", "", "Logged data from " + START_TIME$ + " to " + LAST_TIME$, "Logged data are attached to this mail" + "&[$dtHT$ftT$st" + START_TIME$ + "$et" + LAST_TIME$ + "$fnData.txt]"
  GOSUB "DisableTagsLog"
  ENDIF
END
Rem --- eWON user (end)
End
Rem --- eWON end section: Init Section

Also in your code, more a remark here, you use the function CFGSAVE which is useless when you modify parameters at runtime like you do.
This function allows you to save the modified settings into the Flash memory (when the eWON is off).

Here attached the file that I get (I used MEM tags)


Attached Files
.txt   Data.txt (Size: 4,53 KB / Downloads: 25)
Reply

Engineer4Life Offline
Junior Member
#14
Can you email multiple files in a single SENDMAIL call?  If so what do I use to separate my EBD?

I have three files to send.

[UPDATE]  It does work, if anybody wants to know how here is my command.

SENDMAIL email_primary$, email_cc$, "Subject line of email  ",Email_File_1$ + Email_File_2$ + Email_File_3$

You NEED to store your EBD's in strings because it gets way too long if you add more then a single file and it won't run.

Email_File_1$ = "&[EBD]"
Reply

simon Offline
eWON Support
#15
Well done :-)
Reply



Possibly Related Threads…
10 hours ago
Last Post: simon
09-03-2020, 02:29 PM
Last Post: simon
09-03-2020, 01:48 PM
Last Post: simon
14-02-2020, 06:05 PM
Last Post: simon
07-01-2020, 03:34 PM
Last Post: simon
27-11-2019, 10:30 PM
Last Post: simon
30-10-2019, 10:02 PM
Last Post: Nikolai
05-06-2019, 08:08 AM
Last Post: luuc
  Creating tags in BAsIC IDE Started by ProAuto
1 Replies - 1.051 Views
16-05-2019, 07:18 PM
Last Post: ProAuto
15-05-2019, 09:49 PM
Last Post: Bernd



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy