Difference between class and instance variables in Python


Definition

Electric current is the directional movement of charged particles.
This is the definition from a physics textbook. In simple words it can be translated that its components always have some kind of direction. Actually, this direction is decisive in today's conversation. Alternating current (AC) differs from direct current (DC) in that the latter's electrons (charge carriers) always move in one direction. Accordingly, the difference between alternating current is that the direction of movement and its strength depend on time. For example, in a socket, the direction and magnitude of the voltage, respectively the current, changes according to a sinusoidal law with a frequency of 50 Hz (the polarity between the wires changes 50 times per second).

For electricians, so to speak, we will depict this on a graph, where the vertical axis shows polarity and voltage, and the horizontal axis shows time:

The red line shows a constant voltage; it remains unchanged over time, except that it changes when switching a powerful load or a short circuit. Green waves show sinusoidal current. You can see that it flows in one direction or the other, unlike direct current, where electrons always flow from minus to plus, and the direction of movement of the electric current is chosen to be from plus to minus.

To put it simply, the difference in these two examples is that the constant's plus and minus are always on the same wires. If we talk about alternating, then in power supply the concepts of phase and zero are used. If we look at it by analogy with a constant, then phase and zero are plus and minus, only the polarity changes 50 times per second (in the USA and a number of other countries 60 times per second, and in airplanes more than 400 times).

What is the current in the outlet - direct or alternating?

People who are more or less familiar with electrical engineering can easily answer the question of what current is in the outlet. Of course it's variable. This type of electricity is much easier to produce and transmit over long distances, and therefore the choice in favor of alternating current is obvious.

There are two types of current - direct and alternating. To understand the difference and determine whether the outlet has direct or alternating current, you should delve into some technical features. Alternating current has the property of changing in direction and magnitude. Direct current has stable qualities and direction of movement of charged particles.

Alternating current comes out of the power plant generators with a voltage of 220-440 thousand volts. When approaching an apartment building, the current is reduced to 12 thousand volts, and at the transformer station it is converted to 380 volts.

Advice

The voltage between phases is called linear. The low-voltage section of the step-down substation produces three phases and a zero (neutral) wire. Energy consumers are connected from one of the phases and the neutral wire.

Thus, single-phase alternating current with a voltage of 220 volts enters the building.

The distribution diagram of electricity between houses is presented below:

In the home, electricity is supplied to the meter, and then through automatic machines to the boxes of each room. The boxes contain wiring throughout the room for a couple of circuits - electrical outlets and lighting equipment.

The machines can be provided one for each room or one for each circuit.

Taking into account how many amperes the outlet is designed for, it can be included in a group or connected to a dedicated circuit breaker.

Alternating current accounts for approximately 90% of all electricity consumed. Such a high specific gravity is due to the peculiarities of this type of current - it can be transported over considerable distances by changing the voltage at substations to the required parameters.

Sources of direct current are most often batteries, galvanic cells, solar panels, thermocouples.

Direct current is widely used in local networks of automobile and air transport, in computer electrical circuits, automatic systems, radio and television equipment.

Direct current is used in contact networks of railway transport, as well as on ship installations.

The diagram below shows the fundamental differences between direct and alternating currents.

Home electrical network parameters

The main parameters of electricity are its voltage and frequency. The standard voltage for home electrical networks is 220 volts. The generally accepted frequency is 50 hertz. However, in the USA a different frequency value is used - 60 hertz. The frequency parameter is set by the generating equipment and is unchanged.

It will be interesting➡ The concept of hysteresis: features, applications in boilers

The voltage in the network of a particular house or apartment may be different from the nominal value (220 volts). This indicator is influenced by the technical condition of the equipment, network loads, and substation load. As a result, the voltage may deviate from the specified parameter in one direction or another by 20–25 volts.

Current load

All sockets have a certain marking, by which you can judge the permissible current load. For example, the designation "5A" indicates a maximum current of 5 amperes. Acceptable indicators must be observed, since otherwise the equipment may fail, including fire.

The markings on the sockets are shown in the figure below:

All legally sold electrical appliances are accompanied by a passport indicating the power consumption or current load rating.

The largest consumers of electricity are household appliances such as air conditioners, microwave ovens, washing machines, electric stoves and ovens.

For normal operation, such devices will need an outlet with a load of at least 16 amperes.

note

If the documentation for electrical household appliances does not contain information about the consumed amperes (current strength in the outlet), the required values ​​are determined using the electric power formula:

The power indicator is in the passport, the network voltage is known. To determine electricity consumption, you need to divide the power indicator (indicated only in watts) by the voltage value.

Origin

The difference between AC and DC lies in their origin. Direct current can be obtained from galvanic cells, such as batteries and accumulators.

It can also be obtained using a dynamo - this is an outdated name for a direct current generator. By the way, with their help, energy was generated for the first electrical networks. We talked about this in an article about the discoveries of Nikola Tesla, in notes about the war of ideas between Tesla and Edison. Later this was the name given to small generators used to power bicycle headlights.

Alternating current is also produced using generators, nowadays mostly three-phase.

Also, both voltages can be obtained using semiconductor converters and rectifiers. So you can rectify alternating current or get the same by converting direct current.

Three phase current

A three-phase system is an electrical circuit system operating on three circuits in which forces of the same frequency act, but are out of phase from each other by one-third of a period or 120 degrees. Each individual circuit of such a system is called a phase, and a system of three phase-shifted currents is called three-phase current.

You may be interested in Description and use of neodymium magnet

Almost all modern generators in homes and power plants are three-phase current generators. In fact, this is one large generator consisting of three small motors that generate currents, the electromotive forces in them are shifted relative to each other by 120 degrees or one third of the period.


Three-phase signal graph

Formulas for calculating alternating current

In calculations of alternating current circuits, the difference in formulas is due to the difference in the processes occurring in capacitors and inductances. Then the formula for Ohm's law will be for active resistance:

Here 1/wC and wL are the capacitive and inductive reactance, and w is the angular frequency, it is equal to 2piF.

For a circuit with capacitance and inductance:

wL-1/wC is the reactance and is denoted as Z.

The video below explains in more detail the difference between alternating current and direct current:

What is electric current

The movement of free carriers of electric charges in a vacuum or substance in a fixed direction is called electric current. Free carriers in metals are electrons, in liquids or gases they are ions. The name "current" has two interpretations. The first one denotes the very movement of the electric charge in the conductor, the second one – an estimate of the number of electrons passing through the conductor in 1 s. Its strength can be determined by Ohm's Law. The formula used for this is:

I=U/R,

where U is voltage, V; R – resistance, Ohm.

ru.natapa.org

Alternating current and direct current are two different forms of currents that are used to transmit electricity throughout the world. Both currents are the same because they use electron flows to transmit electricity, but that's where the similarities end. Alternating current is the most common type of electricity that is transmitted by power plants and is used to power buildings, offices, homes, etc.

Direct current (DC) was the predominant form of electricity used in the 19th century and was also used in the first commercial transmission of electricity by Thomas Edison. Direct current means that power flows in one direction. In direct current, the flow of electrons is in a constant direction, without changing at regular intervals, and is achieved by installing permanent magnets on the wire, which help the electrons stay on a steady path. Direct current was originally called "galvanic current". Direct currents flow in conductors such as wires, but can also pass through semiconductors, insulators, or even a vacuum. Direct currents can be generated using sources such as batteries, thermocouples and solar cells. The chemical energy inside the battery is powerful enough to push the electrons rather than pull them, causing the energy to flow in one direction.

Two-phase current

Two-phase current is when two currents of different directions are transmitted at once. The voltage parameter for a two-phase network is shifted in phase by an angle of 90 degrees. This current is transmitted by two conductors: two phase and two neutral. Used in AC electrical networks. To do this, use two circuits, the values ​​of which are shifted in phase by 90 degrees. Each circuit uses four lines - two for each phase. Sometimes one wire with a larger diameter than the other two is used. The advantage of two-phase networks was the smooth start of electric motors, but they were supplanted by three-phase ones.


Two-phase source

Alternating and direct current: what is the difference, history of development, application

Children are taught that they should not stick their fingers into electrical sockets! And why? Because it will be bad. There are often problems with a more detailed explanation: there is some kind of voltage, current, something is flowing somewhere. So that in the future you can explain to your children what’s what, we will now explain to you. This article is about alternating and direct currents, their differences, applications and the history of electricity in general. Science needs to be made interesting, and we modestly try to do this to the best of our ability.

Advantages of DC

What qualities make direct current irreplaceable? The advantages include:

  • there is no reactive power in the circuits, which leads to losses;
  • There is no need to synchronize generators running in parallel;
  • increased range of energy transmission in large volumes;
  • safety for humans in contact with live conductors.

Added to the advantages is that electricity, such as direct current, flows across the entire cross-section of the conductor, so power losses are minimal.


Charge density over the cross section of the conductor

A Brief History of Electricity

Who invented electricity? And no one! People gradually understood what it was and how to use it.

It all started in the 7th century BC, on one sunny (or maybe rainy, who knows) day. Then the Greek philosopher Thales noticed that if you rub amber on wool, it will attract light objects.

Then there were Alexander the Great, wars, Christianity, the fall of the Roman Empire, wars, the fall of Byzantium, wars, the Middle Ages, the Crusades, epidemics, the Inquisition and more wars. As you understand, people had no time for any electricity or ebonite sticks rubbed with wool.

In what year was the word “electricity” invented? In 1600, the English naturalist William Gilbert decided to write the work “On the Magnet, Magnetic Bodies and the Great Magnet - the Earth.” “electricity” appeared .

One hundred and fifty years later, in 1747, Benjamin Franklin, whom we all love very much, created the first theory of electricity. He viewed this phenomenon as a fluid or immaterial liquid.

It was Franklin who introduced the concept of positive and negative charges (before that, glass and resin electricity were separated), invented the lightning rod and proved that lightning is electrical in nature.

Everyone loves Benjamin, because his portrait is on every hundred dollar bill. In addition to his work in the exact sciences, he was a prominent political figure. But contrary to popular belief, Franklin was not the President of the United States.

Next will be a list of discoveries important for the history of electricity.

1785 - Coulomb finds out with what force opposite charges attract and like charges repel.

1791 - Luigi Galvani accidentally noticed that the legs of a dead frog contracted under the influence of electricity.

The operating principle of the battery is based on galvanic cells. But who created the first galvanic cell? Based on Galvani's discovery, another Italian physicist Alessandro Volta created the Volta column in 1800, the prototype of the modern battery.

At excavations near Baghdad, they found a battery more than two thousand years old. What ancient iPhone was recharged with its help remains a mystery. But we know for sure that the battery has already run out. This case seems to say: maybe people knew about electricity much earlier, but then something went wrong.

Already in the 19th century, Oersted, Ampere, Ohm, Thomson and Maxwell made a real revolution. Electromagnetism was discovered, induced emf, electrical and magnetic phenomena were linked into a single system and described by fundamental equations.

By the way! If you don’t have time to deal with all this yourself, our readers are now offering a 10% discount on any type of work

The 20th century brought quantum electrodynamics and the theory of weak interactions, as well as electric cars and ubiquitous power lines. By the way, the famous Tesla electric car runs on direct current.

Of course, this is a very brief history of electricity, and we have not mentioned very many names that influenced progress in this field. Otherwise, a whole multi-volume reference book would have to be written.

Current as flow

Current is the flow rate of electrons, indicating how many electrons are moving through the cable. The higher it is, the more electrons pass through the conductor. Just as large amounts of water require thicker pipes, large currents require thicker cables.

Using the water circuit model allows you to explain many other terms. For example, power generators can be thought of as water pumps, and electrical loads can be thought of as water mills that require water flow and pressure to rotate. Even electronic diodes can be thought of as water valves that only allow water to flow in one direction.

Alternating current

Alternating current is a current that changes magnitude and direction. Moreover, it changes at equal intervals.

Alternating current is used in industry and power supply. This is what is received at stations and sent to consumers. Already on site, the conversion of alternating electric current into direct current occurs with the help of inverters.

Alternating current – ​​alternating current (AC). Direct current – ​​direct current (DC). The abbreviation AC/DC can be seen on the transformer boxes where the conversion takes place. It's also the name of a great Australian rock band.

And here is a visual representation of alternating current.


Alternating current

Alternating current flows in a circuit in two directions: back and forth. One of them is considered positive , and the second is considered negative .

Since the magnitude of the current changes not only in direction, but also in magnitude, do not think that there is always 220 volts in your outlet. 220 is the effective voltage value, which occurs 50 times per second. By the way, in America they use a different standard for alternating current in the network: 110 Volts and 60 Hertz.

Disadvantages of DC

In addition to the fact that sources of this type of current have a complex design, they are more difficult to operate. With an efficiency of 94%, the maximum power of these machines is no higher than 20 MW. There are also other disadvantages:

  • complex circuits are used to increase or decrease voltage;
  • motors designed to consume such electricity are also structurally complex and expensive;
  • decoupling low and high voltage requires complex solutions.

It is not possible to completely abandon such sources and consumers, since they are in demand and have their own advantages.

War of Currents

Active use of direct current began at the end of the 19th century. Then Edison perfected the light bulb (1890) and founded the first power plants in New York that produced 110 volt direct current.

The use of direct current was associated with significant losses when transmitting it over long distances. Alternating current could not be used due to the lack of adequate meters and motors that operated on alternating current. The process of converting direct current into alternating current was also difficult. At the same time, alternating current could be transmitted over long distances without loss.

At that time, Nikola Tesla came to America from Serbia and got a job at Edison’s company. Tesla invented the alternating current electric motor, realized all the benefits and suggested its use to Edison.


Tesla and Edison

Edison did not listen to Tesla and also did not pay him his salary. Thus began the famous confrontation between inventors - the war of currents.

It lasted more than a hundred years and ended in 2007. Then New York completely switched to alternating current electricity.

Technical and economic problems of switching to direct current

Although high-voltage DC transmission is now a proven and accepted technology, there are still a number of technical and economic questions, including about low-voltage networks, that need to be answered:

  • Will DC be able to replace AC in a wide range of applications?
  • Will both technologies continue to exist alongside each other?
  • What might such coexistence look like?
  • What technical and economic obstacles need to be overcome?
  • What security measures will be necessary and effective at the same time?
  • What changes would a switch to DC require in the grid and how would this impact consumers?

The benefits of this “switch” are so significant that there can be no doubt that a paradigm shift is approaching. With significant experience in the development of connection technologies, LAPP immediately takes a leading position here.

The company is an associated partner in the DC-INDUSTRIE project, part of the 6th Energy Research Program of the German Federal Ministry for Economic Affairs and Energy (BMWi). The DC-INDUSTRIE research project addresses the question of how DC grids with central conversion can be created as an energy-saving alternative, especially in the operation of equipment on production lines, and how to make better use of renewable energy sources.

Why is alternating current more dangerous than direct current?

In the war of currents, in order not to suffer losses and financial collapse from the introduction and use of Tesla's ideas, Edison publicly demonstrated how alternating current kills animals. The case where an American citizen died from an alternating current shock was very detailed and widely covered in the press.

For humans, alternating current is, in general, actually more dangerous than direct current. Although you always need to take into account the magnitude of the current, its frequency, voltage, and the resistance of the person being shocked. Let's consider these nuances:

  1. Alternating current with a frequency of 50 Hertz is three to four times more dangerous to life than direct current. If the frequency of the current is more than 1000 Hertz, then it is considered less dangerous.
  2. At voltages of about 400-600 Volts, alternating and direct currents are considered equally dangerous. At voltages greater than 600 volts, direct current is more dangerous.
  3. Alternating current, due to its nature and frequency, excites the nerves more strongly, stimulating the muscles and heart. That is why it poses a great danger to life.

Whatever current you work with, be careful and vigilant! Take care of yourself and your nerves, and also remember: a professional student service with the best experts will help you do this effectively.

{SOURCE}

Understanding Class Variables

Class variables are declared within a class construct. Since variables belong to the class itself, they are shared by all instances of the class. Therefore, they will usually have an equivalent value for each instance unless we use a class variable to initialize the variable.

Class variables are defined outside all methods by convention, classically placed right below the header class and before the constructor method and other functions.

Let's look at the following class variable syntax.

Syntax:

# defining the class class Class_name: # declaring the variable in the class var = "xyz"

The variable "var" is assigned the value "xyz" in the above code snippet.

We can define a class object Class_name (let's call it "myObj") and print out the variable using dot notation.

Syntax:

# defining the class class Class_name: # declaring the variable in the class var = “xyz” # instantiating the class myObj = Class_name()

Let's look at the following example based on the concept of a class variable.

Example:

# defining a class class Animal: # declaring the class variable Terrestrial = "Lion" # instantiating the class my_Animal = Animal() # printing the values ​​print("Name of the Animal:", my_Animal.Terrestrial)

Exit:

Name of the Animal: Lion

Explanation:

In the above code snippet, we have defined a class as "Animal" and declared a class variable. We then instantiated the class with the my_Animal object and printed the final value to users. As a result, the program returns the value of the class variable.

Let's try adding some class variables to a class and printing their values.

Example:

# defining a class class Animal: # declaring some class variables Terrestrial = "Lion" Location = "Jungle" Type = "Carnivore" Population = 20000 # instantiating the class my_Animal = Animal() # printing the values ​​print("Name of the Animal" :", my_Animal.Terrestrial) print("This Animal is found in:", my_Animal.Location) print("This Animal is a:", my_Animal.Type) print("Population of this Animal:", my_Animal.Population, "approx.")

Exit:

Name of the Animal: Lion This Animal is found in: Jungle This Animal is a: Carnivore Population of this Animal: 20000 approx.

Explanation:

In the above code snippet, we have defined a class and declared some variables for it. We then instantiated the class and printed the required output to the users. We can notice that these class variables can contain any data type available to us in Python. Just like in the above program, we have strings and an integer.

Moreover, we can also notice that the myAnimal object is available to all the variables in the class and print them out when we execute the program.

Class variables allow us to define variables when constructing a class. These variables and their corresponding values ​​are then made available to each object of the class.

Rating
( 2 ratings, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]