-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #949 from SciML/ChrisRackauckas-patch-1
Add Modelica code to ThermalFluid Benchmark
- Loading branch information
Showing
7 changed files
with
500 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Modelica.Utilities.Streams.print; | ||
import DhnControl.TimingFunctions.tic; | ||
dir = "ThermalFluid_Benchmark" | ||
// Load the test model file | ||
openModel(dir + "DhnControl.mo"); | ||
testFolder = "DhnControl.Test."; | ||
testModels = { | ||
"test_preinsulated_470_5", | ||
"test_preinsulated_470_10", | ||
"test_preinsulated_470_20", | ||
"test_preinsulated_470_40", | ||
"test_preinsulated_470_60", | ||
"test_preinsulated_470_80", | ||
"test_preinsulated_470_160", | ||
"test_preinsulated_470_320", | ||
"test_preinsulated_470_480", | ||
"test_preinsulated_470_640", | ||
"test_preinsulated_470_800", | ||
"test_preinsulated_470_960", | ||
"test_preinsulated_470_1280" | ||
}; | ||
|
||
outputFile = dir + "benchmark_results.txt" | ||
|
||
// Clear the output file at the beginning | ||
print("", fileName=outputFile); | ||
// Loop over each test model | ||
for i in 1:size(testModels, 1) loop | ||
testName = testFolder + testModels[i]; | ||
|
||
// Start the timer | ||
startTime := tic(); | ||
|
||
// Translate the model | ||
translateModel(testName); | ||
|
||
translateEndTime := tic(); | ||
// Simulate the model | ||
simulateModel(testName); | ||
|
||
// Stop the timer | ||
endTime := tic(); | ||
|
||
// Calculate the elapsed time | ||
translationTime := translateEndTime - startTime; | ||
simulationTime := endTime - startTime; | ||
|
||
// Prepare the output string | ||
outputString = "Test: " + testModels[i] + ", " + String(translationTime) + ", " + String(simulationTime); | ||
|
||
// Print the test name and simulation time to the output file | ||
print(outputString, fileName=outputFile); | ||
end for; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters