/* *************************PROJECT( BY MANUJ ARORA) *************************** ON OPTICAL FIBER *******************************************************************/ // HEADER FILES USED #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> // FUNCTIONS USED void projectwork1(); void projectwork2(); void projectwork3(); void projectwork4(); void projectwork5(); void projectwork6(); void closing(); void main() { int gd=DETECT,gm,x,y; initgraph(&gd,&gm,"c:\\turboc3\\bgi"); //Initializing Graphics Mode projectwork1(); projectwork2(); projectwork3(); projectwork4(); projectwork5(); projectwork6(); closing(); getch(); closegraph(); restorecrtmode(); } void projectwork1() // OPTICAL FIBER { setbkcolor(BLACK); setcolor(WHITE); ellipse(180,220,90,89,5,20); // CORE ellipse(430,220,90,89,5,20); moveto(180,200); lineto(430,200); moveto(180,240); lineto(430,240); setfillstyle(1,YELLOW); floodfill(182,222,WHITE); floodfill(432,222,WHITE); floodfill(200,222,WHITE); ellipse(180,220,90,89,15,60); // CLADDING ellipse(430,220,90,89,15,60); moveto(180,160); lineto(430,160); moveto(180,280); lineto(430,280); setfillstyle(1,BLUE); floodfill(180,170,WHITE); floodfill(430,170,WHITE); floodfill(230,170,WHITE); floodfill(230,270,WHITE); setfillstyle(1,CYAN); // BUFFER ellipse(180,220,90,89,25,80); ellipse(430,220,90,89,25,80); moveto(180,140); lineto(430,140); moveto(180,300); lineto(430,300); floodfill(180,150,WHITE); floodfill(430,150,WHITE); floodfill(250,150,WHITE); floodfill(250,290,WHITE); setfillstyle(1,BROWN); // JACKET ellipse(180,220,90,89,35,100); ellipse(430,220,90,89,35,100); moveto(180,120); lineto(430,120); moveto(180,320); lineto(430,320); floodfill(180,130,WHITE); floodfill(430,130,WHITE); floodfill(250,122,WHITE); floodfill(250,318,WHITE); setcolor(BLUE); settextstyle(11,0,2); outtextxy(285,215,"CORE"); setcolor(YELLOW); outtextxy(270,175,"CLADDING"); setcolor(WHITE); outtextxy(277,147,"BUFFER"); setcolor(YELLOW); outtextxy(277,127,"JACKET"); settextstyle(7,0,4); outtextxy(210,30,"Optical Fiber"); delay(3000); cleardevice(); } void projectwork2() // BLOCK DIAGRAM OF OPTICAL FIBER LINK { setbkcolor(BLACK); setcolor(WHITE); setfillstyle(1,LIGHTGREEN); rectangle(20,30,100,80); floodfill(25,40,WHITE); setfillstyle(1,CYAN); rectangle(140,120,220,170); rectangle(260,120,340,170); rectangle(380,120,460,170); floodfill(150,130,WHITE); floodfill(270,150,WHITE); floodfill(390,130,WHITE); setfillstyle(1,LIGHTBLUE); rectangle(260,220,340,270); // SIGNAL REGENERATOR floodfill(270,230,WHITE); setfillstyle(1,CYAN); rectangle(140,320,220,370); rectangle(260,320,340,370); rectangle(380,320,460,370); floodfill(150,330,WHITE); floodfill(270,330,WHITE); floodfill(390,330,WHITE); setfillstyle(1,LIGHTGREEN); rectangle(500,410,580,460); floodfill(510,420,WHITE); setlinestyle(0,3,3); moveto(100,55); lineto(120,55); moveto(120,55); lineto(120,145); moveto(120,100); lineto(126,94); moveto(120,100); lineto(114,94); moveto(120,145); lineto(140,145); moveto(220,145); lineto(260,145); moveto(260,145); lineto(255,140); moveto(260,145); lineto(255,150); moveto(340,145); lineto(380,145); moveto(380,145); lineto(375,140); moveto(380,145); lineto(375,150); moveto(460,140); lineto(510,140); moveto(460,150); lineto(500,150); moveto(510,140); lineto(510,250); moveto(500,150); lineto(500,240); lineto(340,240); moveto(510,250); lineto(340,250); moveto(260,250); lineto(100,250); lineto(100,340); lineto(140,340); moveto(260,240); lineto(90,240); lineto(90,350); lineto(140,350); setfillstyle(1,YELLOW); floodfill(463,143,WHITE); floodfill(92,342,WHITE); moveto(220,345); lineto(260,345); moveto(260,345); lineto(255,340); moveto(260,345); lineto(255,350); moveto(340,345); lineto(380,345); moveto(380,345); lineto(375,340); moveto(380,345); lineto(375,350); moveto(460,345); lineto(480,345); moveto(480,345); lineto(480,435); moveto(480,390); lineto(485,385); moveto(480,390); lineto(475,385); moveto(480,435); lineto(500,435); setcolor(BLUE); setlinestyle(2,3,2); rectangle(130,100,470,190); rectangle(130,300,470,390); setcolor(YELLOW); settextstyle(11,0,2); outtextxy(250,85,"TRANSMITTER"); outtextxy(270,397,"RECEIVER"); outtextxy(35,15,"SOURCE"); setcolor(BLUE); outtextxy(25,35,"Analog or"); outtextxy(33,50,"digital"); outtextxy(25,65,"Interface"); outtextxy(149,130,"Voltage-"); outtextxy(141,144,"to-current"); outtextxy(145,158,"converter"); outtextxy(280,135,"Light"); outtextxy(277,150,"Source"); outtextxy(381,130,"Source-to-"); outtextxy(400,144,"Fiber"); outtextxy(385,158,"Interface"); outtextxy(275,230,"Signal"); outtextxy(258,243,"Regenerator"); outtextxy(145,325,"Fiber-to-"); outtextxy(160,340,"Light"); outtextxy(148,355,"Detector"); outtextxy(280,335,"Light"); outtextxy(268,350,"Detector"); outtextxy(380,325,"Current-to"); outtextxy(392,340,"Voltage"); outtextxy(385,355,"converter"); outtextxy(505,415,"Analog or"); outtextxy(515,430,"digital"); outtextxy(505,445,"Interface"); setcolor(YELLOW); outtextxy(500,395,"DESTINATION"); outtextxy(360,260,"OPTICAL FIBER CABLE"); outtextxy(105,260,"OPTICAL FIBER CABLE"); settextstyle(7,0,4); outtextxy(200,10,"Optical Fiber Link"); setlinestyle(0,3,2); delay(4000); cleardevice(); } void projectwork3() { setbkcolor(BLUE); setcolor(WHITE); rectangle(200,100,400,400); setfillstyle(1,CYAN); floodfill(300,300,WHITE); setlinestyle(0,3,3); // Center Line ( Partition between the media) moveto(200,250); lineto(400,250); setfillstyle(1,LIGHTBLUE); // LOWER SECTION COLOR floodfill(300,300,WHITE); setcolor(BLUE); settextstyle(2,0,5); outtextxy(215,230,"Air"); outtextxy(205,255,"Glass"); setcolor(BLUE); setlinestyle(3,3,2); moveto(300,100); // Normal ray lineto(300,400); settextstyle(2,1,5); outtextxy(283,110,"Normal"); delay(2000); settextstyle(7,0,4); setcolor(YELLOW); outtextxy(80,30,"Cases for Incidence of rays"); delay(2000); settextstyle(2,1,7); outtextxy(40,200,"Case I :"); outtextxy(80,110,"Angle less than critical"); delay(2000); setlinestyle(0,3,2); setcolor(YELLOW); moveto(300,250); // 1st ray lineto(270,370); moveto(285,313); // 1st arrow lineto(285,325); moveto(285,313); lineto(277,318); settextstyle(2,0,7); outtextxy(265,370,"I"); settextstyle(2,1,7); delay(2000); moveto(300,250); // 2nd ray lineto(350,150); moveto(330,190); // 2nd arrow lineto(330,201); moveto(330,190); lineto(322,190); delay(2000); settextstyle(2,1,7); setcolor(YELLOW); outtextxy(480,200,"Case II :"); outtextxy(520,120,"Angle equal to critical"); delay(2000); setlinestyle(0,3,3); setcolor(BROWN); moveto(300,250); // 3rd ray lineto(250,350); moveto(280,290); // 3rd arrow lineto(280,300); moveto(280,290); lineto(273,290); setcolor(YELLOW); settextstyle(2,0,7); outtextxy(240,350,"II"); settextstyle(2,1,7); setcolor(BROWN); delay(2000); moveto(300,250); //4th ray lineto(380,250); moveto(340,250); // 4th arrow lineto(333,243); moveto(340,250); lineto(333,257); delay(2000); settextstyle(2,0,7); setcolor(YELLOW); outtextxy(250,400,"Case III :"); outtextxy(150,430,"Angle greater than critical"); delay(2000); setlinestyle(0,3,3); setcolor(RED); moveto(220,330); // Total Internal Reflection lineto(300,250); moveto(260,290); // TIR 1 arrow lineto(260,300); moveto(260,290); lineto(253,290); setcolor(YELLOW); outtextxy(205,330,"III"); setcolor(RED); delay(2000); moveto(300,250); lineto(380,330); moveto(340,290); // TIR 2 arrow lineto(340,280); moveto(340,290); lineto(333,290); settextstyle(2,0,5); setcolor(RED); outtextxy(340,330,"Total"); outtextxy(330,340,"Internal"); outtextxy(325,350,"Reflection"); setlinestyle(0,3,2); delay(3000); cleardevice(); } void projectwork4() { setbkcolor(RED); setcolor(YELLOW); settextstyle(7,0,4); outtextxy(175,50,"Optical Fiber Link"); setcolor(WHITE); // TRANSMITTER rectangle(80,300,130,350); // LOWER SQUARE moveto(155,325); lineto(130,350); moveto(105,275); lineto(80,300); moveto(105,275); lineto(155,275); moveto(130,300); lineto(155,275); lineto(155,325); setcolor(YELLOW); settextstyle(2,0,6); outtextxy(65,250,"Transmitter"); setfillstyle(1,MAGENTA); floodfill(82,302,WHITE); floodfill(90,298,WHITE); floodfill(135,300,WHITE); setcolor(WHITE); circle(220,280,15); // OPTICAL FIBER circle(220,280,40); arc(460,220,270,90,15); circle(460,220,40); moveto(220,265); lineto(460,205); moveto(220,295); lineto(460,235); moveto(220,240); lineto(460,180); moveto(220,320); lineto(460,260); setcolor(YELLOW); outtextxy(300,320,"Optical Fiber"); setfillstyle(1,LIGHTBLUE); floodfill(220,280,WHITE); floodfill(245,275,WHITE); floodfill(270,275,WHITE); floodfill(460,220,WHITE); setfillstyle(1,BLUE); floodfill(220,260,WHITE); floodfill(460,200,WHITE); floodfill(240,243,WHITE); floodfill(410,250,WHITE); setcolor(WHITE); setfillstyle(1,MAGENTA); rectangle(515,170,565,220); // RECEIVER moveto(515,170); lineto(540,145); moveto(540,145); lineto(590,145); moveto(590,145); lineto(590,195); moveto(590,145); lineto(565,170); moveto(590,195); lineto(565,220); floodfill(520,180,WHITE); floodfill(535,160,WHITE); floodfill(567,180,WHITE); setcolor(YELLOW); outtextxy(515,120,"Receiver"); setlinestyle(0,3,3); // Ray travel setcolor(YELLOW); delay(3000); moveto(105,325); lineto(25,325); moveto(60,325); // Arrow lineto(55,320); moveto(60,325); lineto(55,330); moveto(10,360); // Electrical Input lineto(20,360); lineto(20,350); lineto(30,350); lineto(30,360); lineto(40,360); lineto(40,350); lineto(50,350); lineto(50,360); lineto(60,360); lineto(60,350); lineto(70,350); lineto(70,360); lineto(80,360); settextstyle(11,0,2); outtextxy(2,300,"Electrical"); outtextxy(20,310,"Input"); delay(1000); moveto(145,315); lineto(220,280); moveto(180,297); // Arrow lineto(180,307); moveto(180,297); lineto(175,292); delay(1000); settextstyle(11,0,2); outtextxy(180,170,"Light Ray Trapped in the Core"); outtextxy(240,190,"of the fiber"); moveto(220,280); lineto(238,262); moveto(229,271); // Arrow lineto(229,278); moveto(229,271); lineto(222,271); delay(1000); moveto(238,262); lineto(260,284); moveto(249,273); // Arrow lineto(249,265); moveto(249,273); lineto(242,273); delay(1000); moveto(260,284); lineto(297,247); moveto(278,266); // Arrow lineto(278,274); moveto(278,266); lineto(271,266); delay(1000); moveto(297,247); lineto(319,269); moveto(308,258); //Arrow lineto(308,250); moveto(308,258); lineto(301,258); delay(1000); moveto(319,269); lineto(355,233); moveto(337,251); // Arrow lineto(337,259); moveto(337,251); lineto(330,251); delay(1000); moveto(355,233); lineto(377,255); moveto(366,244); // Arrow lineto(366,236); moveto(366,244); lineto(359,244); delay(1000); moveto(377,255); lineto(414,218); moveto(395,237); //Arrow lineto(387,237); moveto(395,237); lineto(395,245); delay(1000); moveto(414,218); lineto(436,240); moveto(425,229); // Arrow lineto(425,221); moveto(425,229); lineto(418,229); delay(1000); moveto(436,240); lineto(456,220); moveto(446,230); // Arrow lineto(446,238); moveto(446,230); lineto(439,230); delay(1000); moveto(456,220); lineto(540,195); moveto(492,209); lineto(490,218); moveto(492,209); lineto(486,203); delay(1000); moveto(580,182); lineto(632,182); moveto(606,182); // Arrow lineto(601,177); moveto(606,182); lineto(601,187); moveto(565,230); lineto(575,230); lineto(575,220); lineto(585,220); lineto(585,230); lineto(595,230); lineto(595,220); lineto(605,220); lineto(605,230); lineto(615,230); lineto(615,220); lineto(625,220); lineto(625,230); lineto(635,230); settextstyle(11,0,2); outtextxy(555,240,"Electrical"); outtextxy(585,250,"Output"); delay(3000); cleardevice(); } void projectwork5() { setbkcolor(BLUE); setcolor(WHITE); setlinestyle(0,3,3); moveto(180,130); // OPTICAL FIBER lineto(180,310); moveto(180,130); lineto(440,130); moveto(180,310); lineto(440,310); moveto(180,150); lineto(440,150); moveto(180,290); lineto(440,290); arc(440,140,90,270,10); arc(440,160,270,90,10); arc(440,180,90,270,10); arc(440,200,270,90,10); arc(440,220,90,270,10); arc(440,240,270,90,10); arc(440,260,90,270,10); arc(440,280,270,90,10); arc(440,300,90,270,10); setfillstyle(1,MAGENTA); floodfill(220,170,WHITE); setfillstyle(1,BROWN); floodfill(190,140,WHITE); floodfill(190,300,WHITE); settextstyle(11,0,2); setcolor(BLUE); outtextxy(320,137,"CLADDING"); outtextxy(340,210,"CORE"); setcolor(YELLOW); settextstyle(8,0,4); outtextxy(170,350,"Multi Mode Fiber"); delay(2000); setcolor(WHITE); moveto(155,320); // INCIDENT RAYS lineto(180,220); // FIRST RAY moveto(168,270); // ARROW1 lineto(171,280); moveto(168,270); lineto(159,277); delay(1000); setcolor(YELLOW); moveto(130,320); // SECOND RAY lineto(180,220); moveto(155,270); // ARROW2 lineto(155,278); moveto(155,270); lineto(149,270); delay(1000); setcolor(GREEN); moveto(110,320); // THIRD RAY lineto(180,220); moveto(145,270); // ARROW3 lineto(145,279); moveto(145,270); lineto(138,270); setcolor(WHITE); settextstyle(11,0,2); outtextxy(80,335,"Incident Rays"); delay(1000); setcolor(WHITE); moveto(180,220); // REJECTED RAY lineto(195,150); // PART1 delay(1000); moveto(195,150); // PART2 lineto(215,130); moveto(205,140); // ARROW2 lineto(205,145); moveto(205,140); lineto(200,140); delay(1000); settextstyle(11,0,2); outtextxy(190,115,"Unbound Ray"); moveto(215,130); // PART3 lineto(235,150); moveto(225,140); // ARROW3 lineto(220,140); moveto(225,140); lineto(225,135); delay(1000); moveto(235,150); // PART4 lineto(255,130); moveto(245,140); // ARROW4 lineto(245,145); moveto(245,140); lineto(240,140); delay(1000); setcolor(YELLOW); moveto(180,220); // BOUNDED RAY1 lineto(250,150); // PART1 moveto(215,185); // ARROW1 lineto(208,185); moveto(215,185); lineto(215,193); delay(1000); moveto(250,150); // PART2 lineto(390,290); moveto(320,220); // ARROW2 lineto(320,212); moveto(320,220); lineto(313,220); outtextxy(285,170,"Bounded"); outtextxy(300,180,"Ray"); delay(1000); moveto(390,290); // PART3 lineto(445,235); moveto(418,262); // ARROW3 lineto(418,270); moveto(418,262); lineto(411,262); delay(1000); setcolor(GREEN); moveto(180,220); // BOUNDED RAY2 lineto(210,150); // PART1 delay(1000); moveto(210,150); // PART2 lineto(350,290); moveto(280,220); // ARROW2 lineto(280,212); moveto(280,220); lineto(273,220); outtextxy(225,230,"Bounded"); outtextxy(240,240,"Ray"); delay(1000); moveto(350,290); // PART3 lineto(445,195); moveto(397,243); // ARROW3 lineto(397,251); moveto(397,243); lineto(390,243); delay(3000); cleardevice(); } void projectwork6() { setbkcolor(BLUE); setcolor(WHITE); setlinestyle(0,3,3); rectangle(180,180,450,300); moveto(180,230); lineto(450,230); moveto(180,250); lineto(450,250); setfillstyle(1,LIGHTBLUE); floodfill(190,240,WHITE); setfillstyle(1,GREEN); floodfill(190,190,WHITE); floodfill(190,290,WHITE); setcolor(YELLOW); settextstyle(7,0,4); outtextxy(170,320,"Sinlge Mode Fiber"); settextstyle(11,0,2); outtextxy(460,235,"CORE"); outtextxy(460,200,"CLADDING"); outtextxy(460,270,"CLADDING"); delay(2000); setcolor(YELLOW); moveto(120,240); lineto(180,240); moveto(150,240); lineto(144,234); moveto(150,240); lineto(144,246); settextstyle(11,0,2); outtextxy(80,250,"Incident Ray"); delay(1000); moveto(180,240); lineto(450,240); moveto(315,240); // ARROW lineto(309,234); moveto(315,240); lineto(309,246); delay(2000); cleardevice(); } void closing() { setbkcolor(YELLOW); setcolor(BLUE); settextstyle(7,HORIZ_DIR,4); outtextxy(160,180,"!! THANK YOU !!"); outtextxy(120,280," Press any key to EXIT"); }