Skip to content

Commit

Permalink
Use all currents in sampled data
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Sep 29, 2023
1 parent 7660dc9 commit 54408c0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
15 changes: 11 additions & 4 deletions pages/pagesampleddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void PageSampledData::timerSlot()
// Calculate current and voltages
QVector<double> curr1 = curr1Vector;
QVector<double> curr2 = curr2Vector;
QVector<double> curr3(size);
QVector<double> curr3 = curr3Vector;

QVector<double> ph1 = ph1Vector;
QVector<double> ph2 = ph2Vector;
Expand All @@ -235,8 +235,6 @@ void PageSampledData::timerSlot()
QVector<double> fSw = fSwVector;

for (int i=0;i < curr2.size(); i++) {
curr3[i] = -(curr1[i] + curr2[i]);

if (ui->truncateBox->isChecked()) {
if (!(position[i] == 1 || position[i] == 4)) {
ph1[i] = 0;
Expand Down Expand Up @@ -494,6 +492,13 @@ void PageSampledData::samplesReceived(QByteArray bytes)

tmpCurr1Vector.append(vb.vbPopFrontDouble32Auto());
tmpCurr2Vector.append(vb.vbPopFrontDouble32Auto());

if (vb.size() >= 30) {
tmpCurr3Vector.append(vb.vbPopFrontDouble32Auto());
} else {
tmpCurr3Vector.append(-(tmpCurr1Vector.last() + tmpCurr2Vector.last()));
}

tmpPh1Vector.append(vb.vbPopFrontDouble32Auto());
tmpPh2Vector.append(vb.vbPopFrontDouble32Auto());
tmpPh3Vector.append(vb.vbPopFrontDouble32Auto());
Expand All @@ -509,6 +514,7 @@ void PageSampledData::samplesReceived(QByteArray bytes)
if (tmpCurr1Vector.size() == mSamplesToWait) {
curr1Vector = tmpCurr1Vector;
curr2Vector = tmpCurr2Vector;
curr3Vector = tmpCurr3Vector;
ph1Vector = tmpPh1Vector;
ph2Vector = tmpPh2Vector;
ph3Vector = tmpPh3Vector;
Expand Down Expand Up @@ -640,6 +646,7 @@ void PageSampledData::clearBuffers()
mSampleInt = 0;
tmpCurr1Vector.clear();
tmpCurr2Vector.clear();
tmpCurr3Vector.clear();
tmpPh1Vector.clear();
tmpPh2Vector.clear();
tmpPh3Vector.clear();
Expand Down Expand Up @@ -716,7 +723,7 @@ void PageSampledData::on_saveDataButton_clicked()
stream << timeVec.at(i) << ";";
stream << curr1Vector.at(i) << ";";
stream << curr2Vector.at(i) << ";";
stream << -(curr1Vector.at(i) + curr2Vector.at(i)) << ";";
stream << curr3Vector.at(i) << ";";
stream << ph1Vector.at(i) << ";";
stream << ph2Vector.at(i) << ";";
stream << ph3Vector.at(i) << ";";
Expand Down
2 changes: 2 additions & 0 deletions pages/pagesampleddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private slots:

QVector<double> curr1Vector;
QVector<double> curr2Vector;
QVector<double> curr3Vector;
QVector<double> ph1Vector;
QVector<double> ph2Vector;
QVector<double> ph3Vector;
Expand All @@ -80,6 +81,7 @@ private slots:

QVector<double> tmpCurr1Vector;
QVector<double> tmpCurr2Vector;
QVector<double> tmpCurr3Vector;
QVector<double> tmpPh1Vector;
QVector<double> tmpPh2Vector;
QVector<double> tmpPh3Vector;
Expand Down
4 changes: 2 additions & 2 deletions pages/pagesampleddata.ui
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,13 @@
<string>Samp: </string>
</property>
<property name="maximum">
<number>2000</number>
<number>1600</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>1000</number>
<number>800</number>
</property>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions res/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Check if there are unsaved scripts before closing.
* Better lisp code read import handling.
* Added filter-box to example and recent lists in script editors.
* Limit output size in vesc and lbm terminal to prevent problems when printing too much.
* Use all 3 measured currents in sampled data instead of calculating one.

---

Expand Down

0 comments on commit 54408c0

Please sign in to comment.