112{
113 auto data = m_properties->GetSimulationPropertiesData();
115 _("Value entered incorrectly in the field \"Base power\".")))
116 return false;
117 switch (m_choiceBasePower->GetSelection()) {
118 case 0: {
120 } break;
121 case 1: {
123 } break;
124 default: {
126 } break;
127 }
128 data.faultAfterPowerFlow = m_checkBoxFaultAfterPF->GetValue();
129 data.scPowerAfterPowerFlow = m_checkBoxSCPowerAfterPF->GetValue();
130 data.harmDistortionAfterPowerFlow = m_checkBoxTHDAfterPF->GetValue();
131 switch (m_choicePFMethod->GetSelection()) {
132 case 0: {
133 data.powerFlowMethod = NEWTON_RAPHSON;
134 } break;
135 case 1: {
136 data.powerFlowMethod = GAUSS_SEIDEL;
137 } break;
138 case 2: {
139 data.powerFlowMethod = GAUSS_NEWTON;
140 } break;
141 }
143 _("Value entered incorrectly in the field \"Acceleration factor\".")))
144 return false;
146 _("Value entered incorrectly in the field \"Tolerance (Power flow)\".")))
147 return false;
149 _("Value entered incorrectly in the field \"Max. iterations (Power flow)\".")))
150 return false;
152 _("Value entered incorrectly in the field \"Slack bus angle\".")))
153 return false;
155 _("Value entered incorrectly in the field \"Newton inertia (Power flow)\".")))
156 return false;
158 _("Value entered incorrectly in the field \"Gauss tolerance (Power flow)\".")))
159 return false;
161 _("Value entered incorrectly in the field \"Time step\".")))
162 return false;
164 _("Value entered incorrectly in the field \"Simulation time\".")))
165 return false;
167 _("Value entered incorrectly in the field \"System frequency\".")))
168 return false;
170 _("Value entered incorrectly in the field \"Tolerance (stability)\".")))
171 return false;
173 _("Value entered incorrectly in the field \"Max. iterations (stability)\".")))
174 return false;
176 _("Value entered incorrectly in the field \"Controls step ratio\".")))
177 return false;
179 _("Value entered incorrectly in the field \"Plot time\".")))
180 return false;
181 data.useCOI = m_checkBoxUseCOI->GetValue();
182
183 data.useCompLoads = m_checkBoxUseCompLoads->GetValue();
184
186 this, m_textCtrlActivePowerImp->GetValue(), data.constImpedanceActive,
187 _("Value entered incorrectly in the field \"Constant impedance portion of active power (ZIP load)\".")))
188 return false;
190 this, m_textCtrlActivePowerCur->GetValue(), data.constCurrentActive,
191 _("Value entered incorrectly in the field \"Constant current portion of active power (ZIP load)\".")))
192 return false;
194 this, m_textCtrlActivePowerPow->GetValue(), data.constPowerActive,
195 _("Value entered incorrectly in the field \"Constant power portion of active power (ZIP load)\".")))
196 return false;
198 this, m_textCtrlReactivePowerImp->GetValue(), data.constImpedanceReactive,
199 _("Value entered incorrectly in the field \"Constant impedance portion of reactive power (ZIP load)\".")))
200 return false;
202 this, m_textCtrlReactivePowerCur->GetValue(), data.constCurrentReactive,
203 _("Value entered incorrectly in the field \"Constant current portion of reactive power (ZIP load)\".")))
204 return false;
206 this, m_textCtrlReactivePowerPow->GetValue(), data.constPowerReactive,
207 _("Value entered incorrectly in the field \"Constant power portion of reactive power (ZIP load)\".")))
208 return false;
209
211 this, m_textCtrlUVCur->GetValue(), data.underVoltageConstCurrent,
212 _("Value entered incorrectly in the field \"Constant current undervoltage limit (ZIP load)\".")))
213 return false;
214
216 this, m_textCtrlUVPow->GetValue(), data.underVoltageConstPower,
217 _("Value entered incorrectly in the field \"Constant power undervoltage limit (ZIP load)\".")))
218 return false;
219
220 double sum = data.constImpedanceActive + data.constCurrentActive + data.constPowerActive;
221 if (sum > 100.01 || sum < 99.99) {
222 wxMessageDialog msgDialog(this, _("The sum of active power load composition must be 100%."), _("Error"),
223 wxOK | wxCENTRE | wxICON_ERROR);
224 msgDialog.ShowModal();
225 return false;
226 }
227 sum = data.constImpedanceReactive + data.constCurrentReactive + data.constPowerReactive;
228 if (sum > 100.01 || sum < 99.99) {
229 wxMessageDialog msgDialog(this, _("The sum of reactive power load composition must be 100%."), _("Error"),
230 wxOK | wxCENTRE | wxICON_ERROR);
231 msgDialog.ShowModal();
232 return false;
233 }
234
235 data.busFreqEstimation = static_cast<BusFreqEstimation>(m_radioBoxBusFreqEstimation->GetSelection());
236
237 if (m_checkBoxBusFreqIgnoreEvent->IsShown()) {
238 data.ignoreBusFreqEventStep = m_checkBoxBusFreqIgnoreEvent->GetValue();
239 }
240
241 if (m_textCtrlTf->IsShown()) {
243 this, m_textCtrlTf->GetValue(), data.tf,
244 _("Value entered incorrectly in the field \"Time constant Tf (Bus Frequency)\".")))
245 return false;
246 }
247 if (m_textCtrlTw->IsShown()) {
249 this, m_textCtrlTw->GetValue(), data.tw,
250 _("Value entered incorrectly in the field \"Time constant Tw (Bus Frequency)\".")))
251 return false;
252 }
253
254 data.harmLoadConnection = static_cast<HarmLoadConnection>(m_choiceHarmLoadConn->GetSelection());
255
256 m_properties->SetSimulationPropertiesData(data);
257 return true;
258}
static bool IntFromString(wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
Convert a string to int. Show a error message if the conversion fail.
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.