Friday, April 30, 2021

Truths and Myths About C++

 

v 

Bansilal Ramnath Agarwal Charitable Trust's

Vishwakarma Institute of Technology

(An Autonomous Institute affiliated to Savitribai Phule Pune University)

Vishwakarma Institute of Technology, 666, Upper Indiranagar, Bibwewadi , Pune, Maharashtra, INDIA - 411 037.

Contact No. +91 - 20 - 2428 3001


INTRODUCTION

C++ is a general-purpose programing language created by Bjarne Stroustrup in 1985 as an extension of C programing language or the C with Classes. The language has expanded significantly over time, and modern C++ now has object oriented, generic, and functional features in addition to facilities for low level memory manipulation as a compiled language and many vendors provide C++ compliers.

The most important facilities that C++ adds on to C are classes, inheritance, function overloading and operator overloading. These features enable creating of abstract data types, inherit properties from existing data types and support polymorphism.

In 1979, Bjarne stroustrup a Danish computer scientist and the inventor of C++ began work on “C with Classes” in 1979. In 1982, he started to develop a successor to C with Classes, which he named C++. In 1985, The first edition of the C++ programming Language. The second edition of the C++ was released in 1989. The C++ programming language was initially standardized in 1998 by The International Organization for standards (ISO). The current C++20 standards supersede with new features and an enlarged standard library.

Although there are few truths and myths in this world about the C++ programming language. These we are going to explain here:

1.        To understand C++, you must first learn C

No. Learning basic programming using C++ is far easier than with C. C is almost a subset of C++, but it is not the best subset to learn first because C lacks the notational support, the type safety, and the easier-to-use standard library offered by C++ to simplify simple tasks.Naturally, in a real program, not all arguments will be literal strings. The C version requires explicit manipulation of characters and explicit memory management:

char* compose(const char* name, const char* domain)

 {

char* res = malloc(strlen(name)+strlen(domain)+2); // space for strings, '@', and 0

char* p = strcpy(res,name);

p += strlen(name);

 *p = '@';

strcpy(p+1,domain);

return res;

}

 

 

It can be used like this

char* addr = compose("gre","research.att.com");

 // …

 free(addr); // release memory when done

Which version would you rather teach? Which version is easier to use? Did I really get the C version right? Are you sure? Why? Finally, which compose() is likely to be the most efficient? Yes, the C++ version, because it does not have to count the argument characters and does not use the free store (dynamic memory) for short argument string.

C++ is an Object-Oriented Language

No. C++ supports OOP and other programming styles, but is deliberately not limited to any narrow view of “Object Oriented.” It supports a synthesis of programming techniques including object-oriented and generic programming. More often than not, the best solution to a problem involves more than one style (“paradigm”). By “best,” I mean shortest, most comprehensible, most efficient, most maintainable, etc. The “C++ is an OOPL” myth leads people to consider C++ unnecessary (when compared to C) unless you need large class hierarchies with many virtual (run-time polymorphic) functions – and for many people and for many problems, such use is inappropriate. Believing this myth leads others to condemn C++ for not being purely OO; after all, if you equate “good” and “object-oriented,” C++ obviously contains much that is not OO and must therefore be deemed “not good.” In either case, this myth provides a good excuse for not learning C++

For reliable software, you need Garbage Collection

Garbage collection does a good, but not perfect, job at reclaiming unused memory. It is not a panacea. Memory can be retained indirectly and many resources are not plain memory. Consider:

class Filter

{

// take input from file iname and produce output on file on name

public:

Filter(const string&iname, const string&oname); // constructor

 ~Filter(); // destructor

 // …

private:

ifstream is;

ofstreamos;

// …

 };

This Filter’s constructor opens two files. That done, the Filter performs some task on input from its input file producing output on its output file. The task could be hardwired into Filter, supplied as a lambda, or provided as a function that could be provided by a derived class overriding a virtual function. Those details are not important in a discussion of resource management. We can create Filters like this:

void user()

 {

 Filter flt {“books”,”authors”};

Filter* p = new Filter{“novels”,”favorites”};

// use flt and *p

delete p;

}

 From a resource management point of view, the problem here is how to guarantee that the files are closed and the resources associated with the two streams are properly reclaimed for potential re-use.

For efficiency, you must write low-level code

Many people seem to believe that efficient code must be low level. Some even seem to believe that lowlevel code is inherently efficient (“If it’s that ugly, it must be fast! Someone must have spent a lot of time and ingenuity to write that!”). You can, of course, write efficient code using low-level facilities only, and some code has to be low-level to deal directly with machine resources. However, do measure to see if your efforts were worthwhile; modern C++ compilers are very effective and modern machine 12Stroustrup Myths December 2014 architectures are very tricky. If needed, such low-level code is typically best hidden behind an interface designed to allow more convenient use. Often, hiding the low-level code behind a higher-level interface also enables better optimizations (e.g., by insulating the low-level code from “insane” uses). Where efficiency matters, first try to achieve it by expressing the desired solution at a high level, don’t dash for bits and pointers.

 C++ is for large, complicated, programs only

C++ is a big language. The size of its definition is very similar to those of C# and Java. But that does not imply that you have to know every detail to use it or use every feature directly in every program.In any language, writing a program using only the built-in language features (such as if, for, and +) is quite tedious. Conversely, given suitable libraries (such as graphics, route planning, and database) just about any task can be accomplished with a reasonable amount of effort.

C++ is a compiled language designed with the primary aim of delivering good, maintainable code where performance and reliability matters (e.g., infrastructure [10]). It is not meant to directly compete with interpreted or minimally-compiled “scripting” languages for really tiny programs. Indeed, such languages (e.g. JavaScript) – and others (e.g., Java) – are often implemented in C++. However, there are many useful C++ programs that are just a few dozen or a few hundred lines long.





Home Assignment Activity By - 

SY ME A_ Batch - 3_Group - 5

85 - Ahire Mrunal Keshav

86 - Mathpati Vaishnavi Vikas

87 - Sonawane Pushkar Mukesh

88 - Jagtap Sanket Rajendra

89 - Chavan Sanskruti Suresh


Guided By : 

Prof. R. S. Patil



Thursday, April 29, 2021

Differential gearbox

 

Bansilal Ramnath Agarwal Charitable Trust's

Vishwakarma Institute of Technology

(An Autonomous Institute affiliated to Savitribai Phule Pune University)

Vishwakarma Institute of Technology, 666, Upper Indiranagar, Bibwewadi , Pune, Maharashtra, INDIA - 411 037.

Contact No. +91 - 20 - 2428 3001




Introduction : 

Simply put, a differential is a system that transmits an engine’s torque to the wheels. The differential takes the power from the engine and splits it, allowing the wheels to spin at different speeds. At the point you might be asking, why would I want the wheels to spin at different speeds from each other? If you’re a petrol head, it’s probably painfully obvious. Then again, if you’re a petrol head then you wouldn’t be reading an article explaining how a differential works.

Principle of differential

When a car is taking turn, one rear wheel turns more rapidly than the other wheel. Planet gears in the differential, turns on its shaft and allow outer wheel to rotate faster than inner wheel. But when both the rear wheels are at same speed, the planet gears do not rotate on the shaft and both the wheels rotate with the same speed.

Need of differential

When a vehicle travels in straight line, the two rear wheels turn on road exactly at the same speed and there is no relative movement between the two rear wheels.

                  But when vehicle takes a turn the outer wheel travels on a longer radius than another wheel. The outer wheel turns faster than another wheel i.e. there is relative movement between two rear wheels. If two rear wheels are rigidly fixed to a real axle, the inner wheel will slip, which will cause rapid tyre wear, steering difficulties and poor road holding. therefore, there must be some device which will divide the input torque of transmission system between the two rear axles. The differential serves this purpose.

 

Functions of differential

1.It splits the power that received and sends the same through the two half axle shaft to the driving wheels.

2. It allows the two wheels to turn by the same amount when vehicle goes straight path.

3. It allows the driving wheels to turn by different amount when vehicle goes on curved path and delivers same power to both the wheels.

4. The speed difference between the two wheels became possible because the two half axle shaft are not directly coupled to the crown wheel but are drive-through bevel pinion and side gears. This gear system constitute a differential.

5. It transmit the torque from the propeller shaft to the half axle shaft.

6. It provide permanent speed reduction and also turn the drive round through 90°. The production provided is about 4 : 1 in the car and tennis 10 : 1 in heavy vehicle. This is done either in one or two steps. For less reduction up to about 7 : 1 single reduction is useful stop for higher production is achieved in two step.

 

 

Construction and working of differential

A) Construction of differential

A differential consists of crown wheel (ring gear), two type of bevel gear cage and spider or cross arm.

The road wheels are driven by two half axle shaft.

The side gear (planet gear) on the inner ends of each the half axle shaft.

The sun bevel gear and planet bevel gear are mesh with each other at right angle. The side gears are freely mounted on the spider or cross arm. The cage together with the bevel pinions is secured in the differential cage is bolted to the crown wheel of the final drive.

 

B) operation

The pinion, driven by the propeller shaft, rotates the crown wheel. Since the differential cage is attached to the crown wheel it also rotate, when the cage rotate, the bevel pinion and the cross arm which carries them moves around the circle with the differential cage.

                                      When the vehicle is driving on a straight level road, both the driving meet the same rolling resistance. Hence, the load on the planetary gear which mesh with the gear on one half axle shaft side gear will be same as those on the teeth that mesh with the other side gear. As such, the two bevel pinion do not rotate on the arms of the cross. In this case all the gear will tends to turn as a single unit without any relative motion between them. So the whole unit rotate as a same speed as the crown wheel.

 

Differential action

When the vehicle takes a turn on curved surface. The inner wheel makes higher resistance than the outer wheel and hence its rotation is slowed down. The resistance at the inner wheel (which is near to the centre of curvature) is more because of these wheels are required to do the same amount of work in shorter distance which they travels.

                         Now the tooth load became unequal. Because of this the bevel pinions tends to turn on there spindles. This turn causes the bevel pinion roll around the planet gear on the one of the two half axle shaft. Due to this action more turning of the outer side gear than inner side gear thereby accelerates the same until equilibrium is restored.

                      Thus outer side gear shaft turn more rapidly than the inner wheel shaft. So outer wheel has to travel distance as compared to inner wheel during the same interval of time. Due to differential action, the left wheel rotates back at n  rpm and right wheel will rotate forward at N rpm as the outer wheel has to cover more distance than inner wheel. Thus resultant speed of right wheel will be (N + n) rpm and left wheel will rotate at (N - n).


Types of gears used in differential

Different types of gears used in differential are:

1 Straight bevel gears

2 Spiral bevel gears

3 Hypoid gears

1) Straight bevel gear :

Straight bevel gears have straight teeth. In this type of drive, load is transferred from one pair of teeth to next pair of teeth. Then main advantage of this gear is its simplicity and cheapest in cost as compared to other type of gears. The disadvantage is that, it is noisy and has high wear.

2) Spiral bevel gears :

In spiral bevel gears, teeth are curved and at a time more than one pair of teeth come in contact having gradual transmission of power. Spiral bevel gears are quieter in running and stronger than straight bevel gears.

3 Hypoid gears :

Hypoid gears are similar to that of spiral bevel gears but the profile provided on gear is hyperboloid. The hypoid gear permits the lower position of propeller shaft reducing ground clearance. The type of gear is expensive, difficult to manufacture and requires high-pressure lubricant.


Home Assignment Activity By - 

SY ME A_ Batch - 3_Group - 5

85 - Ahire Mrunal Keshav

86 - Mathpati Vaishnavi Vikas

87 - Sonawane Pushkar Mukesh

88 - Jagtap Sanket Rajendra

89 - Chavan Sanskruti Suresh


Guided By : 

Prof. Dr. U. S. Chavan

                                                                


 

 

 

Mechanical Vibration

  Introduction      Mechanical vibration is the motion of a particle or body which oscillates about a position of equilibrium. Most vibrat...