modelica

Generate white noise in Modelica (SystemModeler)

喜欢而已 提交于 2019-12-09 17:39:01
问题 I am trying to add measurement noise to a simulation. This is possible to do in for example Simulink but seems to be more difficult in Modelica and SystemModeler. Any ideas on how to do this? 回答1: An alternative is to use Modelica.Blocks.Noise to avoid writing external code yourself (added in Modelica Standard Library 3.2.2 released April 3, 2016; i.e. it would not have helped when the original question was asked). One benefit of Modelica.Blocks.Noise is that the tricky questions with

Sensitivity Analysis using PyFMI - FMU in for-loop

本小妞迷上赌 提交于 2019-12-09 06:53:09
问题 Main goal Sensitivity analysis of a district heating network. Approach Modelica model of the system (in Dymola) using the AixLib and BuildingSystem libraries Export model as FMU co-simulation Use SALib (sensitivity analysis python library) to define the samples (parameter sweep) Use PyFMI to run the model in a for-loop in Python for all the individual samples (and parallelize the for loop maybe using JobLib to perfome the simulation on multiple processors) SALib to perform a variance-based

Modelica - Dymola Python interface: Set output format to textual

和自甴很熟 提交于 2019-12-07 19:54:55
问题 I am running Modelica simulations with Dymola via the Dymola Python interface. My aim is to have the result file written to textual output (i.e. to a .txt file). Even though my model contains the annotation __Dymola_experimentSetupOutput(textual=true, events=false) , the output is written to a .mat file. Unfortunately, when I type find() into the Dymola command line, I cannot find a suitable flag for setting the output format via dymola.ExecuteCommand() . Is there a possibility to set the

Searching for a concept like 'verbosity' in Modelica

♀尐吖头ヾ 提交于 2019-12-07 05:06:35
问题 I'm struggling with the size of output files for large Modelica models. Off course, I can protect some objects in order to remove them completely from the result file. However, that gives rise to two problems: it's not possible to redeclare protected objects if i want to test my model in detail (eg for a short time period), i need to declare those objects publicly again in order to see their variables I wonder if there's a trick to set the 'verbosity' of a Modelica model. Maybe what I would

Modelica - Dymola Python interface: Set output format to textual

浪尽此生 提交于 2019-12-06 06:25:59
I am running Modelica simulations with Dymola via the Dymola Python interface. My aim is to have the result file written to textual output (i.e. to a .txt file). Even though my model contains the annotation __Dymola_experimentSetupOutput(textual=true, events=false) , the output is written to a .mat file. Unfortunately, when I type find() into the Dymola command line, I cannot find a suitable flag for setting the output format via dymola.ExecuteCommand() . Is there a possibility to set the output format to textual via the Python interface? Thanks! You can set textual output in the python

How can I add a custom package to the startup path in Dymola/Modelica?

走远了吗. 提交于 2019-12-06 06:08:45
问题 I have a custom package that I find myself reusing repeatedly in Dymola models, and I'd like to put this package in a common directory that is automatically loaded whenever I start Dymola. My current strategy is to load the custom package when a model I'm working on is loaded and then save total. This is not elegant because the contents of the custom package end up saved in multiple locations across my hard drive, and if I change one of them, the changes are not reflected everywhere. I would

Setting up Jupyter Notebook for JModelica

妖精的绣舞 提交于 2019-12-05 13:13:59
I would like to use Jupyter Notebook for editing JModelica python scripts; however after installing, the Jupyter notebook cannot locate key libraries, such as pymodelica. Here is the process I followed to install Jupyter Notebook for JModelica Version 2.1: In the IPython terminal: !pip install jupyter In windows CMD I navigate using cd C:\JModelica.org-2.1\Python27\Scripts I then open using jupyter notebook Within the notebook I create a Python 2 file and attempt to import the pymodelica library, which is followed by: ImportError Traceback (most recent call last) in () ----> 1 import

How can I call an OpenModelica model in Python with OMPython?

最后都变了- 提交于 2019-12-04 21:18:07
问题 I have an OpenModelica model made with OMEdit. In order to get a concrete example I designed the following: Now I would like to run the model in Python. I can do this by using OMPython. After importing OMPython and loading the files I use the following command to run the simulation: result = OMPython.execute("simulate(myGain, numberOfIntervals=2, outputFormat=\"mat\")") The simulation now runs and the results are written to a file. Now I would like to run the same model but with an different

Unit testing Modelica component library?

 ̄綄美尐妖づ 提交于 2019-12-04 12:01:54
问题 I'm creating a library of components in Modelica, and would appreciate some input on techniques for unit testing the package. So far I have a test package, consisting of a set of models, one per component. Each test model instantiates a component, and connects it to some very simple helper classes that provide the necessary inputs and outputs. This works fine when using it interactively in the OMEditor, but I'm looking for a more automated solution with pass/fail criteria etc. Should I start

How can I add a custom package to the startup path in Dymola/Modelica?

爷,独闯天下 提交于 2019-12-04 11:16:50
I have a custom package that I find myself reusing repeatedly in Dymola models, and I'd like to put this package in a common directory that is automatically loaded whenever I start Dymola. My current strategy is to load the custom package when a model I'm working on is loaded and then save total. This is not elegant because the contents of the custom package end up saved in multiple locations across my hard drive, and if I change one of them, the changes are not reflected everywhere. I would like a more robust way of distributing this custom package to all of my models. Is there a way to tell