Exerise 3 Logi Control OBJECTIVE The ojetive of this exerise is giving n introdution to pplition of Logi Control System (LCS). Tody, LCS is implemented through Progrmmle Logi Controller (PLC) whih is lled Progrmmle Logi Devie (PLD), s well. Sine 7 s PLCs hve een widely pplied in prodution proess in ftories nd yrds. Additionlly, they re onvenient solutions lso for in-house pplitions, ity nd trffi lighting, gtes, mjor or minor industril proess ontrol, et. It is sed on n open-loop ontrol system. PLCs re relile, modifile, ost-effetive nd vstly essile devies. The logi ontrol is prt of disrete ontrol nd divided into two groups: onditionl nd sequentil. The onditionl ontrol is sed on Boolen lger nd we will tke into onsidertion only this group. Temporl nd event-sed ontrols whih elong to sequentil group re more importnt in the prtil use when e.g. timers or ounters re needed. REQUIREMENTS A. Prerequisite knowledge: You re expeted to know the following topis:. Boolen lger. Logi gte system 3. Bsi logi funtions, e.g.,, NOT, N, N, X, XN, et. MATLAB/SIMULINK. Applition of onditionl sttements under MATLAB. Construting the logi system under SIMULINK. To e fmilir with Logi Gte digrm, list of elements of Logi Gte Systems is given in the next pge. LAYOUT A ftory produes toy whih is then pked in ox. There re 3 prodution lines, e.g. ssemling, pinting nd leling, s re shown in the following figure: C C M M C3 C4 M3 3
The Elements of Logi Gte Systems Comintion Truth vlues (Boolen Alger) No. Nme Distintive Retngulr A B A B A + B 3 NOT A 4 N ( A B) 5 N ( A + B) 6 X A B 7 XN ( A B)
4 optil sensors: C, C, C3 nd C4 re used to ontrol 3 eletril motors (tutors): M, M nd M3. You hve to design suh logi ontrol system tht stisfies the following requirements: when the ox is on the first line, the first eletril motor should e turned on, ut to sve energy, the first eletril motor should e turned off when the ox is gone down on the seond line. when the ox is on the seond line, the seond eletril motor should e turned on, ut to sve energy, the seond eletril motor should e turned off when the ox is gone down on the third line. when the ox is on the third line, the third eletril motor should e turned on, ut to prevent dmge of the ox when the ox is not tken from the prodution line, the third eletril motor should e turned off till the ox is tken nd the prodution line is redy for the next ox. if the ox is not tken from the prodution line, even if the next ox is put on the first line, the first eletril motor should e kept off till the ox is tken from the third line.. Drw the ldder digrm of this ontrol system,. Write the logi eqution of the system, 3. Prove your solution using Boolen lger, 4. Mke the simultion under MATLAB nd SIMULINK. MATLAB/SIMULINK The following new MATLAB ommnds nd funtions re neessry to e understood nd pplied in this exerise: ~ & if else end while REPT In ddition to those points mentioned under lyout, your report should inlude:. The results of the simultion,. Disussion on possiility of one lterntive solution tking into ount numer of sensors, tutors nd the lgorithm of ontrol. EXAMPLE Consider rely-sed ontroller whih llows three swithes in room to ontrol single lmp. The requirement is tht eh swith hs to e le to turn on or off the lmp regrdless of the sttes of the other swithes so tht the lmp is turned on when only one or ll swithes re turned on. A possile solution is shown y the following ldder digrm:
L We hve here 3 sensors (swithes):, nd, nd one tutor L (lmp). There re 3 =8 different sttes of L (light). The following tle shows the stte of L using Boolen lger:........ L 3 4 5 6 7 8 As it is presented in this tle, L hs stte when: - Only one sensor hs high vlue ( ) - All three sensors hve high vlue ( ). This n e given y the following logi eqution: L = ( + + + ) or L = ( + ) + ( + ) The Logi Gte Digrm (LGD) desriing this eqution is s follows: L 6
The following funtion odes the model of this lighting system under MATLAB:» funtion L=light(,,)» n=~;» n=~;» n=~;» L=(n & n) ( & );» L=( & n) (n & );» L3= & L;» L4=n & L;» L=L3 L4; Then y setting the stte of sensors, we n ll the ove funtion whih is sved s ex3_fun to express the stte of the lmp, e.g.:» lmp=ex3_fun (,,) whih gives lmp = Plese notie tht the expression of» L=L3 L4; is equl to the following expression: if L3== L4== L=; else L=; end Therefore, we n mke our model using the onditionl sttements, s well. This model n e put under SIMULINK using LGD: Clok Mux tl To Workspe In Mux In Out In3 Light Where Light lok is susystem shown elow 7
In NOT not_ In NOT not_ not_ & or & & not_ & Out & 3 In3 NOT not_ not_ & not_ Or & The result whih is lled tl hs een trnsferred to the workspe. tl is mtrix with 5 olumns inluding time,,, nd L, resetively. Let us simulte the tivities of sensors:, nd y 3 different pulse genertors, e.g. with periods of 6, 4 nd seonds, respetively, ut with the sme mplitude nd 5% duty yle. The results re plotted in the next figure using the following sript:» t=tl(:,); =tl(:,); =tl(:,3); =tl(:,4); L=tL(:,5);» suplot(,,); plot(t,);xis([ - ]); ylel(''); xlel('');» suplot(,,); plot(t,);xis([ - ]); ylel(''); xlel('');» suplot(,,3); plot(t,);xis([ - ]); ylel(''); xlel('');» suplot(,,4); plot(t,l, r );xis([ - ]); ylel('l'); xlel(''); - 5-5 L - 5-5 The results re the sme s derived efore using Boolen lger. It is shown tht the lmp is turned on when ONLY ONE ALL of the swithes hve high stte. * * * 8