HansCZ Posted October 5, 2021 Report Share Posted October 5, 2021 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 Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted October 5, 2021 MVP 2023 Report Share Posted October 5, 2021 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 More sharing options...
HansCZ Posted October 7, 2021 Author Report Share Posted October 7, 2021 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 More sharing options...
MVP 2023 Ausman Posted October 7, 2021 MVP 2023 Report Share Posted October 7, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now