Sunday, 5 October 2014
Mes solution
Write a program to transfer the message “YES” serially at 9600 baud, 8-bit data, 1 stop bit. Do this continuously.
CJNE and JB
CJNE
|
|
Function:
|
Compare and Jump If Not Equal
|
Syntax:
|
CJNE operand1,operand2,reladdr
|
Instructions
|
OpCode
|
Bytes
|
Flags
|
CJNE A,#data,reladdr
|
0xB4
|
3
|
C
|
CJNE A,iram addr,reladdr
|
0xB5
|
3
|
C
|
CJNE @R0,#data,reladdr
|
0xB6
|
3
|
C
|
CJNE @R1,#data,reladdr
|
0xB7
|
3
|
C
|
CJNE R0,#data,reladdr
|
0xB8
|
3
|
C
|
CJNE R1,#data,reladdr
|
0xB9
|
3
|
C
|
CJNE R2,#data,reladdr
|
0xBA
|
3
|
C
|
CJNE R3,#data,reladdr
|
0xBB
|
3
|
C
|
CJNE R4,#data,reladdr
|
0xBC
|
3
|
C
|
CJNE R5,#data,reladdr
|
0xBD
|
3
|
C
|
CJNE R6,#data,reladdr
|
0xBE
|
3
|
C
|
CJNE R7,#data,reladdr
|
0xBF
|
3
|
C
|
JB
|
|
Function:
|
Jump if Bit Set
|
Syntax:
|
JB bit addr, reladdr
|
Instructions
|
OpCode
|
Bytes
|
Flags
|
JB bit addr,reladdr
|
0x20
|
3
|
None
|
i) Keep monitoring the P1.2 bit until it becomes high. ii) When P1.2 becomes high, write value 45H to port 0 and iii) Send a high-to-low(H-to-L) pulse to P2.
Saturday, 4 October 2014
Discuss the effect of roughness parameter on friction factor. [5 Marks]
-
In turbulent flow rough pipe leads to a larger friction factor than the smooth pipes for given Reynold’s number.
-
If a rough pipe is smooth, the friction factor is reduced and ultimately a stage will come when further smoothing of the pipe does not reduce the friction factor for given Reynold’s number, the pipe is said to be hydraulically smooth.
-
The height of a single unit of roughness is denoted by K and is called roughness parameter.
-
The relative roughness is the ratio of the roughness parameter to the diameter of pipe, i.e. K/D the dependency of friction factor on the surface roughness is given through relative roughness.
-
For larger values of Reynold’s number (NRe < 2100) the friction factor is independent of the surface roughness.<div>
For low values of Reynold’s number (NRe > 2500) the friction factor is also function of surface roughness.
At very large values of Reynold’s number, the friction factor is independent of NRe but is a function of surface roughness.
Describe the use of friction factor chart. [5 Marks]
-
It is a logarithmic plot of friction factor as a function of the Reynold’s number over a wide range of the Reynold’s number for a flow in smooth as well as rough pipes.
-
The data for the plot are variable such as velocity, density and pipe diameter, etc. using liquids and gases.
-
This chart is termed as friction factor chart, Reynold’s number correlation chart and Moody diagram.
-
The friction factor is a function of both the Reynold’s number and relative roughness.
-
For laminar flow region the friction factor is only the function of Reynold’s number therefore only one line is shown for Reynold’s number upto 2100.
-
For laminar flow region equition $ \f = {16}/{\N_{\R}} $ relates the friction factor to Reynold’s number and the above equation is the equation of straight line having slope minus one.
-
For turbulent flow the lowest line represents the friction factor for smooth tubes the move convenient empirical equation for this line is $ \f = 0.046\ \N_{\R}^{-0.2} $ . This applies over the Range of Reynold’s numbers from 50,000 to 1 × $ 10^6 $ , another equation applicable over range $ 3 \× 10^6 $ is $ \f = 0.0014 + {0.125}/{\N_{\R}^{0.32}} $ .
-
It is clear from the figure that the friction factor is low for smooth pipe as compared to rough pipe and increases as the relative roughness increases for given Reynold’s number.
Write short note on Power curve in mixing and agitation.
${\P}/{\N^3 \D\a^5 \ρ} = \f ({\ND\a^2 \ρ}/{\μ} , {\N^2\D_\a}/{\ρ})$ —(1) > >
where ${\P}/{\N^3 \d\a^5 \ρ}$ is the power number $(\N\P)$, —(2)
${\ND\a^2 \ρ}/{\μ}$ is the impeller Reynold’s number $(\N{\Re})$, —(3)
${\N^2\D\a}/{\ρ}$ is the Froude number $(\N{\Fr})$, —(4)
N = Rotational speed in revolution per second, $\D_\a$ = Diameter of impeller, ρ = Density of fluid,
and μ = Viscosity of fluid. When $\N_{\Re} > 10,000$, the flow in the vessel is turbulent and when $\N_{\Re} < 10$, the flow is laminar For $\N_{\Re}$ between 10 and 10,000 the flow is in a transition region in which the flow is turbulent at the impeller and laminar in remote parts of the vessel. Equation (1) is also written as : $\N_\P = \f(\N_{\Re}, \N_{\Fr})$ ---(5) The Froude number, $\N_{\Fr}$represents the influence of gravitation and effects the power consumption only when vortex is present. If the speed of impeller is increased, in unbaffled vessels, the centrifugal force acting in the liquid causes the free surface of the liquid to assume a paraboloid form by raising the liquid level at the wall and lowering the level at the shaft. This is called _vortex._ The vortex is avoided by use of baffles. For Reynold's number < 300, vortex may not be observed even for the unbaffled vessel. The Reynold's number accounts for viscous forces and in agitated vessels, as usually the case, the viscous forces are significant. Thus, equation (5) reduces to $\N_\P = \f (\N_{\Re})$ ---(6)
The power consumption is related to the density and the viscosity of the liquid, the rotational speed, and the impeller diameter by plotting power as a functional of Reynold’s number.
At lower Reynold’s number (laminar flow), the relationship between $\N\P$ and $\N{\Re}$ may be given as
$\N\P = {\C0}/{\N_{\Re}}$ —(7)
where $\C_0$ is a constant for a given impeller and given geometrical details.
Rearranging equation (7), we get
$\N\P . \N{\Re} = \C_0$ —(8)
Substituting the values of $\N\p$ and $\N{\Re}$ in equation (8), we get
$\P = \C0 \μ \D\a^3 \N^2$ —(9)
Equation (9) indicates that if the speed is doubled, power consumption will increase by a factor of four.
For higher values of $\N_{\Re}$, the Froude number plays an important part. In this case, power number is constant i.e.
$\N_\p = \Constant = \C’$ —(10)
$\P = \C’ \ρ \D_\a^5 \N^3$ —(11)
Equation (11) indicates that if the speed is doubled, the power consumption increases by factor of eight in the turbulent flow region.
Curve 1 : Curve blade turbine, 4 baffles each width of baffle $\D\T ⁄ 12, \D\T -$tank diameter.
Curve 2 : Open straight blade (six blade) turbine four baffles each $\D_\T ⁄12.$
Curve 3 : Pitched blade turbine, 4 baffles each $\D_\T ⁄ 12$.
Curve 4 : Propeller, four baffles each 0.1 $\D\T$. Pitch = $2 \D\a$.
Curve 5 : Propeller, four baffles each 0.1 $\D\T$. pitch = $\D\a$.
</div>
List out different types of values used in industries along with their functions. [10 Marks]
> * **Globe Valve : ** Refer figure below.
> > ![](https://itextbook-prod.s3.amazonaws.com/uploads/book_image/image/926/Question_6__a__2.png) > **
** > > **
** > * **Ball Valve : ** Refer figure below > ![](https://itextbook-prod.s3.amazonaws.com/uploads/book_image/image/927/Question_6__a__3.png) > **
** > >
> > 1. Ball valve is used for complete shut-off (on-off) service and operate through 90°. > > 2. The valve has a high degree of pressure recovery. > > 3. Valve size 1/8" to 48" with ends flanged screwed socket weld. > > 4. Pressure range upto 720 psi. Temperature range is 196° to 260° C. > > 5. Types : >
> >
> > 1. Needle valve is very similar to a globe valve except that it has a needle shaped disc. > > 2. This valve has a small opening which causes more pressure drop (than the globe value) but it is useful for correct flow regulation. > * **Butterfly Valve : ** Refer figure below. > ![](https://itextbook-prod.s3.amazonaws.com/uploads/book_image/image/1150/Question_5__a__4.png) >
> >
> > 1. Butterfly is a rotary-stem valve which operates on same principle as a damper in stove pipe. > > 2. The valve with all metal internals are widely used where leakage flow of about 1% of the maximum rating between disk and the body can be tolerated. > > 3. For tight shut-off service and elastometer linear are inserted in the body which are made of Buna N, Neopreme, Nordel and Viton. > > 4. Pressure range is upto 150 psi and temperature range upto 170 °C. > > 5. Size - 50 mm to 1200 mm. > > 6. Valve body is made of cast iron, steel, aluminium etc. > * **Check Valve or Non-Return Valve:** Refer figure below.
> > ![](https://itextbook-prod.s3.amazonaws.com/uploads/book_image/image/940/Question_6__a__6.png) >
>
> > 1. Check Valves are used to get unidirectional flow or they prevent reversal of flow. > > 2. These are normally used in horizontal pipes, so that at the time of start or closing of valve, the gravity force is maximum and it becomes minimum at time of closing. >
For a turbine agitator installed in a vertical tank speed is 1.5 rps. Diameter of tank is 1.8 m and the diameter of turbine is 0.6 m. The density of liquid is 1120 kg/m3 and viscosity is 120 Ns/m2. If the power Number is given by Np = 65/NRe. Calculate the power required for agitation.
</div>
>
Diameter of tank, DT = 1.8 m
>
> Speed, N = 1.55 rps
>
> Diameter of turbine agitator, Da = 0.6 m
>
> Density of liquid, ρ = 1120 kg/m3
>
> Viscosity of liquid, μ = 120 Ns/m2 = 120 kg/(m-s)
>
> ∴ Reynold’s number, Np = ${\D_a^2 \Nρ}/{μ} = {(0.6)^2 \× 1.5 \× 1120}/{120} = 5.04$
>
> Power number, Np = ${65}/{N_{Re}} = {65}/{5.04}$ = 12.9
>
> ∴ Power required, P = Np ρ N3 Da5 = 12.9 × 1120 × (1.5)3 × (0.6)5
>
> = 3791 watt = 3.79 kW
Write short note on Cavitation.
> > * The vapour pressure of a liquid may be defined as pressure at which the liquid will transform into vapour (liquid boils) at the given temperature and vapour pressure is function of temperature.
> > * Care should be taken that pressure at any point does not fall below the vapour pressure of liquid to be pumped.
> > * If pressure in the pumping system falls below vapour pressure of the liquid to be pumped, then some of the liquid flashes into vapour or if the liquid contains gases, they may come out of the solution resulting into gas pocket, that damage the impeller. This phenomena is known as _cavitation._
> > * Mechanical damage to the pumps occurs as bubble collapse.
> > * Considerable noise and vibration is produced.
> > * Decrease efficiency of pump. How to Minimize Cavitation ? > > > * By keeping the velocity of liquid in the suction pipe as minimum as possible. > > * Avoid sharp bends in the suction pipe, that will reduce loss of head. > > * The cavitation will not take place, if the total head vapour pressure of liquid is water then the absolute pressure head should not be below 2.5 m of water. > > * Cavitation resistant material or coatings such as aluminium, bronze, stainless steel should be used. >
What is NPSH for pumps ? Derive general expression for its calculation. Differentiate between NPSH and NPSHR.
What is NPSH for pumps ? Derive general expression for its calculation. Differentiate between NPSH and NPSHR. [10 Marks]
NPSH (Net Positive Suction Head)
>
> The term NPSH is very commonly used in pump industry. Actually minimum suction conditions are more specified in terms of NPSH. NPSH may be defined as the total head required to make the liquid flow through the suction pipe to the pump impeller, or it is the amount by which the absolute pressure available at the suction point is in excess or greater than vapour pressure of liquid at pumping temperature.
>
> Poor suction due to inadequate NPSH leads to physical erosion, damage to the impeller and this damage can become so severe as to completely destroy the impeller and create excessive clearances in the casing.
>
Expression for NPSH
For deriving the expression for NPSH, let us consider the pumping system shown in figure below.
>
Where $\Z\a$ and $\Z\b$ = Elevation of point A and B respectively, m$\h{\SL}$ and $\h{\DL}$ = Friction losses for suction and discharge side of pump respectively, kgf-m/kg
W = Weight density of liquid = ρg
NPSh = (Absolute pressure head available at suction point A’) - (Vapour pressure head)
∴ NPSH = $({\V’\a^2}/{2\g} + {\P’\a}/{\W}) - {\P_\v}/{\W}$ —(1)
where $\P_\v$ = Vapour pressure of liquid to be pumped.
Applying Bernoulli equation between point A and A’.
$\Z\a + {\V’\a^2}/{2\g} + {\P\a}/{\W} = \Z\a’ + {\V’\a^2}/{2\g} + {\P’\a}/{\W} + \h_{\LS}$
Assuming $\Z\a = 0$ and $\V\α = 0$
$({\P’\a}/{\W} + {\V’\a^2}/{2\g}) = {\P\a}/{\W} - \h{\LS} - \Z’_\a$
Substituting this value for the bracketed quantity in equation (1) we get
NPSH = ${\P’\a}/{\W} - {\P\v}/{\W} - \h{\LS} - \Z’\a = {\P’\a - \P\v}/{\W} - \h{\LS} - \Z’\a$
If pump center-line is below the point A, then
NPSH = ${\P’\a - \P\v}/{\W} - \h{\LS} - \Z’\a$ —(2)
Or equation (2) can also be written as,
NPSH = ${\P’\a - \P\v}/{\ρ\g} - \h{\LS} - \Z’\a$ —(3)
Or in terms of energy per unit mass
NPSH = ${\P’\a - \P\v}/{\ρ} - \h{\LS} - \gZ’\a$ —(4)
where $\h{\LS}$ is in J/klg and $\gZ’\a$ is in J/kg.
Note : If NPSH = 0, suction pressure equals the vapour pressure and cavitation occurs. Thus NPSH must be greater than zero and is usually 2 meters or more.
NPSHA and NPSHR
For any pump installation a distinction is made between required NPSH (NPSHR) and the available NPSH (NPSHA).
The value of NPSHR is given by the pump manufacturer and this value can also be determine experimentally.
For determining its value, the pump is tested and minimum value of suction head is obtained at which the pump gives maximum efficiency without any noise. (i.e. cavitation free.)
The NPSHR varies with pump design, speed of pump and capacity of the pump.
In order to have cavitation free operation of centrifugal pump, the NPSHA should be greater than the NPSHR.
Generally NPSHR must be greater than 2 meters or more.
Characteristics Curves of Centrifugal Pumps
Characteristics Curves of Centrifugal Pumps
>
> Characteristics curves of centrifugal pumps are defined as those curves which are plotted from the results of a tests on the centrifugal pumps and these curves are necessary to predict the behavior and performance of the pump when the pump is working under different flow rate, head and speed.
>
> Main Characteristics Curves
>
> (a) This curves consist of variation of head (manometric head, Hm), power and discharge with respect to speed.
>
> (b) For plotting curves of Hm v/s N, Q is kept constant. We know that $√{h_m}$/DN is a constant or Hm α N2, this means the head developed by a pump is proportional to N2, hence the curve of Hm v/s N is a parabolic curve as shown in figure below.
>
> (c) For plotting curves of Q v/s N, Hm is kept constant. We know that, Q/D3N is constant, hence Q α N, this means that the curve Q v/s N is a straight line.
>
>
>
>
>
(d) For plotting curves of P v/s N. Hm and Q are kept constant. We know that P/D5N3 is a constant, hence P α N3. This means that curves P v/s N is a cubic curve as shown in Figure above.
>
> Operating Characteristics Curves
<div>
>
>
>
>
<div>
> 1. If the speed is kept constant, the variation of manometric head, power and efficiency with respect to discharge gives the operating characteristics of the pump. above figure shows operating characteristic curves of a pump.
>
> 2. This input power curve for pumps shall not pass through the origin. It will be slightly away from the origin on the y-axis, as even at zero discharge some power is needed to overcome mechanical losses.
>
> 3. The head curve will have minimum value of head when discharge is zero.
>
> 4. The output power curve will start from origin as at Q = 0, output power (ρQgH) will be zero.
>
> 5. The efficiency curve will start from origin as at Q = 0, η = 0.
>
$(∵ \η = {\Output}/{\Input})$
</div>
Friday, 26 September 2014
Hashing in MySQL
Password Hashing in MySQL
Trigger
Summary: in this tutorial, we will give you a brief overview of SQL trigger, its advantages and disadvantages.
A SQL trigger is a set of SQL statements stored in the database catalog. A SQL trigger is executed or fired whenever an event associated with a table occurs e.g., insert, update or delete.
A SQL trigger is a special type of stored procedure. It is special because it is not called directly like a stored procedure. The main difference between a trigger and a stored procedure is that a trigger is called automatically when a data modification event is made against a table whereas a stored procedure must be called explicitly.
It is important to understand SQL trigger’s advantages and disadvantages so that you can use it appropriately. In the following sections, we will discuss about the advantages and disadvantages of using SQL triggers.
Advantages of using SQL triggers
SQL triggers provide an alternative way to check the integrity of data.
SQL triggers can catch errors in business logic in the database layer.
SQL triggers provide an alternative way to run scheduled tasks. By using SQL triggers, you don’t have to wait to run the scheduled tasks because the triggers are invoked automatically before or after a change is made to the data in tables.
SQL triggers are very useful to audit the changes of data in tables.
Disadvantages of using SQL triggers
SQL triggers only can provide an extended validation and they cannot replace all the validations. Some simple validations have to be done in the application layer. For example, you can validate user’s inputs in the client side by using JavaScript or in the server side using server side scripting languages such as JSP, PHP, ASP.NET, Perl, etc.
SQL triggers are invoked and executed invisibly from client-applications therefore it is difficult to figure out what happen in the database layer.
SQL triggers may increase the overhead of the database server.
CREATE TRIGGER
Syntax
CREATE [DEFINER = {user
| CURRENT_USER }] TRIGGERtrigger_name
trigger_time
trigger_event
ONtbl_name
FOR EACH ROWtrigger_stmt
DROP TRIGGER
Syntax
DROP TRIGGER [IF EXISTS] [schema_name
.]trigger_name
Example