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

"force sweep"

"force sweep"

Just starting with modlica.
What to do to apply a force sweep to a model?
Just want to have a force with linear increasing frequency (constant amplitude) acting on a mass in a translatory machanical model.

What blocks do I have to use?

Re: "force sweep"

I didn't really find a sources that make this possible but you can try to make your own source:

just copy the code from Modelica.Blocks.Sources.Sine and add it into a new model
and then modify the code for example by adding the factor (time - startTime):

block Sine "Generate sine signal"
  parameter Real amplitude=1 "Amplitude of sine wave";
  parameter Modelica.SIunits.Frequency freqHz(start=1) "Frequency of sine wave";
  parameter Modelica.SIunits.Angle phase=0 "Phase of sine wave";
  parameter Real offset=0 "Offset of output signal";
  parameter Modelica.SIunits.Time startTime=0 "Output = offset for time < startTime";
  extends Modelica.Blocks.Interfaces.SO;
protected
  constant Real pi=Modelica.Constants.pi;
equation
// y=offset + (if time < startTime then 0 else amplitude*Modelica.Math.sin(2*pi*freqHz*(time - startTime) + phase));

y=offset + (if time < startTime then 0 else Modelica.Math.sin(2*pi*freqHz*(time - startTime)^2 + phase));
end Sine;

To use this as a force you can connect it to Modelica.Mechanics.Translational.Sources.Force

There are 0 guests and 0 other users also viewing this topic