Works in PICED, not in PAC

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by mattyb, May 12, 2006.

  1. mattyb

    mattyb

    Joined:
    Jul 29, 2005
    Messages:
    78
    Likes Received:
    0
    Location:
    Sydney, Australia
    I'm having a problem getting a "Lightshow" that I've programmed for the PAC to actually run properly in the PAC.

    Initial testing was done watching sliders on the PICED screen do pretty things, followed by connecting PICED to C-Bus and using it as the logic engine and running the show 'live'. That was all ok. Running from the PAC has been a bit of a problem.

    Running some logs showed the PAC fell over on the first...

    Code:
    SetSceneLevel("Showroom - All Off",-1,0);
    ...command. Changed that to a straight "SetScene" and the scene worked....but nothing after it.

    The code was a bit messy with lots of loops and timers so I thought I'd simplify it to the following just for testing purposes:

    Code:
    if (GetLightingState("Flg_LightShow_Start") = ON) then
    begin
      {Reset & Initialise Flags}
      SetLightingState("Flg_LightShow_Start", OFF);
      SetLightingState("Flg_LightShow_Stop", OFF);
      SetLightingState("Flg_Show_Running", ON);
    
      {SetScene("Showroom - All Off");
      Delay(4);
    
      SetScene("Lightshow - Pod 1");
      Delay(1);}
    
      SetScene("Lightshow - Pod 2");
      Delay(1);
    
      SetScene("Lightshow - Pod 3");
      Delay(1);
    
      SetScene("Lightshow - Pod 4");
      Delay(1);
    
      SetScene("Lightshow - Pod 5");
      Delay(1);
    
      SetScene("Lightshow - Pod 6");
      Delay(1);
    
      SetLightingState("Flg_LightShow_Stop", ON);
    
    end;
    
    
    if (GetLightingState("Flg_LightShow_Stop") = ON) then
    begin
      {End of Show - Reset Flags}
      SetLightingState("Flg_LightShow_Stop", OFF);
      SetLightingState("Flg_Show_Running", OFF);
    
      {SetSceneLevel("Lightshow - Finish",-1,0);}
      SetScene("Lightshow - Finish");
    
    end;

    Buttons on a Monochrome TS control the "Start" and "Stop" GA's and all the "Lightshow" scenes are stored in the PAC.

    Basically once the show is started, only the first scene is selected and nothing else happens - according to the Toolkit log and observing our demo board. When I comment out the first scene, the next one will run and so on.

    The PAC is still running because the "End of Show" code runs when I press the button on the TS.

    I know 'delays' are not really the best thing to use but I'm just trying to get some simple code working in the PAC before I do too much with timers and what not.

    Am I missing something obvious here? Any help greatly appreciated...

    Thanks & cheers
     
    mattyb, May 12, 2006
    #1
  2. mattyb

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    Mattyb
    whats this,first byte ??

    {SetScene("Showroom - All Off");

    dave
     
    Dave Byron, May 12, 2006
    #2
  3. mattyb

    mattyb

    Joined:
    Jul 29, 2005
    Messages:
    78
    Likes Received:
    0
    Location:
    Sydney, Australia
    Oh that's just me commenting out the first coupla scenes...the comment closes after the first "Delay(1)".

    Just wondering now if that may be bad, but I was having all the same problems with no comments, so...dunno.
     
    mattyb, May 12, 2006
    #3
  4. mattyb

    Josh

    Joined:
    Aug 25, 2004
    Messages:
    240
    Likes Received:
    0
    Location:
    Pretoria, South Africa
    Do you have any other logic lines running?

    While you were doing testing (via a PC), what was the number of Instructions (In Logic Window/Resources).The numbers (before doing scenes and during will tell a lot).
    How many GA's do you have in your scenes?
     
    Josh, May 12, 2006
    #4
  5. mattyb

    Phil.H

    Joined:
    Jul 29, 2004
    Messages:
    466
    Likes Received:
    0
    Location:
    Sydney
    Your code looks like it should have continuity however I think the problem is due to the delay and the fact you 'need' to reset your condition group address (Flg_Lightshow_Start) at the start of your actions. After your first delay (with the contidion reset) there is a break in continuity ???

    I usually don't get caught on what should be happening but tend to move on.

    Try starting a timer at the start of the actions then have actions for the value of the timer.

    A really efficient way of doing this(if you want something to happen each second) is to use a case statement where you have a scene triggering (or other action) for each second in a case selector list.

    WARNING: Make sure you have a case selector for each second of the timer otherwise you will get a run time error. For the same reason if you are finished with your timed actions after the 10th second make sure your case selector list has a value of 11 and stop your timer {TimerStop (n)}

    Darren's help files are very good. I have previously done some logic code examples in the logic code section where case is used for a counter which is very similar to this. If you would like some example code for a timer yell out.

    I hope this helps for two reasons. 1. It is always nice to help people. 2. This may save Darren from having to fix you up and give him some time to deal with the Dooseys I have for him based on a programming effort for a display facility I did yesterday :rolleyes:

    PS. I avoid Delay (n) like the plague because it stops you module dead in its tracks. This usually does not mix well with C-Bus.
     
    Last edited by a moderator: May 13, 2006
    Phil.H, May 12, 2006
    #5
  6. mattyb

    mattyb

    Joined:
    Jul 29, 2005
    Messages:
    78
    Likes Received:
    0
    Location:
    Sydney, Australia
    G'day Guys

    Thanks for taking the time to offer some help and advice. Thought I'd just post a bit of an update with my findings to date...

    Since previous post (and prior to reading yours) have had the code running in the hardware ok when the SetScene command is replaced with simple SetLightingState commands.

    Spoke to tech support and went down the timer route...with no success.

    The following code, again, only sets the very first scene...

    Code:
    if (GetLightingState("Flg_LightShow_Start") = ON) then
    begin
      {Reset & Initialise Flags}
      SetLightingState("Flg_LightShow_Start", OFF);
      SetLightingState("Flg_LightShow_Stop", OFF);
      SetLightingState("Flg_Show_Running", ON);
    
      SetScene("Showroom - All Off");
    
      TimerStart(LightshowTimer);
    end;
    
    once (TimerTime(LightshowTimer) > 5) then
    begin
      SetScene("Lightshow - Pod 1");
    end;
    
    once (TimerTime(LightshowTimer) > 10) then
    begin
      SetScene("Lightshow - Pod 2");
    end;
    
    once (TimerTime(LightshowTimer) > 15) then
    begin
      SetScene("Lightshow - Pod 3");
    end;

    The Scenes only have 11 GA's in them and the number of instructions in the resources window seems to hove around the 26-34 mark.

    Anyway, I'm looking at using cascading scenes now and maybe avoiding the PAC but I do like your "case" idea Phil so will give that a whirl in the morning.

    Thanks again...

    Cheers

    Matt
     
    mattyb, May 14, 2006
    #6
  7. mattyb

    Alistair

    Joined:
    Jan 25, 2006
    Messages:
    16
    Likes Received:
    0
    Location:
    Darwen UK
    A couple of observations ....
    Delay probably does not work how you expect it to .. I ave found that having more than on in any module is generally not a good idea and is likly to causr some werdness ...

    The timer solution looks as fi it should have worked but only once, I asume you had some additional code to loop and reset it ...

    I have had some problems with tags not working as planned when their names contained spaces and numbers, I avoid them now.

    How about this aproach:-
    Define your sceens anwwhere you want in single or multiple units or for that matter on the PAC itsself.

    Set them all to be triggered by the same GA, but at different levels.

    Now ramp the trigger GA

    If the Scene 'All Off' is set to trigger when GAt is at 0 then you can easily turn everything off at any time even if a ramp is in progress.

    The advantage here is that no timing code is required so recursave instructions or delays are illiminated.

    In addition you can test the thing using a key, or key pair, set up as a dimmer.

    If you wanted a cascading loop you would create two scenes Loop1 and Loop 100 that are triggered by GAt at 1% and GAt at 100% respectivly. In Loop100 set GAt to 1% and in Loop1 ramp GAt to 100% over N seconds (the length of your show) everything else is simply triggered at varing values of GAt

    Have fun .... and let me know what you think.
     
    Alistair, Jul 27, 2006
    #7
  8. mattyb

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    This isn't necessarily true. The PAC may have reset itself in the meantime. Run this test and look at the status LED. If it stops flashing for a few seconds, the PAC has reset itself.

    Have you tried the latest PAC firmware, available from http://training.clipsal.com/downloads/HomeGateFamily/PICED_3_6_2_Setup.zip
     
    Darren, Jul 28, 2006
    #8
  9. mattyb

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    To the best of our knowledge, multiple delays work perfectly. Can you provide an example of it not working correctly for us to investigate ?

    Once again, we have not come across this. Can you provide an example ?

    You can not trigger a scene by ramping through the trigger level. If you set the trigger to be a ramp to the trigger level, the scene will trigger immediately. See the Triggering Scenes topic of the help file.
     
    Darren, Jul 28, 2006
    #9
  10. mattyb

    mattyb

    Joined:
    Jul 29, 2005
    Messages:
    78
    Likes Received:
    0
    Location:
    Sydney, Australia
    G'day gents

    Thanks for your latest responses. I haven't played around with this one lately as it was a fairly urgent situation at the time and I ended up using cascading scenes in the Monochrome TS with logic in the PAC to start and stop the show under certain conditions and at random times.

    I put it down to the fact that I was trying to get the PAC to do too much too quickly, but was always a bit concerned that the code with the timers didn't work. As I said, all the different versions worked in PICED when it was connected to the network but the PAC seemingly just wouldn't do its thing.

    Anyway, have had a few PAC jobs since using the latest firmware and haven't encountered any problems.

    Darren, I hear what you're saying about the PAC possibly resetting itself. I'll try and get some time over the next week or so to do a few tests and report back what I find.

    Oh, and just on the whole 'Delay' thing....I used it quite a bit in the early days before I discovered how much more suitable timers were for most of my jobs and, as long as you know the implications of using it, I hadn't found it to be a real problem.

    Anyways, thanks again for your thoughts guys.

    Cheers

    Matt
     
    mattyb, Jul 28, 2006
    #10
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.