Skip to content
Snippets Groups Projects
Commit 0b5f299d authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Update index.md

parent e9e18e9c
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -22,12 +22,16 @@ to get the latest release. ...@@ -22,12 +22,16 @@ to get the latest release.
2. Install LabProcesses.jl using command `Pkg.clone("https://gitlab.control.lth.se/processes/LabProcesses.jl.git")` Lots of packages will now be installed, this will take some time. If this is your first time using Julia, you might have to run `julia> Pkg.init()` before you install any packages. 2. Install LabProcesses.jl using command `Pkg.clone("https://gitlab.control.lth.se/processes/LabProcesses.jl.git")` Lots of packages will now be installed, this will take some time. If this is your first time using Julia, you might have to run `julia> Pkg.init()` before you install any packages.
# How to implement a new process # How to implement a new process
1. Locate the file [interface.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface.jl). When the package is installed, you find its directory under `~/.julia/v0.6/LabProcesses/`, if not, run `julia> Pkg.dir("LabProcesses")` to locate the directory. ### 1.
Locate the file [interface.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface.jl). When the package is installed, you find its directory under `~/.julia/v0.6/LabProcesses/`, if not, run `julia> Pkg.dir("LabProcesses")` to locate the directory.
(Alternatively, you can copy all definitions from [/interface_implementations/ballandbeam.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_implementations/ballandbeam.jl) instead. Maybe it's easier to work from an existing implementaiton.) (Alternatively, you can copy all definitions from [/interface_implementations/ballandbeam.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_implementations/ballandbeam.jl) instead. Maybe it's easier to work from an existing implementaiton.)
2. Copy all function definitions. ### 2.
3. Create a new file under `/interface_implementations` where you paste all the Copy all function definitions.
### 3.
Create a new file under `/interface_implementations` where you paste all the
copied definitions and implement them. See [/interface_implementations/ballandbeam.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_implementations/ballandbeam.jl) for an example. copied definitions and implement them. See [/interface_implementations/ballandbeam.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_implementations/ballandbeam.jl) for an example.
4. Above all function implementations you must define the process type, e.g, ### 4.
Above all function implementations you must define the process type, e.g,
```julia ```julia
struct BallAndBeam <: PhysicalProcess struct BallAndBeam <: PhysicalProcess
h::Float64 h::Float64
...@@ -42,7 +46,8 @@ have different biases, hence this must be stored. A simulated process would have ...@@ -42,7 +46,8 @@ have different biases, hence this must be stored. A simulated process would have
to keep track of its state etc. in order to implement the measure and control to keep track of its state etc. in order to implement the measure and control
methods. See [Types in julia documentation](https://docs.julialang.org/en/stable/manual/types/#Composite-Types-1) methods. See [Types in julia documentation](https://docs.julialang.org/en/stable/manual/types/#Composite-Types-1)
for additional info regarding user defined types and (constructors)[https://docs.julialang.org/en/stable/manual/constructors/]. for additional info regarding user defined types and (constructors)[https://docs.julialang.org/en/stable/manual/constructors/].
5. Documentation of all interface functions is available in the file [interface_documentation.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_documentation.jl) ### 5.
Documentation of all interface functions is available in the file [interface_documentation.jl](https://gitlab.control.lth.se/processes/LabProcesses.jl/blob/master/src/interface_documentation.jl)
# How to control a process # How to control a process
The interface `AbstractProcess` defines the functions `control(P, u)` and `measure(P)`. The interface `AbstractProcess` defines the functions `control(P, u)` and `measure(P)`.
...@@ -150,12 +155,8 @@ the user is unsure about a reasonable value. ...@@ -150,12 +155,8 @@ the user is unsure about a reasonable value.
## Non-linear process ## Non-linear process
Your first option is to linearize the process and proceed like above. Your first option is to linearize the process and proceed like above.
Other options include Other options include
1. Make `control` perform forward Euler, i.e., `x' = f(x,u)*h` for a general 1. Make `control` perform forward Euler, i.e., `x[t+1] = x[t] + f(x[t],u[t])*h` for a general system model ``x' = f(x,u); y = g(x,u)`` and sample time ``h``.
system model ``x' = f(x,u); y = g(x,u)`` and sample time ``h``. 2. Integrate the system model using some fancy method like Runge-Kutta. See [DifferentialEquations.jl](http://docs.juliadiffeq.org/stable/types/discrete_types.html) for discrete-time solving of ODEs (don't be discouraged, this is almost as simple as forward Euler above).
2. Integrate the system model using some fancy method like Runge-Kutta. See
[DifferentialEquations.jl](http://docs.juliadiffeq.org/stable/types/discrete_types.html)
for discrete-time solving of ODEs (don't be discouraged, this is almost as simple as
forward Euler above).
# Exported functions and types # Exported functions and types
```@autodocs ```@autodocs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment