openatc-components 0.1.64 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1066,26 +1066,27 @@ export default {
1066
1066
  },
1067
1067
  step2 (newArr, pattern) { // 不同环并发相位做比较
1068
1068
  let ret = []
1069
+ let max = 0
1069
1070
  const patternObj = {}
1070
1071
  pattern.forEach(l => {
1071
1072
  // if (l.mode !== 7) {
1072
1073
  patternObj[l.id] = l.value
1073
1074
  // }
1074
1075
  })
1075
- newArr.forEach((na, index) => {
1076
- if (!na || na.length === 0) return
1077
- let max = 0
1078
- na.forEach(n => {
1079
- const total = n.data.reduce((pre, cur) => pre + patternObj[cur], 0)
1080
- if (total > max) {
1081
- max = total
1076
+ let barrierCycle = newArr.map(item => {
1077
+ return Math.max.apply(Math, item.map(k => { return k.length }))
1078
+ })
1079
+ barrierCycle.forEach((b, index) => {
1080
+ if (index === 0) {
1081
+ ret.push(barrierCycle[index])
1082
+ } else {
1083
+ if (max) {
1084
+ max = barrierCycle[index] + max
1085
+ } else {
1086
+ max = barrierCycle[index] + barrierCycle[index - 1]
1082
1087
  }
1083
- })
1084
- while (index > 0 && max < this.newCycle) { // && max < _this.newCycle
1085
- index--
1086
- max += ret[index]
1088
+ ret.push(max)
1087
1089
  }
1088
- ret.push(max)
1089
1090
  })
1090
1091
  return ret
1091
1092
  },