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

Variing simulation time causes different simulation results

Variing simulation time causes different simulation results

Hello everybody,

I've modeled the effect of regenerative chatter with OpenModelica. As I simulated the model and variied the simulation run time (For example time = 1 and time = 10, I get different simulation results. What's the reason for this effect and how can I get stabile simultaion results?

I've copied the model from the Program.

Thank you very much.

class Regenerativeffekt_mechanisch
  parameter Real mass1.L(quantity = "Length", unit = "m", start = 0.0) = 0.0 "Length of component, from left flange to right flange (= flange_b.s - flange_a.s)";
  Real mass1.flange_a.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real mass1.flange_a.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real mass1.flange_b.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real mass1.flange_b.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  parameter Real mass1.m(quantity = "Mass", unit = "kg", min = 0.0, start = 1.0) = 0.0479 "Mass of the sliding mass";
  parameter enumeration(never, avoid, default, prefer, always) mass1.stateSelect = StateSelect.default "Priority to use s and v as states";
  Real mass1.a(quantity = "Acceleration", unit = "m/s2", start = 0.0) "Absolute acceleration of component";
  Real mass1.s(quantity = "Length", unit = "m", start = 0.0, stateSelect = StateSelect.default) "Absolute position of center of component (s = flange_a.s + L/2 = flange_b.s - L/2)";
  Real mass1.v(quantity = "Velocity", unit = "m/s", start = 0.0, stateSelect = StateSelect.default) "Absolute velocity of component";
  parameter enumeration(never, avoid, default, prefer, always) springdamper1.stateSelect = StateSelect.prefer "Priority to use phi_rel and w_rel as states";
  parameter Real springdamper1.s_nominal(quantity = "Length", unit = "m", min = 0.0) = 0.0001 "Nominal value of s_rel (used for scaling)";
  Real springdamper1.f(quantity = "Force", unit = "N") "Forces between flanges (= flange_b.f)";
  Real springdamper1.flange_a.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real springdamper1.flange_a.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real springdamper1.flange_b.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real springdamper1.flange_b.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  parameter Boolean springdamper1.useHeatPort = false "=true, if heatPort is enabled";
  Real springdamper1.lossPower(quantity = "Power", unit = "W") "Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
  parameter Real springdamper1.c(quantity = "TranslationalSpringConstant", unit = "N/m", min = 0.0, start = 1.0) = 9670000.0 "Spring constant";
  parameter Real springdamper1.d(quantity = "TranslationalDampingConstant", unit = "N.s/m", min = 0.0, start = 1.0) = 15.197 "Damping constant";
  parameter Real springdamper1.s_rel0(quantity = "Length", unit = "m") = 0.0 "Unstretched spring length";
  protected Real springdamper1.f_c(quantity = "Force", unit = "N") "Spring force";
  protected Real springdamper1.f_d(quantity = "Force", unit = "N") "Damping force";
  Real springdamper1.v_rel(quantity = "Velocity", unit = "m/s", start = 0.0, stateSelect = StateSelect.prefer) "Relative velocity (= der(s_rel))";
  Real springdamper1.s_rel(quantity = "Length", unit = "m", start = 0.0, nominal = springdamper1.s_nominal, stateSelect = StateSelect.prefer) "Relative distance (= flange_b.s - flange_a.s)";
  parameter Real add31.k1 = -1.0 "Gain of upper input";
  parameter Real add31.k2 = 1.0 "Gain of middle input";
  parameter Real add31.k3 = 1.0 "Gain of lower input";
  input Real add31.u1 "Connector 1 of Real input signals";
  input Real add31.u2 "Connector 2 of Real input signals";
  input Real add31.u3 "Connector 3 of Real input signals";
  output Real add31.y "Connector of Real output signals";
  parameter Boolean force1.useSupport = false "= true, if support flange enabled, otherwise implicitly grounded";
  Real force1.s(quantity = "Length", unit = "m") "Distance between flange and support (= flange.s - support.s)";
  Real force1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real force1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  protected Real force1.s_support(quantity = "Length", unit = "m") "Absolute position of support flange";
  input Real force1.f(unit = "N") "Driving force as input signal";
  final parameter Real k_cb.k(unit = "1", start = 1.0) = 1000.0 "Gain value multiplied with input signal";
  final input Real k_cb.u "Input signal connector";
  final output Real k_cb.y "Output signal connector";
  final parameter Real Spanungsbreite_b.k(unit = "1", start = 1.0) = 0.2 "Gain value multiplied with input signal";
  final input Real Spanungsbreite_b.u "Input signal connector";
  final output Real Spanungsbreite_b.y "Output signal connector";
  parameter input Real fixed1.s0(quantity = "Length", unit = "m") = 0.0 "Fixed offset position of housing";
  input Real fixed1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  input Real fixed1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real speedsensor1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real speedsensor1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real speedsensor1.v(unit = "m/s") "Absolute velocity of flange as output signal";
  Real forcesensor1.flange_a.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real forcesensor1.flange_a.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real forcesensor1.flange_b.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real forcesensor1.flange_b.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real forcesensor1.f(unit = "N") "Force in flange_a and flange_b (f = flange_a.f = -flange_b.f) as output signal";
  Real accsensor1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real accsensor1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real accsensor1.v(quantity = "Velocity", unit = "m/s") "Absolute velocity of flange";
  output Real accsensor1.a(unit = "m/s2") "Absolute acceleration of flange as output signal";
  Real RegEffekt_positionsensor1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real RegEffekt_positionsensor1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real RegEffekt_positionsensor1.s(unit = "m") "Absolute position of flange as output signal";
  Real relpositionsensor1.flange_a.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real relpositionsensor1.flange_a.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  Real relpositionsensor1.flange_b.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real relpositionsensor1.flange_b.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real relpositionsensor1.s_rel(unit = "m") "Distance between two flanges (= flange_b.s - flange_a.s) as output signal";
  final output Real Vorschub_f.y = 0.0765 "Value of Real output";
  Real positionsensor1.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real positionsensor1.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real positionsensor1.s(unit = "m") "Absolute position of flange as output signal";
  input Real fixeddelay1.u "Connector of Real input signal";
  output Real fixeddelay1.y "Connector of Real output signal";
  parameter Real fixeddelay1.delayTime(quantity = "Time", unit = "s", start = 1.0) = 0.00377 "Delay time of output with respect to input signal";
  Real positionsensor2.flange.s(quantity = "Length", unit = "m") "Absolute position of flange";
  Real positionsensor2.flange.f(quantity = "Force", unit = "N") "Cut force directed into flange";
  output Real positionsensor2.s(unit = "m") "Absolute position of flange as output signal";
  parameter Real gain2.k(unit = "1", start = 1.0) = 1000.0 "Gain value multiplied with input signal";
  input Real gain2.u "Input signal connector";
  output Real gain2.y "Output signal connector";
  parameter Real gain1.k(unit = "1", start = 1.0) = 1000.0 "Gain value multiplied with input signal";
  input Real gain1.u "Input signal connector";
  output Real gain1.y "Output signal connector";
equation
  mass1.v = der(mass1.s);
  mass1.a = der(mass1.v);
  mass1.m * mass1.a = mass1.flange_a.f + mass1.flange_b.f;
  mass1.flange_a.s = mass1.s + (-mass1.L) / 2.0;
  mass1.flange_b.s = mass1.s + mass1.L / 2.0;
  springdamper1.f_c = springdamper1.c * (springdamper1.s_rel - springdamper1.s_rel0);
  springdamper1.f_d = springdamper1.d * springdamper1.v_rel;
  springdamper1.f = springdamper1.f_c + springdamper1.f_d;
  springdamper1.lossPower = springdamper1.f_d * springdamper1.v_rel;
  springdamper1.s_rel = springdamper1.flange_b.s - springdamper1.flange_a.s;
  springdamper1.v_rel = der(springdamper1.s_rel);
  springdamper1.flange_b.f = springdamper1.f;
  springdamper1.flange_a.f = -springdamper1.f;
  add31.y = add31.k1 * add31.u1 + add31.k2 * add31.u2 + add31.k3 * add31.u3;
  force1.flange.f = -force1.f;
  force1.s = force1.flange.s - force1.s_support;
  force1.s_support = 0.0;
  k_cb.y = k_cb.k * k_cb.u;
  Spanungsbreite_b.y = Spanungsbreite_b.k * Spanungsbreite_b.u;
  fixed1.flange.s = fixed1.s0;
  speedsensor1.v = der(speedsensor1.flange.s);
  0.0 = speedsensor1.flange.f;
  forcesensor1.flange_a.s = forcesensor1.flange_b.s;
  forcesensor1.flange_a.f = forcesensor1.f;
  0.0 = forcesensor1.flange_a.f + forcesensor1.flange_b.f;
  accsensor1.v = der(accsensor1.flange.s);
  accsensor1.a = der(accsensor1.v);
  0.0 = accsensor1.flange.f;
  RegEffekt_positionsensor1.s = RegEffekt_positionsensor1.flange.s;
  0.0 = RegEffekt_positionsensor1.flange.f;
  relpositionsensor1.s_rel = relpositionsensor1.flange_b.s - relpositionsensor1.flange_a.s;
  0.0 = relpositionsensor1.flange_a.f;
  0.0 = relpositionsensor1.flange_a.f + relpositionsensor1.flange_b.f;
  positionsensor1.s = positionsensor1.flange.s;
  0.0 = positionsensor1.flange.f;
  fixeddelay1.y = delay(fixeddelay1.u, fixeddelay1.delayTime, fixeddelay1.delayTime);
  positionsensor2.s = positionsensor2.flange.s;
  0.0 = positionsensor2.flange.f;
  gain2.y = gain2.k * gain2.u;
  gain1.y = gain1.k * gain1.u;
  mass1.flange_a.f + force1.flange.f + speedsensor1.flange.f + forcesensor1.flange_a.f + accsensor1.flange.f + RegEffekt_positionsensor1.flange.f + relpositionsensor1.flange_a.f + positionsensor2.flange.f = 0.0;
  mass1.flange_b.f + springdamper1.flange_a.f = 0.0;
  springdamper1.flange_b.f + fixed1.flange.f + relpositionsensor1.flange_b.f + positionsensor1.flange.f = 0.0;
  forcesensor1.flange_b.f = 0.0;
  add31.u1 = gain2.y;
  gain1.u = positionsensor2.s;
  fixeddelay1.u = gain1.y;
  RegEffekt_positionsensor1.s = gain2.u;
  RegEffekt_positionsensor1.flange.s = accsensor1.flange.s;
  RegEffekt_positionsensor1.flange.s = force1.flange.s;
  RegEffekt_positionsensor1.flange.s = forcesensor1.flange_a.s;
  RegEffekt_positionsensor1.flange.s = mass1.flange_a.s;
  RegEffekt_positionsensor1.flange.s = positionsensor2.flange.s;
  RegEffekt_positionsensor1.flange.s = relpositionsensor1.flange_a.s;
  RegEffekt_positionsensor1.flange.s = speedsensor1.flange.s;
  add31.u2 = fixeddelay1.y;
  fixed1.flange.s = positionsensor1.flange.s;
  fixed1.flange.s = relpositionsensor1.flange_b.s;
  fixed1.flange.s = springdamper1.flange_b.s;
  Vorschub_f.y = add31.u3;
  Spanungsbreite_b.y = force1.f;
  Spanungsbreite_b.u = k_cb.y;
  add31.y = k_cb.u;
  mass1.flange_b.s = springdamper1.flange_a.s;
end Regenerativeffekt_mechanisch;

There are 0 guests and 0 other users also viewing this topic
You are here: