Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test that Modelica resource URIs will put the resource inside t…
…he FMU resource folder
- Loading branch information
Showing
3 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
testsuite/openmodelica/fmi/ModelExchange/2.0/FMUResourceTest.mos
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,35 @@ | ||
// name: FMUResourceTest | ||
// keywords: fmu export import | ||
// status: correct | ||
// teardown_command: rm -rf binaries sources modelDescription.xml FMIExercise_Components_PI* FMIExercise.TestPIFMU* output.log | ||
// | ||
|
||
|
||
loadModel(Modelica); getErrorString(); | ||
loadFile("./FMUResourceTest/package.mo"); getErrorString(); | ||
translateModelFMU(FMUResourceTest.TestResource, version="2.0"); getErrorString(); | ||
importFMU("FMUResourceTest.TestResource"); getErrorString(); | ||
loadFile("FMUResourceTest_TestResource.mo"); getErrorString(); | ||
simulate(FMIExercise.TestPIFMU); getErrorString(); | ||
|
||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// "" | ||
// "[CodegenUtil.tpl:178:14-178:14:writable] Error: Template error: initial value of unknown type: OpenModelica_fmuLoadResource("C:\\home\\adrpo33\\dev\\OpenModelica\\testsuite\\openmodelica\\fmi\\ModelExchange\\2.0\\FMUResourceTest\\Resources\\table_test_utf8.txt"). | ||
// " | ||
// "" | ||
// "Error: File not Found: FMUResourceTest.TestResource. | ||
// " | ||
// false | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "", | ||
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'FMIExercise.TestPIFMU', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "Simulation Failed. Model: FMIExercise.TestPIFMU does not exist! Please load it first before simulation." | ||
// end SimulationResult; | ||
// "" | ||
// endResult |
245 changes: 245 additions & 0 deletions
245
testsuite/openmodelica/fmi/ModelExchange/2.0/FMUResourceTest/Resources/table_test_utf8.txt
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
testsuite/openmodelica/fmi/ModelExchange/2.0/FMUResourceTest/package.mo
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,30 @@ | ||
within ; | ||
package FMUResourceTest "Test table resource" | ||
import Modelica.Utilities.Files.loadResource; | ||
|
||
partial model Test0 | ||
Modelica.Blocks.Tables.CombiTable1D t_new | ||
annotation (Placement(transformation(extent={{-40,0},{-20,20}}))); | ||
Modelica.Blocks.Continuous.Der d_t_new | ||
annotation (Placement(transformation(extent={{0,0},{20,20}}))); | ||
Modelica.Blocks.Sources.Clock clock | ||
annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); | ||
equation | ||
connect(t_new.y[1], d_t_new.u) annotation (Line( | ||
points={{-19,10},{-2,10}}, | ||
color={0,0,127}, | ||
thickness=0.0625)); | ||
connect(clock.y, t_new.u[1]) annotation (Line( | ||
points={{-59,10},{-42,10}}, color={0,0,127})); | ||
end Test0; | ||
|
||
model TestResource "Text file with UTF-8 BOM and comments (Ticket #2404)" | ||
extends Modelica.Icons.Example; | ||
extends Test0(t_new( | ||
tableOnFile=true, | ||
tableName="a", | ||
fileName=loadResource("modelica://FMUResourceTest/Resources/table_test_utf8.txt"))); | ||
annotation (experiment(StartTime=0, StopTime=100)); | ||
end TestResource; | ||
end FMUResourceTest; | ||
|