Skip to content

Commit b2ab48d

Browse files
committed
Fixe problem with hamornics view
1 parent 4a97d00 commit b2ab48d

3 files changed

Lines changed: 81 additions & 69 deletions

File tree

src/components/Toolbox/OperatingPoints.vue

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -71,67 +71,69 @@ export default {
7171
excitationSelectorDisabled() {
7272
return this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.Manual && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.CircuitSimulatorImport && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.HarmonicsList;
7373
},
74-
canContinue() {
75-
var allSet = true;
76-
77-
if (this.$stateStore.hasCurrentApplicationMirroredWindings()) {
78-
for (var operatingPointIndex = 0; operatingPointIndex < this.masStore.mas.inputs.operatingPoints.length; operatingPointIndex++) {
79-
for (var windingIndex = 0; windingIndex < this.masStore.mas.magnetic.coil.functionalDescription.length; windingIndex++) {
80-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex] = this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex];
81-
}
82-
}
83-
}
84-
85-
this.errorMessages = "";
86-
for (var operatingPointIndex = 0; operatingPointIndex < this.masStore.mas.inputs.operatingPoints.length; operatingPointIndex++) {
87-
if (this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.Manual && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.CircuitSimulatorImport && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.HarmonicsList) {
88-
allSet = false;
89-
}
90-
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex] == null) {
91-
allSet = false;
92-
this.errorMessages += "Operating point with index " + operatingPointIndex + " is totally empty.\n"
93-
}
94-
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding == null) {
95-
allSet = false;
96-
this.errorMessages += "Operating point " + this.masStore.mas.inputs.operatingPoints[operatingPointIndex].name + " has no windings defined.\n"
97-
}
98-
99-
for (var windingIndex = 0; windingIndex < this.masStore.mas.magnetic.coil.functionalDescription.length; windingIndex++) {
100-
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex] == null ||
101-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current == null ||
102-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.waveform == null ||
103-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.processed == null ||
104-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.harmonics == null ||
105-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage == null ||
106-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.waveform == null ||
107-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.processed == null ||
108-
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.harmonics == null) {
109-
this.errorMessages += "Missing waveforms for winding " + this.masStore.mas.magnetic.coil.functionalDescription[windingIndex].name + " in operating point " + this.masStore.mas.inputs.operatingPoints[operatingPointIndex].name + ".\n"
110-
allSet = false;
111-
}
112-
}
113-
}
114-
return allSet;
115-
}
116-
},
117-
created () {
118-
74+
canContinue() {
75+
var allSet = true;
76+
77+
if (this.$stateStore.hasCurrentApplicationMirroredWindings()) {
78+
for (var operatingPointIndex = 0; operatingPointIndex < this.masStore.mas.inputs.operatingPoints.length; operatingPointIndex++) {
79+
for (var windingIndex = 0; windingIndex < this.masStore.mas.magnetic.coil.functionalDescription.length; windingIndex++) {
80+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex] = this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex];
81+
}
82+
}
83+
}
84+
85+
this.errorMessages = "";
86+
for (var operatingPointIndex = 0; operatingPointIndex < this.masStore.mas.inputs.operatingPoints.length; operatingPointIndex++) {
87+
if (this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.Manual && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.CircuitSimulatorImport && this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] !== this.$stateStore.OperatingPointsMode.HarmonicsList) {
88+
allSet = false;
89+
}
90+
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex] == null) {
91+
allSet = false;
92+
this.errorMessages += "Operating point with index " + operatingPointIndex + " is totally empty.\n"
93+
}
94+
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding == null) {
95+
allSet = false;
96+
this.errorMessages += "Operating point " + this.masStore.mas.inputs.operatingPoints[operatingPointIndex].name + " has no windings defined.\n"
97+
}
98+
99+
for (var windingIndex = 0; windingIndex < this.masStore.mas.magnetic.coil.functionalDescription.length; windingIndex++) {
100+
if (this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex] == null ||
101+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current == null ||
102+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.waveform == null ||
103+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.processed == null ||
104+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].current.harmonics == null ||
105+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage == null ||
106+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.waveform == null ||
107+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.processed == null ||
108+
this.masStore.mas.inputs.operatingPoints[operatingPointIndex].excitationsPerWinding[windingIndex].voltage.harmonics == null) {
109+
this.errorMessages += "Missing waveforms for winding " + this.masStore.mas.magnetic.coil.functionalDescription[windingIndex].name + " in operating point " + this.masStore.mas.inputs.operatingPoints[operatingPointIndex].name + ".\n"
110+
allSet = false;
111+
}
112+
}
113+
}
114+
return allSet;
115+
}
119116
},
120-
mounted () {
121-
122-
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding.length > 0) {
123-
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed == null || Object.keys(this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed).length === 0){
124-
this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed = deepCopy(defaultOperatingPointExcitation.current.processed)
125-
}
126-
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed == null || Object.keys(this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed).length === 0){
127-
this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed = deepCopy(defaultOperatingPointExcitation.voltage.processed)
128-
}
129-
}
130-
this.$emit("canContinue", this.canContinue);
131-
132-
if (!this.canContinue) {
133-
this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] = this.defaultMode
134-
}
117+
created () {
118+
119+
},
120+
mounted () {
121+
122+
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding.length > 0) {
123+
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed == null || Object.keys(this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed).length === 0){
124+
this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.processed = deepCopy(defaultOperatingPointExcitation.current.processed)
125+
}
126+
if (this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed == null || Object.keys(this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed).length === 0){
127+
this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.processed = deepCopy(defaultOperatingPointExcitation.voltage.processed)
128+
}
129+
}
130+
this.$emit("canContinue", this.canContinue);
131+
132+
// Only set default mode if no mode is currently selected
133+
// Don't reset user-selected modes when navigating back from magnetic builder
134+
if (this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] == null) {
135+
this.$stateStore.operatingPoints.modePerPoint[this.currentOperatingPointIndex] = this.defaultMode
136+
}
135137
136138
this.masStore.$onAction((action) => {
137139
if (action.name == "updatedInputExcitationProcessed") {
@@ -151,10 +153,10 @@ export default {
151153
const signalDescriptor = action.args[0];
152154
}
153155
154-
this.$emit("canContinue", this.canContinue);
155-
})
156-
},
157-
methods: {
156+
this.$emit("canContinue", this.canContinue);
157+
})
158+
},
159+
methods: {
158160
async updatedSignal(signalDescriptor) {
159161
if (!this.blockingRebounds) {
160162
this.blockingRebounds = true;

src/components/Toolbox/OperatingPoints/OperatingPointHarmonics.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,20 @@ export default {
8383
created () {
8484
8585
},
86-
mounted () {
87-
this.processHarmonics("current");
88-
this.processHarmonics("voltage");
89-
},
86+
mounted () {
87+
// Only process harmonics if waveform doesn't exist (initial setup)
88+
// Don't regenerate waveform when returning from other tools
89+
const hasCurrentWaveform = this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].current.waveform != null;
90+
const hasVoltageWaveform = this.masStore.mas.inputs.operatingPoints[this.currentOperatingPointIndex].excitationsPerWinding[this.currentWindingIndex].voltage.waveform != null;
91+
92+
if (!hasCurrentWaveform) {
93+
this.processHarmonics("current");
94+
}
95+
96+
if (!hasVoltageWaveform) {
97+
this.processHarmonics("voltage");
98+
}
99+
},
90100
methods: {
91101
checkAndFixOperatingPoint(operatingPoint) {
92102

0 commit comments

Comments
 (0)