Open SHA-Fred opened 4 months ago
model DG1TG1Bus1PQ2DCM1 PowerSystems.AC3ph.Loads.PQload pqLoad(S_nom(displayUnit = "kVA") = 15000, V_nom(displayUnit = "V") = 400, use_pq_in = true, pq0 = {0.4, 0}) annotation( Placement(visible = true, transformation(origin = {88, 28}, extent = {{52, 22}, {72, 42}}, rotation = 0))); inner PowerSystems.System system(f = 50, fType = PowerSystems.Types.SystemFrequency.Average, f_lim = {45, 65}, f_nom = 50, theta(displayUnit = "rad")) annotation( Placement(visible = true, transformation(origin = {0, 0}, extent = {{-100, 80}, {-80, 100}}, rotation = 0))); PowerSystems.AC3ph.Nodes.BusBar bus1 annotation( Placement(visible = true, transformation(origin = {8, 41}, extent = {{6, -27}, {-6, 27}}, rotation = 0))); PowerSystems.Blocks.Signals.Transient speedSignal(t_change = 7, s_end = 2*system.omega_nom/asm.motor.pp, s_start = 0, t_duration = 0.5) annotation( Placement(transformation(origin = {116, -50}, extent = {{78, -20}, {58, 0}}))); PowerSystems.AC3ph.Drives.ASM asm(redeclare model Motor = PowerSystems.AC3ph.Machines.Asynchron(dynType = PowerSystems.Types.Dynamics.FreeInitial, redeclare record Data = PowerSystems.Examples.Data.Machines.Asynchron400V_30kVA), redeclare model Rotor = PowerSystems.Mechanics.Rotational.ElectricRotor(J = 0.3)) annotation( Placement(transformation(origin = {136, -50}, extent = {{-20, -20}, {0, 0}}))); PowerSystems.AC3ph.Breakers.BreakerA breaker2(I_nom = 100, V_nom = 400) annotation( Placement(visible = true, transformation(origin = {50, 4}, extent = {{40, -10}, {60, 10}}, rotation = 0))); PowerSystems.Common.Thermal.BdCondV bdCond(m = 2) annotation( Placement(transformation(origin = {136, -44}, extent = {{-20, 0}, {0, 20}}))); PowerSystems.AC3ph.Breakers.BreakerA breaker6(I_nom = 100, V_nom = 400) annotation( Placement(transformation(origin = {44, -60}, extent = {{40, -10}, {60, 10}}))); PowerSystems.Mechanics.Rotational.Speed speed(tcst = 0.01, use_w_in = true, w0 = system.omega_nom/2) annotation( Placement(transformation(origin = {126, -50}, extent = {{40, -20}, {20, 0}}))); PowerSystems.Control.Relays.SwitchRelay switchRelay(ini_state = false, t_switch = {1}) annotation( Placement(visible = true, transformation(origin = {-20, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 270))); PowerSystems.Control.Relays.SwitchRelay switchRelay3(ini_state = false, t_switch = {5}) annotation( Placement(visible = true, transformation(origin = {100, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 270))); PowerSystems.AC3ph.Breakers.BreakerA breaker3(I_nom = 100, V_nom = 400) annotation( Placement(visible = true, transformation(origin = {52, 60}, extent = {{40, -10}, {60, 10}}, rotation = 0))); PowerSystems.Control.Relays.SwitchRelay switchRelay2(ini_state = false, t_switch = {5}) annotation( Placement(visible = true, transformation(origin = {102, 86}, extent = {{-10, -10}, {10, 10}}, rotation = 270))); PowerSystems.AC3ph.Breakers.Breaker breaker(I_nom = 100, V_nom = 400) annotation( Placement(visible = true, transformation(origin = {-72, 40}, extent = {{40, -10}, {60, 10}}, rotation = 0))); PowerSystems.AC3ph.Nodes.BusBar busBar annotation( Placement(visible = true, transformation(origin = {33, -59}, extent = {{-5, -33}, {5, 33}}, rotation = 0))); PowerSystems.Control.Relays.SwitchRelay switchRelay4(ini_state = false, t_switch = {5}) annotation( Placement(transformation(origin = {94, -34}, extent = {{-10, -10}, {10, 10}}, rotation = 270))); PowerSystems.AC3ph.Breakers.Breaker breaker1(I_nom = 100, V_nom = 400) annotation( Placement(visible = true, transformation(origin = {-70, -18}, extent = {{40, -10}, {60, 10}}, rotation = 0))); PowerSystems.AC3ph.Loads.PQload pQload(S_nom(displayUnit = "kVA") = 15000, V_nom(displayUnit = "V") = 400, use_pq_in = true, pq0 = {0.4, 0}) annotation( Placement(visible = true, transformation(origin = {90, -28}, extent = {{52, 22}, {72, 42}}, rotation = 0))); PowerSystems.Control.Relays.SwitchRelay relay(ini_state = false, t_switch = {1}) annotation( Placement(visible = true, transformation(origin = {-22, 68}, extent = {{-10, -10}, {10, 10}}, rotation = 270))); PowerSystems.AC3ph.Lines.RXline line1(redeclare record Data = PowerSystems.AC3ph.Lines.Parameters.RXline(V_nom(displayUnit = "V") = 400, S_nom(displayUnit = "kVA") = 10000, f_nom = 60, r = 0.02e-3, x = 0.03e-3), len = 100, dynType = PowerSystems.Types.Dynamics.FreeInitial) annotation( Placement(transformation(extent = {{60, 50}, {80, 70}}))); PowerSystems.AC3ph.Lines.RXline line2(redeclare record Data = PowerSystems.AC3ph.Lines.Parameters.RXline(V_nom = 400, S_nom(displayUnit = "kVA") = 10000, f_nom = 60, r = 0.02e-3, x = 0.03e-3), len = 100, dynType = PowerSystems.Types.Dynamics.FreeInitial) annotation( Placement(transformation(extent = {{60, -6}, {80, 14}}))); PowerSystems.Blocks.Signals.Transient[2] pq_change(each t_duration = 1, s_start = {0, 0}, s_end = {0.8, 0.1}, each t_change = 7) annotation( Placement(transformation(extent = {{120, 20}, {140, 40}}))); PowerSystems.Blocks.Signals.Transient[2] pq_change1(each t_duration = 1, s_start = {0, 0}, s_end = {0.8, 0.01}, each t_change = 7) annotation( Placement(transformation(extent = {{120, 78}, {140, 98}}))); PowerSystems.AC3ph.Generation.DieselGenerator dieselGen1(redeclare model Generator = PowerSystems.AC3ph.Machines.Synchron_ee(redeclare record Data = PowerSystems.AC3ph.Machines.Parameters.Synchron_ee(V_nom = 400, S_nom(displayUnit = "kW") = 600000)), initType = PowerSystems.Types.Init.v_alpha, redeclare model Exciter = PowerSystems.Control.Exciters.ExciterConst "constant", redeclare model Excitation = PowerSystems.AC3ph.Machines.Control.Excitation, redeclare model Governor = PowerSystems.Control.Governors.GovernorConst "constant", redeclare model Diesel = PowerSystems.Mechanics.TurboGroups.Diesel(redeclare record Data = PowerSystems.Mechanics.TurboGroups.Parameters.Diesel(w_nom = 314.15926535898))) annotation( Placement(visible = true, transformation(origin = {-50, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); PowerSystems.Common.Thermal.BdCondV bdCond1(m = 2) annotation( Placement(visible = true, transformation(origin = {40, 56}, extent = {{-100, 0}, {-80, 20}}, rotation = 0))); PowerSystems.Control.Setpoints.Set_w_p_v setpts1 annotation( Placement(visible = true, transformation(origin = {28, 50}, extent = {{-120, -20}, {-100, 0}}, rotation = 0))); PowerSystems.Common.Thermal.BdCondV bdCondV(m = 2) annotation( Placement(visible = true, transformation(origin = {0, -22}, extent = {{-60, 20}, {-40, 40}}, rotation = 0))); PowerSystems.Control.Setpoints.Set_w_p_v set_w_p_v annotation( Placement(visible = true, transformation(origin = {-12, -28}, extent = {{-80, 0}, {-60, 20}}, rotation = 0))); PowerSystems.AC3ph.Generation.TurboGenerator turboGenerator(initType = PowerSystems.Types.Init.p_q, redeclare model Generator = PowerSystems.AC3ph.Machines.Synchron_ee(redeclare record Data = PowerSystems.AC3ph.Machines.Parameters.Synchron_ee(V_nom = 400, S_nom(displayUnit = "kW") = 600000)), redeclare model Exciter = PowerSystems.Control.Exciters.ExciterConst "constant", redeclare model Excitation = PowerSystems.AC3ph.Machines.Control.Excitation, redeclare model Governor = PowerSystems.Control.Governors.GovernorConst "constant", H = 20, alpha_start = 0.346481, p_start = 0, q_start = 0, v_start = 1.12762, redeclare model Rotor = PowerSystems.Mechanics.TurboGroups.SingleMassTG) annotation( Placement(visible = true, transformation(origin = {0, -28}, extent = {{-60, 0}, {-40, 20}}, rotation = 0))); PowerSystems.AC3ph.Lines.RXline line3(redeclare record Data = PowerSystems.AC3ph.Lines.Parameters.RXline(S_nom(displayUnit = "kVA") = 10000, V_nom(displayUnit = "V") = 400, f_nom = 60, r = 0.02e-3, x = 0.03e-3), dynType = PowerSystems.Types.Dynamics.FreeInitial, len = 100) annotation( Placement(transformation(origin = {-12, 0}, extent = {{60, -70}, {80, -50}}))); equation connect(asm.heat, bdCond.heat) annotation( Line(points = {{126, -50}, {126, -44}}, color = {176, 0, 0})); connect(relay.y, breaker.control) annotation( Line(points = {{-22, 58}, {-22, 50}}, color = {255, 0, 255})); connect(pqLoad.term, breaker3.term_n) annotation( Line(points = {{140, 60}, {112, 60}}, color = {0, 120, 120})); connect(breaker.term_n, bus1.term) annotation( Line(points = {{-12, 40}, {-8, 40}, {-8, 41}, {8, 41}}, color = {0, 120, 120})); connect(asm.flange, speed.flange) annotation( Line(points = {{136, -60}, {146, -60}})); connect(switchRelay4.y, breaker6.control) annotation( Line(points = {{94, -44}, {94, -50}}, color = {255, 0, 255}, thickness = 0.5)); connect(asm.term, breaker6.term_n) annotation( Line(points = {{116, -60}, {104, -60}}, color = {0, 120, 120})); connect(switchRelay.y, breaker1.control) annotation( Line(points = {{-20, -2}, {-20, -8}}, color = {255, 0, 255}, thickness = 0.5)); connect(switchRelay2.y, breaker3.control) annotation( Line(points = {{102, 76}, {102, 70}}, color = {255, 0, 255})); connect(speedSignal.y, speed.w_in) annotation( Line(points = {{174, -60}, {166, -60}}, color = {0, 0, 127})); connect(breaker1.term_n, bus1.term) annotation( Line(points = {{-10, -18}, {-6, -18}, {-6, 38}, {-8, 38}, {-8, 41}, {8, 41}}, color = {0, 120, 120})); connect(busBar.term, bus1.term) annotation( Line(points = {{33, -59}, {42, -59}, {42, 2}, {-6, 2}, {-6, 38}, {-8, 38}, {-8, 41}, {8, 41}}, color = {0, 120, 120})); connect(breaker2.control, switchRelay3.y) annotation( Line(points = {{100, 14}, {100, 18}}, color = {255, 0, 255}, thickness = 0.5)); connect(breaker2.term_n, pQload.term) annotation( Line(points = {{110, 4}, {142, 4}}, color = {0, 120, 120})); connect(line1.term_n, breaker3.term_p) annotation( Line(points = {{80, 60}, {92, 60}}, color = {0, 120, 120})); connect(line2.term_n, breaker2.term_p) annotation( Line(points = {{80, 4}, {90, 4}}, color = {0, 120, 120})); connect(pq_change.y, pQload.pq_in) annotation( Line(points = {{140, 30}, {152, 30}, {152, 14}}, color = {0, 0, 127})); connect(pq_change1.y, pqLoad.pq_in) annotation( Line(points = {{140, 88}, {150, 88}, {150, 70}}, color = {0, 0, 127})); connect(set_w_p_v.setpts, turboGenerator.setpts) annotation( Line(points = {{-72, -18}, {-60, -18}}, color = {0, 0, 127})); connect(turboGenerator.heat, bdCondV.heat) annotation( Line(points = {{-50, -8}, {-50, -2}}, color = {176, 0, 0})); connect(bdCond1.heat, dieselGen1.heat) annotation( Line(points = {{-50, 56}, {-50, 50}}, color = {176, 0, 0})); connect(setpts1.setpts, dieselGen1.setpts) annotation( Line(points = {{-72, 40}, {-60, 40}}, color = {0, 0, 127}, thickness = 0.5)); connect(dieselGen1.term, breaker.term_p) annotation( Line(points = {{-40, 40}, {-32, 40}}, color = {0, 120, 120})); connect(turboGenerator.term, breaker1.term_p) annotation( Line(points = {{-40, -18}, {-30, -18}}, color = {0, 120, 120})); connect(line3.term_n, breaker6.term_p) annotation( Line(points = {{68, -60}, {84, -60}}, color = {0, 120, 120})); connect(line3.term_p, busBar.term) annotation( Line(points = {{48, -60}, {33, -60}, {33, -59}}, color = {0, 120, 120})); connect(line1.term_p, breaker.term_n) annotation( Line(points = {{60, 60}, {42, 60}, {42, 40}, {-12, 40}}, color = {0, 120, 120})); connect(line2.term_p, breaker.term_n) annotation( Line(points = {{60, 4}, {40, 4}, {40, 40}, {-12, 40}}, color = {0, 120, 120})); annotation( Diagram(coordinateSystem(extent = {{-100, 100}, {160, -140}})), experiment(StopTime = 10, Interval = 0.02, StartTime = 0, Tolerance = 1e-06), __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection --allowNonStandardModelica=reinitInAlgorithms -d=initialization,NLSanalyticJacobian", __OpenModelica_simulationFlags(lv = "LOG_STDOUT,LOG_ASSERT,LOG_NLS_V,LOG_STATS", s = "dassl", variableFilter = ".*", cpu = "()")); end DG1TG1Bus1PQ2DCM1;
I use external signals to control the pq_input of PQLoad with the initial p/q as zero. When the p/q increses the voltage of the generator will increase suddenly and the simulation stops. [Uploading DG1TG1Bus1PQ2DCM1.txt…]()