Commit 20fed3bd authored by Ibrahim Ahmed's avatar Ibrahim Ahmed
Browse files

modelica kernel working

parents
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
%% Cell type:markdown id: tags:

# Modelica x Jupyter

These cells contain modelica code that can be run via Jupyter.

To install:

* Install OpenModelica
* Install Anaconda
* Create environment in `env.yml`

```
    conda env create -f env.yml
```

%% Cell type:code id: tags:

``` OpenModelica
class Pendulum "Planar Pendulum"
   constant Real PI=3.141592653589793;
   parameter Real m=1, g=9.81, L=0.5;
   Real F;
   output Real x(start=0.5),y(start=0);
   output Real vx,vy;
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;
end Pendulum;
```

%% Cell type:code id: tags:

``` OpenModelica
simulate(Pendulum)
```

%% Cell type:code id: tags:

``` OpenModelica
plot(der(x),der(y),m)
```

README.md

0 → 100644
+13 −0
Original line number Diff line number Diff line
# Modelica x Jupyter

These cells contain modelica code that can be run via Jupyter.

To install:

* Install OpenModelica
* Install Anaconda
* Create environment in `env.yml`

```
    conda env create -f env.yml
```
 No newline at end of file

env.yml

0 → 100644
+14 −0
Original line number Diff line number Diff line
name: modelica
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.7
  - scipy
  - matplotlib
  - pyfmi
  - jupyter
  - pip
    - https://github.com/OpenModelica/OMPython/archive/v3.0.3.zip
    - https://github.com/OpenModelica/jupyter-openmodelica/archive/5b90c36f65913e02b5c26757f5babae1f7c5c245.zip