Closed hzgzh closed 4 years ago
Thank you for filing this issue @hzgzh
I included Differentiator
and Integrator
components to Jusdl
. Here are the examples.
using Jusdl
using Plots
model = Model(clock=Clock(0, 0.01, 4π)) addnode!(model, FunctionGenerator(t -> sin(t)), label=:gen) addnode!(model, Differentiator(), label=:dif) addnode!(model, Writer(Inport(2)), label=:writer) addbranch!(model, :gen => :dif, 1 => 1) addbranch!(model, :gen => :writer, 1 => 1) addbranch!(model, :dif => :writer, 1 => 2) simulate!(model)
t, x = read(getnode(model, :writer).component) scatter(t, x[:, 1], markersize=2, label=:gen) scatter!(t, x[:, 2], markersize=2, label=:dif)
![diff](https://user-images.githubusercontent.com/24751240/81756983-0239cf80-94c6-11ea-80a6-e3c7a5869386.png)
* Integration
```julia
using Jusdl
using Plots
model = Model(clock=Clock(0, 0.001, 4))
addnode!(model, FunctionGenerator(t -> 2 * t), label=:gen)
addnode!(model, Integrator(), label=:integ)
addnode!(model, Writer(Inport(2)), label=:writer)
addbranch!(model, :gen => :integ, 1 => 1)
addbranch!(model, :gen => :writer, 1 => 1)
addbranch!(model, :integ => :writer, 1 => 2)
simulate!(model)
t, x = read(getnode(model, :writer).component)
scatter(t, x[:, 1], markersize=2, label=:gen)
scatter!(t, x[:, 2], markersize=2, label=:integ)
Remainder : Do not forget to check out the master branch for the updates!
] add Jusdl#master
I will also include a complete PID controller example to the docs. So, thank you for your contribution by opening this issue.
It's work.thank very much,wish this software can instead simulink.
don't know how to represent the differential part of pid algorithm,how to differential the input, can the author give some example