113{
114 auto data = m_properties->GetSimulationPropertiesData();
116 _("Value entered incorrectly in the field \"Base power\".")))
117 return false;
118 switch (m_choiceBasePower->GetSelection()) {
119 case 0: {
121 } break;
122 case 1: {
124 } break;
125 default: {
127 } break;
128 }
129 data.faultAfterPowerFlow = m_checkBoxFaultAfterPF->GetValue();
130 data.scPowerAfterPowerFlow = m_checkBoxSCPowerAfterPF->GetValue();
131 data.harmDistortionAfterPowerFlow = m_checkBoxTHDAfterPF->GetValue();
132 switch (m_choicePFMethod->GetSelection()) {
133 case 0: {
134 data.powerFlowMethod = NEWTON_RAPHSON;
135 } break;
136 case 1: {
137 data.powerFlowMethod = GAUSS_SEIDEL;
138 } break;
139 case 2: {
140 data.powerFlowMethod = GAUSS_NEWTON;
141 } break;
142 }
144 _("Value entered incorrectly in the field \"Acceleration factor\".")))
145 return false;
147 _("Value entered incorrectly in the field \"Tolerance (Power flow)\".")))
148 return false;
150 _("Value entered incorrectly in the field \"Max. iterations (Power flow)\".")))
151 return false;
153 _("Value entered incorrectly in the field \"Slack bus angle\".")))
154 return false;
156 _("Value entered incorrectly in the field \"Newton inertia (Power flow)\".")))
157 return false;
159 _("Value entered incorrectly in the field \"Gauss tolerance (Power flow)\".")))
160 return false;
162 _("Value entered incorrectly in the field \"Time step\".")))
163 return false;
165 _("Value entered incorrectly in the field \"Simulation time\".")))
166 return false;
168 _("Value entered incorrectly in the field \"System frequency\".")))
169 return false;
171 _("Value entered incorrectly in the field \"Tolerance (stability)\".")))
172 return false;
174 _("Value entered incorrectly in the field \"Max. iterations (stability)\".")))
175 return false;
177 _("Value entered incorrectly in the field \"Controls step ratio\".")))
178 return false;
180 _("Value entered incorrectly in the field \"Plot time\".")))
181 return false;
182 data.useCOI = m_checkBoxUseCOI->GetValue();
183
184 data.useCompLoads = m_checkBoxUseCompLoads->GetValue();
185
187 this, m_textCtrlActivePowerImp->GetValue(), data.constImpedanceActive,
188 _("Value entered incorrectly in the field \"Constant impedance portion of active power (ZIP load)\".")))
189 return false;
191 this, m_textCtrlActivePowerCur->GetValue(), data.constCurrentActive,
192 _("Value entered incorrectly in the field \"Constant current portion of active power (ZIP load)\".")))
193 return false;
195 this, m_textCtrlActivePowerPow->GetValue(), data.constPowerActive,
196 _("Value entered incorrectly in the field \"Constant power portion of active power (ZIP load)\".")))
197 return false;
199 this, m_textCtrlReactivePowerImp->GetValue(), data.constImpedanceReactive,
200 _("Value entered incorrectly in the field \"Constant impedance portion of reactive power (ZIP load)\".")))
201 return false;
203 this, m_textCtrlReactivePowerCur->GetValue(), data.constCurrentReactive,
204 _("Value entered incorrectly in the field \"Constant current portion of reactive power (ZIP load)\".")))
205 return false;
207 this, m_textCtrlReactivePowerPow->GetValue(), data.constPowerReactive,
208 _("Value entered incorrectly in the field \"Constant power portion of reactive power (ZIP load)\".")))
209 return false;
210
212 this, m_textCtrlUVCur->GetValue(), data.underVoltageConstCurrent,
213 _("Value entered incorrectly in the field \"Constant current undervoltage limit (ZIP load)\".")))
214 return false;
215
217 this, m_textCtrlUVPow->GetValue(), data.underVoltageConstPower,
218 _("Value entered incorrectly in the field \"Constant power undervoltage limit (ZIP load)\".")))
219 return false;
220
221 double sum = data.constImpedanceActive + data.constCurrentActive + data.constPowerActive;
222 if (sum > 100.01 || sum < 99.99) {
223 wxMessageDialog msgDialog(this, _("The sum of active power load composition must be 100%."), _("Error"),
224 wxOK | wxCENTRE | wxICON_ERROR);
225 msgDialog.ShowModal();
226 return false;
227 }
228 sum = data.constImpedanceReactive + data.constCurrentReactive + data.constPowerReactive;
229 if (sum > 100.01 || sum < 99.99) {
230 wxMessageDialog msgDialog(this, _("The sum of reactive power load composition must be 100%."), _("Error"),
231 wxOK | wxCENTRE | wxICON_ERROR);
232 msgDialog.ShowModal();
233 return false;
234 }
235
236 data.busFreqEstimation = static_cast<BusFreqEstimation>(m_radioBoxBusFreqEstimation->GetSelection());
237
238 if (m_checkBoxBusFreqIgnoreEvent->IsShown()) {
239 data.ignoreBusFreqEventStep = m_checkBoxBusFreqIgnoreEvent->GetValue();
240 }
241
242 if (m_textCtrlTf->IsShown()) {
244 this, m_textCtrlTf->GetValue(), data.tf,
245 _("Value entered incorrectly in the field \"Time constant Tf (Bus Frequency)\".")))
246 return false;
247 }
248 if (m_textCtrlTw->IsShown()) {
250 this, m_textCtrlTw->GetValue(), data.tw,
251 _("Value entered incorrectly in the field \"Time constant Tw (Bus Frequency)\".")))
252 return false;
253 }
254
255 data.harmLoadConnection = static_cast<HarmLoadConnection>(m_choiceHarmLoadConn->GetSelection());
256
257 m_properties->SetSimulationPropertiesData(data);
258 return true;
259}
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.