Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » Neotake
  • » Profile

Posts

Posts

Good afternoon,

I'm modeling thermo-fluid systems.

This vectorial equation "produces" an algebraic loop:

{Dn, Hn} = Thermo.DnHn(P = P, T = T, Xn = Xn);

The thermo functions are highly dependent on temperature.

Everytime that the algebraic loop is solved, a lot of iterations are needed:

############ Solve nonlinear system 160 at time 1 ############
initial variable values:
[ 1]                       volume.P  =        99500.023         nom =           100000
[ 2]                       volume.T  =        682.77722         nom =              300
Solution status: SOLVED
 number of iterations           : 1810
 number of function evaluations : 6470
 number of jacobian evaluations : 1810
solution values:
[ 1]                       volume.P  =        99500.023
[ 2]                       volume.T  =        682.77722



Even when the initial values are really close to the solution, a lot of iterations are needed. Why is this happening?

Thanks in advance

Hello,

Can OpenModelica provide the time constants of a given model?

Thanks!

Jul-05-18 07:50:14
Directional derivatives error (FMU for model exchange)

Thanks!!!!!!!

Jun-22-18 09:41:31
Directional derivatives (FMU for model exchange)
Category: Developer

Thanks, the information was very helpful.

Jun-22-18 08:43:55
Directional derivatives (FMU for model exchange)
Category: Developer

Hi Willi,

Is there any rough date estimation for the next release??

Thanks!!!!!!!!!!

Jun-22-18 08:29:05
Directional derivatives (FMU for model exchange)
Category: Developer

Good morning,

My company is planning some developments based on OpenModelica FMUs and considering to contribute to the OpenModelica Project.

I opened a ticket about a possible bug in the directional derivatives calculation:
https://trac.openmodelica.org/OpenModel … #comment:1

Is there any way of knowing how important/prioritary is this functionality for the development team?

In order take strategic decisions, it would be very helpful for us to know if the directional derivatives are going to be available soon.

Thank you very much!!



Jun-15-18 06:24:19
Set timeout from the GUI

Thanks!

For other people information: "model.exe -alarm=10".

Notice the sigle "-".

Jun-14-18 10:04:46
Set timeout from the GUI

Thanks Adeel!

It's the right place, but apparently is not working.

I filled this:
OMC Flags:  +d=initialization +d=infoXmlOperations --alarm=1

Am I doing something wrong?

Jun-14-18 08:38:51
Set timeout from the GUI

Hi,

Is it possible to set the timeout compiler option(https://www.openmodelica.org/doc/OpenMo … lag-alarm) from the GUI?

Thanks!!!!

Jun-04-18 14:09:39
Directional derivatives error (FMU for model exchange)

# Python test script

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os as O

import matplotlib
import matplotlib.pyplot as plt

import numpy as N

from pyfmi import load_fmu

curr_dir = O.path.dirname(O.path.abspath(__file__));
path_to_fmus = O.path.join(curr_dir, 'FMUs') # The FMU must be in this folder!!!!!!


def run_fmu_native(filename, list_seed_vector, with_plots=True):
    """E10_linear (native)

    Based on https://jmodelica.org/pyfmi/_modules/py … l#run_demo

    """
    fmu_name = O.path.join(path_to_fmus, filename)
    model = load_fmu(fmu_name)

    Tstart = 0.0 #The start time.
    Tend   = 2.0 #The final simulation time.

    model.time = Tstart #Set the start time before the initialization.

    #Initialize the model. Also sets all the start attributes defined in the
    # XML file.
    model.initialize()

    #Get Continuous States
    x = model.continuous_states
    #Get the Nominal Values
    x_nominal = model.nominal_continuous_states
    #Get the Event Indicators
    event_ind = model.get_event_indicators()

    # Snippet from https://jmodelica.org/pyfmi/pyfmi.html# … derivative
    assert model.get_capability_flags()["providesDirectionalDerivatives"]==True #Assert directional derivatives are provided

    states = model.get_states_list()
    states_references = [s.value_reference for s in states.values()]
    derivatives = model.get_derivatives_list()
    derivatives_references = [d.value_reference for d in derivatives.values()]
   
    print('state_references: {}'.format(states_references))
    print('derivatives_references: {}'.format(derivatives_references))
    print('seed vector: {}'.format(list_seed_vector))

    dd = model.get_directional_derivative(states_references, derivatives_references, list_seed_vector)

    #print('dd: {}'.format(dd))
   
if __name__ == "__main__":

    run_fmu_native('E10_linear.fmu', [1], with_plots=True)

Jun-04-18 14:07:03
Directional derivatives error (FMU for model exchange)

Hello,

I'm using FMUs generated by OpenModelica from FMPy and PyFMI.

When I try to get directional derivatives from the FMUs, there are crashes (with both libraries).

The FMUs are generated from console: c:\openmodelica1.13.0-dev-64bit\bin\omc -n=1 -d=-disableDirectionalDerivatives --postOptModules+=wrapFunctionCalls fmu.mos > error_fmu.txt 2>&1

Files are attached.

Am I doing something wrong or could it be a bug in the FMU code?

Thanks!!!
E10-linear.mo

fmu.mos


Hello,

Did anyone try to do it by hand? I mean taking the sources and compiling them without the OpenModelica help.

Thanks

Is the FMU for Model Exchange code (generated by OpenModelica) parallelized?

If I want parallelization, must I run different FMUs for Co-Simulation in parallel?

Thanks

I'm interested too. The same question in Stack Overflow: https://stackoverflow.com/questions/488 … ux-windows

Thanks

Jan-22-18 07:46:00
sublime and OpenModelica

Java applications (.jar files) are multiplatform.

Regards

Jan-19-18 11:22:57
sublime and OpenModelica

Hello,

I want to export large-scale models from Openmodelica to FMU for model exchange.

As first step, I'm using this model for testing purposes:

Code:

model BigModel "Tank-Pipe-Tank cloned n times"


  //
  constant Real g=9.8;
  //
  parameter Integer n = 1;
  parameter Real A_a = 1;
  parameter Real A_b = 1;
  parameter Real c = 0.2 "Kinematic viscosity";
  parameter Real rho = 1000.0;
  //
  Real P_a[n];
  Real P_b[n];
  Real H_a[n] (start=fill(2,n),each fixed=true);
  Real H_b[n] (start=fill(1,n),each fixed=true);
  Real F[n] "Flow";
 
 
equation 

for i in 1:n loop
  P_a[i] = rho * g * H_a[i];
  P_b[i] = rho * g * H_b[i];
  F[i] = c * (H_a[i] - H_b[i]);
  A_a * der(H_a[i]) = -F[i];
  A_b * der(H_b[i]) = F[i];
end for;
   
end BigModel;

Changing "n" we can generate big models.

Depending on the OpenModelica version and the OS, the maximum number of equations changes a lot:

Windows 10 64 bits - OM 32 bits - 16 GB RAM - 4 CPU - i7) => n = 2600; Equations = 13000
Windows 10 64 bits - OM 64 bits - 16 GB RAM - 4 CPU - i7 => n = a lot less than the previous one
Ubuntu 17.10.1 64 bits - OM 64 bits - Virtual Machine - 8GB RAM - 1 CPU=> n = 22500; Equations = 112500

Does this have any sense for you?

Is it possible to reach n = 22500 in Windows?

Thanks!!!



Dec-13-17 09:39:41
Category: Developer

Hi!

Will OpenModelica support advanced numerical real-time solvers for co-simulation FMUs?

I visited the openCPS website (https://itea3.org/project/opencps.html). It seems they are making efforts in that direction. But it's not clear for me how far we are.

Thanks!!




Hi,

It's possible to set the maximum number of nonlinear solver iterations at one step for the IDA solver (https://openmodelica.org/doc/OpenModeli … liniters).

Is it possible to do the same with other solvers?

I would like to obtain a behaviour closer to real-time solver.

Thanks!!

bumino wrote:

where can i find more documentation how to create own FMI and implement it with openmodelica?

Hi Bumino, did you find the information?

Thanks in advance


Jul-25-17 11:30:44
How would one go about adding a novel solver ot OpenModelica?
Category: Developer

Where can I find more information about how to export an ODE interface using OMC?

I googled it but I didn't find anything useful.

Is it readable file (e.g. XML)?

Thanks


By the moment, I'm treating it similarly to an electrical switch.

Regards

Hello,

I trying to model a tank emptying (see model below, the file is also attached). It was flattened by hand. I wrote all the equations in the same model, including the  equality equations for the across variables and conservation equations for the flow variables. When the level goes to zero, a division by zero occurs.

<p>division by zero at time 1.854376093259535, (a=0.5041528877565462) / (b=0), where divisor b expression is: if noEvent(Tank_Level &gt; 0.0) then 1.0 else 0.0</p>

model EmptyTank4

  parameter Real A = 1;
  parameter Real Patm = 101325;
  parameter Real rho = 1000;
  parameter Real g = 9.8;
  parameter Real c = 0.00001;

  Real Tank_Level(start=1);
  Real Tank_F;
  Real Tank_P;
  Real Tank_Port_F;
  Real Tank_Port_P;
 
  Real Valve_F(start = 1);
  Real Valve_P;
  Real Valve_Port_P;
  Real Valve_Port_F(start = 1);
 
  equation

  // Tank
 
  if noEvent(Tank_Level > 0) then
    Tank_Port_F = Tank_F;
  else
    Tank_Port_F = 0;
  end if;   
 

  A * der(Tank_Level) = - Tank_F;
  Tank_P = rho * g * Tank_Level + Patm;
 
  Tank_Port_P = Tank_P;
     
 
  // Node
  Tank_Port_F = Valve_Port_F;
  Tank_Port_P = Valve_Port_P;         
 
  // Valve
  Valve_F = c * (Valve_P - Patm/2);

  Valve_F = Valve_Port_F;
  Valve_P = Valve_Port_P;

end EmptyTank4;


Could you help me with this model?

Thanks and regards


zero-flow-4.mo

Nov-04-16 14:58:10
Pivoting of dummy derivatives - Bibliography
Category: Developer

Hello,

Mattsson and Söderlind discussed the pivoting of dummy derivatives (Index reduction in differential-algebraic equations using dummy derivatives, SIAM J. Sci. Comput., url = http://dx.doi.org/10.1137/0914043).

I would like more information about this topic. Could you recommend me more bibliography?

Thanks!!

Aug-11-16 09:55:30
Dummy derivatives, automatic differentiation and external functions
Category: Developer

Hello everybody,

Reading Mattsson, Sven Erik and Söderlind, Gustaf: Index reduction in differential-algebraic equations using dummy derivatives, SIAM J. Sci. Comput., url = http://dx.doi.org/10.1137/0914043; I understand the OM implementation of the dummy derivatives method uses automatic differentiation.

Modelica allows calling functions from third-party DLLs. In that case, it's not possible to do operator oveloading nor re-write functions because of we don't have access to the sources.

In this case, does OM uses symbolic differentiation or maybe a mix of symbolic, numeric and automatic differentiation?

Thanks!!!!


Aug-08-16 12:45:48
Looking for a description of the state selection algorithm
Category: Developer

Mattsson and Söderlind speak about an "elimination process of Gaussian type".

Does OpenModelica implement it? I suppose not because OpenModelica crashes simulating this model:

model singular
  // Variables
  Real y(start = 1.0);
  Real x(start = 0.0);
equation
  der(x) + time * der(y) = time;
  x + time * y = time;
end singular;

Where can I find more information about this topic?

Thanks in advance!!

Aug-02-16 12:41:26
Looking for a description of the state selection algorithm
Category: Developer

Hi all,

I'm also interested on this topic.

Mattsson, Sven Erik and Söderlind, Gustaf: Index reduction in differential-algebraic equations using dummy derivatives, SIAM J. Sci. Comput., url = http://dx.doi.org/10.1137/0914043 is really interesting. Is there more useful information?

As Jens said, more information about checking singular systems is missed. Could you recommend me more bibliography about this subject?

Thanks!!!


I have continuous systems (with IF statements and calls to highly non-linear external functions).

I didn't try without tearing. I assumed that tearing was always worthy.

So, is BLT the first option and BLT + Tearing like a plan B?

Thanks!!!!!

In theory, should Newton-Raphson be enough?

Thanks

Hello!

I coded an algorithm to break algebraic loops based on "Practical Realization and Adaptation of Cellier’s Tearing Method". It works: residual equations, tearing variables, etc. are determined properly. The right Bordered-Lower-Triangular matrix is generated.

I tried two approaches to solve it: optimization methods and non-linear solvers. But I couldn't. If the initial guesses of the tearing variables/optimization variables are a bit far from the actual value of the variables, they don't work.

I suspect that I'm writing the objective function (optimization) and the residuals (non-linear solver) in the wrong way.

Please, could you give me any advice or reference?

Thanks a lot!



Jun-02-16 12:34:04
Symbolic preprocessing before Nelder-Mead

You are right, Nelder is not available anymore.

But did the old implementation work in this way (BLT+Tearing+Nelder)?

Thanks

Jun-02-16 12:20:51
Symbolic preprocessing before Nelder-Mead

Hi,

I suppose that Nelder Mead can't initialize big models at once. Does OM use BLT form + Tearing to reduce the number of optimization variables that Nelder-Mead handle each time?

Thanks in advance

Jun-02-16 09:20:20
Solvability documentation related with tearing
Category: Developer

Hi sjoelund.se,

Thank you! I understand the analytic concept of solvability.

I want more information about the numeric/automatic treatment.

I found this paper but I couldn't purchase it yet: "Dynamic tearing: efficiency enhancement of tearing methods by consideration of solvability criteria during runtime". Has anyone read this paper? Does it cover the topic?

Any other references?

Regards






Jun-02-16 08:58:00
Solvability documentation related with tearing
Category: Developer

I'm reading this paper: "Practical Realization and Adaptation of Cellier’s Tearing Method".

It explains: "The main weakness of Cellier’s method is to assume that every variable is solvable in each equation".

They propose a modified Tarjan algorithm.

Do you know where can I find more information about "Unsolvable variables and equations"?

In other words, how to determine "Impossible assignments".

Thank & Regards

  • Index
  • » Users
  • » Neotake
  • » Profile
You are here: