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

Posts

Posts

Jun-30-20 12:28:08
Category: Programming

Thank you for the reply, resampling solved the issue

Jun-30-20 11:38:39
Category: Programming

I have a model that contains lots of events due to usage of 'if' command. The model runs as i expected but the problem is that the generated output data is unusable in anywhere else since it does not have fixed step time. I have tried the both cases in both csv and mat;

-Enable equidistant time grid, disable store variables at events: I am missing short on the some data points possible reason some events are coinciding with the desired step size.

-Enable both equidistant time grid and store variables at events: In this case i have way many data due to the events can happen between the desired time steps and post processing is not an option because there are multiples of data for some time points and they are not exact duplicates.

Is there a way to properly get output data with fixed step time when the model has many events like my model? (Such as how MATLAB provides the fixed step time results even tough solver is not fixed step timed one)

Oct-14-19 09:02:57
How to obtain smooth transition in the trapezoidal function
Category: Programming

I am building a BLDC motor model with 6-step drive. I am having numerical errors in the transitions due to trapezoidal back-emf functions. I tried to use smooth operator but that does not generate a continous differentiable intersections. Is there a way to obtain a trapezoidal shape that is differentiable even in the intersection points (given with a tolerance) to prevent numerical errors in the simulation?

My current shape functions;

Code:

function ShapeFunc

extends Modelica.Icons.Function;
input SI.Angle phi_e;
output Real y;
protected SI.Angle phi_e_wrapped;

algorithm
phi_e_wrapped := Modelica.Math.wrapAngle(phi_e,true) ;

y := smooth(1 ,if (phi_e_wrapped < 2*pi/3) then 1 else
     if (phi_e_wrapped < pi) then 1 - 6/pi*(phi_e_wrapped - 2*pi/3) else
     if (phi_e_wrapped < 5*pi/3) then -1 else
     if (phi_e_wrapped < 2*pi) then -1 + 6/pi*(phi_e_wrapped - 5*pi/3) else 0);

end ShapeFunc;

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