{"id":202,"date":"2021-03-18T20:40:00","date_gmt":"2021-03-19T01:40:00","guid":{"rendered":"http:\/\/sycured.127.0.0.1.sslip.io\/?p=202"},"modified":"2024-01-13T20:39:21","modified_gmt":"2024-01-14T01:39:21","slug":"virtasant-technical-test","status":"publish","type":"post","link":"http:\/\/10.42.0.68:8080\/blog\/virtasant-technical-test","title":{"rendered":"VIRTASANT – Technical test"},"content":{"rendered":"\n

A long time ago, I needed to do this technical test.<\/p>\n\n\n\n

You’ll see my way to resolve it without reinventing the wheel.<\/p>\n\n\n\n\n\n\n\n

The subject<\/h2>\n\n\n\n

Imagine that you are building an electrical grid for a group of settlements on Mars. As with every grid, it has a central power switching station located in the biggest\/central settlement, and it has smaller settlements around it. Each smaller settlement has its power switching station, and they are all interconnected.<\/p>\n\n\n\n

Let’s say there are N<\/em><\/strong> settlements on Mars that are uniquely numbered between [1\u2026N]<\/em><\/strong> The central power switching station is represented with 1<\/strong>. The power between switching stations can be transferred in either direction and it is guaranteed that there will be exactly one path between two stations. This means that there will be N-1<\/em><\/strong> connections that will be used to connect the stations.<\/p>\n\n\n\n

As we know from physics, each station also has a power loss parameter measured in MartianWatt(MW)<\/em><\/strong> (number in red), which shows exactly how much power will be lost on every transfer.<\/p>\n\n\n\n

Electricity will be transferred between two power stations if the power loss is equal to what is projected by the engineers as we want to be sure that we have a precisely planned electrical grid. Otherwise, the power transfer operation cannot be initiated.<\/p>\n\n\n\n

The diagram above (top of the page) represents a sample martian electrical grid, and as we can see #1 node is the central power switching station.<\/p>\n\n\n\n

Examples of how we calculate power loss between stations:<\/p>\n\n\n\n