modelica

Maximum number of event iterations in Modelica

梦想的初衷 提交于 2019-12-11 03:18:11
问题 Is there a way to change the value of "Maximum number of event iterations" , eviter , that is set to 20 in dymola? 回答1: It seems like dymosim.ini is not used for regular simulations (Note the version in line 4: dymosim.ini states 1.1, whereas the dsin.txt has 1.4 written in Dymola 2019). I also could not find a function or variable in Dymola to change eviter , so the only solution I can think of is to edit dsin.txt before simulation. The code below shows how a function could look like which

How to make use of the unit attribute within a model in Modelica?

本秂侑毒 提交于 2019-12-11 02:48:44
问题 Motivation Modelica does store units of measurement (e.g. SI units and Non-SI units) as an attribute with regard to a variable. Here is an example for a Non-SI-unit: type Time_months = Real( quantity = "Time", unit = "mo", displayUnit = "months" ) Since for models in economics it will be rather akward to give rates in seconds, I would like to write a rather general unit conversion function that will allow to convert units of time. So ideally a function to convert to another time base should

How to perform local sensitivity analysis in modelica

百般思念 提交于 2019-12-11 02:25:34
问题 I want to do local senstivity analysis in Dymola to evaluate different parameters affecting the energy consumption in a building (for multi-familyhouse). Can anyone give me some suggestions, how to do it in Dymola (Modelica) software? 回答1: You could export you model as FMU and then follow one of many the different paths for sensitivity analysis with FMUs: PyFMI + SAlib Sensitivity Analysis using PyFMI - FMU in for-loop FMI Toolbox for Excel by Modelon http://www.modelon.com/products/modelon

Modelica output file during simulation

 ̄綄美尐妖づ 提交于 2019-12-11 01:19:23
问题 I am making simulations for long times and I need to check the output when the simulation is continuing. Another reason is that I am doing real-time simulation so I want to see the output in real-time as well. That would be perfect if OpenModelica creates an output file during the simulation so that I can read and plot it using 3rd party tools, maybe Python. So far as I know, OpenModelica creates output file only at the end of the simulation. Is there a way to create an output file using a

matrix singular under determined linear system not solvable

我的未来我决定 提交于 2019-12-11 00:59:07
问题 Following this question, I modified my code to: model test // types type Mass = Real(unit = "Kg", min = 0); type Length = Real(unit = "m"); type Area = Real(unit = "m2", min = 0); type Force = Real(unit = "Kg.m/s2"); type Pressure = Real(unit = "Kg/m/s2"); type Torque = Real(unit = "Kg.m2/s2"); type Velocity = Real(unit = "m/s"); type Time = Real(unit = "s"); // constants constant Real pi = 2 * Modelica.Math.asin(1.0); parameter Mass Mp = 0.01; parameter Length r1 = 0.010; parameter Length r3

Parameters Sometimes Not Editable in Dymola Simulation Tab and FMU

大兔子大兔子 提交于 2019-12-10 22:47:47
问题 Example: You create a model with 9 parameters you expect to be editable in the Simulation tab and user-settable in the FMU. However, Only 5 parameters appear to be editable from the Simulation tab. Likewise, FMU has only 5 user-settable parameters. 回答1: Solution: To generate more efficient code, Dymola sometimes "evaluates" parameters. annotation(Evaluate=false) tells Dymola a parameter should not be evaluated. Example: parameter Real theAnswer = 42.0 "The answer to life,…" annotation

Dynamically switching connect in Modelica

爷,独闯天下 提交于 2019-12-10 20:18:58
问题 Assume I have a large connector involving all kinds of base types (Real, Integer, String, Boolean). How can I switch connections based on state events? I would like to do something like this: model switch input ComplicatedConnector icon[2]; output ComplicatedConnector ocon; input Real x; equation if x >= 0 then connect(ocon, icon[1]); else connect(ocon, icon[2]); end if; end switch; This does not work. How can it be properly expressed in Modelica? Answer based on comment by Adrian Pop. model

integration of function in modelica

心不动则不痛 提交于 2019-12-10 17:54:36
问题 I would like to perform integration of a function of a variable other than time in Modelica, but I don't know how to do it. For example, how can I evaluate the integral of x dx with upper limit 5 and lower limit 2? ∫x dx=x^2/2 回答1: Modelica was not designed to be a CAS (computer algebra system) as Maple, Mathematica or Matlab, but with a little coding you can do it anyway. The thing is that your problem can not be solved automatically symbolically with Modelica tools, but numerically yes. In

Modelica external functions: C versus C99

↘锁芯ラ 提交于 2019-12-10 17:17:40
问题 In Modelica it is possible to define external functions. Chapter 12.9 of the spec says C and Fortran77 are supported, C++ and Fortran90 might be supported in the future. Now I wonder which versions of C are supported? In particular I need the logarithmic gamma function which is available in C99, so I tried the following: function lgamma "logarithmic gamma function" input Real u; output Real y; external "C" y = lgamma(u); end lgamma; but it does not work, while powf works: function powf "power

Conditional type assignment possible for a parameter?

妖精的绣舞 提交于 2019-12-10 15:14:23
问题 I'm trying to let a parameter be of a specific type depending on a condition to be met. But I'm not quite sure how to do this or if this is actually possible/legal in Modelica. In principle what I would like to have is something like this (non-working code example): package test type TypeA=enumeration(A,C,E); type TypeB=enumeration(B,D,F); model foo parameter Boolean Condition; parameter if Condition then TypeA else TypeB MyParameter; end foo; end test; 回答1: I was hoping to acheive this with