📜 ⬆️ ⬇️

Life before IoT or sketches by engineer ASCA

Something on hyktayms became few technical articles from independent non-news and not paid authors.

I will try to rectify this situation and tell about how the automated systems for commercial accounting of electricity (AMR) work and what they are built from. Or rather, how one of such systems was created in a single enterprise.


')
I advise you to treat the article as an engineer’s everyday sketches with elements of equipment reviews.

In 2011, I was brought to work in the North of our homeland, in the forests and swamps in one of the mining
companies. I won’t tell you how and why I got there, the name of the employer’s company and what was mined there at all, but it was then that I, a novice IT engineer, had to get into the field of automation of electricity metering in production.

What did I see at the very beginning?

On the table was a pot-bellied 17-inch “Flatron” and a Celeron 800 system unit with win xp + mssql and 1 gig of memory - it’s also a server, it’s also a client terminal for viewing and printing (for further faxing!) Information on power consumption.

7 smart electricity meters (5 pcs. Mercury-230 and 2 pcs. Euro-Alpha A1600), connected via MoxaNPort - LAN to RS485 to a separate network card, as well as a print-instruction for creating queries to the database for pulling out the necessary information.

The task that I was set for the first 3 months of the trial period:



The first steps.

At first I read, read a lot, crawled around specialized forums, delved into the concepts of AMR, RS-485, ModBus, understood the tricky structure of the base, formed by the electricity metering program.

At that time, a very useful blog was found, which gave most of the initial knowledge.

I also found a new version of the Mercury-230/234 electric meter configuration program.

What is ASKUE and how it works:



Electronic meters are used for electricity metering, each of them has its own microcontroller with a real-time clock, memory cells (48 cells per day for half-hour averaging of consumed power by 4 tariff zones for 90-180 days), measurement circuits and an external interface (CAN, RS-485, optoport, GSM modem, etc.).

The counter has a distinction between levels of data access within its memory.

The first level allows you to only read the readings and make adjustments to the built-in hours, but not more than 5 seconds during the day.

The second level makes it possible to change the date and time, the password of the first level, your password and most importantly, to set up all the internal accounting parameters (tariff schedules, the transformation ratio of the external current transformer, etc.).

As a result, at any time on request we can receive from the device:



All devices can give their accumulated data on request from the server.

The meters (on the RS-485 bus) are addressable from 1 to 254, as a rule, the address is 2-3 last digits of the serial number of the device, but it can be easily changed. Respectively, up to 253 devices with different addresses can be hung on one physical RS-485 port.

There are also two business addresses 0 and 255, they cannot be occupied.

There can be any number of RS-485 lines to which devices are connected.

The survey program is located on the data collection server. She opens the port to which the metering devices are connected and sets up to send a packet with a request, then pauses and receives a packet with an answer, and so on, until all the necessary readings are read or until a very long pause occurs and the survey is not interrupted. for the loss of communication.

The readings are immediately laid out in the database, according to the associated control channels (there are 5 channels for each metering device: active and reactive component of power consumption, active and reactive component generation, reference readings at the beginning of the month). There are two directions for accounting for each component capacity - due to the fact that the meters are able to count in both directions, that is, in theory - it is possible to sell excess electricity for them, but in my practice this has not been used. Although it was possible to fix the emissions of the generation of electricity during deceleration of AC electric motors.

As a result, for the day of work, we get this picture of the consumption of active power (this is one of the head meters, it counts how much electricity is consumed by the entire organization from one of the high-voltage lines with a voltage of 110 kilovolts). On this and all subsequent screenshots - the vertical axis in kilowatts.



The meter polling protocol resembles modbus, but is not it in its pure form.

At some point in time, I even had the desire to write my version of the C # polling program, because there is nothing difficult in implementing the protocol, but I didn’t have enough working time, and then the server software maker released an update that was less or less tolerably worked.

I do not specify a software manufacturer to advertise, I will only say that in addition to commercial products, there are free software versions for polling meters.

For those who want to dig deeper and write something yourself - a protocol description can be downloaded here .

In order to physically connect metering devices to the server, you need to use interface converters. In fact, we need the RS-485 bus on the system to be visible as a virtual COM port. You can use various versions of USB - RS-485 adapters, they are usually made on the basis of an FT232 chip or on analogs.



But this option is suitable for tests when there are very few meters or all of them are close enough to the server.

In my own situation, the meters were scattered throughout the organization, and some of them were problematic to reach at least some wire line.

As a result, for faster network deployment, it was decided to use MoxaNPort 5130 and MoxaNPort 5132. They allowed RS-485 to be connected to the organization's local network.




In the general local network of the company, after the upgrade, the ASCAE server itself was included.
WinXP was replaced with a Win2003 server, sql migrated along with the old database to sql 2008 (you can write a separate article about migration issues, so I’ll not touch upon this moment now).

The machine acquired a new dual-core iron with 4 gigabytes of RAM.

Brakes and memory overruns are gone, it became possible to launch a survey of ten or more ports at once.
And most importantly, the server was now accessible from anywhere in the local network, that is, it became possible to install the client software on any PC of the employee who is responsible for keeping track of energy consumption.

As a result, the concept of expanding the network of data collection began to look like this:

1) We break all points of the account on zones to which we can reach wire communication lines;
2) Find the point at which you can connect to the local network and at the same time closest to the main mass of metering devices of this zone. It is desirable that when laying the cable - there were as little as possible hinged spans between buildings. Next - pull the line through all the devices to Moxa, avoiding long branches away from the main line;
3) On the server, we register Moxa as a virtual com port and work in the data collection software through it.

When implementing point 2, as it turned out, at short distances and in industrial premises (warehouses, garages, repair shops) as a twisted pair for RS-485, the usual vole, which is P-274, shows itself very well.



The maximum length of the laid P-274 line was 500m and it still works (for 5 years already).
At the same time, voles are not afraid of mice and rats (or rather, they are not interested, because they are very hard and not tasty), thanks to durable insulation and steel veins - it has good self-bearing properties, that is, you can throw spans of 10-15 meters.

And the main advantage: the price - a penny, compared with a special cable.

Yes, the characteristic impedance is not that, yes - the form of the signal changes strongly towards the end of the line, but at short distances everything works fine.

Why were 2x port MoxaNPort 5132 used in places? Simply, at some sites it turned out that the lines to the devices went in different directions, and in order not to fence the wrapping of the line in the opposite direction - they were connected to different ports. It also increased the reliability of the system as a whole. If for some reason there was a short circuit on one of the ports, the second port continued to work.

Bike number 1 Pro wire ...


One of the metering points to which it was necessary to lay a wired communication line was in the garage room for BelAZov, for those who do not know, this is such a big hangar, 6-7 storey house high, inside there are no service floors from floor to roof and other reference sites.

But in the geometric center of the building - there is a 6000 / 380V power installation with operating currents up to 600A, and in the immediate vicinity of it (but not strictly above it, this is important) a crane drives along the ceiling, which can easily transfer the whole BelAZ from one point of the hangar to another.

Proper access to electrical installations is a high-voltage cable duct, but laying low-voltage RS-485 lines in it is strictly prohibited. Therefore, the “wrong” but safe path was chosen: From the junction box from the roof of the building, through the opening in the service window - vertically down to the electrical installation.
Moreover, the service telephone cable has already been stretched in the same way.

The plan of laying is coordinated, the crew is collected, we begin.
Alexey, one of the installers, on the eve of the evening vigorously celebrated some kind of holiday and was not able to
to work at height. He was left below to control cable descent to the designated point.

Then followed a long climb to the very top of the roof along fire escapes (do not forget about the tool and the cable bay). Then they marked and drilled a hole in the intended location, flashed a flashlight at it, so that Alexey, seven floors below, would assess the accuracy of the measurements and the correspondence of the hole location to the intended cable entry point.

We started cable descent, simultaneously discussing the process with the observer left below - by phone:

Me: Lech, see the cable?
Alexey: Not yet
Me: Did you see the hole when it was shining?
Alexey: Yes, I saw, probably the cable was blocked and it is not visible on the background of the roof.
I: Well, look, so as not to hurt anything, as you will see - let me know
Alexey: I see! I went down from the ceiling by 5-7 meters, let's
I: Take care not to touch the lamps and do not interfere with the crane
Alexey: All the rules, let's get more ...
...
Alexey: All the guys are enough, fasten your end and get down, I will start cutting the cable
I: All the rules? Long enough? Lamps are not wrapped? Crane will pass?
Aleksey: Yes, everything is ok. No.? $ Nno, let's go down already.

It took 10-15 minutes, we went down, we approached Alexei, who was laying on the electrical cabinets and fixing the cable, and we see the picture: The cable runs vertically down from the roof and passes neatly between the crane rails. That is exactly where the crane must pass.

I'm Alex! Raise your head! confuses nothing?
Alexey: The cable hangs, the lamps do not touch, the rail does not touch, right between ...
Alexey: Mlja ... Gre%; No. crane ... Is that how it is ...?

Naturally, the laying work had to be redone.

In general, there were a lot of similar moments, but this one was remembered especially strongly.

Thus, the network quickly grew and gave the first results.

I remember one morning. It was -30 outside, this temperature kept up all night. At the entrance to work I was greeted by a smiling girl (yes, at night girls and women remained on duty at the electricians) after a while - she said the phrase:

“It’s so good that this thing has worked, now you don’t have to run outside every hour and take supporting readings.”
At this moment, I will not lie - it was damn nice.

I will try to explain the reason for her joy. Previously, in the electrical installation on the street in a container - there were ordinary analog counters. On a certain night of the month (like every first Wednesday), it was necessary to take readings from them, exactly at 00:00, 01:00, 02:00 and 03:00 o'clock in the morning, in order to send it to the electricity supplying organization for reconciliation. And now, after the installation of “smart appliances” - this could be done in the morning, with one click of the mouse, from the warm room, since the necessary data was read around the clock automatically.

Bike number 2 About the first ZP


The first month of work was nearing its end, on the street damp northern September, I had already climbed all possible electrical installations in my creative search for a faster and cheaper way to connect to the network.
Stretched first cables. The work came out at a stable speed, every 2-3 days a new metering point is connected to the system (and this is all despite the fact that each connection case is unique, where you need to work out, coordinate and lay 100m of communication line along the cable shelves at a height 4 floors, where you need to get access to the premises of other services, passing 7 circles of hell bureaucracy and other paperwork).

By the end of the first month, what was already before me was stable, new reporting forms were pulling out the necessary information from the database, which could then be exported to excel and transferred where needed.
And so, I received the first salary at this place, as I remember: 9,600 rubles ... In a month ... In 2011 ...!

First thought: I got 4 times more on freelance, what the hell ...
Second thought: I’ll quit today ...

Then, of course, they explained to me that such a salary was for everyone in the first month: due to the lack of a premium, allowances and other nice buns. But then I wanted to quit, without explaining the reasons.

But, back to the network.

Slowly began to emerge miscalculations in the design and lack of experience in this area.
First in winter, for unknown reasons, several interface ports flew out on the counters, then with the arrival of spring and the beginning of the thunderstorm period - some more counters were silent for ever, leaving the server’s requests unanswered.

Here, probably, it is worth saying thanks to the manufacturer company - they made replacements under warranty, despite the cause of the malfunction, which is very nice when you need to repair a dozen instruments at once.

As a result, after another thunderstorm and subsequent repair, it became clear that protection against static electricity is needed for long lines.

Having studied everything that was then on sale, the choice fell on DTR 2/6/1500 SPD modules, again I write the name not for the sake of advertising, but with the goal of sharing a proven solution time and maybe saving someone time.



First, the protection was put on long street RS-485 lines, and then, after a single new burnout of counters did not occur in these directions for a year, it was added to all other wired lines.
Protection was installed from two sides of a long line in the immediate vicinity of the metering device on the one hand and in front of the moxa port on the other.

Do not forget that the protection device requires mandatory grounding.

In my memory, the protection modules burned out several times when the lightning was discharged near the communication line, but the moxa port and the meter ports remained intact. That is, even by self-sacrifice - she did her job.
In winter, from induced static in long lines - burnout protection and equipment no longer occurred.

It's a funny fact, but when you see hourly consumption, you start to think about saving energy.

Life example:

On one of the working days, the replacement of the line of lighting for the production road began.
Old lamps based on DRL-250 (250W with uniform burning and up to 500W at the time of start-up) were replaced with modern 40-90W LED.

This fact was immediately reflected in the electricity consumption of this line (the meter takes into account only the lighting line). According to our calculations, the new luminaires, at their rather high cost, paid for themselves with electricity alone in 3 years of operation.

Before replacement



After replacement



Of course, 40W lamps were inferior in brightness to old lamps, but 90W were quite comparable with them. Since the same number of those and others were purchased, the management simply ordered them to be hung up after one. So the overall level of illumination remains the same. In addition, in winter it became noticeably brighter, since the light from the LED lamps is re-reflected from the snow-covered surface.

When all the distribution and metering sites in the immediate vicinity of the local network were developed, it was decided to move to geographically distant sites. The closest one was located at 2.2 km, before it was the only communication line based on the TPPep 20x2x0.5 telephone cable, which had a free pair. We tried to skip RS-485 for this pair, but it worked extremely unstable. At a speed of 9600, the loss of packages reached 50%.

But besides this site there were objects in even less accessible places.

Began to consider the option of communication with the use of data transmission over power lines.
As it turned out, there are no inexpensive solutions that allowed transmitting telemetry data over power lines with a voltage of 6kV and more in Russia.

A single-phase 220V network is complete, a three-phase 380V network can be found, but for 6-10 kilovolts, so that 10-15km draws, but in the conditions of interference in the line from switching emissions of mining equipment - I'm sorry - no.

Then we looked in the direction of cellular communication.

Electric meters with built-in GSM modems were purchased, after they were brought in - one did not work right away. Something was hanging inside, it sounded like coins in a piggy bank.
Well, well, put those two that remained intact.

And then immediately there were 3 problems at once:

1) Technical support of our corporate account OPSOS did not know what data transfer through CSD. Accordingly, they also did not know how to turn it on on the SIM cards we chose. The redirection to qualified technical support engineers ended with a melody and the words of a female robot: “Your call is very important to us ...”. It’s good that later the guys from “Taiky №3” helped, but a lot of time was spent on this stage.
2) If you set up a survey via the CSD channel (default settings) and receive data every half hour, then at the end of the month you can receive a bill for communication services of 34 thousand rubles. Because, a minute CSD costs 1.5 p.
3) The modems built into the meters hang up with enviable regularity, they can only be rebooted by disconnecting the entire meter from electricity. No, we of course disconnected several times the 6kV line together with all consumers, just to reset the meter. Several times a brigade went to the installation site to reset the meter without disconnecting the high-voltage line, but the problem remained.

Bike number 3 About KAMAZ


On the territory of the organization several cell phone towers were installed. All of them were powered from our lines, so they fell under the control of the electricity metering system. One day, the energy engineers of one of the mobile operators arrived to install a GSM modem on their meter in order to take readings directly to their AMR.

My duties were to escort them to the site and resolve the situation with parallel connection to
two data acquisition systems. The guys were about my age, while the equipment was being installed - they talked, exchanged phone numbers in case of problems and their prompt elimination, after which they left.

Everything worked, there were no problems, a couple of times they called and asked why the power supply to the base station was lost, in general, everything went in the usual working way.

After 9 months of work, I went on vacation to another city.

On Sunday at 9 am, the phone rings:

Sergey (one of the guys who came): Dmitry, hello, did not wake up ?! You do not know if your KAMAZ is not in the city “N” (350 km from the place of work).
Me: Ah ... ah ... I don't know, I'm on vacation and just in the same city "N", but I can call to find out, but what happened?
Sergey: Yes, I can't leave the house here, KAMAZ across the road in the courtyard is thrown, I punched numbers in the traffic police - they said they registered with your organization ...
I: Now call the dispatcher, find out the number drove.

I call the dispatcher of motor transport:
I: Hello, this is Dmitriy Takoytovich, your engineer works in such a department. Here the situation is strange, I need the number of the driver of KAMAZ, who is now on a business trip in the city of "N".
Dispatcher: Hi. But we have all the drivers in place.
I: How so? An acquaintance called me, he said that our KAMAZ had blocked him from leaving the yard.
Dispatcher: For a second, I’ll clarify ...

... what are the conversations on high voices, noise in the background, screams ...

Dispatcher (almost screaming): WHERE IS KAMAZ? ADDRESS LET'S GO!
I: And what happened? Dictate the phone of a person, call him, he will tell you what and how ...

After 2-3 weeks, I went to work (yes, yes, the holidays in the north are large, by the end of the holidays, you even miss the work), went to the control room, where they told me a story:

Kamaz was hijacked while driving, had not declared, hoping they would find themselves, drove back to base by train. Then after my call I went to the city where they found the truck. They removed the radio tape recorder, the battery, stolen the instrument, and then threw it in the courtyards. It’s good that at the time of the hijacking the car was already without a load ...

By the way, the same colleague suggested that external modems are much more convenient, and besides, the bundle from “meter without modem” and “third-party external modem” is 2 times cheaper, than "counter with built-in modem."

Some objects were equipped with external iRZ MC52i-485GI modems, problem number 3 seems to have disappeared.
To reduce the communication time, we reconfigured the survey schedule, now the data was read 4 times a month. Yes, this is no longer operational information, but on the other hand, the cost of cellular communication has decreased to an acceptable 1.5 thousand rubles.



On the server side, GSM Teleofis RX101-R USB was used for the survey. According to him, there were no complaints in the work, the only thing is to immediately set up a watchdog timer in it to auto-reload when it hangs.



GSM is certainly good, but it is expensive for communication, and there are objects in the near zone (at a distance of up to 5 km) that require constant monitoring of power consumption. Here you need a survey at least once an hour and preferably without paying for the connection.

A little googling after reading reviews and descriptions - I decided at my own risk to order the Nevod-5 radio modems that operate on the unlicensed 433 MHz frequency band.

An order was issued for 2 modems and 2 standard whip antennas, the price tag was certainly not pleased, on the manufacturer’s website for some reason it was 2 times lower than it turned out in the end, but there was nowhere to go.



What attracted this modem:

1) It can work with different network topologies (star, retransmission, point-to-point), while passing traffic in transparent mode.
2) It can work as a repeater, thereby increasing the range of coverage by 2 times.
3) Fast delivery times, as local products.
4) Flexible configuration system (but it is also difficult for those who see this modem for the first time)

We collected a test link based on the object to which the telephone cable went (wrote about it above).

Base station: A modem in the attic of a 2-storey building, power supply, a pin antenna on the roof, cable to the antenna 10 meters from the modem RS-485 line which is connected to the MOXA NPort 5130.

Remote point: the modem is inside the iron container of the transformer substation, outside cable, antenna mounted on a piece of pipe with a length of 3 meters, that is, the height of the antenna above the ground is about 5 meters. There are industrial hangars and a forest between objects, the distance is 2.2 km in a straight line, but there is no visual line of sight.

During the year - not a single modem freezes, even in winter during frosts.

Now we are planning on the basis of the same modems to make data retransmission from the farthest corner of the territory, in a straight line somewhere 10-15 km. Intermediate repeaters will be fixed on the masts of industrial lighting (high metal towers), since there it is easiest to power them from the electrical grid + the antenna will be at a sufficient height so that the signal does not overlap with buildings in the enterprise.

Well, some interesting pictures lastly:

Here we can see that at 7:30 in the morning people came to work, turned on the lights and computers:



And here it is clearly shown how a low-power consumer periodically turns on in a street container with equipment (20 watts devices) and sometimes in the middle of the day include a light bulb (60 W incandescent lamp).



I hope that some readers have learned something new for themselves.

By the way, this year has been 5 years of working system. Already rarely get out of a technical malfunction, more and more often we encounter software glitches, a hanging database engine or client software. The main administration of the system occurs remotely, without going to the site.

I ask you not to consider the links to information sources and used equipment published in the article as advertising, since I only have a relationship with the manufacturers of the described hardware and software as a consumer.
He cited the full names, images and links only in order to share his experience, which I hope will save time when solving similar problems.

UPDNow I just remembered that the power supply units BP-2A and BP-1A
were used to power them. They are reliable and in their composition are quite oak transformer and rectifier (there is essentially nothing to break). They look like this:



True, it is better to use them only in rooms at temperatures from 0 and above. Although we worked on the street without any problems.

Source: https://habr.com/ru/post/397123/


All Articles