jmodelica

Replacement of deprecated function cardinality(c) in Modelica

ⅰ亾dé卋堺 提交于 2020-05-14 20:42:34
问题 In the documentation it is indicated, that cardinality() function is deprecated and should no longer be used. However, it is still used in the libraries such as ThermoSysPro. e.g. if (cardinality(C) == 0) then some code end if; where C is FluidInlet or FluidOutlet Could anyone give a simple example of how it could be replaced? 回答1: The usual solution is to make the connector conditional, and if enabled you require that it is connected. For physical connectors you can see how heatports and

What are the differences between diffferent Modelica Simulation Environments?

为君一笑 提交于 2020-04-10 03:42:25
问题 There are different Modelica Simulation Environments, including Dymola, Wolfram SystemModeler, OpenModelica, and Jmodelica. So, I try to load a thermal fluid library(ThermoSysPro https://github.com/Dwarf-Planet-Project/ThermoSysPro), but except Dymola, the results on the other software all end with errors. If the library and the simulation environment are all based on the Modelica Specification Standard, why there is a compatibility issue? I think that maybe the library includes some features

What are the differences between diffferent Modelica Simulation Environments?

微笑、不失礼 提交于 2020-04-10 03:41:23
问题 There are different Modelica Simulation Environments, including Dymola, Wolfram SystemModeler, OpenModelica, and Jmodelica. So, I try to load a thermal fluid library(ThermoSysPro https://github.com/Dwarf-Planet-Project/ThermoSysPro), but except Dymola, the results on the other software all end with errors. If the library and the simulation environment are all based on the Modelica Specification Standard, why there is a compatibility issue? I think that maybe the library includes some features

PyFMI in Python 3 environment in Ubuntu 18.04

非 Y 不嫁゛ 提交于 2020-02-26 02:37:28
问题 My goal is to be able to run FMUs produced by OpenModelica in Ubuntu 18.04 and then run these with PyFMI in Python 3 environment. I follow the outline for PyFMI installation here https://jmodelica.org/pyfmi/installation.html. So far I have using Conda managed to install Python3, Numpy, Scipy, lxml and some other packages and made it work with some of my Python examples. But I would appreciate some detailed advice how to Install FMI Library - and I do not get how to setup the flag fmil-home

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 *

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;

JModelica on Ubuntu 18.04

ぃ、小莉子 提交于 2019-12-22 09:47:12
问题 Hello JModelica community. I already managed to compile JModelica on CentOS, but I am still failing on Ubuntu 18.04. The compilation itself is successful, but running from pyjmi.examples import cstr_casadi cstr_casadi.run_demo() fails with --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-33de447ae4ee> in <module>() ----> 1 cstr_casadi.run_demo() /opt/JModelica.org/Python/pyjmi/examples/cstr_casadi.pyc

Pause JModelica and Pass Incremental Inputs During Simulation

六眼飞鱼酱① 提交于 2019-12-14 01:20:36
问题 Hi Modelica Community, I would like to run two models in parallel in JModelica but I'm not sure how to pass variables between the models. One model is a python model and the other is an EnergyPlusToFMU model. The examples in the JModelica documentation has the full simulation period inputs defined prior to the simulation of the model. I don't understand how one would configure a model that pauses for inputs, which is a key feature of FMUs and co-simulation. Can someone provide me with an

Setting up Jupyter Notebook for JModelica

你。 提交于 2019-12-12 09:43:13
问题 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

OpenModelica and JModelica deliver significantly different results

孤人 提交于 2019-12-11 15:34:43
问题 Following this question, I'm trying to compare the results of the simulation between JModelica and OpenModelica. The Modelica file is identical to the above-mentioned post and the JModelica wrapper is the corrected version: #%% from pymodelica import compile_fmu from pyfmi import load_fmu import matplotlib.pylab as plt #%% model_name = 'friction1D.fricexample_1' mofile = 'friction1D.mo' #%% fmu_name = compile_fmu(model_name, mofile) sim = load_fmu(fmu_name) #%% opts = sim.simulate_options()