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

Posts

Posts

Apr-13-21 15:12:25
Unable to export CSV from OpenModelica.

Hello guys,

I was runninng into a problem, where i could not export the CSV from a set of data, the values which were giving me a problem were those coming from a heat port connected to a Fxed temperature source. I am not sure why this was the case. I should see only a steady value, instead i am unable to export the CSV. If i unselect this port then i can export the rest of the data that i wished to plot.

Issue with version 1.14

Mar-31-21 14:53:10
I am trying to summ the first 100 values of a fourier function
Category: Programming

Just an update, thanks sjoelund.se, the advice helped. The code runs just fine now. I am placing the updated code here so it may help others who have the same question.

model sample1
parameter Real x[5] = 1:5;
extends Modelica.Constants;
Modelica.SIunits.Length L = 2;
Real y[5];
Real p[5];
Real u[5];
Real z;
Real t = time;
equation
u = (x.*pi)./L;
p = ((e.^(-1.*((u).^2).*t).-1)./x.^3);
y = L * pi * x;
z = sum(y);
end sample1;

Mar-30-21 10:47:47
I am trying to summ the first 100 values of a fourier function
Category: Programming

Thank you again for your feedback. I have another question. I updated the code to try to get the following to work. However, i keep getting an error in variable "u". Open Modelica tells me that this cannot be solved bcause the operation is of integer type. Any help will be appreciated thank you.

model sample1
parameter Real x[5] = 1:5;
extends Modelica.Constants;
Modelica.SIunits.Length L = 2;
Real y[5];
Real p[5];
Real u[5];
Real z;
equation
u = x*pi/L;
p = ((e^(-1*((u)^2)*t)-1)/x^3); /*/here i have a problem where u cannot be solved because it is of type integer? But i am not sure what it should be then /*/ 
u =x*pi/L;
y = L * pi * x;
z = sum(y);
end sample1;

Mar-30-21 09:16:57
I am trying to summ the first 100 values of a fourier function
Category: Programming

Adrpo,

Thank you so much, that worked!!  current/big_smile

Mar-29-21 16:01:30
I am trying to summ the first 100 values of a fourier function
Category: Programming

I am currently trying to get sum up the first 100 values of a fourier function. I wrote an OpenModelica program to help. But for some reason i am unable to get the program top work. If someone could help that would be greatly appreaciate it. This is what i wrote just an an example.

model sample1
Real x[5] = 1:5; //So this line should create a file column 1 row array. from 1,2,3,4,5
Real p=5;
Real y[5]; // here i am telling OpenModelica that this y-array is also 5 columns wide
//parameter Real z;
equation
y = p * x; // here i should multiply the array by the the real value, unfortunatelly this is not happening, in fact the code is not working it all.
z = sum(y); //here i should be able to add the all of the columns of y-array to get my sum.
end sample1;

I know i am making a dumb mistake somewhere, but after looking online and trying in vain to figure it out by myself, i am finally reaching out to hopefully get some help.

Thanks.

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