147{
149
150 data.name = m_textCtrlName->GetValue();
151 data.baseVoltage = m_choiceBaseVoltage->GetSelection();
152
153 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlNominalPower->GetValue(), data.nominalPower,
154 _("Value entered incorrectly in the field \"Nominal power\".")))
155 return false;
156 switch(m_choiceNominalPower->GetSelection()) {
157 case 0: {
159 } break;
160 case 1: {
162 } break;
163 case 2: {
165 } break;
166 }
167
168 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlResistance->GetValue(), data.resistance,
169 _("Value entered incorrectly in the field \"Resistance\".")))
170 return false;
171 switch(m_choiceResistance->GetSelection()) {
172 case 0: {
174 } break;
175 case 1: {
177 } break;
178 }
179
180 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlReactance->GetValue(), data.indReactance,
181 _("Value entered incorrectly in the field \"Indutive reactance\".")))
182 return false;
183 switch(m_choiceReactance->GetSelection()) {
184 case 0: {
186 } break;
187 case 1: {
189 } break;
190 }
191
192 switch(m_choiceConnection->GetSelection()) {
193 case 0: {
194 data.connection = GWYE_GWYE;
195 } break;
196 case 1: {
197 data.connection = WYE_GWYE;
198 } break;
199 case 2: {
200 data.connection = GWYE_WYE;
201 } break;
202 case 3: {
203 data.connection = WYE_WYE;
204 } break;
205 case 4: {
206 data.connection = DELTA_GWYE;
207 } break;
208 case 5: {
209 data.connection = DELTA_WYE;
210 } break;
211 case 6: {
212 data.connection = GWYE_DELTA;
213 } break;
214 case 7: {
215 data.connection = WYE_DELTA;
216 } break;
217 case 8: {
218 data.connection = DELTA_DELTA;
219 } break;
220 }
221
222 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlTurnRatio->GetValue(), data.turnsRatio,
223 _("Value entered incorrectly in the field \"Turns ratio\".")))
224 return false;
225
226 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlPhaseShift->GetValue(), data.phaseShift,
227 _("Value entered incorrectly in the field \"Phase shift\".")))
228 return false;
229
230 data.useTransformerPower = m_checkUseTransformerPower->GetValue();
231
232 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
233 _("Value entered incorrectly in the field \"Zero sequence resistance\".")))
234 return false;
235
237 m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroIndReactance,
238 _("Value entered incorrectly in the field \"Zero sequence indutive reactance\".")))
239 return false;
240
241 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlPrimResistance->GetValue(), data.primaryGrndResistance,
242 _("Value entered incorrectly in the field \"Primary ground resistance\".")))
243 return false;
244
245 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlPrimReactance->GetValue(), data.primaryGrndReactance,
246 _("Value entered incorrectly in the field \"Primary ground reactance\".")))
247 return false;
248
249 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlSecResistance->GetValue(), data.secondaryGrndResistance,
250 _("Value entered incorrectly in the field \"Secondary ground resistance\".")))
251 return false;
252
253 if(!m_transformer->
DoubleFromString(m_parent, m_textCtrlSecReactance->GetValue(), data.secondaryGrndReactance,
254 _("Value entered incorrectly in the field \"Secondary ground reactance\".")))
255 return false;
256
257 m_transformer->SetElectricaData(data);
258 return true;
259}
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.