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