Current Measurement

Discussion in 'General Discussion' started by Newbie, Mar 19, 2013.

  1. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Hi All,

    Hope all is well...

    Is it possible to pull down a history log from the current measurement unit without any type of wiser or touch..My boss want me to be able to go to a client and pull down the history log for a "before" and "after" type of config...

    So his idea is to go to our client and take a history log for a month measurement without c-bus('"BEFORE"), and then again afterwards when we install c-bus units("AFTER").. It is just to give them the idea of the capabilities of the ENERGY SAVINGS part of C-bus...

    Thank You
     
    Newbie, Mar 19, 2013
    #1
  2. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Newbie,

    The current measurement unit won't run unless at least a C-Bus Power supply and a unit providing a clock eg PCI / CNI / Wiser (and a burden) is in place on the C-Bus network.

    Can't tell you about pulling down a history file directly sorry though someone else reading may be able to.

    If you are using a Wiser, the data is stored in the PICED 'Projects' directory and looks something like wiser_test-PFR.csv after you download the project back from the Wiser.

    Brad
     
    bmerrick, Mar 19, 2013
    #2
  3. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Hi Brad

    If i am using a CTC...How would i do this in the wiser as i cant use the AssignFile and other statements in the Wiser?

    I got this piece of logic from a posts..It compiles and everything but then when you enable the module with the button it just give me a error and sometimes it will push the info onto the csv file a created..

    But i cant say it is a success because i don't really see that it is changing anything really..

    The error i am getting :Logic Run-time Error R100 at line 32:0 - Other error (I/O error 32)

    Logic:
    AssignFile(file1, 'Power Data.csv');
    ReWrite(file1);

    WriteLn(file1,'date, Lights, Aircon, Outside Lights, Total, total cost R');

    for i := 12 DownTo 0 do
    begin
    DateToString(Date - i, DataString);
    Energy := GetRealIBSystemIO("Measurement App Energy Value",254, 50, 1, 3, 12, i, 0, 0);
    Format(s, ',', Energy:0:0);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 2, 3, 12, i, 0, 0);
    Format(s, ',', Energy:0:0);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 3, 3, 12, i, 0, 0);
    Format(s, ',', Energy:0:0);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, i, 0, 0, 0);
    Format(s, ',', Energy:0:0);
    Append(DataString, s);
    Cost := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, i, 2, 0, 0);
    Format(s, ',', Cost:0:2);
    Append(DataString, s);
    WriteLn(File1, DataString);
    end;

    CloseFile(file1);
    DisableModule("Power Export");
     
    Newbie, Mar 19, 2013
    #3
  4. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Newbie,

    It seems your boss is making your life difficult!!! Most bosses never do that :p

    Why not suggest just attaching either the CTC or a Wiser to the network to use for both the initial testing period and the 'after C-Bus' monitoring. You will then get a nice graph from either unit that will actually show the difference to your client in a nice form and serve as a baseline for the future. You can also then easily download the CSV from the project directory without having to play around with the logic. If you use the CTC you can use the logic you found to create a specific file.

    If you are worried to, during the initial testing phase you can remove the small amount of power usage of the Wiser or CTC from the equation by putting a cheap inline power use meter on the power lead for the Wiser or CTC (and any other bits like a C-Bus PSU etc) which will tell you how much it used. If you want to get really fancy, you can put a spare CT on the CMU around the lead and track it on it's own channel.

    Give it a go.

    Brad
     
    bmerrick, Mar 20, 2013
    #4
  5. Newbie

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    323
    Likes Received:
    5
    Location:
    FNQ
    Hello Newbie.

    As Brad suggests, maybe use a touchscreen such as the desk mount Spectrum (part number C-5000CTDL2-WE). If it's temporary, the desktop will sit nicely on a bench or on a shelf and you can add some advertising pages to help sell the concept. A small initial outlay that you should make back in labour saving - always a good pitch to the Boss :)

    Mark
     
    Mr Mark, Mar 20, 2013
    #5
  6. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Hi Bmerick

    Ja the job has been made note easy, but that piece of logic i actually found from one of your post..Ok i would also just liked to use the graphs or even just the analog meters on wiser but he wants to be able to track back two months and show all of that info like watts used more or less what the cost would be..And also i did try to open the csv file, but had the same issue that you had where it shows some weird characters..

    O ja is there way to sure that the currency is in Rands?
     
    Newbie, Mar 25, 2013
    #6
  7. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Almost there

    This is what it looks like so far, is it possible show a monthly bill/Kw rather than a day by day?


    date Phase A Red Phase B Wh Solar Wh Total Wh total cost R
    3/10/2013 20600 21000 20000 61600 616
    3/11/2013 18000 18000 20800 56800 568
    3/12/2013 19000 19200 18600 56800 568
    3/13/2013 19600 20000 21600 61200 612
    3/14/2013 20000 20800 20600 61400 614
    3/15/2013 20400 18800 20400 59600 596
    3/16/2013 21800 18200 20600 60600 606
    3/17/2013 18400 20200 21400 60000 600
    3/18/2013 19000 21200 20600 60800 608
    3/19/2013 18800 20200 21600 60600 606
    3/20/2013 0 0 0 0 0
    3/21/2013 0 0 0 0 0
    3/22/2013 0 0 0 0 0
    3/23/2013 0 0 0 0 0
    3/24/2013 0 0 0 0 0
    3/25/2013 0 0 0 0 0
     

    Attached Files:

    Newbie, Mar 25, 2013
    #7
  8. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Newbie,

    Once it is in the spreadsheet, you can add up whatever columns you need with a total box, or a macro if you want to be fancy and pick off the last 30 days automatically based on an entered date.

    You can also do that in the logic program. In Logic Help, Look for the 'Using Power and Energy Data' section. I've appended the 'Energy' part of the section here below.

    try MonthPower := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 3, 3, 1, 0, 0, 0); (I haven't tried this, I just plugged in the figures)

    If for some reason that does not give you exactly what you want, you are stuck writing a more complicated rotational array that enters the data into a FIFO array and sums the last x days (or whatever periods or parts of days for example if you wanted to split 'business hours' from 'after hours' etc.)

    Also, just looking at your sheet, it all seems very 'calm' without much rate of change. Is that what you expected?? I noticed in your earlier logic example you had periods based on months not hours. Has that been changed?

    Hope that helps,

    Brad



    Energy

    Several in-built System IO Variables can be used with energy data:
    ? Pulse Power Meter Energy - Recorded energy for a Pulse Power Meter
    ? Measurement App Energy Value - Recorded energy for an Analogue Power Meter
    ? Power Meter Total Energy - Total energy for all meters

    To get the maximum power level over a period of time for a pulse power meter:

    GetRealIBSystemIO("Pulse Power Meter Energy", MeterNumber, PeriodType, PeriodQuantity, Offset, UnitType, DataType);

    where

    MeterNumber is the index of the Pulse Power Meter (0 is the first one) or tag
    PeriodType is the units of the duration:
    ? 0 = Hours
    ? 1 = Days
    ? 2 = Weeks
    ? 3 = Months

    PeriodQuantity is the number of periods
    Offset is the offset back from today (in multiples of PeriodQuantity x PeriodType)

    UnitType is the units the data is required in:

    ? 0 = kWh
    ? 1 = kg of CO2 (uses the Carbon Footprint value)
    ? 2 = Cost (uses the energy Tariff )
    ? 3 = MJ

    DataType is:

    ? 0 = To date (energy used during the period so far)
    ? 1 = Predicted (rough estimate for the period)
    ? 2 = Average (average for as far back as data is available)

    For example, to find the energy (in Watt Hours) over the past 24 hours for pulse power meter "Meter A":

    Power := GetRealIBSystemIO("Pulse Power Meter Energy", "Meter A", 0, 24, 0, 0, 0);

    To find the energy for the 24 hours prior to that, the offset will be 1:

    Power := GetRealIBSystemIO("Pulse Power Meter Energy", "Meter A", 0, 24, 1, 0, 0);

    To find the predicted energy cost for this month:

    Cost := GetRealIBSystemIO("Pulse Power Meter Energy", "Meter A", 3, 1, 0, 2, 1);


    To get the maximum power level over a period of time for an analogue power meter:

    GetRealIBSystemIO("Measurement App Energy Value", Network, DeviceId, Channel, PeriodType, PeriodQuantity, Offset, UnitType, DataType);

    where
    • Network is the C-Bus Network number
    • DeviceId is the Measurement Application Device Identifier
    • Channel is the Measurement Application channel number (0 is the first channel)
    • PeriodType is the units of the duration (as above)
    • PeriodQuantity is the number of periods
    • Offset is the offset back from today (in multiples of PeriodQuantity x PeriodType)
    • UnitType is the units the data is required in (as above)

    DataType is as above

    For example, to get the energy used by the analogue power meter on network 254, Device Id 2, channel 0 (the first channel) in kg of CO2 over the past 12 months:

    Power := GetRealIBSystemIO("Measurement App Energy Value", 254, 2, 0, 3, 12, 0, 1, 0);

    To get the the total energy for all power meters:

    GetRealIBSystemIO("Power Meter Total Energy", PeriodType, PeriodQuantity, Offset, UnitType, DataType, TariffNo);

    Where TariffNo is the number of the tariff of the meters to be included in the total. Use a value of -1 to get the total for all meters.

    For example, to get the energy used by all power meters today:

    Energy := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, 0, 0, 0, -1);

    To get the average daily energy used by all power meters:

    Energy := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, 0, 0, 2, -1);
     
    Last edited by a moderator: Mar 25, 2013
    bmerrick, Mar 25, 2013
    #8
  9. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Hi Bmerick

    Ja i actually changed it to days...

    Ok... Sorry this might most likely be a stupid question...But in the history log of the actual history log, i am sure suppose to do something there for all the analogue meters to work..I have created RED,BLUE,WHITE PHASES and also a TOTAL..Not controllable..Um but now when you go to that history log you can select all and the say edit, and that is the part i am sure is not correct, is all that value just the max it will measure up to?

    When i change the values in the total history it does give you values but all are the same, and when you go to the RED,BLUE and White Phase one it just takes the value that you given it and assign it to all the dates?

    I think the logic is actually working , it is just me not really knowing how to the history log works..

    Thank You for the help..:):confused:
     
    Newbie, Mar 27, 2013
    #9
  10. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Newbie,

    I am sorry, I am finding it hard to picture which history log you mean? Are you talking about in PICED in Power Meter Manager in the history section, or the history in the CSV spreadsheet created by your logic program?

    The fact that you say you can set it leads me to believe you are talking about the PICED PMM History tab. In that you can actually change the power used in a period and if re-uploaded to a Wiser for instance, will change the history in its power measurement log. Is that what you meant?

    The history tab should (after download/updating the project from your Wiser or Touch Screen) be populated with the actual figures for the last ~24 hr period. These are the figure put into the local projects CSV file, and I would think should be closely replicated in any download that you instigate from the CMU via the measurement app using logic. As I mentioned before, I haven't used the logic for this purpose so I am just speculating here.

    Can try on my bench tomorrow though if I get a free minute or ten!!

    Brad
     
    bmerrick, Mar 27, 2013
    #10
  11. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Hi Bmerick

    Yes i was talking about the History log in Power Measurement Management tab..

    Do understand this correctly that history log in the tab will give me the last 2 months information?

    And also can you please explain to me what this actually does? Format(s, ',', Energy:0:2);:eek:

    And for some reason when i do 364 downto 0

    I get R100 errors?:confused:

    Kindest Regards
    Tobie
     

    Attached Files:

    Newbie, Mar 28, 2013
    #11
  12. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Tobie,

    Can you please send a return post with your latest modified logic and also the CSV output file it is creating (if it currently is). There are a number of Logic gurus here who have probably done this CMU download before to a greater degree than me.

    The way I understand it (and am happy to be corrected here), If you are in PICED and you have refreshed your project from your unit (I assume you are using a Touch Screen?), the numbers in the history are what the unit has recorded over the period.

    In Power Meter Manager History, if you are in hourly data, you will usually get around 24 hours. In daily data, it gives you a larger window but depending on the unit type it may have reduced daily data to monthly averages beyond about 30 days.

    This is not what you are trying to download with the logic. The logic is reading the power use data directly from the 5504CMU data in the C-Touch/Wiser and creating its own file from that.

    This is just to convert the numerical output from the previous line in the logic (that is reading a particular energy parameter - 'Energy' or 'Cost' variable) into a string(variable 's') with a text width of the numeric value and adds a comma so that in the logic line after this (The Append statement) the new parameter gets added to the end of the growing output string (named 'DataString'). This comma being added after each parameter is what is making the final output file (in the 'Data String' variable) a CSV file (ie Comma Separated Values)

    Gotta love PASCAL errors, so helpful and user friendly :p Then you look it up in the help and get:

    Error R100 : Other error
    An unlisted type of error has occurred. Thanks for that...................


    Sight unseen, I would speculate that you are running out of actual records, ie there are not that many and there is no error handling so it just gives the error. Without seeing the final form of your code and giving it a test, can't tell you off hand. As I said above, post it and there are many logic gurus watching this forum who will be able to say for sure just reading it. I myself often need to run it to see where it is going wrong / off the rails.

    Hope some of the above helped and please do post your code back,

    Brad
     
    Last edited by a moderator: Apr 7, 2013
    bmerrick, Mar 28, 2013
    #12
  13. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Tobie,

    I have had a further play around with the logic that you posted earlier. (Please still post your updated/changed logic).


    Code:
    29/03/2013 9:52:22 AM  Info     : Logic Engine Started
    29/03/2013 9:52:22 AM  Logic    : date, Lights, Aircon, Outside Lights, Total, total cost R
    29/03/2013 9:52:22 AM  Logic    : 24/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 25/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 26/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 27/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 28/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 29/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 30/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 31/01/2013,0,0,0,49271,14.78
    29/03/2013 9:52:22 AM  Logic    : 1/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 2/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 3/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 4/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 5/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 6/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 7/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 8/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 9/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 10/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 11/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 12/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 13/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 14/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 15/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 16/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 17/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 18/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 19/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 20/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 21/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 22/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 23/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 24/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 25/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 26/02/2013,0,0,0,83068,24.92
    29/03/2013 9:52:22 AM  Logic    : 27/02/2013,0,0,0,98290,29.49
    29/03/2013 9:52:22 AM  Logic    : 28/02/2013,0,0,0,65637,19.69
    29/03/2013 9:52:22 AM  Logic    : 1/03/2013,0,0,0,42983,12.89
    29/03/2013 9:52:22 AM  Logic    : 2/03/2013,0,0,0,46911,14.07
    29/03/2013 9:52:22 AM  Logic    : 3/03/2013,0,0,0,34844,10.45
    29/03/2013 9:52:22 AM  Logic    : 4/03/2013,0,0,0,54886,16.47
    29/03/2013 9:52:22 AM  Logic    : 5/03/2013,0,0,0,46970,14.09
    29/03/2013 9:52:22 AM  Logic    : 6/03/2013,0,0,0,53097,15.93
    29/03/2013 9:52:22 AM  Logic    : 7/03/2013,0,0,0,85089,25.53
    29/03/2013 9:52:22 AM  Logic    : 8/03/2013,0,0,0,58356,17.51
    29/03/2013 9:52:22 AM  Logic    : 9/03/2013,0,0,0,56594,16.98
    29/03/2013 9:52:22 AM  Logic    : 10/03/2013,0,0,0,70588,21.18
    29/03/2013 9:52:22 AM  Logic    : 11/03/2013,0,0,0,100699,30.21
    29/03/2013 9:52:22 AM  Logic    : 12/03/2013,0,0,0,79126,23.74
    29/03/2013 9:52:22 AM  Logic    : 13/03/2013,0,0,0,52078,15.62
    29/03/2013 9:52:22 AM  Logic    : 14/03/2013,0,0,0,64279,19.28
    29/03/2013 9:52:22 AM  Logic    : 15/03/2013,0,0,0,46373,13.91
    29/03/2013 9:52:22 AM  Logic    : 16/03/2013,0,0,0,69339,20.83
    29/03/2013 9:52:22 AM  Logic    : 17/03/2013,0,0,0,61082,18.32
    29/03/2013 9:52:22 AM  Logic    : 18/03/2013,0,0,0,48386,14.52
    29/03/2013 9:52:22 AM  Logic    : 19/03/2013,0,0,0,53644,16.09
    29/03/2013 9:52:22 AM  Logic    : 20/03/2013,0,0,0,41037,12.31
    29/03/2013 9:52:22 AM  Logic    : 21/03/2013,0,0,0,50531,15.16
    29/03/2013 9:52:22 AM  Logic    : 22/03/2013,0,0,0,94638,28.39
    29/03/2013 9:52:22 AM  Logic    : 23/03/2013,0,0,0,96303,28.89
    29/03/2013 9:52:22 AM  Logic    : 24/03/2013,0,0,0,121829,36.55
    29/03/2013 9:52:22 AM  Logic    : 25/03/2013,0,0,0,116327,34.90
    29/03/2013 9:52:22 AM  Logic    : 26/03/2013,0,0,0,101346,30.40
    29/03/2013 9:52:22 AM  Logic    : 27/03/2013,0,0,0,119864,35.96
    29/03/2013 9:52:22 AM  Logic    : 28/03/2013,745109,501452,475020,147791,44.34
    29/03/2013 9:52:22 AM  Logic    : 29/03/2013,7659509,5866476,6852122,23011,6.90
    
    This was with it doing 64 to 0.

    I didn't get the R100 error (seems to me possibly a file writing/opening based error?? you are seeing) but an R008 when I went too much more than 300 in the for Downto do loop, see the output here.

    Code:
    29/03/2013 9:50:58 AM  Error    : Logic Run-time Error R008 at line 306:0 - Exceeded maximum number of Instructions
    
    and this error is because the program exceeded a limit to number of instructions per module cycle.

    Your R100 error is probably for a similar reason as it takes a long time to write those records to a file and would exceed the module program execution time I'm assuming. Try a 64 to 0 as this will give you 2 months, but as you can see from my data (which is from a Wiser), it has redacted the previous month to a monthly figure.


    I also tried another approach providing just totals. Made a new logic module named Power Monitor1
    Code:
    WriteLn('Total Energy (Whr) as at');
    DateToString(Date, DataString);
    WriteLn(DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy",3, 1, 0, 0, 0, -1);
    Format(DataString, 'Current Months Power Use = ', MonthPower:0:0);
    WriteLn(DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy", 3, 1, 1, 0, 0, -1);
    Format(DataString, 'Previous Months Power Use = ', MonthPower:0:0);
    WriteLn(DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy", 3, 1, 2, 0, 0, -1);
    Format(DataString, 'Month Befores Power Use = ', MonthPower:0:0);
    WriteLn(DataString);
    DisableModule("Power Monitor1");
    

    which gave the output of:
    Code:
    29/03/2013 11:53:58 AM  Info     : Logic Engine Started
    29/03/2013 11:53:58 AM  Logic    : Total Energy (Whr) as at
    29/03/2013 11:53:58 AM  Logic    : 29/03/2013
    29/03/2013 11:53:58 AM  Logic    : Current Months Power Use = 2042693
    29/03/2013 11:53:58 AM  Logic    : Previous Months Power Use = 2323683
    29/03/2013 11:53:58 AM  Logic    : Month Befores Power Use = 1527395
    29/03/2013 11:54:01 AM  Info     : Logic Engine Stopped
    
    
    You can try this by setting your 'logic options' in the logic window in PICED to 'Allow use of all functions for testing' and 'Send WriteLn output to log'. You then look for the output in the PICED log file under the 'View' pull down menu in the main PICED window.


    To wrap that up to an output file

    Code:
    AssignFile(file2, 'Month_Total_Data.csv');
    ReWrite(file2);
    WriteLn(file2,'Total Energy (Whr) as at');
    DateToString(Date, DataString);
    WriteLn(file2,DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy",3, 1, 0, 0, 0, -1);
    Format(DataString, 'Current Months Power Use = ', MonthPower:0:0);
    WriteLn(file2,DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy", 3, 1, 1, 0, 0, -1);
    Format(DataString, 'Previous Months Power Use = ', MonthPower:0:0);
    WriteLn(file2,DataString);
    MonthPower := GetRealIBSystemIO("Power Meter Total Energy", 3, 1, 2, 0, 0, -1);
    Format(DataString, 'Month Befores Power Use = ', MonthPower:0:0);
    WriteLn(file2,DataString);
    CloseFile(file2);
    DisableModule("Power Monitor1"); 
    
    and you need these variables define in 'Global Variables'

    DataString : string;
    s :string;
    MonthPower : real;

    All the best,

    Brad
     
    Last edited by a moderator: Mar 30, 2013
    bmerrick, Mar 28, 2013
    #13
  14. Newbie

    Newbie

    Joined:
    Jun 16, 2010
    Messages:
    45
    Likes Received:
    0
    Location:
    South Africa
    Latest Logic

    Hey Bmerick

    Once again thank you for all the help...

    Ok, um i haven't been really playing again as we had a lot of long weekends in South Africa and i am busy with my studies too..

    But this is what it looks like, i also noticed that i can not go up to 300 so i just took down to 15 for testing..

    AssignFile(file2, 'Power Data.csv');
    ReWrite(file2);

    WriteLn(file2, 'date, Phase A Red, Phase B Wh, Solar Wh, Total Wh, total cost R');

    for i := 15 DownTo 0 do
    begin
    DateToString(Date - i, DataString);
    Energy := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 1, 1, 1, i, 0, 0);
    Format(s, ',', Energy:0:2);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 2, 1, 1, i, 0, 0);
    Format(s, ',', Energy:0:2);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Measurement App Energy Value", 254, 50, 3, 1, 1, i, 0, 0);
    Format(s, ',', Energy:0:2);
    Append(DataString, s);
    Energy := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, i, 0, 0, 0);
    Format(s, ',', Energy:0:2);
    Append(DataString, s);
    Cost := GetRealIBSystemIO("Power Meter Total Energy", 1, 1, i, 2, 0, 0);
    Format(s, ',', Cost:0:2);
    Append(DataString, s);
    WriteLn(File2, DataString);
    end;

    CloseFile(file2);
    DisableModule("Power Export");
     

    Attached Files:

    Newbie, Apr 3, 2013
    #14
  15. Newbie

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    If you are still getting the R008 error as you were previously, just change the option for the Maximum Instructions in the logic engine.

     
    Darren, Apr 6, 2013
    #15
  16. Newbie

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    437
    Likes Received:
    35
    Location:
    Sydney
    Hi Tobie,

    Your logic seems sound. I ran it on my Wiser project in PICED and increased to 90 in the loop. (or do as Darren suggests to exceed the 300 loops.)

    Got the following output which tallies with my Homegate screen power numbers (for three of my 5504CMU channels).

    Code:
    date, Phase A Red, Phase B Wh, Solar Wh, Total Wh, total cost R
    7/01/2013,20487,17148,11636,49271,14.77
    8/01/2013,20487,17148,11636,49271,14.77
    9/01/2013,20487,17148,11636,49271,14.77
    10/01/2013,20487,17148,11636,49271,14.77
    11/01/2013,20487,17148,11636,49271,14.77
    12/01/2013,20487,17148,11636,49271,14.77
    13/01/2013,20487,17148,11636,49271,14.77
    14/01/2013,20487,17148,11636,49271,14.77
    15/01/2013,20487,17148,11636,49271,14.77
    16/01/2013,20487,17148,11636,49271,14.77
    17/01/2013,20487,17148,11636,49271,14.77
    18/01/2013,20487,17148,11636,49271,14.77
    19/01/2013,20487,17148,11636,49271,14.77
    20/01/2013,20487,17148,11636,49271,14.77
    21/01/2013,20487,17148,11636,49271,14.77
    22/01/2013,20487,17148,11636,49271,14.77
    23/01/2013,20487,17148,11636,49271,14.77
    24/01/2013,20487,17148,11636,49271,14.77
    25/01/2013,20487,17148,11636,49271,14.77
    26/01/2013,20487,17148,11636,49271,14.77
    27/01/2013,20487,17148,11636,49271,14.77
    28/01/2013,20487,17148,11636,49271,14.77
    29/01/2013,20487,17148,11636,49271,14.77
    30/01/2013,20487,17148,11636,49271,14.77
    31/01/2013,33648,29853,19488,82989,24.90
    1/02/2013,33648,29853,19488,82989,24.90
    2/02/2013,33648,29853,19488,82989,24.90
    3/02/2013,33648,29853,19488,82989,24.90
    4/02/2013,33648,29853,19488,82989,24.90
    5/02/2013,33648,29853,19488,82989,24.90
    6/02/2013,33648,29853,19488,82989,24.90
    7/02/2013,33648,29853,19488,82989,24.90
    8/02/2013,33648,29853,19488,82989,24.90
    9/02/2013,33648,29853,19488,82989,24.90
    10/02/2013,33648,29853,19488,82989,24.90
    11/02/2013,33648,29853,19488,82989,24.90
    12/02/2013,33648,29853,19488,82989,24.90
    13/02/2013,33648,29853,19488,82989,24.90
    14/02/2013,33648,29853,19488,82989,24.90
    15/02/2013,33648,29853,19488,82989,24.90
    16/02/2013,33648,29853,19488,82989,24.90
    17/02/2013,33648,29853,19488,82989,24.90
    18/02/2013,33648,29853,19488,82989,24.90
    19/02/2013,33648,29853,19488,82989,24.90
    20/02/2013,33648,29853,19488,82989,24.90
    21/02/2013,33648,29853,19488,82989,24.90
    22/02/2013,33648,29853,19488,82989,24.90
    23/02/2013,33648,29853,19488,82989,24.90
    24/02/2013,33648,29853,19488,82989,24.90
    25/02/2013,33648,29853,19488,82989,24.90
    26/02/2013,33648,29853,19488,82989,24.90
    27/02/2013,33648,29853,19488,82989,24.90
    28/02/2013,28895,25375,15591,69861,20.96
    1/03/2013,28895,25375,15591,69861,20.96
    2/03/2013,28895,25375,15591,69861,20.96
    3/03/2013,28895,25375,15591,69861,20.96
    4/03/2013,28895,25375,15591,69861,20.96
    5/03/2013,28895,25375,15591,69861,20.96
    6/03/2013,28895,25375,15591,69861,20.96
    7/03/2013,38009,26806,20274,85089,25.52
    8/03/2013,27633,18615,12107,58355,17.50
    9/03/2013,25406,19471,11716,56593,16.97
    10/03/2013,26949,30528,13111,70588,21.17
    11/03/2013,35594,44649,20455,100698,30.21
    12/03/2013,27279,26637,25210,79126,23.73
    13/03/2013,21569,18538,11971,52078,15.62
    14/03/2013,28560,20931,14788,64279,19.29
    15/03/2013,21010,17166,8197,46373,13.91
    16/03/2013,27914,24126,17299,69339,20.83
    17/03/2013,23137,25378,12567,61082,18.32
    18/03/2013,17812,21790,8785,48387,14.52
    19/03/2013,19963,25846,7835,53644,16.09
    20/03/2013,18181,13689,9166,41036,12.31
    21/03/2013,23023,18045,9463,50531,15.16
    22/03/2013,40656,31399,22583,94638,28.39
    23/03/2013,36634,39621,20048,96303,28.89
    24/03/2013,48027,45203,28599,121829,36.55
    25/03/2013,49137,39593,27597,116327,34.90
    26/03/2013,42822,33528,24995,101345,30.41
    27/03/2013,48142,39763,31959,119864,35.96
    28/03/2013,60128,45809,34069,140006,41.98
    29/03/2013,24838,24073,11192,60103,18.04
    30/03/2013,20239,15862,11107,47208,14.16
    31/03/2013,21919,19002,10138,51059,15.32
    1/04/2013,21478,15720,8853,46051,13.82
    2/04/2013,21141,22442,8758,52341,15.70
    3/04/2013,18118,29554,7451,55123,16.54
    4/04/2013,15486,16914,9114,41514,12.45
    5/04/2013,19627,15639,9159,44425,13.33
    6/04/2013,17797,13089,7216,38102,11.43
    7/04/2013,0,0,0,0,0.00
    
    I suggest a small change is to reduce the decimal points on the first 4 'Energy' lines by changing

    Format(s, ',', Energy:0:2); to this Format(s, ',', Energy:0:0);

    Leave the 2 decimal places in the Costs calc. If you don't make the dec. point change above, each line will just look like this instead:

    Code:
    3/03/2013,14381.00,13591.00,6873.00,34845.00,10.45
    
    Based on you wanting to have quite accurate daily data, you might consider adding a 'once (Hour = 00) then' to the top of your logic and saving a daily file instead (which could even break it down into use per hour) which would then record for you the accurate figures for every day. You could then even get rid of the loop altogether or only make it 31 to 0 (or use hours instead) giving you exact figures for every day and after a few months recording you would have every days un-redacted numbers rather than the averages recorded by the Wiser/C-Touch.

    But otherwise, logic looks good. On your end, just check that the unit number and channels are correct for the data you are capturing. Also that your PICED is connected to C-Bus when doing your initial logic test (before uploading to your touch screen) so it can see the current data coming in.

    Your data seems a bit wrong (differences between the channels) so perhaps the CMU channels are set differently from each other in Toolkit. They all need to be on Power measurement, not current measurement and have the correct sensor and other options chosen.

    All the best,

    Brad
     
    Last edited by a moderator: Apr 7, 2013
    bmerrick, Apr 6, 2013
    #16
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.