modelica

modelica: compute minimum/maximum of continuous variable over time

不打扰是莪最后的温柔 提交于 2019-12-01 06:41:52
As stated above: I wish to compute the minimum (and/or maximum) of a continuous variable over time. Here is a minimal example to demonstrate: model MinMaxTest Real u; Real u_min(start = 10); Real u_max(start = -10); equation u = sin(time / 180 * Modelica.Constants.pi); u_min = min(u, u_min); u_max = max(u, u_max); annotation(experiment(StartTime = 0, StopTime = 360, Tolerance = 1e-06, Interval = 1)); end MinMaxTest; u is the arbitrary continuous variable (for demo purposes a simple sinus wave). u_min / u_max is the minimum/maximum over time. Obviously the expected result is u_min=-1 and u_max

Modeling closed hydraulic cycle in OpenModelica

穿精又带淫゛_ 提交于 2019-12-01 05:46:07
问题 I'd like to model a closed hydraulic cycle as one can find in the Modelica Standard Library/Fluid/Examples/HeatingSystem. With the heating system as well as with my (minimalistic) example I've got the same problem: The system is overdetermined. You can find the HeatingSystem as a "bad example" in the following lecture, so I guess this is a well known problem, but I don't really get the point. http://www.modprod.liu.se/MODPROD2011/1.252944/modprod2011-day2-talk3-Keynote-Francesco-Casella

Teaching Modelica Medical Non-SI Units

左心房为你撑大大i 提交于 2019-12-01 05:15:03
I want to use non-SI units in a Modelica model in a medical context. I am using Modelica in Dymola. Being an engineer I prefer the SI units. But my model parameters are sourced from medical publications and I want to avoid conversion mistakes. Medical units also simplify communication with doctors. For example, the unit "mmHg" (millimetres of mercury) is used instead of "Pa" for pressure. Pressure variables are defined in the model as follows: type Pressure_mmHg = Real (final quantity="Pressure", final unit="mmHg") Translating the model for simulation yields the following warning for every

modelica: compute minimum/maximum of continuous variable over time

大兔子大兔子 提交于 2019-12-01 04:50:30
问题 As stated above: I wish to compute the minimum (and/or maximum) of a continuous variable over time. Here is a minimal example to demonstrate: model MinMaxTest Real u; Real u_min(start = 10); Real u_max(start = -10); equation u = sin(time / 180 * Modelica.Constants.pi); u_min = min(u, u_min); u_max = max(u, u_max); annotation(experiment(StartTime = 0, StopTime = 360, Tolerance = 1e-06, Interval = 1)); end MinMaxTest; u is the arbitrary continuous variable (for demo purposes a simple sinus wave

conditional component declaration and a following if equation

点点圈 提交于 2019-12-01 04:25:55
I am trying to build a model that will have slightly different equations based on whether or not certain components exist (in my case, fluid ports). A code like the following will not work: parameter Boolean use_component=false; Component component if use_component; equation if use_component then component.x = 0; end if; How can I work around this? If you want to use condition components, there are some restrictions you need to be aware of. Section 4.4.5 of the Modelica 3.3 specification sums it up nicely. It says "If the condition is false, the component, its modifiers, and any connect

Teaching Modelica Medical Non-SI Units

别来无恙 提交于 2019-12-01 03:24:42
问题 I want to use non-SI units in a Modelica model in a medical context. I am using Modelica in Dymola. Being an engineer I prefer the SI units. But my model parameters are sourced from medical publications and I want to avoid conversion mistakes. Medical units also simplify communication with doctors. For example, the unit "mmHg" (millimetres of mercury) is used instead of "Pa" for pressure. Pressure variables are defined in the model as follows: type Pressure_mmHg = Real (final quantity=

Two-Phase Modelica Media example

╄→尐↘猪︶ㄣ 提交于 2019-11-30 23:25:56
I am trying to develop a simulation in OpenModelica of a flow that has a single substance that will be liquid or vapor. The Modelica.Media.Water models do have two phases, but are extremely complicated, and would be very hard to reproduce for a completely different substance. I would like to find a simple example of a two phase medium that I can work from. There is a partial package TemplateMedium and a partial package PartialTwoPhaseMedium, but I don't see any examples of how to write a completely new Medium that can be in either of two phase. If anyone can provide a simple example, or just a

How to initialize model with previous simulation solution?

泄露秘密 提交于 2019-11-30 17:25:17
问题 Having run out of ideas again I turn to you. I'm sure this has to have been answered before though for the life of me I can't find a clear description of it. Scenario: You work hard to get a model all set up with initial guesses, etc., and then solve for the 'real' steady state (SS) condition of all parameters in the model. From this solution I want to investigate events effects on the system. To perform this deviation from SS analysis, it would be expedient to be able to simply load the SS

steady state initialization in Modelica

假装没事ソ 提交于 2019-11-29 15:31:16
For example, I have a multibody vehicle model with an initial height of, say 0.1 meter (all wheel vertical loads = 0), as the sim runs, the vehicle will drop onto the ground, after 10 seconds, it reaches its steady state. I wonder if it is possible to initialize the model exactly at the steady state? I read something about the homotopy command, but I was not even sure if it is something that I was looking for due to lack of examples, so I am not able to implement it to my model. I wonder if there are any other solutions to this kind of initialization problem? Thanks in advance! Thanks for

Change annotation(Evaluate=true/false ) for parameters in models from Modelica Standard Library

倾然丶 夕夏残阳落幕 提交于 2019-11-29 12:08:12
I am using some components from the Modelica Standard Library (MSL) in my simulations. These components each have some parameters. For example, Modelica.Fluid.Sources.MassFlowSource_T has a parameter m_flow . Usually, parameters can be changed between simulation runs without re-compilation. This is not the case for m_flow , because it has an annotation(Evaluate=true) , so it is used for symbolic processing. Is it possible to change the annotations of parameters at instantiation? I tried the following, but it didn't work. Modelica.Fluid.Sources.MassFlowSource_T source2( redeclare package Medium