modelica

Generate white noise in Modelica (SystemModeler)

老子叫甜甜 提交于 2019-12-04 04:36:08
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? 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 sampling, multiple seeds, etc are solved. Mikael Forsgren You can add white noise in Wolfram SystemModeler via

Sensitivity Analysis using PyFMI - FMU in for-loop

只谈情不闲聊 提交于 2019-12-03 08:51:24
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 sensitivity analyses ( http://salib.readthedocs.io/en/latest/basics.html#an-example ) First step Simple

Unit testing Modelica component library?

血红的双手。 提交于 2019-12-03 07:54:58
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 writing .mos scripts, or is there another/better way ? Thanks. Christoph I like how Openmodelica

Generating two random time depedant veariables with different sample periods

跟風遠走 提交于 2019-12-03 00:12:52
问题 Following this question, I'm trying to generate two time-dependent random functions omega1 and tau using this example. The difference is that I need to have two different sample periods of 0.05 and 0.17 for omega1 and tau respectively. I just duplicated the parts I thought would do the job: model testData extends Modelica.Icons.Example; import Modelica.Math.Random.Generators; import Modelica.Math.Random.Utilities; parameter Real k = 50.0; parameter Real J = 0.001; Real theta1; Real theta2;

How to compile with /bigobj within Dymola (Modelica)

柔情痞子 提交于 2019-12-02 14:06:39
问题 I am integrating a relative small Finite Element (FE) model into Modelica. In doing so, I created a Model (Modelica class) that can read the mass (M) and stiffness (K) matrix in Matlab binary file format. I connected the FE model with some components from the Modelica Standard Library (Modelica.Mechanics.MultiBody). If M and K are very small (say 20x20), then Dymola is able to run the Model and provides pretty accurate results compared to Abaqus (but computational not that efficient). However

How to override default equations?

你离开我真会死。 提交于 2019-12-02 12:29:30
问题 All the derived classes should inherit some default equations from their base class. When the default equation is not valid for a derived class then it should redeclare it. This minimalistic example below is somewhat silly. Am I on the right track to achieve the above goal? Or is there a better way to express this in the Modelica language? package Pkg partial class Equations Real x; end Equations; class DefaultEquations extends Equations; equation x = 0.0; end DefaultEquations; class Base

OpenModelica modelling Coulomb friction: Translation Error, post-optimization module findZeroCrossings (simulation) failed

偶尔善良 提交于 2019-12-02 07:52:30
问题 I'm trying to simulate Coulomb friction in Modelica. The basic concept is to check if relative velocity speed between to surfaces is less than a constant and the external force which tried to slid surfaces against each other is less than maximum static friction force (normalForce * staticFrictionCoefficient) then the friction force is equal to negative of the external shear force. otherwise, the friction force is equal to the kinetic friction force (normalForce * kineticFrictionCoefficient)in

Modelica Discrete Semantics

让人想犯罪 __ 提交于 2019-12-02 07:23:08
I am trying to understand the Modelica semantics for a discrete signal. Given a step signal that instantaneously transitions from 0.0 to 1.0 with infinite slope at t = 0.5. Then let's say you also have a when statement as in the following code: model test_discrete Modelica.Blocks.Interfaces.RealOutput q(start = -1.0); Modelica.Blocks.Sources.Step step( height=1, offset=0, startTime=0.5) algorithm when time >= 0.5 and time <= 0.5 then q := step.y; end when; equation end test_discrete; My question is whether q will be 0.0 or 1.0? Lets assume q is initialized to -1. When I implement the code, it

How to override default equations?

只谈情不闲聊 提交于 2019-12-02 06:59:55
All the derived classes should inherit some default equations from their base class. When the default equation is not valid for a derived class then it should redeclare it. This minimalistic example below is somewhat silly. Am I on the right track to achieve the above goal? Or is there a better way to express this in the Modelica language? package Pkg partial class Equations Real x; end Equations; class DefaultEquations extends Equations; equation x = 0.0; end DefaultEquations; class Base replaceable class T = DefaultEquations; replaceable T equations extends Equations; end Base; end Pkg;

How to add load libraries, change directory, etc. on startup?

爷,独闯天下 提交于 2019-12-02 06:22:45
Is there a way to automatically load libraries, change to a certain working directory, etc. when launching Dymola? The question is slightly ambiguous - the other answer is quite good for one scenario. (The openModel call in Step 2 can be modified.) However, if you always want to launch Dymola in a specific directory etc it is possible using the GUI in Dymola 2017 FD01 (and slightly differently from Dymola 2016 FD01): Change Directory (File>Change Directory) Add to Modelica Path (File>Modelica Path) Save those settings (Edit>Options>Settings: Select Startup and Modelica Path) If you want to