More Help Needed

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by xrmichael, Feb 11, 2008.

  1. xrmichael

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    This is a screen grab from the touch screen i have been working on it shows the external temp over the last 1/12/24/168 hours base on a 77 samples per time frame, Problem is until the module has run for 1/12/24/168 i get the steep kick in the graph at the right as the array removes the wrong temp values out of the graph.

    I have tried to set all array values to the current temp or 0degs but get a similar effect any ideas.

    Also is there a way (i presume using a save/read to file command) to store the array so if we get a power outage it wont take 1/12/24/168 hrs to get the graph back.

    The ctouch also logs the Internal Average Temp of 12 Rooms/ Current KWH Of the House / Ex Light Level in the same way with the same problem.

    Also any general comments on would be appreciated.
     

    Attached Files:

    xrmichael, Feb 11, 2008
    #1
  2. xrmichael

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Also

    It did not get above 8degs today.
     
    xrmichael, Feb 11, 2008
    #2
  3. xrmichael

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Calibration

    Cbus stat is 2/4 degs out of calibration, but thats normal.
     
    xrmichael, Feb 11, 2008
    #3
  4. xrmichael

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Without seeing the code you have used it is impossible to comment on this.

    Have you looked at the example project in C:\Clipsal\PICED\Projects\Examples\Logic\Graphing\graphing.ctd ?

    You could write all of the data to a file every hour or so, and read the data when the logic first starts.

    If you have your data stored in array called LevelArray (as in the Graphing example), you could save and read the data as follows :

    Code:
    procedure SaveData;
    var
      i : integer;
    begin
      AssignFile(file1, 'data.txt');
      ReWrite(file1);
      for i := 1 to 100 do
        WriteLn(file1, LevelArray[i]);
      CloseFile(file1);
    end;
    
    procedure ReadData;
    var
      i : integer;
    begin
      AssignFile(file1, 'data.txt');
      Reset(file1);
      for i := 1 to 100 do
        if not eof(file1) then
          ReadLn(file1, LevelArray[i]);
      CloseFile(file1);
    end;
    You need to call SaveData on a regular basis (but not too often) and you need to call ReadData when the logic first start.

    Note that the first time you run this, the data file will not exist and so the ReadData procedure will fail. There are two ways around this :
    1. Add the SaveData procedure to the code first. Wait for it to save the data, then add the ReadData procedure.
    2. Create a dummy 'data.txt' file.
     
    Darren, Feb 12, 2008
    #4
  5. xrmichael

    xrmichael

    Joined:
    Nov 20, 2006
    Messages:
    113
    Likes Received:
    1
    Location:
    uk
    Read Data

    I have altered the code to save / read the file, this will make the system work better but,

    The logic works fine running in Piced but fails on the ctouch, I created the data files by running the save data code first the adding the read data code.

    But in the log i get a file not found error.

    Is there a way to search for the files on the ctouch they have appeared in the project directory of the piced project.

    Also when you use the code 'for i := 1 to 77 do'. Do you need a different variable for each instance of the 'for i do' code? what if 2 modules ran the 'for i do' code at the same time. would this mess the counter up.
     
    xrmichael, Feb 13, 2008
    #5
  6. xrmichael

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    There is a problem with Colour C-Touch where a file which is only accessed from logic does not get transferred from PICED to the Colour C-Touch. The simple work-around is to have a button on an unused page which opens the file. This will then ensure that the file gets included with the project archive.

    No, you can't search for files.

    You can use the index variable (in this case "i") as many times as you want.
     
    Darren, Feb 15, 2008
    #6
  7. xrmichael

    leeandj

    Joined:
    Apr 13, 2006
    Messages:
    37
    Likes Received:
    0
    Location:
    Park City, UT
    On a similar vein, once the file has been created and transferred from PICED to the Colour C-Touch how do I prevent a new, blank file from being transferred when I re-load the project to the Colour C-Touch? It seems that my file is being created, transferred and written to as required, but it seems that whenever I re-load the project (say with other enhancements) the file is overwritten and the existing data is lost.

    If there is no other solution, I was thinking of storing the file name in an I/O variable. Would this trick PICED into not creating and transferring a file?

    Thanks,
    leeandj.
     
    leeandj, Sep 23, 2008
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.