cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to set up and configure Schedulers

No ratings
  • Create a new Thing using the Scheduler Thing Template.
  • The Scheduler Thing will fire a ScheduledEvent Event when the configured schedule is fired. The event is automatically present and does not need to be added manually.

Configuration

 

  • The Scheduler Configuration is quite straightforward and allows for an exact setup of schedule based on units of time, e.g. seconds, minutes, hours, days of week etc. It can be accessed via the Thing's Entity Configuration

image

 

  • Configuration allows for
    • Changing the runAsUser context - in which the Events will be handled. The user will need visibility and permission on e.g. executing Services or depending Things, which are required to run the Service triggered by the Event.
    • Changing the Schedule - in which time the Events will be fired (by default every minute). The schedule is displayed in CRON String notation and can be changed and viewed in detail by clicking on "More". The CRON String will be generated automatically based on the inputs.
      • Schedules can be configured in Manual mode - allowing for full configuration of each and every time based attribute.
      • Schedules can be configured for a specific time Type - allowing for configuration only based on seconds, minutes, hours, days, weeks, months or years.
      • Below screenshots show schedules running every minute and every Saturday / Sunday at 12:00 ("Every Weekend Day").

image

 

image

 

Services

 

  • Scheduler Things inherit two Services by default from the Thing Template
    • DisableScheduler
    • EnableScheduler
  • These will activate / de-activate the Scheduler and allow / disallow firing Events once a scheduled time is reached
  • If a Scheduler is currenty enabled or disabled can be seen in its properites

image

 

Comments

How can we use scheduler for Industrial Things and their properties?

Do i need to create Service in Scheduler thing and after that assign to Industrial thing? or any other way.

 

Please suggest me i am bit confused while using this scheduler.

I follow all the steps and I create one scheduler but please suggest how do I apply scheduler ,how to set up scheduler and how to display??

How to set up scheduler: This is what is explained above

How to display: There is no other view than what you have in the Composer when you edit the scheduler thing. Not sure what you want to display.

How do I apply scheduler: Create a subscription to the scheduler's "ScheduledEvent". The code in the subscription is executed everytime the scheduler fires the event.

 

Thanks for your reply , I want to show before program starting status as "Start in hh:mm:ss" and  if program is start then I want to show status is "ON" and  if that program is finish it will show program status is "OFF" for daily basis for these refer below attachment and please suggest

how do I used scheduler or Timer with above condition and how to write subscription code ??

To my knowing you can't query a timer or scheduler when it is running next.

You can subscribe to a timer or scheduler like to any other thing, using the subscriber's thing subscription tab. Subscriptions are a central feature of Thingworx, so if you are not familiar with them I suggest you go through your training material to understand the capabilities.

 

For your use case, I suggest to have two properties "nextStartTime" and "minutesToStart" on your program thing. nextStartTime being a datetime field with, well, the time when the program should start. minutesToStart is for the numbers of minutes left before the program starts next time.

Then you subscribe to a timer running once every minute. In that subscription, you compute the minutesToStart (basically the time between now and nextStartTime). If minutesToStart<=0 you run your program service and compute the nextStartTime and minutesToStart.

In your mashup, you simply display minutesToStart.

 

Version history
Last update:
‎Mar 01, 2018 09:37 AM
Updated by: