Jump to content

Recommended Posts

Posted

Hello.

I would like to get a detailed explanation about Unilogic schedule block. Is it possible to set it up as an independent component to run according to fixed hours and how do you do it?

I would love to get a link to a tutorial video or something, because it's hard to understand from help

Posted

Here is a simple explanation on how the schedule works:

The schedule struct has From Year and To Year members, and also Month (bits array), Day of Month, Day Of Week, From hour, To hour.

When the schedule rule is met, the RLO after the element, will become 1 (Assuming that the RLO before it was also 1)

 

If you don't want the schedule to work on specific years range, then leave it 0.  If the from year or to year are not 0 then the value must be from 1900 to 2100.

If one of the values is set (From Year, or To Year), then both of them must be set (Meaning, you can have the To Year set to 2024, but leave the from year as 0).

 

The From Hour and To Hour is an array with members of Hours , Minutes, and Seconds, and they must have valid values (0-60 for minutes and seconds, and 0-24 for hours, else, the result RLO will be 0).

 

Month bit array: If the value of all the bits in that array are 0, then the month will not be checked (So if you want to execute something every month, or every day, then make sure that all bits are off). If one or more bits are set, then the schedule will execute (change the RLO to 1) only on those months and when the other rules are met.

 

Same for "Day in month" bits array. If no bit is set, it won't check for the day in month, else, it will check if the current day in the array is set. (no bit set equals in how the code behaves to all bits are set)

Same for "Day of week" bits array. If no bit is set, it won't check for the day of week. (no bit set equals in how the code behaves to all bits are set)

If you want that something will happen every day at the same time, then leave the Month, From Year, To Year, and Day in month unset (0), and also don't set any bit in the Day of week array. You just need to make sure that the From hour and To Hour are configured correctly.

But if you want that it will happen once per week, and just set to 1 the specific day in the Day of Week array.

 

Since this block is executed on each cycle, then when the schedule is met, it will call the code after it until the schedule is no longer met (For example, the schedule is valid for one hour per day, then the RLO will be 1 for the whole hour).

So if you want to execute something just once when the schedule is met, then you can use Positive Transition Coil after the Schedule, that will set a bit when the Schedule output is changed from 0 to 1.

Then call your second function when that bit is 1.

On the next cycle, the schedule will still output 1, but the Positive Transition Coil will reset the bit, since the previous RLO was 1, and the current one is also 1, so on the next rung since the bit is 0, then the second function will not be called.

 

I will try to record a video for you, but my PLC is currently busy on debugging some bug, so it will only be available in 1-2 days, and I hope that you will understand what I will show, since I'm not a native English speaker.

 

 

Posted

Thank you very much for the explanation, it's a shame they don't explain it like that with the help.
So, if I want to create a fixed schedule on Friday from 14:00 to 23:00, I only need to set Power-up values of Friday to  "1", From Hour 14:00 and To hour 23:00?

Not to touch the bits of years and months?

Posted

You need to set up a powerup value on "Day Of Week" ->Friday, and leave the years, month, and day in month unchecked.

Then the from hour 14:00 and 23:00, just like you've said. I didn't test it, but looking at the code of the PLC (Since I'm a developer at Unitronics), I see that it behaves and I've explained.

 

@Cara Bereck Levy

How about adding information in the help about the schedule ladder element? The information doesn't tell much.

 

@ilyamor
Btw, you can build your own UDFB that will accept a schedule struct (Either your own struct, or use the schedule struct that Unitronics supply) and the UDFB will set a result bit if the rules are matching or reset of they don't (Use the system tags RTC Date and RTC Time, for the PLC date and time). It is not a hard task.

Posted

I know how to use RTC TIME, etc., but I wanted to get smarter and try Schedule.

In the end, probably in the application of a fixed hour and day, it is simpler to compare to RTC hour and day

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.