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
  • » Perun
  • » Profile

Posts

Posts

Thank you very much. This is what I wanted to do.

I have been mostly using OMedit so I just want to clarify some things. "buildModel" command is  OpenModelica scripting command and can be used when using OMshell for example.  Is this what you meant with the first part of your answer, or there exist another(better?) option to change the parameter value within Python environment (besides ModelicaSystem or "-override" flag)?

Best regards

Hi

I am simulating  the following Modelica model

Code:


model HelloWorld
  Real x(start=1);
  parameter Real a = -1;
equation 
  der(x) = a*x;
annotation(
    uses(Modelica(version = "3.2.2")));
end HelloWorld;

with the following Python code

Code:


from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
omc.sendExpression("loadFile(\"C:/Users/user/Desktop/HelloWorld.mo\")")
omc.sendExpression("loadModel(HelloWorld)")
results = omc.sendExpression("simulate(HelloWorld, outputFormat=\"csv\")")

The simulation is successful and the value ofparameter a is  -1.  What I want is to perform the simulation with different value of a. How can I change the parameter value within OMCSessionZMQ() and then perform the simulation using the new value of a? I know that this is possible with OMPython.ModelicaSystem.

Since there was no reply to my question I figuered it out by myself. Perhaps this is going to be useful for someone else. I am going to explain it on explicit Euler example. The stability region for Euler is written as |(1,0) Padé | ≤ 1. We look at the table in Wikipedia (title: An example – the exponential function) and take the equation which is located in 1st row and 0th column ((1+z)/1). We insert some complex numbers as z and check if the absolute value of the result is smaller than 1. We then plot z on a plot with real x-axis and imaginary y-axis. The result of Euler example is shown in the attachement.
https://openmodelica.org/images/agorapro/attachments/6066/mini_stabilityEuler2.jpg

Hi everyone,

I have a question regarding the stability of integration methods. In the following link (integration methods) is stability region in many cases written as |(a,b) Pade| < 1. I have read the provided article on Wikipedia, but I still don't know how to use provided stability region.Could someone please tell me (perhaps on Explicit Euler example) how to plot stability plot using stability region written in form of Pade table.

Best regards

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