Page 1
Aside

iPython from Anaconda in PyCharm

Lately I fell in love with Python and its easy capability of interfacing with DLLs. Yet so far I always relied on using MATLAB for generating reports and plots for our papers. My good old friend Dawid pointed out I could just use iPython to do the plotting for me. Removing the middle man (i.e. MATLAB) would also be beneficial since our University's license will expire in 3 days 🙁

The only issue I've had with getting iPython going in PyCharm (my preferred Python IDE) was that it just would not start the Kernel. IPython  natively installs when deploying Anaconda and should just work when making a notebook. But it doesn't. Here I will go through how I managed to "fix" this and have my notebooks run beautifully in PyCharm.

Continue Reading →

more
design-1210160_1920
Standard

Model View Controller (MVC) for MATLAB GUIs

The other day I attended a MATLAB training course to make pretty GUIs. It was very interesting, yet the way MathWorks recommended to share data between multiple windows was slightly off-putting for me. In short, they showed all attendees two ways to exchange data. Either have a main windows that holds all data, or the data is stored alongside all windows' handles (handles are used in MATLAB to access properties of displayed objects). The former works well if there is always an main window open, and I don't see any inherent problem here. Nonetheless, the latter approach requires duplicate data to be stored, which seems very wasteful, unstable, and difficult to expand. My solution: the Model View Controller (MVC - link). Next I will show you the differences and how the MVC can be programmed.

Continue Reading →

more
more
anonymised-power
Standard

Python and DLLs (applied to OpenDSS)

It has been a very long time since I programmed using a Dynamic Linked Library (DLL). Last time I remember was during my 3rd year for our master project to interface the xbox Kinect to our semi-autonomous drone; good old days... For my PhD we need to interface our developed energy management algorithms with a standardized simulation environment. The one we chose is OpenDSS (link), and as it seems it comes with a so called "Direct Connection Shared Library (DLL) for OpenDSS"! This far, every time we wanted to interface with OpenDSS, we had to fully install OpenDSS on our target machines in the HTCluster and let our code interface to the simulation engine via the registered COM server. Now we can achieve the same without installing OpenDSS by simply including the relevant DLLs alongside our Python code! This post addresses (and in the future will remind me) how this is done, and how some traps and errors can be prevented and fixed.

Continue Reading →

more
signal-image
Standard

Independent Component Alanysis

I am trying to get my head around, and fully understand and implement, Independent Component Analysis (ICA) for my power profile analysis. Doing this is more challenging than I anticipated. Therefore I did what I always do when trying to understand challenging topics: find them in my mother tongue, i.e. German. Some of my colleagues would happily vouch for the unambiguousness of a native language when it comes, and for me this is no exception (after all, that's how I managed to truly understand Maxwell in my 2nd year). So here I go again, and found a great article written in 2005 by Dr Christoph Bergmeir during his time at the faculty of Engineering, Informatics and Psychology at Ulm University (link). His article is extremely well versed (but that may be due to the preciseness of the German language 😛 ), it covers basic stochastic fundamentals based on information theory, it highlights requirements and limitations of ICA, and it also gives well explained examples (which I hope to replicate and include in this post). By reading the article and coding it up, I finally delved beyond my superficial understanding of ICA and am extremely happy to translate the article, both for my benefit, as well as that of others. Enjoy...

Big credit goes to Dr Christoph Bergmeir, many thanks!

Continue Reading →

more