- Index
- » Users
- » bhargava.nemmaru
- » Profile
Posts
Posts
Hi,
I have overcome the issues stated in the previous post, by sticking to .mat format and, converting the .mat files to a consolidated .csv file using Octave. But, when I try to run the script that simulates the system, I get an error saying 'Internal error BackendDAE.adjacencyRowEnhanced failed for eqn:' and it points to the code in algorithm section of my master model in which two component models have been connected. I have also attached a screenshot of the error statement. Kindly let me know what this error means and, if there is any possible way out.
Regards,
Bhargava
Hi,
Thank you for the reply. Yeah, I have checked this model out and there is a similar model in ModelicaByExample system library. I believe that the issue in my case is with the DASSL solver and the way I am handling it. The model is a long one. So, is it fine if I send that over to your e-mail?
Regards,
Bhargav
Hi,
Yeah I followed the code that you had suggested and it works fine. There are a few last minute issues that I am facing. Please take a look at the following code and kindly address the issues that follow.
Code:
loadFile("/.../BouncingBall.mo");
myStart := 0;
myStop := 2;
tempHt := 10;
tempV := 0;
buildModel(BouncingBall);
for i in 1:3 loop
system("./BouncingBall -override h="+String(tempHt)+",v="+String(tempV)+",startTime="+String(myStart)+",stopTime="+String(myStop)+",outputFormat=csv,numberOfIntervals=10 -r sample_out_"+String(i)+".csv");
tempHt := val(h,myStop);
tempV := val(v,myStop);
myStart := myStop;
myStop := 2*myStop;
end for;
(Excuse any typos like extra spaces in the code. I have ensured that they are in place.)
Here, tempHt and tempV are the variables that are used to store the values of velocity and height at the end of every iteration, to be used as initial values for the next iteration.
Issue1: I am unable to use the val() function if my output format is csv(works with mat and plt). So, would you suggest an alternative way of storing the values of variables at the last time instant after every iteration? I don't need the complete output vectors which is given by the -output option.
Issue2: I am unable to manipulate the number of intervals. I am using this option as 'numberOfIntervals=10'. Kindly suggest how this needs to be done.
Regards,
Bhargava
Yeah that works. But a couple of issues that I am facing here are:
1. If I call the system command in a for loop wherein I manipulate the values of startTime, stopTime and other variables, depending on the progression of loop, I don't understand how to store the values generated from various loops in a single output file. Could you please shed more light on that?
2. When overriding the start or stop time, if I use a variable to assign the start or stop time, the script generates an output csv file but the system doesn't simulate. The command looks like this:
Code:
system("./BouncingBall -override stopTime=myStop, outputFormat = csv");
In this case, myStop := 3 assignment has been done before the system command. If I instead use stopTime=3, the system seems to simulate.
Thank You.
Hi,
The spaces in code were a typo error. I apologize for that. Nevertheless, the problem arose because of not using './' before the name of executable. The script works fine now. I have been trying to save the output as a csv file instead of a mat file, so that I could open it in Excel. Could you suggest a way to do that?
Thank You.
Hi,
I have been trying to implement the first methodology that you suggested using a system call in a .mos file. But, the script returns a value of 127 which I guess represents failure, as success returns 0(according to OpenModelica.scripting documentation). I have attached a snippet of the script that I am using (assume that the model I am building is BouncingBall). My PC runs on Ubuntu. So, in the system command, I can't write BouncingBall.exe.
Also, in the second methodology that you had suggested, by own DASSL, do you mean from some other software or program or is there a way to access the solver directly from the scripting environment?
Code:
loadFile("/.../BouncingBall.mo");
buildModel(Bouncing Ball);
system("BouncingBall -override startTime = 2, stopTime = 10");
Thank You. Any help on this front would be greatly appreciated.
Hi,
Thank you for the reply. This question is part of a bigger problem that I am trying to solve. Please find a description of the problem below:
I am using DASSL solver to solve a DAE system in OpenModelica. Until now, I was using 'Simulation Setup' to modify the solver options like step size etc but it had little effect on the system because of the events involved. So, we are trying to give increasing time intervals to the solver, starting from a very low value (~ 1e-10). By time interval, I mean the difference between 'Start Time' and 'Stop Time' and not the step size that solver considers. So, I was thinking of a script which might look similar to the one below:
loadFile("name_of_model.mo");
my_start_time := 0;
my_stop_time := 1e-10;
for i in 1:33 loop
simulate(name_of_model, startTime = my_start_time, stopTime = my_stop_time, 'other options');
my_start_time := my_stop_time;
my_stop_time := 2*my_stop_time; // After every loop the start time is equated to the stop time of previous loop and the stop time is multiplied by a factor of 2 //
end for;
In essence, I am trying to call the solver multiple times, store the result after each loop and use this result as the initial condition for the next loop(the way it can be done in FORTRAN). So, if at all I need to use this methodology then I need an efficient way of storing the results and handling them.
This was an alternative that I could think of. Please let me know if there are any efficient ways of doing the same in OpenModelica, and if this methodology would work.
Thank You.
Hi,
I have been using OpenModelica to build a reactor model. I am simulating the system using a .mos script which loads and simulates the model. Could anyone please let me know if there are any scripting commands available to do file operations like opening an excel file, copying or extracting data from it?
Thank You.
Hi,
I am using OpenModelica to simulate a DAE system with 15 equations (5 differential and 10 algebraic). There is an equation with a square root term and so the argument should not turn negative. Therefore, I am using the noEvent() function to keep a check on the argument and accordingly change the expression if required. But, the argument turns negative as it does in the case where noEvent() function is not used. Please look below for a symbolic representation of the problem:
Left-hand expression = if noEvent(P > Pout) then sqrt(P - Pout) * (some constants) else (some expression)
Could somebody please help me out with this?
Thanks
- Index
- » Users
- » bhargava.nemmaru
- » Profile