modelica

How to determine the maximum of a mixed time-continuous time-discrete signal in SimulationX?

我们两清 提交于 2020-01-17 05:36:28
问题 There are questions how to determine the maximum of a mixed time-continuous and time-discrete signal x(t) over passed time with Modelica, i.e., y(t) = max{ x(s) with s in [startTime,t] }. This is an open issue in the Modelica bug tracker (see https://trac.modelica.org/Modelica/ticket/109). I will give a SimultionX-specific solution. 回答1: SimulationX extends Modelica by the last -operator which returns the last accepted value of the argument. At event-time points it returns the value at which

can't retrieve the results back from JModelica to Python

时光总嘲笑我的痴心妄想 提交于 2020-01-16 11:12:07
问题 Following this question, I'm trying to compile and simulate a Modelica model with JModelica. The model is: package friction1D function coulombFriction input Real relVel; input Real shearForce; input Real normalForce; input Real statfricco; input Real kinfricco; input Real inertia; input Real relAcc; output Real fricForce; algorithm if (relVel == 0) and (abs(shearForce - inertia * relAcc) < statfricco * normalForce) then fricForce := shearForce - inertia * relAcc; else fricForce := kinfricco *

Modelica libraries use different MSL version

空扰寡人 提交于 2020-01-14 18:56:17
问题 I want to use two Modelica libraries together, in Dymola, so for convenience I wrote a little script, loadLibraries.mos that just opens the two libraries. But they use different versions of the MSL (3.2.1 versus 3.2.2), defined by the uses annotation in the top level package.mo: annotation(uses(Modelica(version="3.2.1"))); The library developed by us uses 3.2.2, the library that uses MSL 3.2.1 is developed by someone else. Now whenever I run the mos script (or when I open the two libraries

Trouble implementing a very simple mass flow source

被刻印的时光 ゝ 提交于 2020-01-13 05:59:28
问题 I am currently learning Modelica by trying some very simple examples. I have defined a connector Incompressible for an incompressible fluid like this: connector Incompressible flow Modelica.SIunits.VolumeFlowRate V_dot; Modelica.SIunits.SpecificEnthalpy h; Modelica.SIunits.Pressure p; end Incompressible; I now wish to define a mass or volume flow source: model Source_incompressible parameter Modelica.SIunits.VolumeFlowRate V_dot; parameter Modelica.SIunits.Temperature T; parameter Modelica

Current version of the modelica translator can only handle array of components with fixed size

走远了吗. 提交于 2020-01-11 11:52:08
问题 I created an part with the AC library, and when I was trying to simulate the model, there is an error says "Current version of the modelica translator can only handle array of components with fixed size". Not sure what is the meaning of it, and is there anyone has the same issue like this one? Thank you enter image description here 回答1: Consider the following simple model: model M parameter Integer n(start=3, fixed=false); initial algorithm n := n; end M; It has a parameter n which can be

How to ensure convergence during the initialization of the nonlinear system in Dymola

跟風遠走 提交于 2020-01-06 05:21:06
问题 Is there a guide for increasing the ability of convergence during the initialization of the nonlinear system in Dymola? Usually, the connector contains start values, but they are not always suited for the model I build, so there might be a divergence issue during the initialization. How could I avoid this issue? 回答1: The Dymola User Manual Volume 1 has several chapters, which deal with the initialization of nonlinear systems. In Dymola 2020 the chapters are: 5.6.8 Initial guesses for

How to use the value of the variable in the previous interval as an input to the equation…?

别说谁变了你拦得住时间么 提交于 2020-01-03 21:03:19
问题 Is it possible to use the previous value of the time varying variable for eg: Suppose I have pipe whose inlet temperature is 298K with a specified uniform mass flow(m_flow), now suppose i am heating the pipe using a heater of 100 watts. The outlet temperature will be attain a higher temperature of suppose 302K, now if i have to use this outlet temperature as my inlet temperature (in the sense i am recircuilating the water), how would i be doing it? is it possible to update the value of the

Including a causal relation in a Modelica simulation leads to translation Error while flattening model

我们两清 提交于 2019-12-31 05:23:07
问题 I want to simulate a controller for a mass-spring model which works based on energy: model model //constants parameter Real m = 1; parameter Real k = 1; parameter Real Fmax = 3; parameter Real x0 = 1; parameter Real x1 = 2; parameter Real t1 = 1; //variables Real x, v, a, xy, vm; initial equation x = x0; v = 2; equation v = der(x); a = der(v); m * a + k * x = F; algorithm vm := sign(xy - x)*sqrt(2 * (Fmax * abs(xy - x) + k * (xy^2 - x^2) / 2) / m); // step signal if time < t1 then xy := x0;

Modelica Discrete Semantics

懵懂的女人 提交于 2019-12-31 04:11:07
问题 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

conditional component declaration and a following if equation

痞子三分冷 提交于 2019-12-30 08:32:08
问题 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? 回答1: 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