Está en la página 1de 86

INTERACTIVE DESIGN AND DEVELOPMENT OF PNEUMATIC STEP COUNTER CIRCUIT A PROJECT REPORT Submitted by DIWAKAR.R KARTHICK.S SRINATH.

R 41502114101 41502114501 41502114096

in partial fulfillment for the award of the degree of BACHELOR OF ENGINEERING in MECHANICAL ENGINEERING S.R.M. ENGINEERING COLLEGE, KATTANKULATHUR 603203.

ANNA UNIVERSITY: CHENNAI 600 025 MAY 2006

ANNA UNIVERSITY : CHENNAI 600 025 SRM ENGINEERING COLLEGE KATTANKULATHUR - 603203

BONAFIDE CERTIFICATE

Certified that this project report INTERACTIVE DESIGN AND DEVELOPMENT OF PNEUMATIS STEP COUNTER CIRCUIT is the bonafide work of DIWAKAR.R,KARTHICK.S,SRINATH.R who carried out the project work under my supervision.

SIGNATURE DR.S.KRISHNAN HEAD OF THE DEPARTMENT

SIGNATURE Z.E.KENNEDY M.E SUPERVISOR (ASST PROFESSOR)

MECHANICAL DEPARTMENT S.R.M.ENGINEERING COLLEGE KATTANKULATHUR.603203

MECHANICAL DEPARTMENT S.R.M.ENGINEERING COLLEGE KATTANKULATHUR.603203

INTERNAL EXAMINER

EXTERNAL EXAMINER

ACKNOWLEDGEMENT

If words are considered as a symbol of approval and tokens of knowledge, then let words play the heralding role expressing my gratitude.

I would like to express my deepest gratitude to Dr. S.Krishnan, Prof and Head, and Prof. D.Kingsly Jeba Singh(Phd), Department of Mechanical Engineering, for granting me special permission on various occasions.

It is a great pleasure to acknowledge those who have given their valuable suggestions and guidance in the successful completion of the work. I would like to thank my Guide Z.E.Edward kennedy M.E and our Co-Guide M.Thirumurugan M.E.

The continuous encouragement given by M.R.Stalin john M.E who will never be forgotten. I am grateful to T.V. Gopal (Phd) and G.Rajaram(M.E), for their support, friendship and being an illustration to how to tolerate bad things. And of course, for their unforgettable support, and for their constant help and suggestions.

CONTENTS

CHAPTER NO.

TITLE

PAGE NO.

1.

INTRODUCTION 1.1 1.2 FLUID POWER PNEUMATICS 1 2.

2. 3.

LITERATURE REVIEW PROBLEM FORMULATION

3.1 3.2 4.

PROBLEM DESCRIPTION OBJECTIVES OF THE PROJECT

6 7

PNEUMATIC COMPONENTS 4.1. COMPONENT CLASSIFICATION 4.2. INTRODUCTION TO CYLINDER 4.2.1 FORCE 4.2.2 TYPES OF CYLINDER 4.2.3 CONSTRUCTION 4.3 DIRECTION CONTROL VALVE 4.3.1 INSTRUCTION 4.3.2 4/2 DIRECTION CONTROL VALVE 4.3.3 4/3 DIRECTION CONTROL VALVE 4.4 PILOT VALVE 4.5 SOLENOID OPERATED VALVE 4.6 PRESSURE RELIEF VALVE 4.7 LIMIT SWITCH 4.8 PNEUMATIC LOGIC VALVES 4.9 ADVANTAGES OF PNEUMATICS 8 10 11 12 14 15 15 16 17 19 21 23 25 26 28

5.

DESIGN METHOD CONSIDERATION OF SEQUENTIAL CIRCUITS 5.1 5.2 5.3 5.4 5.5 CLASSIC METHOD STEP-COUNTER CIRCUIT KARNAUGH-VEITCH MAPPING METHOD COMBINATIONAL CIRCUITS DESIGN CASCADE CIRCUIT 29 30 30 31 31

6.

DESIGNING OF STEP-COUNTER CIRCUIT 6.1 6.2 DEFINITION PROCEDURE 32 32

6.3 6.4 7. 8. 9.

ALGORITHM FLOW CHART

33 33 37 38

CONCLUSION SCOPE FOR FUTURE DEVELOPMENT APPENDICES 9.1 CODING 9.2 INPUT SCREEN 9.3 OUTPUT SCREEN

39 78 79 86

10.

REFERENCES

LIST OF FIGURES

FIGURE NO

TITLE

PAGE NO

4.1 4.2 4.3 4.4

SINGLE ACTING CYLINDER DOUBLE ACTING CYLINDER- PUSH DOUBLE ACTING CYLINDER- PULL CYLINDER WITH TIE RODS FOR HOLDING THE END CAPS IN PLACE

13 14 14 15

4.5 4.6

DIRECTION CONTROL VALVE 4/2 DIRECTION CONTROL VALVE

16 17

4.7 4.8

4/3 DIRECTION CONTROL VALVE 4/3 DCV ALL THE PORTS TO BE JOINED IN THE CENTRE.

18

18 19

4.9 4.10

VALVE ACTUATING DEVICES 3 PORT VALVE, PILOT OPERATED AND SPRING RETURNED.

20

4.11

3 PORT VALVE, PILOT OPERATED AND SPRING RETURNED 20 21 22

4.12 4.13

SOLENOID VALVE DIRECT ACTING SOLENOID VALVE WOULD HAVE PLUNGER PUSHING DIRECTLY ON THE VALVE

4.14

PNEUMATIC SOLENOID/POPPET OPERATED AND SPRING RETURN 23 24 24 25 26 30 35

4.15 4.16 4.17 4.18 5.1 6.1

PRESSURE RELIEF VALVE SYMBOL OF PRESSURE RELIEF VALVE PUSH-BUTTON SWITCH SYMBOL OF TWO-PRESSURE VALVE STEPPING UNIT FLOW CHART FOR STEP COUNTER CIRCUIT

LIST OF TABLES

FIGURE NO

TITLE

PAGE NO.

4.10

COMPARISION OF LOGIC ELEMENTS

27

ABSTRACT

Hydraulic and pneumatic systems are highly nonlinear, and difficult to analyze. The project work deals with the development of generalized software for a pneumatic stepcounter circuit system design. Number of industrial operations involves fluid power applications, to perform the job. This invokes manual operation, and sufficient knowledge in the area, to achieve the sequence. Moreover, changing the sequence of operation is manually difficult. A lot of change in wiring is needed to bypass the operation of certain cylinders. The project aims at overcoming the above difficulties, by developing software, to generate a pneumatic step-counter circuit for the given sequence, and also use it to control the operations of the cylinder in real time, which will also be optimized and thus, the simulation is carried out. The software provides environment for design and development of step-counter. The additional feature of this software is, it can also be manually designed for the requirements. The sequence can be changed, by just entering the sequence as input to software.

CHAPTER 1

1. INTRODUCTION

1.1 FLUID POWER

Fluid Power is the form of power that is transmitted by a pressurized liquid or gas. It can be categorized into hydraulic or pneumatic. Oil hydraulics employs pressurized liquid and pneumatics employs compressed air.

Hydraulic systems use liquids such as petroleum oils, water, synthetic oils, and even molten metals. The first hydraulic fluid to be used was water because it is readily available. Pneumatic systems use air as the gas medium because air is very abundant and can be readily exhausted into the atmosphere after completing its assigned task. It should be realized that there are actually two different types of fluid systems: Fluid transport and Fluid power.

Fluid transport systems have as their sole objective the delivery of a fluid from one location to another to accomplish some useful purpose. Examples include pumping stations for pumping water to homes, cross-country gas lines, and systems where chemical processing takes place as various fluids are brought together. `

Fluid Power systems are designed specifically to perform work. The work is accomplished by a pressurized fluid bearing directly on an operating fluid cylinder or fluid motor. A fluid cylinder produces a force, whereas a fluid motor produces a torque. Fluid cylinders and motors thus provide the muscle to do the desired work. Of course, control components are also needed to ensure that the work is done smoothly, accurately,

efficiently, and safely. Liquids provide a very rigid medium for transmitting power and thus can provide huge forces to move loads with utmost accuracy and precision.

1.2 PNEUMATICS

The technology of pneumatics has played a major role in Certain characteristics of compressed air have made this medium quite suitable for use in modern manufacturing and production plants. It is, therefore, important that technicians and engineers should have a good working knowledge of pneumatic system, air operated tools and other accessories, including a thorough and clear concept of the physical principle that govern the behavior of compressed air.

There are several reasons for considering the use of pneumatic systems instead of hydraulic systems. Liquid exhibit greater inertia than do gases. There-fore, in hydraulic systems the weight of oil is a potential problem when accelerating and decelerating actuators and when suddenly opening and closing valves. Due to Newtons second law of motion the force

required to accelerate oil many times greater than that required to accelerate an equal volume of air.

In pneumatic systems, compressors are used to compress and supply the necessary quantities of air. Pneumatic systems normally use a large centralized air compressor, which is considered to be an infinite air source similar to an electrical outlet for electricity. In this way, pressurized air can be piped from one source to various locations throughout an entire industrial plant. The compressed air is piped to each circuit through an air filter to remove containments, which might harm closely fitting parts of pneumatic components such as valves and cylinders the air then flows through a pressure regulator, which reduces the pressure to the desired level for the particular application. Because air

is not a good lubricant (contain about 20% oxygen), pneumatic systems require a lubricator to inject a very fine mist of oil into the air discharging from the pressure regulator. This prevents wear of the closely fitting moving parts of pneumatic components. CHAPTER 2

2. LITERATURE SURVEY

Ahmed Elsawy and Veekit OCharoen (1997) say that the development of an interface design alternative (icon, pull-down, and screen menus) for pneumatic circuits design. It was also an attempt, to determine the possibility of using it as a tool, to help designers who could associate the menu systems with commands, and visualize circuit design improvement. This study provides three main benefits. Firstly, each of menus helps designers to associate these pictures with commands and to visualize circuit design improvement. Second, the ability to preview pneumatic circuits and minimize rejected designs. Last, is the ability to create more prototypes in less time and at lower cost. . Heung Yeoul Shin and Jae-Won says about the prototype that enables the user the optimal design of pneumatic system. Once the design requirements, such as cylinder type, work load, etc., are inputs to the system, optimal cylinder specifications, with standardized order-based size, valves types, and necessary accessories, are all determined.

Tony Wong and Pascal Bigras (2002) says that pneumatic system non-linearity is even stronger because of air compressibility. It is always a challenge to explain the effects of these nonlinear phenomena on the overall system behavior. This paper presents a software tool developed to help

students understand these complex phenomena without restoring to sophisticated finite element analysis.

Tony Wong and Pascal Bigras says a quasi real-time simulator is designed for efficient numerical simulation of hydraulic and pneumatic systems. This simulator uses a bondgraph theoretic approach, for system equation formulation. A highly optimized and stabilized iterative integrator ensures accurate numerical solution of the system equations. Coupled to the integrators output is a graphical animation subsystem. The later is responsible for rendering movable components on screen at every simulation time-step. Thus, creating the illusion of continuous movement. An important characteristic of this simulator is its ability to permit in-simulation manipulation that allows user to interact with circuit components while a simulation run is in progress .

Yung-Tien Liu and Toshiro Higuchi (2001) says that a new actuator combining both a piezoelectric actuator and a pneumatic cylinder, for the applications of automatic assembly. The experimental results show, that the proposed actuator could move a target object, with step sizes in the 10-nm order, by utilizing the impact force of a piezoelectric element, while maintaining the comparatively long operation range of a pneumatic cylinder. Based on the above literature survey we have decided to have a system for step counter circuit which eliminates the human fatigue in certain application drilling, boring and shifting.

CHAPTER 3

3. PROBLEM FORMULATION

3.1 PROBLEM DESCRIPTION

The application of pneumatics in the industrial environment is wide spread. Some of the general applications of pneumatics are in clamping, shifting, positioning, packaging, feeding, metering, sorting of parts, door etc.

The machining process involving pneumatics is Drilling, Sawing, Forming. It also ensures quality control in the plant by providing precise machining, positioning and clamping operations. It is also used in robotics for gripper control. The manual operation of pneumatics has its own drawbacks. The operator may get tired in repeating a process after a certain amount of time. This will affect the quality of the product produced. It also requires a considerable amount of knowledge in the field of pneumatics to operate the circuit for any process. This project aims at developing a control program for a given input sequence, which is based on the corresponding pneumatic circuit of the sequence controls the entire process.

3.2 OBJECTIVES OF THE PROJECT

Primary Objectives: Program design and development to establish control Selection of the actuator The simulation of the circuit with all possible combinations.

Secondary Objectives: Minimize human efforts and fatigue Ease of operation Any pneumatic process involving sequencing to be automated Minimize time and cost by automation

CHAPTER 4

4. PNEUMATIC COMPONENTS

4.1 COMPONENT CLASSIFICATION

Pneumatic circuit elements are classed into four primary groups. These are

1. AIR SUPPLY AND CONDITIONING ELEMENTS Compressor Receiver Pressure regulator, Filter

2. INPUT ELEMENTS (electrical or pneumatic) On/off devices (switches) Position sensors Trip valves

Many pneumatic sensing and switching devices are directional control valves such as a 3/2 plunger operated valve for detecting a cylinder position.

3. PROCESSING ELEMENTS Logic valves Time delay valves

Pressure switches Directional control valves of many types.

4. ACTUATING DEVICES Cylinders Motors Semi-rotary actuators

MONO-STABLE A mono-stable element only has one stable position and automatically returns to it when the switching signal is removed. Examples of these are Directional valves with spring return Pressure switches Reed relays Proximity detectors Spring loaded switches. Logic valves

BI-STABLE

A bi-stable element has two stable positions and requires a switching signal to change it from one to the other. Examples are

Directional valves with no spring return such as

Pilot/pilot operation Solenoid/solenoid operation Valves with detents Switches with no spring return Latching relays

Fluidic logic elements (AND, OR and so on can be bi-stable) Bi-stable elements are also memory devices since they retain their status until switched and so their status indicates the last thing that happened to them.

4.2 INTRODUCTION TO CYLINDER

Cylinders are linear actuators which convert fluid power into mechanical power. They are also known as JACKS or RAMS.

Hydraulic cylinders are used at high pressures and produce large forces and precise movement. For this reason they are constructed of strong materials such as steel and designed to withstand large forces.

Because gas is an expansive substance, it is dangerous to use pneumatic cylinders at high pressures so they are limited to about 10 bar pressure. Consequently they are constructed from lighter materials such as aluminium and brass. Because gas is a compressible substance, the motion of a pneumatic cylinder is hard to control precisely. The basic theory for hydraulic and pneumatic cylinders is otherwise the same.

4.2.1 FORCE

The fluid pushes against the face of the piston and produces a force. The force produced is given by the formula:

F = pA p is the pressure in N/m^2 and A is the area the pressure acts on in m^2. This assumes that the pressure on the other side of the piston is negligible. The diagram shows a double acting cylinder. In this case the pressure on the other side is usually atmospheric so if p is a gauge pressure we need not worry about the atmospheric pressure.

Let A be the full area of the piston and a be the cross sectional area of the rod. If the pressure is acting on the rod side, then the area on which the pressure acts is (A - a).

F = pA on the full area of piston. F = p(A-a) on the rod side.

4.2.2 TYPES OF CYLINDERS

Functionally cylinders are classified as:

1. Single acting cylinders 2. Double acting cylinders

In single acting cylinders, the oil pressure is fed only on one side of the cylinder either during extension or retraction. When the oil pressure is cut-off, these cylinders return to the normal position either by a spring or by an external load. The cylinders which are actuated by an external load are essentially mounted in the vertical position since the return is affected through the force of gravity.

Fig.4.1 Single acting cylinders

In the case of spring return cylinders, the spring may either be external or internal. Spring size is a function of load and desired operating speed and hence needs careful and judicious selection for optimization.

Double acting cylinders(as shown in Fig.4.2& 4.3) are operated by applying oil pressure to the cylinder in both directions. Due to inherent mechanical problems associated with the spring, single acting cylinders with spring return are not used in applications using larger stroke lengths. As a result cylinders in various applications are mostly double acting type only.

Double acting cylinders are may be either single rod ended or double ended type. The single rod end cylinders have pistons connected to a smaller diameter piston rod. For a given pressure single rod end cylinders exert greater force when extending than when retracting. When it is required to exert equal forces in both directions, the double rod end cylinder is used. However, the maximum force of the cylinder for a given tube size is smaller than the single rod end type.

Double acting cylinder Fig.4.2 Fig.4.3

This force acting on the load is often less because of friction between the piston and piston rod and the seals.

4.2.3 CONSTRUCTION

The detailed diagram shown in Fig.4.4 the main construction details. Hydraulic cylinders are built to withstand substantial pressures and so are expensive compared to pneumatic cylinders. The body is a tube or barrel with a smooth finish to prevent seals wearing out. Steel is usually used for the strength required. The fluid ports are contained in the end caps. One end cap has a hole for the rod. The end caps must be sealed to the barrel.

Fig.4.4 Cylinder with tie rods for holding the end caps in place

4.3 DIRECTION CONTROL VALVE

4.3.1 INTRODUCTION

Valves are necessary to control the pressure, flow rate and direction of the fluid. Hydraulic valves are made to a high standard of quality and robustness. The diagram shown in Fig.4.5 shows few of the vast range of hydraulic valves available. We should remember always that hydraulic systems are high pressure systems and pneumatic systems are low pressure systems. Hydraulic valves are made of strong materials (e.g. steel) and are precision manufactured. Pneumatic valves are made from cheaper materials (e.g. aluminum and polymer) and are cheaper to manufacture.

Fig.4.5 Direction control valve

4.3.2 4/2 DIRECTION CONTROL VALVE

Fig. 4.6 shows the hydraulic pressure port designated P and the return port R or T (for tank). The two other ports are designated A and B. In Pneumatics the pressure port is numbered (1) and the exhaust port (3). The other two are numbered (2) and (4). Note how in the normal position P connects to B and A to T. In the operated position P is connected to A and B to T thus reversing the flow directions at A and B.

Fig.4.6 4/2 Direction control valve

The left box of the symbol shows the connections for the normal position. The right box shows the connections when the spool is moved to the left. The identification tags A, B, P and T is placed against the normal position of the valve. Note this particular valve has a push button to operate it and a spring to return it to the normal position. This is also shown on the symbol.

4.3.3 4/3 DIRECTION CONTROL VALVE

If the valve has a neutral position such that nothing is supplied to neither A nor B, then a third rectangle is inserted in the middle of the symbol (Fig.4.7). The valve is then a 4/3 valve. There are various ways the ports may be connected in the middle position for various reasons. In fig they are all shown blocked off.

Fig.4.7 4/3 Direction control valve

When the P connection is blocked off the valve is said to have a closed centre. A slight modification as shown in Fig.4.8 allows all the ports to be joined in the centre position. When P is connected to T in the middle position, it has an open centre. This allows the pump to vent to tank in the neutral position so saving energy and wear and tear on the pump. The disadvantage of an open centre is that you lose the system pressure so nothing else can be used from with pump.

Fig.4.8 4/3 DCV all the ports to be joined in the centre.

Besides showing the internal connections, a valve symbol must show how the valve element is moved. This is done by adding a small box at each end containing the symbol showing how it is done.Some examples are shown below.

Fig.4.9 A. Hand lever operated and pilot return. B. Pilot operated and pilot return C. Push knob operated and spring return. D. 3 position valve pilot/pilot with spring centering. E. Solenoid operated and solenoid returns. F. Roller operated and spring return.

4.4 PILOT VALVE

The diagram show in Fig.4.10 a pneumatic 3 port valve, pilot operated and spring returned. The pressure port (1) is normally open to the cylinder port (2) and the valve must be operated to turn the pressure off. This valve is said to be Normally Open

Fig.4.10

3 port valve, pilot operated and spring returned.

By simply reversing ports (1) and (3) the pressure port is normally closed and the valve is operated to obtain pressure at port (2). This valve is Normally Closed.

Fig.4.11 3 port valve, pilot operated and spring returned

4.5 SOLENOID 0PERATED VALVE

A solenoid is a coil with an iron plunger inside it. When current flows in the coil, the plunger becomes magnetized and tries to move out of the coil. If a spring is used to resist the movement, the distance moved is directly proportional to the current in the coil. Solenoids are used in relays where they operate an electric switch. They are also used in hydraulic and pneumatic valves to move the valve element.

Fig.4.12 Solenoid Valve

A direct acting solenoid valve would have the plunger pushing directly on the valve element as shown in Fig.4.12 This is more common in pneumatic valves.

Fig.4.13 Direct acting solenoid valve would have plunger pushing directly on the valve

Often the valve may be manually operated by pushing the plunger with a screw driver or by turning a screw on the side. This is very useful when checking to see if the valve has

stuck. Modern solenoid valves are really pilot valves. A second small electrically operated poppet valve is fitted at the end which lets oil/air through to the end of the piston and so pilot operates them. The valve shown is a pneumatic solenoid/poppet operated and spring return. When the solenoid is activated, the valve switches. When the solenoid is deactivated, the valve switches back; hence it is a two position valve.

Fig.4.14 Pneumatic solenoid/poppet operated and spring return

4.7 PRESSURE RELIEF VALVE

The purpose of a pressure relief valve as shown in Fig.4.15 is to protect a system from too much pressure. This will occur if the actuator is overloaded or if the flow of fluid is blocked. For example when a cylinder reaches the end of its stroke, the pump will still try

to pump oil into it but it has nowhere to go. Similarly if a closed centre valve is used, the pump becomes blocked off. In such cases the pump or the system will become damaged.

Fig.4.15 Pressure Relief valve

The relief valve is normally kept closed by the spring. Port (A) is connected to the system to be protected. If the pressure acting on the poppet overcomes the force of the spring, the poppet opens and lets the oil through to the tank (port B) thus limiting the pressure. Usually the spring is adjusted in order to set the pressure.

Fig.4.16 Symbol of Pressure Relief valve

4.8 LIMIT SWITCH

Limit switches open and close circuits when they are actuated either at the end of retraction or extension strokes of hydraulic or pneumatic cylinders.

By the use of a simple push-button switch, an operator can cause sophisticated equipment to begin performing complex operations. These push-button switches are used mainly for starting and stopping the operation of machinery as well as providing for manual override when an emergency arises.

Fig.4.17 Push-button switch

4.9 PNEUMATIC LOGIC VALVES

The AND valve only gets air from port C when air is applied to ports A AND B.

Fig.4.18 Symbol of Two-Pressure valve

4.10 COMPARISION OF LOGIC ELEMENTS

4.11 ADVANTAGES OF PNEUMATICS

Pneumatics is used in preference to hydraulics for the following reasons. 1. Easily connected to an air supply and needs no separate power pack. 2. The operation of actuators is fast. 3. No return piping is required; the air is vented to atmosphere. 4. Clean medium with no mess when it leaks. 5. No fire hazard as with oil. 6. Multiplication of small forces to achieve greater forces for performing work. 7. It easily provides infinite and step less variable speed control which is difficult to obtain from other devices. 8. As the medium of power transmission is a fluid, it is not subjected to any breakage of parts as in a mechanical transmission.

Pneumatics is used in preference to electrics for the following reasons.

1. Will not start a fire through electric fault (Intrinsically safe). 2. Air motors are safe when over loaded and does not overheat. 3. Safer for operators (no risk of electrocution).

CHAPTER 5

DESIGN METHOD CONSIDERATION OF SEQUENTIAL CIRCUITS

There is no universal circuit design method that suits all types of sequential circuits. Some methods are more suitable for compound circuits but would be too expensive for simple two-cylinder circuits. There are five common methods used by engineers and they are given below.

1. Classic method

2. Step Counter method 3. Karnaugh-Veitch mapping method 4. Combinational circuit design 5. Cascade method

5.1 CLASSIC METHOD

The classic method is based, on the knowledge of pneumatic logic elements, and application of the logics. Each pneumatic element is a logic element performing various logic functions like AND, NAND, OR, NOR etc. The principle of Boolean algebra and De Morgan theorem are employed to solve problems in the analysis of control logics. In Boolean algebra, input signals and output signals are expressed by means of letters. The logical functions are denoted by symbols. For example, OR is used as (+) or U, AND is used as (.).

5.2 STEP COUNTER METHOD

A step counter is a digital modular counter, constructed from stepping units which serve as sequence steppers for asynchronous sequential fluid power controls. A basic stepping unit as shown in Fig.5.1 is built from a signal output signal from the stepping unit requires.

Fig.5.1 Stepping Unit


5.3 KARNAUGH-VEITCH MAPPING METHOD

While the classic algebraic method of simplifying binary functions is useful for simple cases, it becomes time consuming as the function become very complex. so a graphical design method using Karnaugh-Veitch map is used to simplify intricate. Control problems and it produces the simplest possible

result. This method is generally such faster than the algebraic one. The K-V map can contain large number of control variables in their algebraic and binary logic modes. From the diagram, they can be formed into a number of suitable Boolean equations. They are mapped together and then minimized by applying the basic rules of set algebra. This gives the final control equation in its simplest form.

5.4 COMBINATIONAL CIRCUIT DESIGN

Combinational circuit output signals depend, solely, on the momentary state of their input signals or input variables. This makes combinational circuits relatively simple to design.

The design tools for combinational circuits are the truth tables and the Karnaugh-Veitch maps.

5.5 CASCADE METHOD

Cascade has arisen from the stage, like series connection. Cascade arrangement ensures that, at any one time, only one output line is pressurized, and all other are vented to atmosphere. In principle, this cascade can be expanded to any number of stages, where signal cut out is affected, by use of a reversing valve. In this system, the air supply to various pilot trip-valves is derived, from a group selector valve. This ensures air supply, to the pilot trip-valve (signal generator), only when needed, and, at all other times, the trip valves are without air supply.

CHAPTER-6

DESIGNING OF STEP COUNTER CIRCUIT

6.1 DEFINITION

A step counter is a digital modular counter, constructed from stepping units which serve as sequence steppers for asynchronous sequential fluid power controls. A basic stepping unit is built from a signal output signal from the stepping unit requires.
6.2 PROCEDUERE

1. Draw the cylinders and their memory valves (D.C.V.s), connect the to the cylinders and label the cylinders and their memories. 2. Draw a step counter for four steps. Include the start valve. 3. Draw the position sequence valves.

memories

4. The confirmation signal for step 1 originates from the position sequence valve controlling the completion of the previous step. This is step 4 of the previous cycle, and hence this is at the retracted end of cylinder A. 5. This first step serves a triple purpose:

It signals cylinder A to extend. It prepares step 2. It resets the previous step which was step 4.

6. The confirmation signal for step 2 originates from the position sequence valve controlling the completion of the previous step which is step 1. 7. This second step serves a triple purpose:

It signals cylinder B to extend. It prepares the third step.

It resets the previous steps, which was step 1. 8. Continue in the same manner through out the circuit.

6.3 ADVANTAGES

Minimize human efforts Ease of operation Any pneumatic process involving sequencing to be automated Minimize time and cost by automation The simulation of the circuit with all possible combinations
6.3 ALGORITHM CYLINDER

Step1. Declare cylinder parameters

Step2. Set cylinder location Step3. Set cylinder size Step4. Set piston parameters Step5. Set piston size and length Step6. Declare cylinder forward movement Step7. Declare cylinder retraction movement Step8. Draw cylinder and piston using parameters

DCVALVE

Step1. Declare DC valve parameters Step2. Set DC valve location Step3. Set DC valve size Step4. Move compressor Step5. Draw DC valve

TWIN PRESSURE VALVE

Step1. Declare TP valve parameters Step2. Set TP valve location Step3. Set TP valve size Step4. Draw TP valve

POSITION SEQUENCE VALVE

Step1. Declare position sequence valve parameters Step2. Set position sequence valve position Step3. Set position sequence valve size Step4. Move compressor Step5. Draw position sequence valve Step6. Set position valve as limit switch when parameter is 0 Step7. Set position valve as start button when parameter is 1 Step8. Set position valve as 3/2 DC valve when parameter is 2

6.4 FLOW CHART FOR STEP COUNTER CIRCUIT(Fig.6.1)

start Read the sequence A+,B+,A-,B- etc Avoid repetition of same Letter in the same group Split minimum number Of groups Calculate the no.of steps for step counter circuit

Decide no. limit switches Generate the circuit

No Check all Components are connected Yes Run the simulation Stop

Start the process flow by reading the sequence A+,B+,A-,B- etc. A represents any

specified opera ration in the cylinder and B represents some other operation which is defined by user.

The plus and minus symbol represent the forward and backward movement. After

the input sequence being reed we start to split the sequence to minimum numbers of groups.

The software initially taking the sequence as input does the splitting work and

then validates the sequence by avoiding repetition of same letters in one group. After validations go for calculation were the design parameters for the step

counter circuit system control valve is calculated. Then it calculates the number of steps for step counter circuit. There are three

cylinders and so the number of limit switches equals to 6 (3*2=6). The entire process still now is done automatically by the system and the required

circuit is generated. After the generation of the circuit verify for the connection between all the

components. If they doesnt fit well then repeat the entire process above starting from the point

were check for repetition of same letters in the same group. If justify that all the components are connected well go for running the

simulation.

CHAPTER 7

CONCLUSION

Thus the project reduces the human effort and fatigue, by employing software control, for sequencing the hardware operation. The work is implemented using the concept of step counter circuit. The software developed can accommodate the simulation of the circuit with all possible combinations. It can also be connected to real time applications to use these sequences to achieve a real time control. The enhanced feature of this software is, it

can also be manually designed for the requirements. The sequence can be changed, by just entering the sequence as input to software. Thus the user time can be effectively.

CHAPTER-8 SCOPE FOR FUTURE DEVELOPMENT

This project has been coded universally to show the simulation for various applications like drilling, boring, clamping etc. Based on this one can interface the hardware components with real time applications. The simulation can be checked for various sequences with the help of this step counter circuit. Thus it reduced the risk employed in changing various hardware components manually. Number of cylinders also can be extended depends on the user requirements.

CHAPTER-9 APPENDICES 9.1 CODING

#include <stdlib.h> #include <string.h> #include <dos.h>

#include <stdio.h> #include <conio.h> #include <graphics.h> #include "Cylinder.cpp" #include "PValve.cpp" #include "DCValve.cpp" #include "TPValve.cpp" #include "save.cpp" enum {RIGHT,LEFT,UP,DOWN};

void GetInput(); int getNoOfCylinder(); void ShowAnimationScreen(); void DrawFixedLines(int Color=-1); void DrawFirstSequence(); void DrawSecondSequence(); void DrawThirdSequence(); void GetSequence(int N,char *S); int GetSequenceID(int GroupNo,char *F);

char Buffer[18]; int Index,NoOfCylinder;

Cylinder cylinder[5]; DCValve dcValve[5]; PValve pValve[15]; TPValve tValve[15]; PValve bValve[15]; PValve StartButton;

class Point

{ public: int XValue,YValue;

Point() { XValue=YValue=0; } void SetX(int V) { XValue=V; } void SetY(int V) { YValue=V; } int GetX() { return XValue; } int GetY() {

return YValue; } };

class Coordinate { public: Point P1;

Point P2;

void AddLineCoordinate(int x1,int y1,int x2,int y2) { P1.SetX(x1); P1.SetY(y1); P2.SetX(x2); P2.SetY(y2); }

Point GetFirstCoordinate() { return P1; }

Point GetSecondCoordinate() { return P2; } };

class Sequence

{ public: char Id[3]; char Dir; int Color; Coordinate Line[10]; int LineCount; Sequence()

{ Color=0; for(int i=0;i<3;i++) Id[i]=0; LineCount=0; }

void AddSequenceID(char S[]) { S[2]=0; strcpy(Id,S); }

char *GetSequenceID() { return Id; }

void AddLine(int x1,int y1,int x2,int y2) { Line[LineCount].AddLineCoordinate(x1,y1,x2,y2); LineCount++;

void operator=(Sequence S) { for(int i=0;i<S.LineCount;i++) Line[i]=S.Line[i]; LineCount=S.LineCount; Color=S.Color;

void Animate() { int Dir=0,Row,Col,ERow,ECol; int Color; for(int i=0;i<LineCount;i++){ Col=Line[i].P1.XValue; Row=Line[i].P1.YValue; ECol=Line[i].P2.XValue; ERow=Line[i].P2.YValue;

putpixel(Col,Row,12); while(Col!=ECol || Row!=ERow){ delay(2); if((Color=getpixel(Col+1,Row))==14) putpixel(++Col,Row,12); else if((Color=getpixel(Col,Row+1))==14) putpixel(Col,++Row,12); else if((Color=getpixel(Col-1,Row))==14)

putpixel(--Col,Row,12); else if((Color=getpixel(Col,Row-1))==14) putpixel(Col,--Row,12); else if((Color=getpixel(Col+1,Row+1))==14) putpixel(++Col,++Row,12); else

if((Color=getpixel(Col-1,Row-1))==14) putpixel(--Col,--Row,12); } } }

void Animate(int F) { int Dir=0,Row,Col,ERow,ECol; int Color; for(int i=LineCount-1;i>=0;i--){ Col=Line[i].P2.XValue; Row=Line[i].P2.YValue; ECol=Line[i].P1.XValue; ERow=Line[i].P1.YValue;

putpixel(Col,Row,12); while(Col!=ECol || Row!=ERow){ delay(2); if((Color=getpixel(Col+1,Row))==14) putpixel(++Col,Row,12); else

if((Color=getpixel(Col,Row+1))==14) putpixel(Col,++Row,12); else if((Color=getpixel(Col-1,Row))==14) putpixel(--Col,Row,12); else if((Color=getpixel(Col,Row-1))==14) putpixel(Col,--Row,12);

else if((Color=getpixel(Col+1,Row+1))==14) putpixel(++Col,++Row,12); else if((Color=getpixel(Col-1,Row-1))==14) putpixel(--Col,--Row,12); } } }

operator =(int N) { Color=N; }

void DrawLine(int C=-1) { if(!C) setcolor(C); else setcolor(Color); if(C==10)

setcolor(C); for(int i=0;i<LineCount;i++) line(Line[i].P1.XValue,Line[i].P1.YValue, Line[i].P2.XValue,Line[i].P2.YValue); }

}Link[45],FixedLine[50],ActionLine[50],ActionLink[40],DefaultLine[50],Action CylinderLine[35],DefaultLink[45];

int LinkCount,FixedLineCount,ActionLineCount,ActionLinkCount,ActionCylinderLineCou nt;

void Reset() { _AX=0; geninterrupt(0x33); }

void ShowMouse() { _AX=1; geninterrupt(0x33); }

void HideMouse() { _AX=2; geninterrupt(0x33); }

int GetButtonStatus(int &Row,int &Col) { _AX=3; geninterrupt(0x33); Row=_DX; Col=_CX; return _BX; }

void ReleaseButton() { int Row,Col; while(GetButtonStatus(Row,Col)); }

void ShowXYAxis(int Row,int Col) { static int PRow,PCol; if(!PRow && !PCol){ PRow=Row; PCol=Col; } if(PRow==Row && PCol ==Col) return; HideMouse(); setcolor(0); line(0,PRow,768,PRow); setcolor(0); line(PCol,0,PCol,500); setcolor(7);

line(0,Row,768,Row); line(Col,0,Col,500); PRow=Row; PCol=Col; ShowAnimationScreen(); ShowMouse(); }

void ActivateMouse() { char Key=0,Flag=0; char B[200]; int Button,Row,Col,PCol,PRow; int x1,y1,x2,y2; while(Key!=27 && Key!=13){ if(kbhit()) Key=getch(); Button=GetButtonStatus(Row,Col); ShowXYAxis(Row,Col); if(PRow!=Row || PCol!=Col){ PRow=Row; PCol=Col; sprintf(B," Row:%4d Col:%4d ",Row,Col); settextstyle(2,0,6); setfillstyle(0,1); bar3d(450,450,630,470,0,0); outtextxy(450,450,B); } } }

void LoadActionForCylinder(char *FileName) { FILE *Fp; int Row,Col; char S[200],Ch;

int Index=0,Color=0;

Fp=fopen(FileName,"r"); ActionCylinderLineCount=0; while(!feof(Fp)){ int Array[100]={0}; if(feof(Fp)) break; Index=0; Ch=0; while(Ch!='$'){ fscanf(Fp,"%d",&Array[Index++]); if(feof(Fp)) break; Ch=fgetc(Fp); if(Ch=='$'){ fscanf(Fp,"%d",&Color); break; } } int j=0; if(feof(Fp)) break;

for(j=0;j<Index-2;j+=2){

ActionCylinderLine[ActionCylinderLineCount].AddLine(Array[j],Array[j+1],Array[j+2] ,Array[j+3]); ActionCylinderLine[ActionCylinderLineCount].Color=Color; } ActionCylinderLineCount++; }

fclose(Fp);

void LoadFixedValues(char *FileName) { FILE *Fp; int Row,Col; char S[200],Ch;

int Index=0,Color=0; Fp=fopen(FileName,"r"); while(!feof(Fp)){ int Array[100]={0}; if(feof(Fp)) break; Index=0; Ch=0; while(Ch!='$'){ fscanf(Fp,"%d",&Array[Index++]); if(feof(Fp)) break;

Ch=fgetc(Fp); if(Ch=='$'){ fscanf(Fp,"%d",&Color); break; } } int j=0; if(feof(Fp))

break;

for(j=0;j<Index-2;j+=2){

FixedLine[FixedLineCount].AddLine(Array[j],Array[j+1],Array[j+2],Array[j+3]); FixedLine[FixedLineCount].Color=Color;

DefaultLine[FixedLineCount].AddLine(Array[j],Array[j+1],Array[j+2],Array[j+3]); DefaultLine[FixedLineCount].Color=Color; } FixedLineCount++; } fclose(Fp); }

void LoadValues(char *FileName) { FILE *Fp; int Row,Col; char S[200],Ch; int Array[100]={0}; int Index=0;

Fp=fopen(FileName,"r"); while(!feof(Fp)){ fscanf(Fp,"%s",S); if(feof(Fp)) break; Index=0; Ch=0; while(Ch!='$'){

Ch=fgetc(Fp); if(Ch=='$') break; fscanf(Fp,"%d",&Array[Index++]); } fscanf(Fp,"%d",&Link[LinkCount].Color); Link[LinkCount].AddSequenceID(S); int j=0; for(j=0;j<Index-2;j+=2) Link[LinkCount].AddLine(Array[j],Array[j+1],Array[j+2],Array[j+3]); LinkCount++; } fclose(Fp); }

void LoadActionValues(char *FileName) { FILE *Fp; int Row,Col; char S[200],Ch; int Array[100]={0}; int Index=0;

Fp=fopen(FileName,"r"); while(!feof(Fp)){ Index=0; Ch=0; if(feof(Fp)) break; while(Ch!='$'){ fscanf(Fp,"%d",&Array[Index++]);

Ch=fgetc(Fp); if(Ch=='$') break;

} fscanf(Fp,"%d",&ActionLine[ActionLineCount].Color); int j=0; for(j=0;j<Index-2;j+=2)

ActionLine[ActionLineCount].AddLine(Array[j],Array[j+1],Array[j+2],Array[j+3]); ActionLineCount++; if(feof(Fp)) break; } fclose(Fp); }

void PrintPValveNames() { int i,Row=0,Col=0,C=0; char Str[20]={0}; for(i=0;i<12;i+=2){

if(Buffer[i+1]=='+') sprintf(Str,"%c0",Buffer[i]+32); else sprintf(Str,"%c1",Buffer[i]+32); Row=bValve[C].getRow()+bValve[C].getHeight(); Col=bValve[C].getCol(); settextstyle(2,0,6); outtextxy(Col,Row,Str);

C++; } C=0; for(i=0;i<12;){ if(Buffer[i+1]=='+') sprintf(Str,"%c0",Buffer[i]+32); else sprintf(Str,"%c1",Buffer[i]+32);

Row=cylinder[C].getRow()+cylinder[C].getHeight()+5; Col=cylinder[C].getCol()-30; settextstyle(2,0,6); outtextxy(Col,Row,Str); i+=2; if(Buffer[i+1]=='+') sprintf(Str,"%c0",Buffer[i]+32); else sprintf(Str,"%c1",Buffer[i]+32);

Row=cylinder[C].getRow()+cylinder[C].getHeight()+5; Col=cylinder[C].getCol()-80; settextstyle(2,0,6);

outtextxy(Col,Row,Str); i+=2; C++; } }

void ChangeAsAction(int N) {

FixedLine[N].DrawLine(0); FixedLine[N]=ActionLine[N]; FixedLine[N].DrawLine(); FixedLine[N].Animate(); }

void PressureLeftUp(int C) { FixedLine[C].Animate(); }

void PressureLeftDown(int C) { FixedLine[C].Animate(1); }

void PressureRightUp(int C) { FixedLine[C+1].Animate(); }

void PressureRightDown(int C)

{ FixedLine[C+1].Animate(1); }

void ChangeCylinderDefaultAction(int C) { int X=25; X=X+C*2;

FixedLine[C].DrawLine(0); FixedLine[C+1].DrawLine(0); FixedLine[C]=DefaultLine[X+1]; FixedLine[C].Color=14; FixedLine[C].DrawLine(); FixedLine[C+1]=DefaultLine[X]; FixedLine[C+1].Color=14; FixedLine[C+1].DrawLine(); }

void ChangeCylinderAction(int C) { int X=25; X=X+C*2; FixedLine[X].DrawLine(0); FixedLine[X+1].DrawLine(0); FixedLine[C+1]=ActionCylinderLine[X+1]; FixedLine[C+1].DrawLine(); FixedLine[C]=ActionCylinderLine[X]; FixedLine[C].DrawLine(); }

void MoveCylinder(int No,int Dir) { if(!Dir){ ChangeCylinderAction(No); PressureRightUp(No); cylinder[No].moveForward(); PressureLeftDown(No); }

else{ ChangeCylinderDefaultAction(No); PressureLeftUp(No); cylinder[No].moveRetraction(); PressureRightDown(No); } }

void ChangeAsValueAction(int N) { Link[N].DrawLine(0); DefaultLink[N]=Link[N]; Link[N]=ActionLink[N]; Link[N].DrawLine(); Link[N].Animate(); }

void ChangeAsDefaultAction(int N) { Link[N].DrawLine(0); Link[N]=DefaultLink[N]; Link[N].DrawLine();

void ChangeAsDefault(int N) { for(int i=0;i<N;i++){ FixedLine[i].DrawLine(0); FixedLine[i]=DefaultLine[i]; FixedLine[i].Color=7;

FixedLine[i].DrawLine(); } }

void InitialFlow() { char F[4]; int Start,Diff=0; for(int i=0;i<6;i++){ GetSequence((i+1),F); Start=GetSequenceID(i,F); if(Diff) Diff+=3; else Diff=1; FixedLine[Diff].DrawLine(0); if(F[1]=='+') FixedLine[Diff]=ActionLine[Diff]; FixedLine[Diff].DrawLine(); } }

void Flow(Coordinate &C,int &Dir) { int x1,x2,y1,y2,Color; switch(Dir) { case UP:y1=C.P1.YValue; y2=C.P2.YValue; x1=C.P1.XValue;

x2=C.P2.XValue; break; case DOWN: y1=C.P1.YValue; y2=C.P2.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; case RIGHT: y1=C.P2.YValue; y2=C.P1.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; case LEFT: y1=C.P1.YValue; y2=C.P2.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; } if(x1==x2){

if(y1<y2){ for(int i=y1;i<y2;i++){ Color=getpixel(x1,i); if(Color==14) break; } putpixel(x1,i,12); }

else { for(int i=y1;i>y2;i--){ Color=getpixel(x1,i); if(Color==14) break; } putpixel(x1,i,12); } } else{ if(x1<x2){ for(int i=x1;i<x2;i++){ Color=getpixel(i,y1); if(Color==14) break; } putpixel(i,y1,12); } else{ for(int i=x1;i>x2;i--){ Color=getpixel(i,y1);

if(Color==14) break; } putpixel(i,y1,12); } } }

int isEnd(Coordinate C,int &Dir) { int x,y,Color; switch(Dir){ case RIGHT: case LEFT : case UP :x=C.P2.XValue; y=C.P2.YValue; break; case DOWN :x=C.P2.XValue; y=C.P2.YValue; break; } Color=getpixel(x,y); if(Color==12){ if(Dir==RIGHT) Dir=DOWN; return 1; } return 0; }

int IsMeetJunction(Coordinate C,int Dir) { int x1,x2,y1,y2,Color,C1,C2,C3,C4,x,y; switch(Dir) { case UP:y1=C.P1.YValue; y2=C.P2.YValue; x1=C.P1.XValue;

x2=C.P2.XValue; break; case DOWN: y1=C.P2.YValue; y2=C.P1.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; case RIGHT: y1=C.P2.YValue; y2=C.P1.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; case LEFT: y1=C.P1.YValue; y2=C.P2.YValue; x1=C.P1.XValue; x2=C.P2.XValue; break; } x=x1;

y=y1; if(x1==x2){ if(y1<y2){ for(y=y1;y<y2;y++){ Color=getpixel(x1,y); if(Color==14) break; }

} else { for(y=y1;y>y2;y--){ Color=getpixel(x1,y); if(Color==14) break; } } } else{ if(x1<x2){

for(x=x1;x<x2;x++){ Color=getpixel(x,y1); if(Color==14) break; } } else{ for(x=x1;x>x2;x--){ Color=getpixel(x,y1);

if(Color==14){ break; } } } } C1=getpixel(x,y); C2=getpixel((x-1),y);

C3=getpixel((x+1),y); C4=getpixel(x,y-1); if(C1==14 && C2==14 && C3==14 && C4==14) return 1; return 0; }

void FlowUpToJunction(Sequence &F) { int Count=0,Dir=UP; Coordinate Line1; while(1) { if(Count<F.LineCount) Line1=F.Line[Count]; Flow(Line1,Dir);

if(isEnd(Line1,Dir)) Count++; if(IsMeetJunction(Line1,UP)) break; }

} void FlowAllDirection(Sequence &F,Sequence &S,Sequence &T) { char Flag=0; int i=0,Dir1=RIGHT,Dir2=UP,Dir3=LEFT; Point FPoint1,FPoint2; Point SPoint1,SPoint2; Point TPoint1,TPoint2;

Coordinate Line1; Coordinate Line2; Coordinate Line3; int Line1Count=0,Line2Count=0,Line3Count=0; while(Line1Count<F.LineCount || Line2Count<S.LineCount || Line3Count<T.LineCount) { if(Line1Count<F.LineCount) Line1=F.Line[Line1Count]; if(Line2Count<S.LineCount) Line2=S.Line[Line2Count]; if(Line3Count<T.LineCount) Line3=T.Line[Line3Count]; Flow(Line1,Dir1); Flow(Line2,Dir2); Flow(Line3,Dir3); delay(2); if(Dir1==DOWN && Flag) Line1.P1.XValue++; Flag=0; if(isEnd(Line1,Dir1)){ Line1Count++;

Flag=1; } if(isEnd(Line2,Dir2)) Line2Count++; if(isEnd(Line3,Dir3)) Line3Count++; } }

void ShowActionFixed() { int i=0,C=0,Start=0,CylinderID=0,PC=-1; char Flag=0,Dir=0,ID=0,TCount=0,PStart=-1; char F[10]={0},SaveFileName[20]={0}; int SaveCount=0; pValve[5].shiftCompressor(); while(i<19){ if(Flag){ GetSequence(C,F); Start=GetSequenceID((C-1),F); } Flag=0; if(i!=3 && i!=6 && i!=9 && i!=12 && i!=15){ ChangeAsAction(i); } i++; if(C!=PC && C<5) bValve[C].shiftCompressor(); PC=C; if(i==3 || i==6 || i==9 || i==12 || i==15 || i==18){

GetSequence(C+1,F); Start=GetSequenceID(C,F); ID=F[0]-'A'; pValve[C].shiftCompressor();

FixedLine[i].Color=14; FixedLine[i].DrawLine(); FixedLine[19+TCount].Color=14;

FixedLine[19+TCount].DrawLine();

Link[Start].DrawLine(0); DefaultLink[Start]=Link[Start]; Link[Start]=ActionLink[Start]; Link[Start].DrawLine(); FlowUpToJunction(Link[Start]); FlowAllDirection(FixedLine[i],Link[Start],FixedLine[19+TCount]); if(TCount){ pValve[TCount-1].shiftCompressor(); GetSequence(C,F); Start=GetSequenceID((C-1),F); ChangeAsDefaultAction(Start); ChangeAsDefault(i); FixedLine[19+(TCount-1)].Color=7; FixedLine[19+(TCount-1)].DrawLine(); } else pValve[5].shiftCompressor(); TCount++; GetSequence(C+1,F); if(F[1]=='+')

Dir=0; else Dir=1; Start=GetSequenceID(C,F);

if(CylinderID>2) CylinderID=CylinderID%3; ID=F[0]-'A';

dcValve[ID].shiftCompressor(); dcValve[ID].Show(); ChangeCylinderAction(ID); MoveCylinder(ID,Dir); SaveCount++; sprintf(SaveFileName,"Action%d",SaveCount); // Save(SaveFileName); Flag=1; CylinderID++; C++; } if(i==18) break; } exit(0); }

void LoadActionLink(char *FileName) { FILE *Fp; int Row,Col;

char S[200],Ch; int Array[100]={0}; int Index=0; Fp=fopen(FileName,"r"); while(!feof(Fp)){ fscanf(Fp,"%s",S); if(feof(Fp)) break;

Index=0; Ch=0; while(Ch!='$'){ Ch=fgetc(Fp); if(Ch=='$') break; fscanf(Fp,"%d",&Array[Index++]); } fscanf(Fp,"%d",&ActionLink[ActionLinkCount].Color); ActionLink[LinkCount].AddSequenceID(S); int j=0; for(j=0;j<Index-2;j+=2)

ActionLink[ActionLinkCount].AddLine(Array[j],Array[j+1],Array[j+2],Array[j+3]); ActionLinkCount++; } fclose(Fp);

void main() {

int GDriver=DETECT,GMode; LoadValues("value.txt"); LoadFixedValues("fixed.txt"); LoadActionValues("f1.txt"); LoadActionLink("value1.txt"); LoadActionForCylinder("fixed1.txt"); initgraph(&GDriver,&GMode,"d:\\tc\\bgi"); ShowMouse();

setcolor(11); settextstyle(1,0,3); GetInput(); // Save("Input.bmp"); cleardevice(); NoOfCylinder = getNoOfCylinder(); HideMouse(); ShowAnimationScreen(); getch(); // Save("Layout.bmp"); ShowActionFixed(); ShowMouse(); ActivateMouse(); getch(); }

void GetInput() { char Key; while(Key!=27 && Key!=13){ outtextxy(10,400,"Enter the Sequence :"); Key=getch();

if(Key==13) break; if(Key==8){ if(Index){ Index--; Buffer[Index]=0; } }

else{ if(Key>='a' && Key<='z') Key-=32; if((Key>='A' && Key<='C') ||Key=='+' || Key=='-' || Key==' '){ Buffer[Index++]=Key; Buffer[Index]=0; } } cleardevice(); outtextxy(265,400,Buffer); } }

int NotRepeat(char Array[],char Ch) { int i; for(i=0;Array[i];i++) if(Array[i]==Ch) return 0; return 1; }

int getNoOfCylinder() { int i; int Count=0; char Array[20]={0}; int ArrayCount=0; for(i=0;Buffer[i];i++) if(Buffer[i]>='A' && Buffer[i]<='C' && NotRepeat(Array,Buffer[i])){

Count++; Array[ArrayCount++]=Buffer[i]; } return Count; }

void GetSequence(int N,char *S) { char B[200]; strcpy(B,Buffer); if(N>1) strcpy(B,Buffer+(N-1)*2); B[2]=0; strcpy(S,B); }

int GetSequenceID(int GroupNo,char *F) { for(int i=GroupNo*6;i<LinkCount;i++) if(!strcmp(F,Link[i].GetSequenceID())) return i; return -1;

void DrawFixedLines(int Color) { for(int i=0;i<FixedLineCount;i++) for(int j=0;j<FixedLine[i].LineCount;j++){ if(!Color) setcolor(Color);

else setcolor(FixedLine[i].Color); line(FixedLine[i].Line[j].GetFirstCoordinate().GetX(), FixedLine[i].Line[j].GetFirstCoordinate().GetY(), FixedLine[i].Line[j].GetSecondCoordinate().GetX(), FixedLine[i].Line[j].GetSecondCoordinate().GetY()); }

void DrawFirstSequence() { int i,Start=0; char F[3]; char S[3]; GetSequence(1,F); GetSequence(2,S); Start=GetSequenceID(0,F); for(int j=0;j<Link[Start].LineCount;j++){ setcolor(Link[Start].Color); line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(),

Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); } Start=GetSequenceID(1,S); for(j=0;j<Link[Start].LineCount;j++){ setcolor(Link[Start].Color); line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(),

Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); } }

void DrawSecondSequence() { int i,Start=0; char F[3]; char S[3]; GetSequence(3,F); GetSequence(4,S); Start=GetSequenceID(2,F); for(int j=0;j<Link[Start].LineCount;j++) line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(), Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); Start=GetSequenceID(3,S); for(j=0;j<Link[Start].LineCount;j++) line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(),

Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); }

void DrawThirdSequence() { int i,Start=0; char F[3];

char S[3]; GetSequence(5,F); GetSequence(6,S); Start=GetSequenceID(4,F); for(int j=0;j<Link[Start].LineCount;j++) line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(), Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); Start=GetSequenceID(5,S); for(j=0;j<Link[Start].LineCount;j++) line(Link[Start].Line[j].GetFirstCoordinate().GetX(), Link[Start].Line[j].GetFirstCoordinate().GetY(), Link[Start].Line[j].GetSecondCoordinate().GetX(), Link[Start].Line[j].GetSecondCoordinate().GetY()); }

void ShowAnimationScreen() { char B[200]; int Col=80,Row=10; int x1,y1,x2,y2;

settextstyle(2,0,7); sprintf(B,"Sequence :%s",Buffer); outtextxy(10,450,B); int i; for(i=0;i<NoOfCylinder;i++){ cylinder[i].setLocation(Row,Col+i*200); cylinder[i].Show();

dcValve[i].setLocation(Row+cylinder[i].getHeight()+30,cylinder[i].getCol()+20); dcValve[i].setSize(60,20); dcValve[i].Show(); } int C=0,tpCol=0; for(i=0;i<NoOfCylinder*2;i++){ pValve[i].setSize(60,20); pValve[i].setType(2); if(!(i%2)&&i) C++; if(!(i%2)) Col=dcValve[C].getCol()-pValve[i].getWidth(); else Col=dcValve[C].getCol()+pValve[i].getWidth(); Row=dcValve[C].getRow()+dcValve[C].getHeight()+110; pValve[i].setLocation(Row,Col); if(!C) x1=dcValve[C].getCol()-25; else x1=dcValve[C].getCol()-104;

x2=x1; y1=dcValve[C].getRow()+dcValve[C].getHeight()/2; y1=dcValve[C].getRow()+dcValve[C].getHeight()/2; y2=pValve[i].getRow(); pValve[i].shiftCompressor(); pValve[i].Show(); tpCol=Col=pValve[i].getCol()-pValve[i].getWidth()+20; tValve[i].setSize(40,20); tValve[i].setLocation(Row+80,Col+20);

tValve[i].Show(); bValve[i].setType(0); bValve[i].setSize(40,20); if(!(i%2)) bValve[i].setLocation(Row+200,Col+tValve[i].getWidth()); else bValve[i].setLocation(Row+200,Col+tValve[i].getWidth()-20); bValve[i].shiftCompressor(); bValve[i].Show(); } Row=tValve[0].getRow()+tValve[0].getHeight()+50; Col=tValve[0].getCol()+20; StartButton.setType(1); StartButton.setSize(40,20); StartButton.setLocation(Row,Col); StartButton.Show(); DrawFixedLines(); DrawFirstSequence(); DrawSecondSequence(); DrawThirdSequence(); }

9.2 INPUT SCREEN

9.3 OUTPUT SCREEN

REFERENCES

[1] Fluid Power with applications by Anthony Esposito. [2] Programming in C++ by Balaguruswamy. [3] Programming in C++ by Yashwanth Kanithkar. [4] Industrial Hydraulic control by Peter Rohner.

WEBSITES

www.festo.com www.electropneumatics.com www.pneumaticsonline.com www.industrialhydrauliccontrol.com

También podría gustarte