Browse Source

power window model with object

Cláudio Gomes 8 years ago
parent
commit
f578fec7b5
2 changed files with 18 additions and 1 deletions
  1. 0 1
      .gitignore
  2. 18 0
      debugging_fsa_cbd_composition/fsa_cbd_simulator/models/power_window.mo

+ 0 - 1
.gitignore

@@ -46,7 +46,6 @@ coverage.xml
 *,cover
 
 # Translations
-*.mo
 *.pot
 
 # Django stuff:

+ 18 - 0
debugging_fsa_cbd_composition/fsa_cbd_simulator/models/power_window.mo

@@ -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;