Skip to content

Commit

Permalink
Add tests for PowerSystems library
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke committed Oct 15, 2021
1 parent 4523ec1 commit 28cd7de
Show file tree
Hide file tree
Showing 132 changed files with 6,404 additions and 0 deletions.
14 changes: 14 additions & 0 deletions testsuite/libraries-for-testing/index.json
Expand Up @@ -341,6 +341,20 @@
}
}
},
"PowerSystems": {
"versions": {
"1.0.1": {
"path": "PowerSystems",
"sha": "07b5d32cc291e2397becd2f97351c0bc1a375d54",
"support": "support",
"uses": {
"Modelica": "3.2.3"
},
"version": "1.0.1",
"zipfile": "https://github.com/modelica-3rdparty/PowerSystems/archive/07b5d32cc291e2397becd2f97351c0bc1a375d54.zip"
}
}
},
"SiemensPower": {
"versions": {
"0.0.0-OMCtest": {
Expand Down
181 changes: 181 additions & 0 deletions testsuite/simulation/libraries/3rdParty/PowerSystems_cpp/Makefile
@@ -0,0 +1,181 @@
TEST = ../../../../rtest -v

TESTFILES = \
PowerSystems.Examples.AC1ph_DC.Drives.BLDC.mos \
PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed.mos \
PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed.mos \
PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par.mos \
PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_pm.mos \
PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_ser.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Breaker.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.DoubleLine.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Fault.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Impedance.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.ImpedanceOneTerm.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Inverter.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Line.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.LoadAC.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.LoadDC.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Machines.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Rectifier.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Sensor.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Source.mos \
PowerSystems.Examples.AC1ph_DC.Elementary.Transformer.mos \
PowerSystems.Examples.AC1ph_DC.Inverters.Chopper.mos \
PowerSystems.Examples.AC1ph_DC.Inverters.InverterAvToGrid.mos \
PowerSystems.Examples.AC1ph_DC.Inverters.InverterToGrid.mos \
PowerSystems.Examples.AC1ph_DC.Inverters.InverterToLoad.mos \
PowerSystems.Examples.AC1ph_DC.Inverters.Rectifier.mos \
PowerSystems.Examples.AC1ph_DC.Transformation.OnePhase.mos \
PowerSystems.Examples.AC1ph_DC.Transformation.TapChanger.mos \
PowerSystems.Examples.AC3ph.Drives.ASM.mos \
PowerSystems.Examples.AC3ph.Drives.ASM_Y_D.mos \
PowerSystems.Examples.AC3ph.Drives.ASM_ctrl.mos \
PowerSystems.Examples.AC3ph.Drives.ASM_ctrlAv.mos \
PowerSystems.Examples.AC3ph.Drives.ASMav.mos \
PowerSystems.Examples.AC3ph.Drives.ASMav_icontrol.mos \
PowerSystems.Examples.AC3ph.Drives.ASMcharacteristic.mos \
PowerSystems.Examples.AC3ph.Drives.SM_ctrl.mos \
PowerSystems.Examples.AC3ph.Drives.SM_ctrlAv.mos \
PowerSystems.Examples.AC3ph.Elementary.Breaker.mos \
PowerSystems.Examples.AC3ph.Elementary.Fault.mos \
PowerSystems.Examples.AC3ph.Elementary.Impedance.mos \
PowerSystems.Examples.AC3ph.Elementary.ImpedanceYD.mos \
PowerSystems.Examples.AC3ph.Elementary.Inverter.mos \
PowerSystems.Examples.AC3ph.Elementary.Line.mos \
PowerSystems.Examples.AC3ph.Elementary.Load.mos \
PowerSystems.Examples.AC3ph.Elementary.Machines.mos \
PowerSystems.Examples.AC3ph.Elementary.Rectifier.mos \
PowerSystems.Examples.AC3ph.Elementary.Sensor.mos \
PowerSystems.Examples.AC3ph.Elementary.Source.mos \
PowerSystems.Examples.AC3ph.Elementary.Transformer.mos \
PowerSystems.Examples.AC3ph.Generation.GenOrder3and7.mos \
PowerSystems.Examples.AC3ph.Generation.Islanding.mos \
PowerSystems.Examples.AC3ph.Generation.LocalGeneration.mos \
PowerSystems.Examples.AC3ph.Generation.PQsource.mos \
PowerSystems.Examples.AC3ph.Generation.PVsource.mos \
PowerSystems.Examples.AC3ph.Generation.PowerAngle.mos \
PowerSystems.Examples.AC3ph.Generation.TieLine.mos \
PowerSystems.Examples.AC3ph.Generation.TurbineGenerator.mos \
PowerSystems.Examples.AC3ph.Generation.TurbineGeneratorLine.mos \
PowerSystems.Examples.AC3ph.Generation.TurboGeneratorLine.mos \
PowerSystems.Examples.AC3ph.Generation.TurboGroupGenerator.mos \
PowerSystems.Examples.AC3ph.Generation.Vsource.mos \
PowerSystems.Examples.AC3ph.Generation.WindGeneratorLine.mos \
PowerSystems.Examples.AC3ph.Inverters.InverterAvToGrid.mos \
PowerSystems.Examples.AC3ph.Inverters.InverterToGrid.mos \
PowerSystems.Examples.AC3ph.Inverters.InverterToLoad.mos \
PowerSystems.Examples.AC3ph.Inverters.Rectifier.mos \
PowerSystems.Examples.AC3ph.Precalculation.EqCircFromTransDat.mos \
PowerSystems.Examples.AC3ph.Precalculation.TransDatFromEqCirc.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixEqCirc0.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixEqCirc1.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixEqCirc2.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixEqCirc3.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixTrDat0.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixTrDat1.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixTrDat2.mos \
PowerSystems.Examples.AC3ph.Precalculation.Z_matrixTrDat3.mos \
PowerSystems.Examples.AC3ph.Transformation.PhaseShifts.mos \
PowerSystems.Examples.AC3ph.Transformation.TapChanger.mos \
PowerSystems.Examples.AC3ph.Transformation.ThreeWinding.mos \
PowerSystems.Examples.AC3ph.Transmission.DoubleLineTG.mos \
PowerSystems.Examples.AC3ph.Transmission.DoubleRXline.mos \
PowerSystems.Examples.AC3ph.Transmission.DoubleRXlineTG.mos \
PowerSystems.Examples.AC3ph.Transmission.FaultRXline.mos \
PowerSystems.Examples.AC3ph.Transmission.FaultTline.mos \
PowerSystems.Examples.AC3ph.Transmission.PowerTransfer.mos \
PowerSystems.Examples.AC3ph.Transmission.RXline.mos \
PowerSystems.Examples.AC3ph.Transmission.Tline.mos \
PowerSystems.Examples.AC3ph.Transmission.VoltageStability.mos \
PowerSystems.Examples.Generic.Network.NetworkControlled.mos \
PowerSystems.Examples.Generic.Network.NetworkLoop.mos \
PowerSystems.Examples.Generic.Network.NetworkLoop_d.mos \
PowerSystems.Examples.Generic.Network.NetworkLoop_dq.mos \
PowerSystems.Examples.Generic.Network.NetworkLoop_dq0.mos \
PowerSystems.Examples.Generic.Network.NetworkOpened.mos \
PowerSystems.Examples.Generic.Test.AdmittanceTest.mos \
PowerSystems.Examples.Generic.Test.FixedCurrentTest.mos \
PowerSystems.Examples.Generic.Test.FixedLoadTest.mos \
PowerSystems.Examples.Generic.Test.GeneratorTest.mos \
PowerSystems.Examples.Generic.Test.GeneratorTest2.mos \
PowerSystems.Examples.Generic.Test.ImpedanceTest.mos \
PowerSystems.Examples.Generic.Test.InductiveLoadTest.mos \
PowerSystems.Examples.Generic.Test.PMeterTest.mos \
PowerSystems.Examples.Introductory.Display.mos \
PowerSystems.Examples.Introductory.Frequency.mos \
PowerSystems.Examples.Introductory.InitialSteadyState.mos \
PowerSystems.Examples.Introductory.ReferenceInertial.mos \
PowerSystems.Examples.Introductory.ReferenceSynchron.mos \
PowerSystems.Examples.Introductory.SimulationFixedInitial.mos \
PowerSystems.Examples.Introductory.SimulationSteadyInitial.mos \
PowerSystems.Examples.Introductory.SimulationSteadyState.mos \
PowerSystems.Examples.Introductory.Tables.mos \
PowerSystems.Examples.Introductory.Units.mos \
PowerSystems.Examples.PowerWorld.PowerWorld.mos \
PowerSystems.Examples.PowerWorld.Test.CityTest.mos \
PowerSystems.Examples.PowerWorld.Test.HydroPlantTest1.mos \
PowerSystems.Examples.PowerWorld.Test.HydroPlantTest2.mos \
PowerSystems.Examples.PowerWorld.Test.PowerPlantTest1.mos \
PowerSystems.Examples.PowerWorld.Test.PowerPlantTest2.mos \
PowerSystems.Examples.PowerWorld.Test.PowerPlantTest3.mos \
PowerSystems.Examples.PowerWorld.Test.WindFarmGridTest.mos \
PowerSystems.Examples.PowerWorld.Test.WindFarmHVDCTest.mos \
PowerSystems.Examples.Wind.Test.RotorTest.mos \
PowerSystems.Examples.Wind.WindFarm.mos \
PowerSystems.Examples.Wind.WindTurbine_DFIG.mos \
PowerSystems.Examples.Wind.WindTurbine_IG.mos \
PowerSystems.Examples.Wind.WindTurbine_PSGI.mos \
PowerSystems.Examples.Wind.WindTurbine_PSGR.mos \


# Run make failingtest
FAILINGTESTFILES= \


DISABLED_TOO_SLOW = \
PowerSystems.Examples.AC3ph.Transmission.DoubleLine.mos \


# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mos \
Makefile \


CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test clean getdeps failingtest


test:
@echo
@echo Running tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f *.mos.txt
@rm -rf $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES)
@@ -0,0 +1,46 @@
// name: PowerSystems.Examples.AC1ph_DC.Drives.BLDC
// keywords: simulation PowerSystems Examples
// status: correct
//
// Simulation Results
// PowerSystems Library
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.SimpleSimulation;
modelName := $TypeName(PowerSystems.Examples.AC1ph_DC.Drives.BLDC);
compareVars :=
{
"power.p",
"loadInertia.w",
"loadInertia.flange_a.tau",
"efficiency.eta"
};

runScript("common.mos"); getErrorString();

runScript(modelTesting); getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.SimpleSimulation
// PowerSystems.Examples.AC1ph_DC.Drives.BLDC
// {"power.p","loadInertia.w","loadInertia.flange_a.tau","efficiency.eta"}
// "PowerSystems
// \"\"
// OpenModelicaModelTesting.SimulationRuntime.Cpp
// \"PowerSystems\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 3.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'PowerSystems.Examples.AC1ph_DC.Drives.BLDC', options = '', outputFormat = 'mat', variableFilter = 'time|power.p|loadInertia.w|loadInertia.flange_a.tau|efficiency.eta', cflags = '', simflags = ' -emit_protected'
// Result file: PowerSystems.Examples.AC1ph_DC.Drives.BLDC_res.mat
// Warning: It was not possible to determine if the initialization problem is consistent, because of not evaluable parameters/start values during compile time: bldcm.rotor.w = bldcm.rotor.w_start (loadInertia.w_start = bldcm.rotor.w_start)
// Warning: The initial conditions are over specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->Show additional information from the initialization process, in OMNotebook call setCommandLineOptions("-d=initialization").
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,45 @@
// name: PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed
// keywords: simulation PowerSystems Examples
// status: correct
//
// Simulation Results
// PowerSystems Library
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed);
compareVars :=
{
"efficiency.eta",
"machine.motor.w_el",
"machine.motor.tau_el"
};

runScript("common.mos"); getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed
// {"efficiency.eta","machine.motor.w_el","machine.motor.tau_el"}
// "PowerSystems
// \"\"
// OpenModelicaModelTesting.SimulationRuntime.Cpp
// \"PowerSystems\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed', options = '', outputFormat = 'mat', variableFilter = 'time|efficiency.eta|machine.motor.w_el|machine.motor.tau_el', cflags = '', simflags = ' -emit_protected'
// Result file: PowerSystems.Examples.AC1ph_DC.Drives.BLDCcharSpeed_res.mat
// Files Equal!
// Warning: The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.
//
// "true
// "
// ""
// endResult
@@ -0,0 +1,43 @@
// name: PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed
// keywords: simulation PowerSystems Examples
// status: correct
//
// Simulation Results
// PowerSystems Library
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed);
compareVars :=
{
"efficiency.eta",
"machine.motor.w_el",
"machine.motor.tau_el"
};

runScript("common.mos"); getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed
// {"efficiency.eta","machine.motor.w_el","machine.motor.tau_el"}
// "PowerSystems
// \"\"
// OpenModelicaModelTesting.SimulationRuntime.Cpp
// \"PowerSystems\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed', options = '', outputFormat = 'mat', variableFilter = 'time|efficiency.eta|machine.motor.w_el|machine.motor.tau_el', cflags = '', simflags = ' -emit_protected'
// Result file: PowerSystems.Examples.AC1ph_DC.Drives.DCcharSpeed_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,46 @@
// name: PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par
// keywords: simulation PowerSystems Examples
// status: correct
//
// Simulation Results
// PowerSystems Library
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par);
compareVars :=
{
"power.p",
"tabLoad.vVehicle"
};

runScript("common.mos"); getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par
// {"power.p","tabLoad.vVehicle"}
// "PowerSystems
// \"\"
// OpenModelicaModelTesting.SimulationRuntime.Cpp
// \"PowerSystems\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 60.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par', options = '', outputFormat = 'mat', variableFilter = 'time|power.p|tabLoad.vVehicle', cflags = '', simflags = ' -emit_protected'
// Result file: PowerSystems.Examples.AC1ph_DC.Drives.DCmotor_par_res.mat
// Messages: ... loading "height" from "/home/rfranke/Modelica/PowerSystems/PowerSystems/Resources/Tables/hNormProfile.tab"
// Model terminate() at 54.1181
// Message: BOUNDARY POSITION REACHED!
//
// Files Equal!
// "true
// "
// ""
// endResult

0 comments on commit 28cd7de

Please sign in to comment.