pid_controller 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64075129161ab9782dc7fabaf471d096e75bf877
4
- data.tar.gz: db661feaafaa8af5d4ff1b4be7c76364e22064ab
3
+ metadata.gz: 64ecc7bf7935e8cc32a7a406336901a92604aebc
4
+ data.tar.gz: c49271b98e1befb819efccc1a7e90d6b8b48cb4b
5
5
  SHA512:
6
- metadata.gz: 2ee1c8f010b1e235aa883b1e33f6b4fce083c991f0e87614f12a6bf99892814cf8abd57e79165e87ca46c1d7093dc450fa94958aafc441cc894deb5b9212d8f5
7
- data.tar.gz: b4919aca65fd37811c77ccf6e7900f4fcd63d9241fd97885ae669480c5e584371761a6faf66d4c6c13458c1f62b9f71f350dde418a10939b06352da27ab73431
6
+ metadata.gz: 4fac26433f749c99c20233fafb6d865a7e43a4446bbbf18e8842d2d874816a2dc0e2682fc03a0325a5f335cfe3896d33d4b8f5d3b433057eb73fd396af2469e2
7
+ data.tar.gz: 346311b9cbe34e75e2e992ffa3eae936bca68b0c9d05cc23102dd3147c8156e92081621e7a94689c465ffa24606a97e01be2b597e6531bd4ade242f907b19c3c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pid_controller (0.2.0)
4
+ pid_controller (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # PidController
2
+
2
3
  [![Gem Version](https://badge.fury.io/rb/pid_controller.svg)](https://badge.fury.io/rb/pid_controller)
3
4
  [![Build Status](https://travis-ci.org/gabetax/pid_controller.svg?branch=master)](https://travis-ci.org/gabetax/pid_controller)
4
5
 
@@ -15,11 +16,18 @@ I mentioned databases, so here's an example of how we can prevent a low priority
15
16
 
16
17
  ```ruby
17
18
  sensor = MySQLSensor.new # Use your imagination
18
- controller = PIDController.new(setpoint: 60.0, kp: 5.0, ki: 1.0, kd: 0.1)
19
+ controller = PIDController.new(
20
+ setpoint: 60.0,
21
+ kp: 5.0,
22
+ ki: 1.0,
23
+ kd: 0.1,
24
+ output_max: 0.0,
25
+ integral_max: 0.0
26
+ )
19
27
 
20
28
  Event.where(account_id: account_id).in_batches do |relation|
21
29
  relation.delete_all
22
- backoff = controller << sensor.cpu_utilization
30
+ backoff = -1 * controller << sensor.cpu_utilization
23
31
  sleep backoff if backoff > 0
24
32
  end
25
33
  ```
@@ -28,8 +36,6 @@ end
28
36
 
29
37
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
38
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
39
  ## Contributing
34
40
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/gabetax/pid_controller.
41
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/gabetax/pid_controller.>
@@ -73,7 +73,7 @@ class PidController
73
73
  end
74
74
 
75
75
  def p_term
76
- kp * @last_error
76
+ kp * (@last_error || 0.0)
77
77
  end
78
78
 
79
79
  def i_term
@@ -1,3 +1,3 @@
1
1
  class PidController
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pid_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabe Martin-Dempesy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-29 00:00:00.000000000 Z
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler