Posts

The Importance of Unit Testing

In March, VIA’s Ashley DaSilva, Team Leader, Product Development, was invited to lead a workshop on unit testing for McGill’s Computer Science Graduate Society. The workshop was part of their seminar series: CS Tools and Tricks, which introduces graduate students to topics they may not otherwise explore in depth in their academic programs. Ashley discussed the critical importance of software testing, why developers should embrace unit testing, and when and how to use mocking. She shares her experience with unit testing and a recap of her workshop below.

Learning Never Goes Out of Style

I first learned the importance of software testing in the early days of my theoretical physics Phd program. Back then, most of my coding was limited to scripting. I wrote scripts to model physical systems, analyze data, and visualize results. Over time, I started writing modules to be reused by myself or my colleagues for different projects. The first time I attempted to refactor one of these modules, it broke in unexpected ways, and I spent days tracking down and resolving all the issues.

I’ve grown significantly as a developer since those days, and now lead a product development team at VIA, focused specifically on the Trusted Analytics Chain™ (TAC™). Every day, my team and I build, test, and deploy Docker containers with microservices. This includes Airflow and RabbitMQ for scheduling tasks, Redis as a cache storage, and BigchainDB to host a blockchain. Software testing is critical to each stage of product development, and something we constantly work to improve.

Unit testing is the foundation of VIA’s software testing process, and an essential skill for all of our developers. For example, TAC™ contains several components that all need to communicate with each other. We maintain a list of python scripts that are authorized to run on the system. Components of TAC™ must download this list to verify the checksum of the scripts. If we did not use mocking for the content of the list in the unit tests of these verification functions, then every time the list was updated, the tests would all have to be updated to account for the change. With mocking, we are free to update the list of scripts without affecting the status of the unit tests.

Ready, Set, Resilience!

Clean Architectures in Python by Leonardo Giordani is a great resource for learning more about unit testing and test-driven development. During my workshop at McGill, I presented examples of unit testing and mocking and shared a few exercises for the students to practice on their own. Some of these exercises came from the github repository associated with Giordani’s book. I’ve included some other examples below:

First, let’s look at a snippet of code. The code below shows a DataAnalyzer class. It has a method, get_data, which is a placeholder for however one would want to retrieve the data from an external resource (e.g., a database or an http request). It also has a method,
analyze_data which performs the sum of the items in a list:

   class DataAnalyzer:
       def get_data(self):
           # Gets data from an external resource
           pass
       def analyze_data(self):
           data = self.get_data()
           result = sum(data)
           return result

The code below shows one example of a unit test that uses mocking of the get_data method:

   from unittest import mock
   from calc.analyzer import DataAnalyzer
   def test_analyzer():
       analyzer = DataAnalyzer()
       with mock.patch("calc.analyzer.DataAnalyzer.get_data", return_value=[1.0, 2.1, 3.5]):
           result = analyzer.analyze_data()
       assert result == 6.6

In this example, the unittest.mock.patch will be applied to the method specified as its first argument and return the assigned return value every time that method is called from inside the scope of the patch. A sample list is assigned to the return value of the patch of the get_data method. This list should have the same format as the expected output of the get_data method, which in this case is a list of floating point numbers. Finally, the result of the analyze_data method is checked that it matches the expected value.

Mocking can also be used to check how you handle exceptions:

   import pytest
   from unittest import mock
   from calc.analyzer import DataAnalyzer
   def test_analyzer_connection_error():
       analyzer = DataAnalyzer()
       with mock.patch("calc.analyzer.DataAnalyzer.get_data", side_effect=ConnectionError("Could not connect.")):
           with pytest.raises(ConnectionError):
               analyzer.analyze_data()

In this example, instead of specifying a return value, there is a side effect. When the specified method is called, the side effect will be executed. In this case, a ConnectionError is raised by the get_data method. Using a side effect is particularly applicable when you have logic in your code that catches and recovers from errors.

Stay Curious

I enjoyed leading a thoughtful discussion on unit testing, and fielded some great questions from the students. One that stood out to me was:

“How can developers make sure that their mocks don’t get out of date?”

This is a really important and sometimes tricky topic! At VIA, we know that unit testing is only the first step of software testing. We also use other types of tests, like integration tests or end-to-end tests help identify problems in mocking before our software reaches users. And isolating and resolving problems at that stage is key to setting ourselves up for a successful integration. 

Mocking allows the freedom to isolate one particular part of your code and focus your unit tests on that functionality. Ideally, the expected inputs and outputs of the component being mocked are not going to change. This is typically true for external modules that you will use, at least within a particular major release of the software. However, if you know a software update will cause a change to your internal code base, it is your responsibility to recognize and communicate how that will affect your teammates. That’s why VIA believes that, in addition to testing, strong team communication and values like Learning Never Goes out of Style, Ready, Set, Resilience!, and Stay Curious are what help us develop and deliver the best iterations of our software to our users. 

VIA’s Joe Babiec Attends DistribuTECH Conference & Exhibition in New Orleans

Earlier this month, VP, Strategic Initiatives, Joe Babiec attended DistribuTECH, the utility industry’s leading conference on electric power transmission and distribution. Hosted in New Orleans, the event featured speakers from Exelon, FERC, and Siemens, among others, and welcomed more than 12,000 attendees over two days.  

“Speakers like Paul Hinnenkamp of Entergy, and many vendors emphasized the importance of customer and operational data. A major theme of the conference was the value of gathering and analyzing this data in order to improve current operating efficiency and create new services. I spoke with representatives from a number of utilities about this issue, and I was delighted they felt that VIA’s TAC™ application offers a great solution to the difficult challenge of making customer and operational data more easily available for analysis,” remarked Joe.  

For more information on the event, please visit DistribuTECH’s website.

 

VIA’s Colin Gounden and Jeremy Taylor Attend Opening of Innovation Center Denmark in Boston

Earlier this week, CEO Colin Gounden and CSO Jeremy Taylor were among a select group invited to the inauguration ceremony for Denmark’s Innovation Center in Kendall Square. VIA has established a presence within Denmark’s innovation community, thanks in large part to the support of Accelerace’s Cleantech program. This center is part of a partnership between the Danish Ministry of Higher Education and Science and the Ministry of Foreign Affairs. Boston now joins Silicon Valley, Shanghai, Tel Aviv, Munich, New Delhi/Bangalore, Sao Paolo, and Seoul on the list of cities home to Danish Innovation Centers.

The new center will create opportunities for Danish researchers and companies to connect with Boston’s universities and cutting-edge start-ups, with a focus on cleantech and sustainable energy solutions.

Jeremy Taylor joined the roundtable discussion led by Danish Minister for Higher Education and Science Tommy Ahlers. “Denmark has established an innovation cluster for artificial intelligence and robotics. One topic we discussed was the challenge with supporting ongoing development of these technologies in a socially and ethically responsible way. Montreal recently released its Declaration for Responsible AI, and I think that could be a great roadmap for Danish researchers and entrepreneurs as well,” said Jeremy.

 

VIA Denmark Innovation VIA Denmark Innovation

Joe Babiec Speaks at EUCI Conference on Blockchain, Energy Sector

In October, VIA’s Joe Babiec, VP, Strategic Initiatives, was invited to present at EUCI’s conference: “The Blockchain Technology Revolution: Implications for the Energy Sector”. Hosted in New Orleans, the event welcomed thought leaders and decision makers from leading utilities and energy providers, local government agencies, research organizations, and technology companies to discuss business use cases of blockchain in the energy industry.

In his session, “Valuation of Utility Data Through Blockchain and Artificial Intelligence”, Joe discussed the ways customers are using VIA’s TAC application to reduce costs and monetize operational data in secure and privacy-protected ways. He explained how TAC’s blockchain-enabled smart contracting capability allows data owners and analysts to reach agreements with one another much faster than by traditional methods, and with the confidence that the terms of their agreement will be observed by all parties.

Fellow presenter Kristen Brown, a principal of technology innovation at Exelon, touched on implications of the transformation taking place in the energy industry. Specifically, she called on energy companies to embrace the transition from business models that prioritize “pipelines” to new approaches that emphasize generating value from “platforms” that connect energy providers and consumers in new ways.

For information on upcoming EUCI conferences, visit their website.

VIA’s Joe Babiec Invited to Speak at Cleantech Group’s Executive Summit

In October, Joe Babiec, VIA’s VP, Strategic Initiatives, was invited to speak at Cleantech Group’s Executive Summit, “Blockchain in Energy & Mobility”. The summit, hosted in New York, invited top leaders in energy and blockchain to discuss the technical, commercial, and regulatory challenges of scaling blockchain-based applications within the energy industry.

Joe spoke on the opening panel, which focused on the value propositions and business models being used by innovating companies like VIA. He explained how VIA’s Trusted Analytics Chain (TAC) application generates revenue by helping energy companies reduce operations and maintenance costs, and by providing secure, private data access to external analysts. Joe also noted that TAC has an important advantage as a new product: unlike some future-oriented blockchain applications, TAC helps energy companies address challenges and opportunities they already experience, so using TAC allows companies to realize substantial benefits right away.

VIA is now engaging in a series of proof of concept pilots to confirm TAC’s evolution from a prototype to a production-ready application. The company plans to officially launch TAC in 2019.

VIA’s Joe Babiec Invited to Speak at Greentech Media’s Blockchain in Energy Forum

VIA’s VP, Strategic Initiatives Joe Babiec was invited to speak on a panel at Greentech Media’s Blockchain in Energy forum earlier this month. The panel, hosted at Pacific Gas and Electric’s San Francisco offices, focused on monetizing energy company data with the help of blockchain. Greentech Media’s Emma Foehringer Merchant moderated.

On the panel, Joe shared this insight into why VIA developed its blockchain-based Trusted Analytics Chain (TAC): “We identified a problem which turns out to be very common: in a typical nine-month project you often spend over two-thirds of your time getting access to the data before any of the value-add analytics work can begin.” TAC solves this challenge by establishing secure access to confidential data for analysis by third parties. Employing TAC to facilitate access to on-premise or cloud-stored data provides two key benefits: cost savings from better and faster analysis, and the opportunity for energy companies to generate new revenues by making data available, safely and privately, to in-house and external experts.

For more information about the event, visit PG&E’s website.

VIA CEO Colin Gounden Gives Keynote Speech at Siemens, Intelligent Energi Event

Earlier this month, VIA CEO Colin Gounden gave the keynote speech during an event hosted at Siemens’ Denmark offices. The Danish Intelligent Energy Alliance, Intelligent Energi, organized the event for its members. Intelligent Energi’s goal was to encourage dialogue between network companies, suppliers, and academics about opportunities and challenges to adapt to variable and renewable generation in the electricity distribution network.

Colin shared VIA’s AI and blockchain expertise, with a particular focus on its AI results to improve operations and maintenance and its Trusted Analytics Chain (TAC) application. One major topic of discussion at the event was related to the massive transformation that electrification is having (e.g., changing consumption due to electric vehicles and electric heat pumps). In particular, participants agreed that to ensure the reliability of the grid under new stresses like electrification and renewables, improved sharing of digital information and AI are necessities.

Joe Babiec Presents at Swiss-US Energy Innovation Days (SUEID)

In August, VIA’s VP, Strategic Initiatives Joe Babiec was invited to introduce VIA’s Trusted Analytics Chain application (TAC) and its innovative use of blockchain technology to more than 100 energy industry leaders during an address at the Swiss-US Energy Innovation Days (SUEID) conference in Geneva, Switzerland.

SUEID, hosted by the Swiss Federal Office of Energy and swissnex Boston, is an annual, invitation-only event that unites industry and thought leaders across Switzerland and the US. This event convenes a dynamic community of corporate, government, and academic leaders eager to exchange ideas, explore potential collaborations, and showcase promising energy-related innovations. One major theme voiced by conference participants was the need to increase information sharing within the energy industry while also respecting privacy concerns like GDPR. Joe’s address highlighted TAC’s ability to facilitate advanced analysis while ensuring compliance with customer-imposed or government-mandated security and privacy requirements.

Joe was also invited to meet with some of Switzerland’s largest power companies as well as leading academics in the country’s blockchain community, all of whom were interested in learning more about TAC and exploring potential future collaborations with VIA.

To learn more about the event, visit SUEID’s website.

Colin Gounden and Joe Babiec Present at Energy Impact Partners Roundtable in NYC

In late July, VIA CEO Colin Gounden and VP, Strategic Initiatives Joe Babiec gave a presentation on VIA’s Trusted Analytics Chain (TAC) application at the Energy Impact Partners (EIP) Roundtable in New York City.

The event’s attendees, which included a mix of EIP’s utility partners, asked thoughtful questions about TAC implementation, as well as the application’s software and security details. One question that stood out to Colin and Joe was more related to specific use cases for TAC:

“Given TAC is able to share data privately and anonymously across companies,
could TAC then also be used for benchmarking the performance of assets, like power plants and wind turbines, in addition to advanced AI applications?”

The short answer is yes. In fact, we are currently developing a specific application on top of TAC to do just that. Companies today already spend a lot of money on third-party consultants to aggregate their data and generate anonymized comparisons of operating performance and physical asset performance. TAC offers a near real-time, cost effective way of sharing those same metrics.

To learn more about how VIA is helping the energy industry solve its biggest challenges, watch this interview Colin did during Iberdrola’s Innoday in May.

Colin Gounden Shares Expertise on Panel at Elemental Excelerator’s Interactive Event

VIA’s CEO Colin Gounden was handpicked to speak on a panel, moderated by California Energy Commissioner, Carla Peterman, at Elemental Excelerator’s (EEx) Interactive Event held in San Francisco last week. The panel, titled “Energy’s Digital Grid”, touched on the ways data is changing electrical grid operations in terms of predictability and visibility.

Over 200 people were in attendance, including some of the world’s largest utilities, as Colin talked about the ways VIA is applying artificial intelligence and blockchain technology to reduce risks associated with the aging electrical infrastructure. EEx captured a memorable quote from Colin, which was shared to Twitter:

For more information on VIA’s involvement in the EEx program, visit their website.

Iberdrola Innoday Recap: “We rely on power for everything”

In late May, VIA was invited to Iberdrola’s Innoday at its international campus in Madrid, Spain. The invite-only event was attended by over 600 people, with 25 companies showcasing the latest technology innovations to hit the energy industry. There were a number of technologies like drones for wind turbine inspection and AI solutions for the electrical grid being exhibited at the event.

CEO Colin Gounden attended Innoday and was the only participant to both be invited to speak on stage and give an exclusive video interview with Iberdrola. In the interview, Colin talked about the current state of the energy industry, how it will change over time, and the critical role VIA will play in the future of the energy. Check out the full video interview below, featured on Iberdrola’s website:

 

Colin Gounden Presents at FERC Technical Conference

Colin Gounden, CEO of VIA, gave a presentation last week at the Federal Energy Regulatory Commission (FERC) conference, “Increasing Market and Planning Efficiency and Enhancing Resilience through Improved Software.” This is the second time Colin has been selected to present at this invitation-only conference.

During his presentation, titled “AI for forecasting and resiliency in energy” Colin discussed the issues that limit AI learning to improve grid resiliency. These include too little data / signal, too much data, physically distributed data, and information privacy. His presentation focused on how VIA’s application, Trusted Analytics Chain (TAC), addresses these four common AI training data issues.

The three-day conference culminated with a final session with multiple speakers focused on the importance of data access and data sharing. There was widespread consensus from participants that improved access to energy data and modeling frameworks would allow faster and better analytical solutions. In particular, widening the scope for expert collaboration would have a dramatic impact on the quality of technical solutions that could improve grid resiliency and day ahead forecasting.

View the presentation slides:

For a copy of Colin’s presentation, please visit the FERC event page.

Colin Gounden Speaks at the 9th Asian Leadership Conference in Seoul, Korea

Colin Gounden was invited to speak at the 9th Asian Leadership Conference (ALC) in Seoul, Korea earlier this week. During the session titled “Blockchain in our Lives” Colin discussed VIA’s blockchain application, Trusted Analytics Chain (TAC) and the benefits its smart contract functionality in particular, can have for the energy industry. The session also featured five other executives involved in the blockchain space, including Mike Kayamori, CEO of Quoine, Asia’s largest ever ICO.

ALC is an annual international conference hosted by The Chosunilbo, one of the largest newspapers in Korea. The theme of this year’s conference was “Globalization in Crisis: Navigating the World with New Opportunities” which featured speakers from all over the world, including former Vice President of the United States, Dick Cheney and Gerhard Schröder, former Chancellor of Germany, among others.

 

Colin Gounden speaking at ALC 2018.

Colin Gounden Speaks at EUCI Blockchain Technology for the Energy Sector Event in Houston

Colin Gounden was a featured speaker at EUCI’s latest event “Blockchain Technology for the Energy Sector” on May 9th in Houston, TX. The event focused on the fundamentals of blockchain technology and the opportunities it presents to the energy industry.

Colin’s session, titled “Realizing the Value of Utility Data Through Blockchain and Artificial Intelligence,” highlighted the ways blockchain, and more specifically VIA’s Trusted Analytics Chain (TAC), can provide utilities with more rigorous AI solutions (like predictive maintenance and contingency planning) and streamline compliance filings with regulatory agencies. For more information about Colin’s presentation or VIA’s blockchain solution, email us at info@solvewithvia.com.

Pepper Hamilton Features Colin Gounden at Energy Blockchain Event

VIA CEO Colin Gounden was a featured speaker alongside Scott Clavenna, Chairman of Greentech Media, at Pepper Hamilton’s Energy Blockchain event last week. Hosted at the firm’s Boston office, the event focused on current applications of blockchain in the energy industry as well as opportunities and obstacles facing further development of the technology. Colin’s presentation addressed how VIA is supporting utilities in their efforts to adopt these solutions.

VIA is developing a blockchain application, Trusted Analytics Chain (TAC), currently in beta testing. TAC will allow businesses to pool their data in order to improve analytical outcomes without having to physically transfer or aggregate the data. By moving the algorithm instead of the data, TAC ensures all client data remains on premise. Additionally, the application uses homomorphic encryption and differential privacy to keep client data secure and anonymous, which solves some of the key concerns utilities have about implementing AI solutions. To learn more about this and other solutions VIA provides, please visit our website.

Blockchain energy VIA

Scott Clavenna (left) and Colin Gounden both presented and led Q&A sessions about the growing opportunities for blockchain in energy.

blockchain energy VIA

Gounden spoke to VIA’s work supporting utilities’ adoption of AI initiatives.