Jump to content

Clock indirect function


Recommended Posts

Hi,

I am preparing a PLC program using VisiLogic and Vision 350 for controlling biological waste water treatment plant in SBR (sequencing bio-reactor). The principle is using a roots blower (say electrical motor) for a part of day, then submersible pump (again motor) to pump out the treated water. For example the air is blown to the poluted water from 6 am to 22.35 p.m., then there is a time-out from 22.35 pm to 1 am, when the blower and pump are both off to let the sludge to settle. From 1 am to 4 am pump has to pump out the treated water.

The VisiLogic solution is quite easy, using clock indirect function for blower and also pump, where the user sets the time desribed above. So far, ok. But, I would like to check if there is time-out between blower and pump.

According the documentation, the time in TIME CLOCK INDIRECT FUNCTION is represented by MI, where the first eight bits are hours, but represented by HEX and the last eight bits are minutes, again in HEX. 

The algorithm is quite easy, just get rid of minutes, check if the hours are over midnight and then calculate the time span. But how to do that?

Get rid of minutes (and then hours) is easy, it is simple bitwise logic AND. But if I apply that on MI containing say 2235h, I get simply 2200h. The question is how to get that 22 hrs in decimal?

Is there is such function or gadget in Visilogic? Like c# function:

int hours(int MI)

{

    string s;

    s = MI.ToString();

    string sHrs = s.Substring(0,2);

    int iHrs;

    Int32.TryParse(sHrs, out iHrs);

    return iHrs;

}

I think one solution is to "redefine" TIME CLOCK FUNCTION and use my own MIs for hours and minutes, but is there something easier and more than once utilizable?

 

Jan

 

 

 

 

 

 

 

 

 

 

 

 

TimeIndirect.PNG

Link to comment
Share on other sites

  • MVP 2023

Perhaps your easiest solution would be to let the user ONLY specify a start time.  If your system needs blower time of X and pump time of Y which should be further controlled by a level switch anyway, your entire treatment cycle/timings should remain the same.  This could be easily done with timers, or perhaps even use a drum, both ideas triggered by the user chosen start time.  For ease of finding info about Drum,  use the Search tab in Help for "drum" and then open FBs Library where it will show up in the FBs List.  Drums are useful and the timings can be over-ridden as necessary.

cheers, Aus

Link to comment
Share on other sites

Thanks Ausman,

you have improved my approach using start time and timer, I think it is a little bit easier than using 4 MIs for blower and 4 for pump, maybe. Drum is not usable in this case, the time (period) has to be changeable by an user, as the composition of inlet waste water changes during the campaignes. 

bye

jan

Link to comment
Share on other sites

  • MVP 2023

Don't necessarily give up on using Drum.  Nearly all the times I use it, I also use the Jump to Step facilities.  The innate beauty of Drum is that you can set maximum  timings for each operation, that can be easily over-ridden by any other relevant parameter using all the variations of Jump to Step.

In your case the time periods could be linked quite easily to shorten the period desired.

cheers, Aus

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...