-
Notifications
You must be signed in to change notification settings - Fork 34
Moliana for Quality Assurance
Moliana is a Python written Modelica Library Analyser for Dymola.
Its basic idea is, to automatically apply Dymolas checkModel()
to several packages and generate a simple table-based Html report to visualize the results.
Moliana can be downloaded from https://github.com/jmoeckel/moliana. Also note the wiki, where you can find several examples as well as a documentation of the user-interface.
Following code will check the BuildingSystems
library and generate an Html report, which gives a overview of which subpackages still throws errors or warnings. Note, that of course the pathes must be adapted to your host-system.
os.chdir('Q:\Git\moliana')
import moliana
pLib = 'Q:\\Git\\BuildingSystems\\BuildingSystems' library
pDym = os.path.join('C:\Program Files (x86)\Dymola 2016\\bin64','Dymola.exe')
dm = moliana.DymolaMode(pLib, pDym, modelica_lib_depth = 1)
dm.execute_check('html')
Note, that increasing the level of detail (check out attribute DymoloaMode.modelica_lib_depth
) increases the richness of details in the report as well the runtime of a check.
Moliana provides the possibility to compare different reports to each other, as long as they correspond to the same library. This functionality could be used, to assure a basic quality when it comes to merging development-branches into the master-branch. In general, a development-branch should never be worse in any component than the corresponding component of the master-branch. Using Moliana, this could be easily checked.
Following code shows, how to use Moliana for this purpose Any component of the 'branch' that is worse than the corresponding component of the 'master' is highlighted in red, any component which is better in green.
#Note: All reports will be generated to the BuildingSystems directory
os.chdir('Q:\Git\moliana')
import moliana
pLib = 'Q:\\Git\\BuildingSystems\\BuildingSystems' library
pDym = os.path.join('C:\Program Files (x86)\Dymola 2016\\bin64','Dymola.exe')
#check out the master of the BuildingSystems library
master = moliana.DymolaMode(pLib, pDym, report_name = 'master', modelica_lib_depth = 1)
master.execute_check('html')
rep_master = master.get_report()
#check out any branch you want to compare
branch = moliana.DymolaMode(pLib, pDym, report_name = 'branch', modelica_lib_depth = 1)
branch.execute_check('html')
rep_branch = branch.get_report()
#compare both
rep_branch.compare_to(rep_master)