Commit 41388b83 authored by hazrmard's avatar hazrmard
Browse files

added modelica spring example, powershell clearfiles script

parent 7a59293a
*.ini
*.mat
*.o
*.libs
*.log
*.makefile
*.c
*.h
*.xml
*.exe
*_info.json
.ipynb_checkpoints/
......@@ -15,22 +15,22 @@
```
%% Cell type:code id: tags:
``` OpenModelica
class Pendulum "Planar Pendulum"
class Pendulum "Pendulum"
constant Real PI=3.141592653589793;
parameter Real m=1, g=9.81, L=0.5;
Real F;
Real F; // External force tengential to motion
output Real x(start=0.5),y(start=0);
output Real vx,vy;
output Real vx,vy; // x and y velocities
equation
m*der(vx)=-(x/L)*F;
m*der(vy)=-(y/L)*F-m*g;
der(x)=vx;
der(y)=vy;
x^2+y^2=L^2;
m*der(vx)=-(x/L)*F; // Force equation in x direction
m*der(vy)=-(y/L)*F-m*g; // Force equation in y direction
der(x)=vx; // Relating x position to x velocity
der(y)=vy; // Relating y position to y velocity
x^2+y^2=L^2; // Constraining x, y to string length
end Pendulum;
```
%% Cell type:code id: tags:
......@@ -41,5 +41,31 @@
%% Cell type:code id: tags:
``` OpenModelica
plot(der(x),der(y),m)
```
%% Cell type:code id: tags:
``` OpenModelica
class Spring "Damped Spring"
// mass, gravity, spring constant, air, contact resistance
parameter Real m=0.5, g=9.81, k=3, r_a=0.1, r_c=0.0;
output Real x(start=0.0); // x position
output Real vx(start=0.2); // x velocity
equation
m*der(vx)= -k*x - r_a*vx - r_c*m*g; // force equation
der(x)=vx; // relating position to velocity
end Spring;
```
%% Cell type:code id: tags:
``` OpenModelica
simulate(Spring)
```
%% Cell type:code id: tags:
``` OpenModelica
plot(der(x), x)
```
......
......@@ -10,4 +10,6 @@ To install:
```
conda env create -f env.yml
```
\ No newline at end of file
```
On Windows, set the environment variable `OPENMODELICAHOME` to point to the installation directory for OpenModelica.
\ No newline at end of file
rm *.o
rm *.libs
rm *.log
rm *.makefile
rm *.c
rm *.h
rm *.xml
rm *.exe
rm *_info.json
rm dygraph-combined.js
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment