Facility Control

 View Only
  • 1.  Adding timers values

    Posted 15 days ago

    Hi,

     Im very new to the custom panels, mostly watching the tutorial videos to get ideas and inspiration. I need some help with a custom panel that i built. This panel has 3 timers, each with a stop, start and reset button.  We have a show that has 3 segments, each segment have a rough time it can go, but we need a specific total runtime for the show. I have 3 timers that i need to add the value of the 3 timers together to get the total show runtime. Is there a simple way to do this? it will be awesome if the "total runtime" can display the total combined time dynamically. I can add a screenshot of the panel if it helps. 

    thanks



    ------------------------------
    Theo Olivier
    Sonlife Broadcasting Network
    ------------------------------


  • 2.  RE: Adding timers values

    Posted 11 days ago
      |   view attached

    Hi Theo,

    You can use the method ogscript.getTimerManager().getTimer('CountUpTimer1').getCurrent(); to retrieve the current value in milliseconds for each timer. Once you have the values, you can sum them up and set the total runtime using ogscript.getTimerManager().getTimer('TotalRuntime').setTime(getTotalRuntime());.

    I have attached a zip file that contains a grid demonstrating this process. The grid includes three timers that count up, controlled by a reset button, as well as a timer that displays the total runtime. The reset button utilizes a reusable API function, reset_timer(timerID), which accepts the timer ID, resets the timer, and starts it counting again. Additionally, there is another API function, getTotalRuntime(), which calculates the sum of the three timers and returns the value. This function is subsequently used to update the total runtime timer.

    Let me know if you need further assistance!



    ------------------------------
    Cheers,

    Aury Rukazana
    Senior Software Developer
    Ross Video
    ------------------------------

    Attachment(s)

    zip
    Total Runtime.zip   1 KB 1 version


  • 3.  RE: Adding timers values

    Posted 10 days ago

    Thank you for this example. Before i got your response, i was trying a few more things and i came up with a timer panel that will work for us. However one thing i couldnt figure out is how to make it calculate continually. I added a button called "Calculate" on the bottom, but i have to press this every time i want the timers to update. Is there a way that it can automatically update it without the user having to press the "update" button?

    What i did was i created 6 timers names (t1,t2,t3,t4,t5,t6) 

    The "t1" timer is segment 1

    The "t12" timer is segment 2

    The "t13" timer is segment 3

    the "t4" timer is the "total runtime" timer

    the "t5" is a timer i created with the start time of 53:00 minutes (this is the total show time) and this is the timer i used to calculate the remaining time "t6"

    the "t6" timer is the "remaining time" timer

    I have attached the Grid file if you want to take a look at what i did, and if you can guide me in the correct direction that would be great. Im sure there is a much better way to accomplish this.

    thank you



    ------------------------------
    Theo Olivier
    Sonlife Broadcasting Network
    ------------------------------



  • 4.  RE: Adding timers values

    Posted 9 days ago

    Hi Theo,

    I couldn't find the grid file you mentioned. You might need to zip it first, as files with a .grid extension may not be accepted during upload.

    As for automatically updating timers, you can set the timing in your TimerTask, which runs each time the timer updates. Check out the example I shared earlier for the total runtime timer to see how I handled it.

    <timer id="TotalRuntime" pattern="HH:mm:ss" rate="1000" start="23:59:59" stop="00:00:00">
          <timertask tasktype="ogparamset">ogscript.getTimerManager().getTimer('TotalRuntime').setTime(getTotalRuntime());
             params.setValue('totalRuntime', 0, event.getDisplay());</timertask>
       </timer>
    






    ------------------------------
    Cheers,

    Aury Rukazana
    Senior Software Developer
    Ross Video
    ------------------------------



  • 5.  RE: Adding timers values

    Posted 9 days ago
      |   view attached

    My apologies, here is the zip file



    ------------------------------
    Theo Olivier
    Sonlife Broadcasting Network
    ------------------------------

    Attachment(s)

    zip
    Timers Test.grid.zip   2 KB 1 version


  • 6.  RE: Adding timers values

    Posted 9 days ago
      |   view attached

    Hi Theo,

    I made some adjustments to your custom panel by converting your calculation scripts into two API functions: getTotalRuntime() and getRemainingTime(). These functions are now used in the respective timer tasks for timers t4 and t5.

    Additionally, I've set up the timers t4 and t5 to start within the API tag, ensuring that the timers can be updated seamlessly by the timer tasks when the custom panel loads.



    ------------------------------
    Cheers,

    Aury Rukazana
    Senior Software Developer
    Ross Video
    ------------------------------

    Attachment(s)

    zip
    Timers Test.zip   1 KB 1 version