Hi Tecnomatix Community,
I want to run a Method several times a day (e.g. 08:00, 15:00, 16:00, and 22:00), every day for a range of days (e.g. 5th day to 30th day). How can I achieve this?
I tried using a trigger.
Start time: 5:00:00:00 (5th day)
Active interval: 30:00:00:00 (30th day)
Period length: 1:00:00:00 (one day)
Actions --> Methods --> Selected the method I want to run.
Even if enter the times (08:00, 15:00, 16:00, and 22:00) in the Values under 'Point in Time', I don't know how to use this to get the method to run at these particular times in the day, every day. Which attribute do I change in order to trigger the Method to run?
Currently, the method runs at 0:00:00.0000 (0:00 hours) everyday.
Please suggest some way I can make this work.
Using the current setup, the easiest way would be to create 4 triggers setup like you have, but changing the start time to 5:08:00:00, 5:15:00:00, 5:16:00:00 and 5:22:00:00 to offset when the method is triggered.
You can point all 4 of them to the same method without any issue, so that way if they all do the same thing you only got 1 block of code to maintain.
From what I understand setting the Active Interval to 30 days means it will run for 30 days in all and not until the 30th day, instead you might want to set it to 25 days if you want the 5th to 30th day.
I usually resort to the Generator object, if I just want to trigger a method with some regularity.
Note that you can use a formula for interval and duration. Hence, if you use a counter (incremented by your method), you can also work down a list of predefined times.
var startdate, enddate : integer startdate := 5 enddate := 30 for var i := startdate to enddate var daytime := 1:00:00:00 * i &Method.methcall(daytime + 08:00:00) &Method.methcall(daytime + 15:00:00) &Method.methcall(daytime + 16:00:00) &Method.methcall(daytime + 22:00:00) next
Since I'm using the standard license, I can't use the generator object. However, if you're somewhat familiar with SimTalk, I've found that this is no problem.
If you're trying to trigger something on the start/stop of shifts, break, please have a look at the UnplannedCtrl of objects. You can assign a Shift Calender to an object first and you'll notice that the UnplannedCtrl triggers whenever this object becomes planned/unplanned.
Running the above code in an init method will do the trick. 'Method' should be changed to the path to the method you want to execute.