|
@@ -0,0 +1,18 @@
|
|
|
+model power_window
|
|
|
+ parameter Real torque_w = 2;
|
|
|
+ parameter Real mass_w = 10;
|
|
|
+ parameter Real friction_w = 10;
|
|
|
+ parameter Real height_o = 0.4;
|
|
|
+ parameter Real stiffness_o = 1000;
|
|
|
+ parameter Real friction_o = 1000;
|
|
|
+ // Set 1.0 to enable object force.
|
|
|
+ parameter Real enable_o = 1.0;
|
|
|
+ Real height_w(start = 0);
|
|
|
+ Real velocity_w(start = 0);
|
|
|
+ Real force_o;
|
|
|
+equation
|
|
|
+ der(height_w) = velocity_w;
|
|
|
+ mass_w * der(velocity_w) = torque_w - friction_w * velocity_w + enable_o * force_o;
|
|
|
+ force_o = if height_w > height_o then (-friction_o * velocity_w) - stiffness_o * (height_w - height_o) else 0;
|
|
|
+ annotation(experiment(StartTime = 0, StopTime = 4, Tolerance = 1e-06, Interval = 0.008));
|
|
|
+end power_window;
|