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

Posts

Posts

Hy all,

I have a problem with OM 1.6.0. I have Ubuntu 10.04 and I work on project, where OM communicate with external C function. Its worked fine, but I updated OM and I have now OM 1.6.0.

My problem is project cant work in OM 1.6. I used sample function in model:

Code:

model myModel

    parameter Real fun = 0;
    parameter Real led = 0;
    parameter Real Ts =  0.01 "sample time [s]";
  Teplota tep;           
  Intenzita  int;
equation
    when sample(time,Ts) then     
        tep.value = omReadWrite(int.value,fun,led); 
    end when;
end myModel;

OmReadWrite is external C function, which alone works fine.  The whole project worked fine, but now I get error:

Code:

Error: The language feature non-linear equations within when-equations is not supported. Suggested workaround: Perform non-linear operations outside the when-equation (this is slower, but works)

[ExternalPID.mo:42:3-42:45:writable] Error: Internal error SimCode.createNonlinearResidualEquations failed
Error: Internal error createOdeSystem2 failed
Error: Internal error createOdeSystem failed
Error: Internal error createEquations failed
Error: Internal error Generation of simulation using code using templates failed

I dont know where can I find OM 1.5.0. Any idea for solution?

Thanks,

xilos.

OK, I understand you, too current/smile I am from Slovakia.

Thanks. Firstly I will try via OMI Transfer Client.

xilos

Hy Francesco,

Thank you for your reply, I ll try this solution. But my biggest problem is link my real model with  OpenModelica model. I wanna regulate the system in real time via usb connection, this communication is solved with a python language (I mean USB and PC).

    My idea is to create one model for regulation (for example PID regulator) and connect him to other model. The second model will contain variables, which will sets in interactive real time simulation. Outputs from regulator will be filtered by command setfilter...

   So the main point is that, I have functions in python to get and set values from usb device, but I need to send him to my OM model. Any idea for solution?

Sorry for my english. I hope you will understand. current/smile

Thanks,
xilos

Hy there again,

I solved my problem current/smile So to get values from simulation is needed to define setfilter correctly. I tried for 2 model and its works current/smile
Firstly is needed to define variables and parameters. When I had model with Real x, and parameter p the good form of command was: setfilter#1#x#p#end. When I send command setfilter#1#x#end, the program defined as Type p - parameter. And i get olny value of parameter.

xilos

Hi Francesco,

I have similar problem as your.  I work on project, which communicate with real system. I want regulate this system with OpenModelica. I created to the GUI, and when I start simulating a get only time value.
The example model HelloWorld I used for tests.
I tried send command:
           setfilter#1#HelloWorld.x#end
           or
           setfilter#1#x#end
but I get nothing new only time.
My question is: Can you get values from simulation? Can someone help me with this? My result from simulation is: result#28.4###end, the number is value of time.

Thanks,

xilos

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