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

Posts

Posts

Apr-30-18 21:40:28
Trouble with using the val() function using OMPython OMC scripting for finding pipe port pressure

Hi,

I've simulated a model using OMPython's access to omc scripting functions putting the simulation results into a .mat file. I want to find the value of pressure at a specific port for any pipe and using the val() function for pressure at this point returns NaN.

The strange thing is that I can call some results using the val() function, using Pipe3 as an example.

print omc.sendExpression('val(Pipe3.flowModel.m_flows[1], 0.0, "Network_res.mat")')
will return: 1000.0

However when I try:

print omc.sendExpression('val(Pipe3.port_b.p, 0.0, "Network_res.mat")')
it returns: NaN

I have tried it for a number of values in the result file, from what I gather it seems to be some of the values which have units which it gives NaN. When simulating and putting the results into a .csv file, I can find the result Pipe3.port_b.p when opening with Excel.

Is there a way to use val() or any other way to display the simulation result for pressure at a poirt?

Many thanks,

Jaimo

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