잘못된 수식 수정
This commit is contained in:
parent
3ee073d1d0
commit
a4bd4bc22f
11
main.go
11
main.go
|
@ -135,8 +135,8 @@ func CpuTempetureScraper(processorCount int, notifier <-chan TempetureChange, er
|
||||||
P, I, D = 1.5, 0.4, 2.0
|
P, I, D = 1.5, 0.4, 2.0
|
||||||
SetPoint = 40.0
|
SetPoint = 40.0
|
||||||
SampleTime = time.Second
|
SampleTime = time.Second
|
||||||
WindupGuard = 96.0
|
|
||||||
maxNoob, minNoob = 0x64, 0x4
|
maxNoob, minNoob = 0x64, 0x4
|
||||||
|
WindupGuard = float64(maxNoob - minNoob)
|
||||||
)
|
)
|
||||||
noobs := make([]int, processorCount)
|
noobs := make([]int, processorCount)
|
||||||
controllers := make([]pid.Controller, 0, processorCount)
|
controllers := make([]pid.Controller, 0, processorCount)
|
||||||
|
@ -152,13 +152,12 @@ func CpuTempetureScraper(processorCount int, notifier <-chan TempetureChange, er
|
||||||
select {
|
select {
|
||||||
case change := <-notifier:
|
case change := <-notifier:
|
||||||
controller := controllers[change.Id]
|
controller := controllers[change.Id]
|
||||||
resp := controller.Update(change.Tempeture)
|
adj_noob := int(-controller.Update(change.Tempeture))
|
||||||
|
if adj_noob < minNoob {
|
||||||
adj_noob := -int(resp) + minNoob
|
adj_noob = minNoob
|
||||||
if adj_noob > maxNoob {
|
} else if adj_noob > maxNoob {
|
||||||
adj_noob = maxNoob
|
adj_noob = maxNoob
|
||||||
}
|
}
|
||||||
|
|
||||||
if noobs[change.Id] == adj_noob {
|
if noobs[change.Id] == adj_noob {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
16
test/test.go
16
test/test.go
|
@ -22,20 +22,20 @@ func test_pid(P float64, I float64, D float64, L int) {
|
||||||
|
|
||||||
for i := 0; i < END; i++ {
|
for i := 0; i < END; i++ {
|
||||||
output := pid.Update((feedback * 1000.0) / 1000.0)
|
output := pid.Update((feedback * 1000.0) / 1000.0)
|
||||||
adj := output
|
adj := -output
|
||||||
if output > 0 {
|
if adj < 4.0 {
|
||||||
adj = 0.0
|
adj = 4.0
|
||||||
} else if output < -96.0 {
|
} else if adj > 100.0 {
|
||||||
adj = -96.0
|
adj = 100.0
|
||||||
}
|
}
|
||||||
|
|
||||||
adj_noob := int(-adj + 4)
|
adj_noob := int(adj)
|
||||||
|
|
||||||
adj /= 10.0
|
adj /= 10.0
|
||||||
adj += 1.1
|
adj -= 1.1
|
||||||
fmt.Printf("feedback: %0.17f output: %0.17f adj: %0.17f noob: 0x%x\n", feedback, output, adj, adj_noob)
|
fmt.Printf("feedback: %0.17f output: %0.17f adj: %0.17f noob: 0x%x\n", feedback, output, adj, adj_noob)
|
||||||
|
|
||||||
feedback += adj
|
feedback -= adj
|
||||||
|
|
||||||
if feedback < minTemp {
|
if feedback < minTemp {
|
||||||
feedback = minTemp
|
feedback = minTemp
|
||||||
|
|
Loading…
Reference in New Issue