Logic Timers

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Mr Mark, Nov 8, 2012.

  1. Mr Mark

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Hello all. I've got a query regarding timers.
    What I need to know is, how accurate are these timers? We have a project with logic created with an older version of PICED - can check the version later but it was about 6 years ago. My concern is we have lights running in a sequence to an audio track about 20 minutes long and if the later firmware changes these times...
    ie: would 10 seconds, six years ago equal 10 seconds now? :)
    Most likely I'm worried about nothing but being a high profile tourist attraction would like to get this one right first time! Normally I'd just upgrade it and test but this one in a couple of hours out of town with no after hours access.

    Mark
     
    Mr Mark, Nov 8, 2012
    #1
  2. Mr Mark

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi Mr Mark,

    Seems everyone is jumping in here to answer you!!..........should have left off the bit about 'high profile tourist attraction', I am sure everyone's liability alarms went off collectively. :)

    If you tread carefully as you suggest, making a whole Clipsal directory backup prior, you would be able to back it out should you have a problem.
    Of course you could alternatively take a prepared notebook with updated Toolkit and PICED, copy over the project files and run it from your notebook in Simulation Mode with logic running. If that works you could then update the PAC or Touch Screen (whatever the logic is on) and give it a try from that. If it all turns to custard you still have the original PC system to re-update the logic module. You also have the 'factory reset' option as a 'final fallback' to get it back running, so I think you would be pretty well covered.

    If you have the Toolkit and PICED project files from before, you could upgrade it back at the office and then run in simulation mode on your test bench so at least you would know if the timing was accurate before leaving.

    Good Luck,

    Brad
     
    bmerrick, Nov 13, 2012
    #2
  3. Mr Mark

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Thanks Brad.

    It might be time to buy another laptop as the old faithful backup machine died the day before heading up to this job, hence the hasty post.

    Anyway no stress, once I get another laptop I'll go up during the week and try out a newer version of PICED and see how it goes.

    Mark
     
    Mr Mark, Nov 13, 2012
    #3
  4. Mr Mark

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Nothing should change in the timers from version to version.

    They are based off a 100ms system tick, which is driven by the RTC, which uses a 20ppm crystal.

    Nick
     
    NickD, Nov 14, 2012
    #4
  5. Mr Mark

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Thanks Nick.

    I realise it may have looked like a silly question, but it is important to this project so I had to ask. I really appreciate the technical reasoning as to why these periods will stay the same.

    Mark
     
    Mr Mark, Nov 14, 2012
    #5
  6. Mr Mark

    Roosta

    Joined:
    Nov 22, 2011
    Messages:
    560
    Likes Received:
    1
    Location:
    Australia
    In my mind I am picturing a large christmas lights installation using cbus to control the lighting and some poor person having to have sat there and sequence the lighting to a set track of music..

    Cheers..
     
    Roosta, Nov 14, 2012
    #6
  7. Mr Mark

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Welcome to Coffee World...

    This one is the Coffee World display at the Mareeba Coffee Works just north of Cairns, FNQ. A bit of a drive, but well worth it. The automated sections are run off C-Bus and use PIR's to run as required, timers to disable the lot and recently a cleaners switch to turn on all lighting while disabling the audio (recently changed over to iPods). It's not the biggest or most challenging project we have done, but by far the most fun.

    Section 1: Retro Pots
    This is the easy one with circulating logic flashing lights in a predetermined sequence. Great upbeat music...

    Section 2: Posh Pots
    20 minute skit where a fancy pot with links to royalty gives her own version of coffee evolution through the ages, mixed in with a dozen other pots tipping in with their own warped versions. Very well done as there is a lot of famous people mentioned and actual history presented in an entertaining way.

    Section 3: Miss America Pots
    15 minute skit where a number of pots are interviewed by a panel of judges as to why they should be Miss America... The audio starts with 'Sex Bomb' by Tom Jones.

    Section 4: Olympic Pots
    Yet another crazy one where different styles of coffee machines battle it out to determine who should win gold.

    Each display has the lighting synchronised to the audio track to create the illusion of movement and interaction. There is so much history at this place and you can spend all day there without seeing it all or being bored, with static displays, audio guides and the cafe and shops. Level 2 have a dedicated section on tea and they make their own chocolate on site... Most of the lighting is LED and was done before they became fashionable - 90% of the lamps are still the originals after almost six years. Many hours and lots of coffee was consumed to get this one just right - so much time in fact that only its only been in the last two years that I can appreciate it as an attraction and not just an all-consuming project. I'm not employed by the guys, but do drop in for coffee every time I'm up that way. Here's a link to their website. I found one link one YouTube, but it was a series of static shots so you don't get the full effect. Mark

    Christmas lights would have been easier...
     
    Last edited by a moderator: Nov 14, 2012
    Mr Mark, Nov 14, 2012
    #7
  8. Mr Mark

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi NickD,

    I always like to more fully understand the 'internals' of something I use. To that end I would like to pose the following question in advancing my own knowledge, not trying to be pernickety.

    In my earlier response to MrMark, I was suggesting being purposefully quite conservative in his upgrade for two reasons. Firstly just as it is a commercial operation that really relies on the C-Bus equipment doing its job for financial gain which always makes sense.

    Secondly, he indicated his code was using Delays ie delay based timing (wait x then execute z) rather than absolute timing (at x start time plus y seconds execute z).

    It is a given that any clocked logic will be timed by a clock with precision in the ppm, but I took the view that over a 20 minute program, any albeit small changes in the logic code execution time would aggregate. At the end of a program this could be several seconds of aggregate logic execution time and ruin a timed routine. As new features and bug fixes have been applied over time I surmised that the logic execution time may vary, as it would should the logic engine change eg faster processor, PAC to Wiser etc.

    What I am questioning is that whilst the 'Delay for 4 seconds' can be quite accurate, we don't know how long it took to get to that Delay command (ie to initiate it) through the program steps before it. If those program steps take longer now possibly due to enhanced processing for eg. new features etc, would that not change the T+ time of execution?

    Regards,

    Brad
     
    bmerrick, Nov 14, 2012
    #8
  9. Mr Mark

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Hi Brad,

    It's a fair question.

    The execution of the logic code is driven by a timer based interrupt. When the interrupt goes off, the logic is executed.

    All of this assumes that the processor has had has enough time to execute all of the logic code from the previous cycle within the allotted cycle time (200ms).

    From memory, the logic engine will allow a certain amount of transient overrun.. ie if every now and then the execution time exceeds the cycle time, it will just run a few cycles faster than the normal rate to catch up time.

    If this happens for too long though (something like getting 2 seconds behind), it throws in the towel and reinitialises.

    Assuming this is not happening, then there should be no problem with lost time or timing differences.

    Nick
     
    NickD, Nov 15, 2012
    #9
  10. Mr Mark

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi Nick,

    Thanks, exactly what I wanted, to add to my knowledge of the timing logic, which helps me diagnose client issues in future.

    All the best,

    Brad
     
    bmerrick, Nov 15, 2012
    #10
  11. Mr Mark

    bmerrick

    Joined:
    Jun 13, 2007
    Messages:
    434
    Likes Received:
    34
    Location:
    Sydney
    Hi Mark and Nick,

    Hit the books to get more into what you were saying Nick. Found the following 'Good Oil' article in the Logic manual that I had somehow overlooked previously (is only linked to from a small number of pages).

    It is under 'How Much Logic Is Possible' and well worth the read for long modules like your Coffee project, as far as knowing how 'close to the max' the current project runs and how to monitor if it is currently exceeding the execution window. The article breaks down each command into % of available execution time which makes it easy to see if you are exceeding the max execution time windows etc.

    Here's an excerpt about what Nick was saying:
    Short and Long Term Maximum Usage

    The PAC and C-Touch do allow the code to use more than 100% of a scan occasionally, as long as the longer term average (over several seconds) does not exceed 100%. The PAC will allow the logic to run for up to 333% of a scan occasionally and the C-Touch will allow the code to run for up to 200% occasionally.

    Most logic code has occasions when it needs to run considerably more logic than normal. An example of this is when a large Scene is being set. In this case, the logic may only require 20% for most of the time, but may need over 100% of a scan when the Scene gets set.

    C-Touch Mark 2 - The C-Touch Mark 2 unit can run around 5 times as much code as the PAC.

    Enjoy the read and all the best,

    Brad
     
    bmerrick, Nov 15, 2012
    #11
  12. Mr Mark

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    322
    Likes Received:
    5
    Location:
    FNQ
    Hi Brad and Nick.

    This project is fairly straight forward in the way the logic runs - a PIR starts a timer in logic triggering events as it goes. Delays were only used when we needed a 1/2 second here and there to set the timing just right. Having been caught out by PICED updates early on, I've been somewhat cautious on certain projects. Mind you, these updates made me code better... :)

    Mark
     
    Mr Mark, Nov 15, 2012
    #12
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.