Posted by Ryan Roper
http://www.thisiswhyimbroke.com/the-ultimate-swiss-army-knife |
But John's webinar also highlighted a whole other world of things that you can do with GoldSim. From internal documentation to graphics drawing tools to dashboards and more, GoldSim is more than just its core simulation capabilities. In the world of simulation tools, it's actually quite like having a corkscrew, nail file, scissors and toothpick on your pocket knife. Here, I want to highlight a few things that stood out to me in John's webinar. I'd also like to make mention of some features of GoldSim that I have used to my advantage in developing a system for automated verification testing of GoldSim. This includes using Spreadsheet elements to export test results to Excel, recording Time Series elements to store expected results for comparison and a batch file to run multiple tests automatically one after the other.
Schematics and flowcharts: One thing that most impressed me from John's webinar was how well he's made use of GoldSim's very basic graphics drawing tools to incorporate schematics into his models. And the schematics are placed next to GoldSim elements in a way that you can see exactly how the elements (representing inputs or properties of the model) correspond to the schematics.
John has also incorporated detailed flowcharts into his models. The flow charts include labels that are actually hyperlinks either to specific locations in the model or to external sources and documentation.
GoldSim verification: One of my primary responsibilities here at GoldSim is software testing and verification. Currently, we have 318 verification tests that need to be run before each major release of GoldSim. Within the last year or two, I have managed to convert almost half of these (157 of them) to automated tests. If it weren't for a few very useful features of GoldSim, I wouldn't have been able to do this.
Time Series elements for storing expected results: One thing I needed for automating these verification tests was a way to store expected results in GoldSim. I could have manually entered the expected results into Time Series elements, but for many tests, there are dozens of results that need to be checked for correctness. Instead, for a given test to be automated, I linked all results (that are checked for correctness) into a vector Data Element and ran the test once with a recording Time Series element to record the results vector. Then all I had to do was switch to Edit Mode and set the Time Series element back to 'Locally defined data'. Conveniently, the results are then hard-coded in the element. One manual check of the results is required to make sure they are correct. Thereafter, results generated in new versions of GoldSim can always be checked against the stored (correct or expected) results in an automated way.
Spreadsheet Element results exporting: Once I had expected results stored in a Time Series element, all I needed was a vector Extrema element to store the maximum (absolute value) deviations between expected and actual results and a condition-type expression element, called 'TestPassed', that is true if all deviations are zero (or less than some small threshold value). Then the whole test was reduced to a single true/false value that could be exported to Excel. I put together an Excel file that has a full listing of all our verification tests, grouped into separate tabs by test category. Then I set up a Spreadsheet element that exports the single result to the appropriate tab and row in the Excel file.
Running GoldSim from the command line: The last 'piece' that I needed was a way to run all of the automated tests (all 157 of them) one after the other. Fortunately, there are command line functions that allow you to run GoldSim from a command window or, more importantly (in this case), from a batch file. All I had to do was write a batch file that I could execute which would, for each test, open GoldSim, open and run the test file and then close GoldSim. Each test would be executed and the result stored to the appropriate location in the Excel file.
Think outside of the box and have fun: GoldSim is not only a powerful and versatile computation and simulation tool, but it also offers several additional features for documenting and presenting your models. Try to think outside of the box and push GoldSim to the limits of what it can do. This blog post is meant to give you a small taste of the variety of things you can do with GoldSim. I would encourage you to take a look at John Tauxe's webinar.
Also, you might occasionally get some cool ideas that, even if they aren't particularly useful, are fun to play around with. This plot shows increasingly accurate Fourier series approximations for a square wave. The model uses multiple realizations where the realization number corresponds to the number of terms used in the Fourier series. So as the realization number gets higher, the approximations become more accurate.
No comments:
Post a Comment