Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » Arinomo23
  • » Profile

Posts

Posts

May-12-22 05:26:56
I have a power input in model that varies with time,

Yes, see Modelica Standard Library (Modelica) -> Blocks -> Sources -> CombiTimeTable.

You have to format your table accordingly and save it as mat or txt, It was explained in the documentation view of CombiTimeTable.

May-11-22 05:56:22
How to close an opened model and remove all intermediate files

tjroamer wrote:

After calling this API, OpenModelica generated lots of intermediate files

After initiating

Code:

ModelicaSystem

the model will be build at the current working directory and as a results you got the executable and xml to run the simulation. As far as i know, there are no option to to delete the intermediate files automatically.

At top of my head, you can make a subclasss of

Code:

ModelicaSystem

and add a routine to delete the c-files.

May-09-22 10:53:28
Simulation process failed. Exited with code 0xffffffffffffffff.

Code:

The initialization problem is inconsistent due to the following equation: 0 != -4.05568 = $START.Pv - Pv

I got the above error. So the problem is with initialization.

Code:

Real Pv(start = 1, fixed = true); // state variable - ventricular pressure

it works when I set fixed to false. But i don't know if the simulation results are correct.

From  Modelica by Example

fixed

    The fixed attribute changes the way the start attribute is used when the start attribute is used as an initial condition. Normally, the start attribute is considered a “fallback” initial condition and only used if there are insufficient initial conditions explicitly specified in the initial equation sections. However, if the fixed attribute is set to true, then the start attribute is treated as if it was used as an explicit initial equation (i.e., it is no longer used as a fallback, but instead treated as a strict initial condition).

    Another, more obscure, use of the fixed attribute is for “computed parameters”. In rare cases where a parameter cannot be initialized explicitly, it is possible to provide a general equation for the parameter in an initial equation section. But in cases where the parameter is initialized in this way, the fixed attribute for the parameter variable must be set to false.

    Default: false (except for parameter variables, where it is true by default)

    Type: Boolean

May-09-22 08:57:14
Simulation process failed. Exited with code 0xffffffffffffffff.

is it possible to share your code?

Consider following example

Code:


package myLib

package Archive
end Archive

package subPacakge
    model myModel
    end myModel;
end subPacakge;

annotation(version="1.0.0"
and myLib;

and a newer version of it

Code:


package myLib

package Archive
    model myModel
    end myModel;
end Archive

package subPacakge
    model myModel_v2
    end myModel_v2;
end subPacakge;

annotation(version="1.0.1",
conversion(from(version={"1.0.0"}, script="modelica://oldLib/Resources/convertingScript.mos")));
and myLib;

with mos script inside Resources

Code:


convertClass("oldLib.subPackage.model_v1",
             "oldLib.Arcihve.model_v1")

how can I convert a model/package using convert script in OMEdit, if my library was not in HOME/.openmodelica/library ?

Code:


package testPackage
    model testModel
        oldLib.subPackage.model_v1 model_v1;
    end testModel;

annotation(uses(oldLIb(version="1.0.0")));

I've tried running [code}OpenModelica.Scripting.convertPackageToLibrary(testPackage, oldLib, "1.0.1")

Code:


[1] 12:24:43 Translation Error
JSON expected value, got <EOF>...

[2] 12:24:43 Scripting Error
[C:/Users/~/AppData/Roaming/.openmodelica/libraries/index.json: 0:0-0:0]: The package index C:/Users/~/AppData/Roaming/.openmodelica/libraries/index.json could not be parsed.

What did i missed?

Edit: I got it working by pre-loading the testPackage whe OM is open. But this does not change the original source code of testPackage. If one want to "update" the source code of testPackage, than one have to make a new copy of testPackage with save_as

Edit 2: right-click on myModel on Library Browser and right click up update binding seems to solve my problem. But it will be awful if you have multiple models that need to be updated

justnielsen wrote:


An alternative to the suggestion by Arinomo23 is the following:

Code:


block MathExpression
  extends Modelica.Blocks.Interfaces.SISO;
  input Real expression=u "User defined expression" annotation(Dialog);
equation
  y=expression;
end MathExpression;

+1 i also preferred this solution.

I forgot that SISO block exist and i don't now about the

Code:

 annotation(Dialog) 

could be used that way.

Thanks for the info.

Hi, i'm not familiar with Formula node but i assume you want to calculate some outputs based on some inputs according to a more complex equation. you can always create your own blocks like this simple example

Code:


model quadraticFunction
  /* Calculate quadratic function y = ax^2 + bx + c */
  Modelica.Blocks.Interfaces.RealInput x annotation(
    Placement(visible = true, transformation(origin = {-106, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput y annotation(
    Placement(visible = true, transformation(origin = {104, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {98, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  parameter Real a = 1, b=2, c=3;
equation

  y = a*x^2 + b*x  + c;

annotation(
    Icon(graphics = {Rectangle(fillColor = {170, 170, 170}, fillPattern = FillPattern.Solid, extent = {{-100, 40}, {100, -40}}, radius = 15), Text( extent = {{-66, 15}, {66, -15}}, textString = "Quadratic function")}));
end quadraticFunction;

you can drag and drop input and output port from

Code:

Modelica.Blocks.Interfaces 

(or manually type the annotation for position and visibility) so the ports will be visible on top level. In the text view you can define your equation and some other parameters.

As fas as i know there are no "blank" block that enables you to create I/O port and define an equation on the fly or from top level, but maybe i'm wrong


Hope it helps

Feb-16-22 06:55:38
Hoe to start or install?

HI, i'm not familiar with stateflow, but there is a package in MSL Modelica.StateGraph or a 3rdparty Library Modelica_StateGraph2 that have state machine components.

Hi Andreas Th,

I have also had some problem when trying to integrate FMU from OM to a real-time test that require compilation from FMU-Source file. I dont have a direct solution to your problem, but maybe it will help. In my case, i had to recheck the modelDescription.xml to make sure all the necessary file are listed there, since in my case, the tool will read the xml file and goes from there. I also had to removed the defined "stopTime=1" in the xml file becaused it stoped my real-time test after 1s.

Like i've said, it might not be a solution to your problem but maybe it will give you some idea.

adrpo wrote:



Then you can either simulate model ReuseModel, plot x, change a = 10 in the plot view, right click on the simulation results, say resimulate and simulates with a = 10, 15, 20.

Hallo adrpo,

a follow-up question from your answer. does OM save the "old" value(s) when a model is resimulated?

MP wrote:


Do you know any way to restrict possible connections to input-to-output connections only (so that input-input (or output-output) connections will not be allowed)?

Why would you restrict the connection?

I dont have any idea how that would be done... normally you can use assert to check condition regarding parameter (i.e. check if a parameter within allowed limit), but i've never done a connectuion type checking.

If you could share your use case or a minimum working example, it would help.

Code:


model Test
Modelica.Blocks.Interfaces.RealInput input1;
Modelica.Blocks.Interfaces.RealInput input2;
Modelica.Blocks.Interfaces.RealOutput output1;
equation
  connect(input1, input2);
end Test;

failed the translation

Code:

[2] 16:09:22 Symbolic Error

[Test: 8:3-8:26]: Found equation without time-dependent variables: input1 = input2

[3] 16:09:22 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/BackEnd/ResolveLoops.mo: 295:9-295:86]: Internal error function resolveLoops_cutNodes failed

[4] 16:09:22 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.

[5] 16:09:22 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

I dont know the exact rationale behind it, but in my use case, nested model(s), i.e. input propagation, especially in schematic view.

You have a model A that have an input input_a nested/used insiede model B and model B itself is used inside a top model C. inorder to connect model C to input_a you have to create some input port to allow the value to be passed from C via B to A.

e.g.:

Code:


connect(modelA.input_a, modelB.input_ba) ; //connection between B and A inside modelB

connenct(modelC.someValue, modelB.input_ba) ; //connection between some value to B inside model C

of course you can write your own under equation section in text view such as:

Code:

connecnt(modelC.someValue, modelB.modelA.input_a); //connection between modelA and someValue in model C

but sometimes user only want to do the modelling through schematic/diagram view and thats why it is possible to connect two input ports together.

at least that is MY reasoning.

cheers

In my use case, i want to implement the combiTimeTable inside a FMU, with the possibilites to change the interpolation.

a test model is such:

Code:

model tableSource

  import loadFile = ModelicaServices.ExternalReferences.loadResource;
  parameter String internalFile = "modelica://thermalSimulation/internalFile.txt";
  parameter Modelica.Blocks.Types.Smoothness smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments;
  parameter Modelica.Blocks.Types.Extrapolation extrapolation = Modelica.Blocks.Types.Extrapolation.LastTwoPoints;
  Modelica.Blocks.Sources.CombiTimeTable combiTimeTable(extrapolation = extrapolation,fileName = loadFile(internalFile), smoothness = smoothness, tableName = "internalTable", tableOnFile = true) annotation(
    Placement(visible = true, transformation(origin = {-12, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealOutput profile_out annotation(
    Placement(visible = true, transformation(origin = {52, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {58, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(combiTimeTable.y[1], profile_out) annotation(
    Line(points = {{0, 2}, {52, 2}}, color = {0, 0, 127}));
end tableSource;

i've noticed that if i disable the option

Code:

Evaluate all parameters

from Tools-> Options -> Simulate and export the FMU, OM will packed all the currently loaded library on OMEdit into the FMU. Is it a bug? or that is the intended behaviour when exporting the FMU?

EDIT:
solved by installing the nightly build 1.19

Nov-02-21 10:18:28
I don’t know where to download and install it in openmodelica

thanks @sjoelund,  i'm not aware of this change,so my reply was based on V1.18.

On the side note: How does this effect user w/o an internet connection? I assume, it was down to make it easier for user to mange package based on its version on github etc?

Nov-02-21 06:44:47
I don’t know where to download and install it in openmodelica

Note: Based on OMEditor V1.18

with "Basic" library, you mean the Modelica Standard Library?

there are some other libraries in

installDir\lib\omlibrary

and "Installing" library is as simple as open the library/package (or ctrl-o).

You could fine more libraries on Modelica GitHub

Its quiet hard without an example. But if i understand correctly, maybe the output flow should be set to zero when h equal to zero since in

Code:

rho * S * der(h) = flow 

the only variables are

Code:

 der(h) 

and

Code:

 flow 

so if you set

Code:

 flow = 0 

the derivative oo h should also be zero.

but again, without example model i could only guess.

Hope it helps you.

Could you provide a minimal example from your code?

Have you look into the BouncingBall model from modelica? in there, the position of the ball is set to always positive i.e. when h<=0.0 the speed of the ball recalculated (reinit) and the ball "jumps" back in the air. How should your model reacts, if the water level is equal to zero? Does a pump start to fill the container so the level would rise or something else happen?

Thanks for the info!

I've tested the FMU for my use case, but it didn't go smoothly yet. Here are some points i've found during my test

Background:
the exported FMU from OM will be implemented in dSPACE real-time simulation. For this, dSPACE software will take the extracted fmu and compile it to rt-application according to the content of sources directory and modelDescription.xml

So the compile proccess is still un-successful and can be break down into four problems.

1) the included header file fpr cvode use angle-bracket <> and assumes the neccesarry files are in the standard seach path. I manually changed to search on relative path "" and it does the trick solving missing file error

2) the IDA and KINSOL directory were not included in "./resources/sundials" directory inside the FMU. I manually unpacked, add and repack the fmu and it seems does the trick.

3) in the sundial_error.h the header file omc_config.h is included if OMC_FMI_RUNTIME is not define (line 44-45). The omc_config.h file it self does not included in the FMU. I try to set the macro when building the rt-application and the missing file error is gone. --> so the question is, should i or should i not defiine the macro?

4)the rt-app compiler throw errrors for sundial_xxx.h files with following error

Code:

error: expected declaration specifiers before '__declspec' #define SUNDIALS_EXPORT __declspec(dllimport)

and it seems to come from sundial_config.h (line 153) for this i haven't found any workaround. --> for this i wil try to export the fmu with Platforms setting set to Static (previously was None) but i'm nut sure, since dSPACE doesn't seems to look inside the binary folder of the FMU

Edit:
on point #4 it seems declaring LINK_SUNDIAL_STATIC eliminate the errors mention above. but building the rt-app still unsuccessful. current/big_smile

when i check or simulate some of my model, the following translation error is shown

Code:

[2] 09:06:43 Translation Error

[C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFUnit.mo: 883:7-883:68]: Internal error function lexer failed

but the simulation seems to work just fine. I'm trying to make a minimal working model and will share it as soon as i'm done.

any idea why OM throw that error?

Edit:
so the problem is, i defiend a unitless Real parameter as

Code:

parameter Real Kp(unit="-")

and it seems OpenModelica does not like that

Thanks for the reply, i've tried it and it seems to worked. there are now sundials directory inside .\sources, cvode_solver.c was added to .\soruces\simulation\solver and new .json file in .\resouces. But on the init_fmu_c the solver mowthod is still defined as dassl. I will try if this work for my use case, since the FMU will be compiled from the source code by the tool to create real-time app for HiL test.

Another question, why is the fmu flag has to be set globally? it seems the like the export function does not look into model translation flag. I've mention it regarding the missing fmu attributes that also define in translation flag.

in this topic fmu-simulates-incorrectly

a FMU export using CVODE was mentioned. I am now trying to export my model as Co-Sim FMU using cvode to no success. I explicitly set the solver flag to

Code:

s="cvode"

in model annotation but solver method in the modelName_init_fmu.c still defined as "dassl".

How is the proper way to export co-sim FMU using cvode?

CMIIW, but component's name will be shown in diagram view only when on component's icon view the place holder

Code:

%name

is defined.

As example, look at the icon view of basic electrical resistor (Modelica.Electrical.Analog.Basic.Resistor). There you will see a place holder for component's name and a parameter.

Hope it help you.

Aug-19-21 12:05:44
Is there a way to save the output settings

More often than not, I only want to save a certain variable from my model and have to re-write the filter after i re-open a model.

is there a way to save the settings from output tab to model annotation? Since the experiment settings and other flags could be saved, i dont see why the option setting could not be saved in model annotation

Jul-08-21 06:15:48
Simulating a simple model resulting in clang error linker

it works now. thanks!

Jul-02-21 13:24:25
Simulating a simple model resulting in clang error linker

adrpo wrote:


I suggest you restart (to kill any process that might hold dlls or exe hostage) then uninstall OpenModelica then delete the directory, then install it again.

OK, i will give it a try.

Thanks Adrian!

Jul-02-21 13:07:09
Simulating a simple model resulting in clang error linker

Hi Adrian, thanks for the reply

just updated to v1.18.0-dev-285-gc5eac8a7bd (64-bit) from (i think) v.1.13. Is there a workaround to fixed it or should it be a re-install ?

Edit: found the dir './5.3.0' should i just delete it?

Jul-02-21 11:53:41
Simulating a simple model resulting in clang error linker

simulating a simple model

Code:


model simple
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage1;
  Modelica.Electrical.Analog.Basic.Ground ground1;
  Modelica.Electrical.Analog.Basic.Resistor resistor1 ;
equation
  connect(ground1.p, constantVoltage1.n);
  connect(resistor1.p, constantVoltage1.p);
  connect(ground1.p, resistor1.n) ;
annotation(
    experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-6, Interval = 0.002),
    __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian",
    __OpenModelica_simulationFlags(lv = "LOG_STATS", s = "dassl"));
end simple;

resulting in

clang: error: linker command fail

usinng -v compiler flag i got these information (some of it, can not upload a txt file od screen shot at the moment)

 Spoiler Show Spoiler Hide Spoiler
 
clang -I. -o simple.exe simple.o simple_functions.o simple_records.o simple_01exo.o simple_02nls.o simple_03lsy.o simple_04set.o simple_05evt.o simple_06inz.o simple_07dly.o simple_08bnd.o simple_09alg.o simple_10asr.o simple_11mix.o simple_12jac.o simple_13opt.o simple_14lnz.o simple_15syn.o simple_16dae.o simple_17inl.o simple_18spd.o -I"C:/OpenModelica/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=simple -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"H:/Eigene Dateien"    -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse   -v  -I"C:/OpenModelica/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=simple -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"C:/OpenModelica/lib//omc" -L"C:/OpenModelica/lib" -Wl,--stack,16777216,-rpath,"C:/OpenModelica/lib//omc" -Wl,-rpath,"C:/OpenModelica/lib"  -fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lomcgc -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Wl,-Bdynamic -Wl,-Bdynamic -lSimulationRuntimeC -Wl,-Bdynamic -Wl,-Bdynamic -lomcgc -lregex -ltre -lintl -liconv -lexpat -static-libgcc -luuid -loleaut32 -lole32 -limagehlp -lws2_32 -llis -lsundials_nvecserial -lsundials_sunmatrixdense -lsundials_sunmatrixsparse -lsundials_sunlinsoldense -lsundials_sunlinsolklu -lsundials_sunlinsollapackdense -lsundials_sunlinsolspbcgs -lsundials_sunlinsolspfgmr -lsundials_sunlinsolspgmr -lsundials_sunlinsolsptfqmr -lsundials_sunnonlinsolnewton -lsundials_cvode -lsundials_cvodes -lsundials_idas -lsundials_kinsol -lumfpack -lklu -lcolamd -lbtf -lamd -lsuitesparseconfig -lipopt -lcoinmumps -lpthread -lm  -lgfortran -lquadmath -lmingw32 -lgcc_eh -lmoldname -lmingwex  -luser32 -lkernel32 -ladvapi32 -lshell32 -lopenblas -lcminpack -Wl,-Bdynamic -lwsock32 -lstdc++
clang version 11.0.0 (https://github.com/msys2/MINGW-packages c0083b9edc111315c868f9c53dd60aaa78d1669b)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:\OPENMO~1\tools\msys\mingw64\bin
"C:\\OPENMO~1\\tools\\msys\\mingw64\\bin\\ld" -m i386pep -Bdynamic -o simple.exe "C:\\OPENMO~1\\tools\\msys\\mingw64\\x86_64-w64-mingw32\\lib\\crt2.o" "C:\\OPENMO~1\\tools\\msys\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\5.3.0\\crtbegin.o" "-LH:/Eigene Dateien" -LC:/OpenModelica/lib//omc -LC:/OpenModelica/lib "-LC:\\OPENMO~1\\tools\\msys\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\5.3.0" "-LC:\\OPENMO~1\\tools\\msys\\mingw64\\x86_64-w64-mingw32\\lib" "-LC:\\OPENMO~1\\tools\\msys\\mingw64\\lib" "-LC:\\OPENMO~1\\tools\\msys\\mingw64\\x86_64-w64-mingw32/sys-root/mingw/lib" simple.o simple_functions.o simple_records.o simple_01exo.o simple_02nls.o simple_03lsy.o simple_04set.o simple_05evt.o simple_06inz.o simple_07dly.o simple_08bnd.o simple_09alg.o simple_10asr.o simple_11mix.o simple_12jac.o simple_13opt.o simple_14lnz.o simple_15syn.o simple_16dae.o simple_17inl.o simple_18spd.o --stack 16777216 -rpath "C;C:\\OPENMO~1\\tools\\msys\\OpenModelica\\lib\\omc" -rpath C:/OpenModelica/lib -Bstatic -lregex -ltre -lintl -liconv -lexpat -lomcgc -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Bdynamic -Bdynamic -lSimulationRuntimeC -Bdynamic -Bdynamic -lomcgc -lregex -ltre -lintl -liconv -lexpat -luuid -loleaut32 -lole32 -limagehlp -lws2_32 -llis -lsundials_nvecserial -lsundials_sunmatrixdense -lsundials_sunmatrixsparse -lsundials_sunlinsoldense -lsundials_sunlinsolklu -lsundials_sunlinsollapackdense -lsundials_sunlinsolspbcgs -lsundials_sunlinsolspfgmr -lsundials_sunlinsolspgmr -lsundials_sunlinsolsptfqmr -lsundials_sunnonlinsolnewton -lsundials_cvode -lsundials_cvodes -lsundials_idas -lsundials_kinsol -lumfpack -lklu -lcolamd -lbtf -lamd -lsuitesparseconfig -lipopt -lcoinmumps -lpthread -lm -lgfortran -lquadmath -lmingw32 -lgcc_eh -lmoldname -lmingwex -luser32 -lkernel32 -ladvapi32 -lshell32 -lopenblas -lcminpack -Bdynamic -lwsock32 -lstdc++ -lomp -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lkernel32 "C:\\OPENMO~1\\tools\\msys\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\5.3.0\\crtend.o"
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(simulation_runtime.o):simulation_runtime:(.text+0x5327): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(simulation_runtime.o):simulation_runtime:(.text+0x5370): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(simulation_runtime.o):simulation_runtime:(.text+0x65c6): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(dataReconciliation.o):dataReconciliation:(.text+0x6b): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(dataReconciliation.o):dataReconciliation:(.text+0xd6f2): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libSimulationRuntimeC.a(dataReconciliation.o):dataReconciliation:(.text+0xd93d): more undefined references to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()' follow
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x15522): undefined reference to `_gfortran_os_error_at'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x1567e): undefined reference to `_gfortran_os_error_at'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x16729): undefined reference to `_gfortran_os_error_at'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x1682a): undefined reference to `_gfortran_os_error_at'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x24847): undefined reference to `_gfortran_os_error_at'
C:\OPENMO~1\tools\msys\mingw64\bin\ld: C:/OpenModelica/lib//omc/libcoinmumps.a(dmumps_part5.o):dmumps_part5.Fcurrent/sad.text+0x33367): more undefined references to `_gfortran_os_error_at' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make: *** [simple.makefile:37: omc_main_target] Error 1
mingw32-make: Leaving directory 'C:/Users/xxx/AppData/Local/Temp/31/OPENMO~1/OMEdit/simple'
Compilation process failed. Exited with code 0x00000002.
can somebody enlighten me, what was going on?

I find the subject is interesting. one question about using CVODE in FMU

from OM User Guide:

To have CVODE in a SourceCode FMU the user needs to add all sources for SUNDIALS manualy and create a build script as well

what or which build script is this reffering to? is it a build script to zip the FMU?

Thanks in advance

Jun-28-21 11:23:20
Simulation failed when using OMEdit on server
Category: Developer

Just got an update to v1.18 on server. Simulation failed with following code:

Code:

/usr/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'

/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
mingw32-make: *** [test.makefile:37: omc_main_target] Error 1
mingw32-make: Leaving directory 'C:/Users/xxx/AppData/Local/Temp/31/OPENMO~1/OMEdit/TESTCA~1.TES'
Compilation process failed. Exited with code 0x00000002.

what is a possible cause of the error? since it works on v1.18 on local machine and v1.14  current/big_smile

OM on server:
Connected to OpenModelica v1.18.0-dev-285-gc5eac8a7bd (64-bit)
Connected to OMSimulator v2.1.1.post70-gdf73447-mingw

Or could we use final prefix for the parameter? Modelica Langage Spec 3.4 chapter 7.2.6

Code:

final parameter Modelica.Block.Type.Extrapolation myExtrapolation = ... 

my first idea was a bit hacky and i didn't like it  current/big_smile

How did you pass the parameter in your model?

using the code below the parameter became structural and thus cannot be changed when re-simulating

Code:


parameter Modelica.Blocks.Types.Extrapolation myExtrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint ;
  Boolean isOne;

equation
  if myExtrapolation == Modelica.Blocks.Types.Extrapolation.HoldLastPoint then
    isOne = true;
  end if;

Jun-07-21 12:15:14
automatically load used library defiene in package or model

Hi perost,

Ok, i'll try it on the nightly build. But that means, I have to include the path to Library on OPENMODELICALIBRARY env variable? (i'm using window)

Jun-07-21 11:57:02
automatically load used library defiene in package or model

Say i have a directory named Library and inside it there were the directories Lib_A, Lib_B (each with package.mo inside) and model_1.mo

Code:


package Lib_A
annotation(version="1.0.0");
end Lib_A

Code:


package Lib_B
annotation(uses(Lib_A(version="1.0.0"));
end Lib_A

and

Code:


model model_1
annotation(uses(Lib_A(version="1.0.0"));
end Lib_A

opening Lib_B will automatically loads Lib_A but not when opening model_1.

Why is the dependency frorm one package to other (in the same path) could be reolved but not between model and package?

OM version 1.14

cheers

Which OM version did you use? It works on OpenModelica v1.14.0-dev-26586-geb59bf2b38 .

Try to search about variable filter in OpenModelica. It uses Regex to match a variable name(s) to filter(s). You can then save the result as csv, mat or plt.

cheers

Code:


Modelica.Blocks.Sources.Step step1(height = -30, offset = 15, startTime = 10);

at t=10s the value will step downwards (negative height) with amplitude of 30.

Apr-21-20 10:32:30
Model simulation on parallel in many cores

I'm too, interested in this topic. I've found some old presentation from OM developer on Google, but no concrete use case/example so far... How could we utilize multi core for Openmodelica simulation? is it possible?

Basically if you read the link i attached on my prev comment you should write a matrix in text file with a certain format (see the link).

for your case maybe somthing like this:

Code:


#1
double TempMatrix (#ofRow, 3)
#time indoorTemp OutdoorTemp
value value value
value value value
value value value

You could just copy paste the values from excel.

Try to play around with 1D-Lookup table on OpenModelica.

You could convert it as text file and using a 1D-lookup-table block. Read further info here CombiTable1Ds

No, you can not change the value of parameter during simulation. You could write your point mass model and make the mass a variable, that way it can be cahnged during simulation.

Hope it helps.

Cheers

IMHO you could use some Real I/O for each I/O you want to connect, so the FMU has a "port" to outside.

For example:

Code:


  model RL
    ...
    output Real i_out;
   ...

   equation
    i_out = currentSensor1.i
   end RL;

  model controller
    ...
    input Real u2_in
   ...

   equation
   feedback1.u2 = u2_in
   end controller;

so you can connect the ports in python.

Code:

 connections = [( RL ,"i_out",controller ,"u2_in") 

i think it will solve your underdetrmined problem.

Cheers

yes you have to define P first in your model (i.e. calulate variable P = V * I)

you could use the parametric plot in Plotting view (spiral solid line under menu bar)

Nov-25-19 09:08:24
A simple 3 phase rectifier model cannot be initialized.

i Tried your model and got a matrix singular error. Somtimes a numerical singular can be caused by the ground block. You could try to move your ground to other pin (like D6.p or resistor.n) and see if its works.

If i rememberd corretly, this happend to me once on some circuit and had to used two ground instead of one in order to make my model works.

hope it helps you debug your model

Cheers
A

Nov-18-19 08:57:09
Category: Programming

It would be great if you couldgive some simple code that represent what you are trying to do and also maybe give the information on what error exactly that OMEdit was giving you. It would help other to understand your problem better.

best regards

Nov-15-19 06:32:41
Category: Programming

was there any error reported on OMEdit or on simulation output window?

Nov-08-19 08:58:40
Category: Programming

https://mbe.modelica.university/behavio … ete/decay/
https://mbe.modelica.university/behavio … te/events/

Hi, above link give you an example and can better explain the different than me. Hope it helps.

sjoelund.se wrote:


The only integration method you can set for co-simulation FMUs is Euler. Dassl is not supported.

Hi Martin,

is the Step size in FMU set a a default value (e.g. 0.001s) or can we define it via annotation?

Thanks

Hi, if I understand it correctly, you used a parameter as a condition in a If-statement, thus makes "method" a structural parameter and you can not change it. Instead, maybe you can defined "method" as an input

Code:

 input Integer method 

.

Like i said, my understanding about sructural parameter might be wrong current/tongue

@Mingzhe37: Thank you for the suggestion. But i'm looking for more offline solution. If i understand it correctly, you still need to connect to internet when using GitHub Desktop even if your repo is in local. But I might be wrong tho.

I'll try martin's suggestion for now using gitforwindows and meld, and see if it is sufficient for my need at the moment.

Cheers

but the integrated Git function is still disabled on OMEdit, isn't it? Or that is not what you ment?

As time goes on the package becoming more complex with many changes in models and sub-models.

What are the best practice to keep track of the changes in packages and models?

P.S I dont save my Pacakge as one file  current/big_smile  current/tongue

IMHO you can download the version released on 27th of June since the next change is implemented on 1st of July version. I don't thing they put every old released in older folder, just versions with changes from the previuos. But i might be wrong.  current/big_smile  current/big_smile  current/big_smile

Thanks for the feedback.

I have noticed that in ModelName_init_fmu.c the solverMethod always set to "dassl".

From model annotation such as

Code:


annotation(
    Icon(coordinateSystem(preserveAspectRatio = false)),
    Diagram(coordinateSystem(extent = {{-180, -180}, {180, 180}})),
  experiment(StartTime = 0, StopTime = 1E8, Tolerance = 1e-06, Interval = 0.001),
  __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,evaluateAllParameters,NLSanalyticJacobian -d=initialization ",
  __OpenModelica_simulationFlags(lv = "LOG_STATS", outputFormat = "csv", s = "euler"));

the values that written in ModelName_init_fmu.c are the one under experiment annotation (startTime, stopTime etc). That's why i was wondering why it was always defaulted to dassl.

Jul-24-19 10:58:08
Category: Programming

What error message did OM give you?

Is there a possibility to set the integration method and time step when exporting FMU as a co-simulation other than dassl?

When Starting a simulation, a Translation Warning from GreaterEqual Block about

Code:

 Assuming fixed start value for the follwoing variable: Component.greaterEqual.y(fixed=false) "Connector for Boolean output signal 

does this had anyting to do with 5565

I only used the output y as a condition for a When-Loop and not connected to anything else-

See Modelica.ComplexBlocks.Examples

Connecting two of my models (model A and model B) resulting in a Translation Error

Code:

 

[16] 10:21:48 Translation Warning
There are discrete tearing variables because otherwise the system could not have been torn (unsolvables). This may lead to problems during simulation.

[17] 10:21:48 Translation Error
[Modelica.Blocks.Logical: 819:7-819:23]: The language feature non-linear equations within when-equations is not supported. Suggested workaround: Perform non-linear operations outside the when-equation (this is slower, but works)

[18] 10:21:48 Translation Error
Internal error function createNonlinearResidualEquations failed

[19] 10:21:48 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 3306:9-3306:50]: Internal error function createOdeSystem failed for component torn nonlinear Equationsystem{{{107:45}, {110:141}, {106:43}, {105:44}, {104:51}, {102:136}, {101:1}, {100:2}, {81:46}, {80:47}, {99:4}, {82:50,49,48,127}, {85:140}, {83:42}, {98:26}, {97:137}, {96:12}, {95:11}, {88:31,33,128,29,28,130,132,133,37,30,131,40,35,36,129,134,39,34,38,32}, {94:10}, {93:9}, {92:8}, {90:23}, {87:14}, {86:19}, {91:22}, {89:13}, {109:27}},
{84, 103, 108:55, 3, 41} Size: 3

[20] 10:21:48 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 1478:5-1478:77]: Internal error createEquationsForSystems failed

[21] 10:21:48 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 746:5-746:146]: Internal error function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]

Simulation each model ontheir own works perfectly. The translation error points to Timer block, which is present multiple time in both model A and B, so i can not pinpoint the exact block causing this problem. is there any flags that can help me debug this error.

P.S: I can not share the models due to policy and trying to figure it out how can i reproduce this error with a simplify models.

Cheers
A

Jul-10-19 19:29:19
Category: Programming

Ingrasciotta wrote:

I want to print an error when these two parameter are false or true both of them at the same time.

I try to use an auxiliary boolean parameter n

you can compare both parameters directly as the condition of assertion.

assert is triggered (e.g. the simulation is stopped) when the condition is not fulfilled(i.e. condition = false). In your case it should be


Code:



mode foo
  parameter Boolean p1 = true;
  parameter Boolean p2 = true;
  Boolean n;
equation
  if p1 == p2 then
    n = false;
  else
    n = true;
  end if;
  assert(n,"Assertion Test" ,level = AssertionLevel.error);
  //or
  // assert(p1<>p2,"p1 can not be identical to p2", level = AssertionLevel.error); // this will also abort the simulation like above assertion
end foo;

so when both p1 and p2 have the same value, n would be false and thus the assertion triggered.

hope it helps you a little bit to understand OM

cheers
A


Jul-10-19 06:33:45
Category: Programming

ModelicaSpec

On Page 97, section 8.3.7 there are explainations on asset funtion. Maybe it might help you.

Cheers
A

Jul-05-19 13:28:36
Category: Programming

I know it sounds strange, but i think i read it somewhere that a 'parameter input' prrefix is exsist.

I've try it on a model
[code]
Model Foo
parameter input Real x;
parameter input Integer k;
Real y;

equation
y = x*k;
end Foo;
[\code]

saving and instantiating the model did result in any error. I then make a second model
[code]
Model Foo2

Foo foo1 annotation(...);

end Foo2
[\code]

So in Foo2 i can double click on foo1 and open the parameter window like usual.

What interesting is when i exported as FMU, Foo.fmu listed x and k as input where as Foo2 listed foo1.x and foo1.k as parameter.

how does the 'paramter input' combination works? or how does it intended to use? So can x and k be manipualted as input or parameter?

cheers

When i tried to compared two Real variable for if/when condition a Translation Warning is given by OM

Code:


[2] 08:17:44 Translation Warning
[KS_modelica.Blocks.Electrical.Load.Internal.DefaultLoadProfile: 82:3-82:67]: In relation A <> B,  <>  on Real numbers is only allowed inside functions.

[3] 08:17:44 Translation Warning
[Load.Internal.DefaultLoadProfile: 92:3-92:66]: In relation A <> B  <>  on Real numbers is only allowed inside functions.

[4] 08:17:44 Translation Warning
[Load.Internal.FaultProfilesUnit: 30:3-42:9]: In relation C== 1.0,  ==  on Real numbers is only allowed inside functions.

[5] 08:17:44 Translation Warning
[Load.Internal.FaultProfilesUnit: 30:3-42:9]: In relation C == 2.0,  ==  on Real numbers is only allowed inside functions.


With Real A,B,C;

If i recall correctly, using Integer would not trigger the warning message. Using floor(C) still resulting in translation warning.

How is the best way to compare two real values w/o triggering the translation warninig?

P.S. simulation runss with out problem

Code:

 noEvent(abs(SSHP.eva.Q_flow) < 200.0 * SSHP.eva.vol.steBal.cp_default * max(0.001 * SSHP.eva.vol.steBal.m_flow_small, abs(PANELin.m_flow))) 

is the condition.

And according to the message:

Code:

In SSHPTest.SSHP.eva.vol.steBal: Energy may not be conserved for small mass flow rates.

   The implementation may require prescribedHeatFlowRate = false.

is your mass flow rates too small and it suggest you set the  prescribedHeatFlowRate = false.

maybe it will help you. I've never used the building library, but that is what i can understand from the error message. Hope the information helps you .

Cheers
A

Mingzhe37 wrote:

"In SSHPTest.SSHP.eva.vol.steBal: Energy may not be conserved for small mass flow rates.
   The implementation may require prescribedHeatFlowRate = false."

if i understand correctly, there is your problem. The simulation won't run because the assertion condition is not fulfilled.

Mingzhe37 wrote:

but the simulation can't execute

is there any error messages why the simulation would not execute?

Jun-28-19 06:37:56
Category: Programming

You could try to use Modelica.Blocks.Source.BooleanPulse and set period to 0.5s and width to 20% and vary the start time accordingly. Maybe that behaviour is what you want?

Jun-28-19 05:22:19
Category: Programming

didrif14 wrote:

The "BooleanTable" block creates the sequence i want, but the sequence is not symetrical and for that reason it is not repeating as I want it to.

what did you mean by the sequence is not symetrical?

in table block you define at which time point the boolean value chages and put the extrapolation as periodic.

Jun-27-19 21:56:58
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Hallo Philipp,

yes, please use the newest nightly build since it included the necessary c-files in modelDescription.xml. You have to export the FMU as FMU2.0 Co-Simulation. I don't think the static/dynamic linking is necessary since (as far as i know) ConfigDesk don't use the binary provided by OM but i always choose static linking anyway current/big_smile

glow wrote:

Question to Arinomo: Did you solve the problem for your project? If yes, would you share the workaraound with me/us please?

There are some MACROS that need to be defined before you compiled the RT-App in ConfigDesk.

The error you got is due to a missing FMI2_FUNCTION_PREFIX macro.

You can do that either in ConfigDesk

Code:

 FMI2_FUNCTION_PREFIX=ModelName_ 

or add it in ModelName_FMU.c c-file

Code:

#define FMI2_FUNCTION_PREFIX ModelName_

exported from OM (make more sense when you are working with multiple FMUs in one app).

Next you have to set

Code:

HAVE_MMAP=0

in ConfigDesk (only once per RT-Application).

Last you have to modify the modelDescription.xml file by removing the stopTime in

Code:

 DefaultExperiment startTime="0.0" stopTime="1.0" tolerance="1e-006" 

in every FMU you use.

i think with that steps you can successfully build a rt-app in ConfigDesk.

hope the info help you.

Cheers
A

Jun-24-19 05:39:34
Gettting time event
Category: Programming

Hi,

try

Code:


when x >=1.5 then
  T = time;
end when;

Using the "==" on real number will result in a Translation Warning. Maybe thats why it doesn't work.

Jun-19-19 10:23:01
I got this error when compiling FMU's sourcefile for RT-Application

When including the FMU for a rel-time application, i got this error when compiling die app


Making Makefile "CfgDeskInterface.mk"
In file included from f2c.h:162:0
                 from iparmq.c:13:
iparmq.c: In function 'iparmq_':
iparmq.c:24:12: error: expected declaration specifiers or '...' before numeric constant
     double log(doublereal):
            ^
Compiling failed  "C:\Users\User1\Documents\dSPACE\ConfigurationDesk\6.2\FMU_import_test\TopologyTest\Components\Simple_Topology\sources\external_solvers\iparmq.c"
Making Makefile "CfgDeskInterface.mk" failed

i know its not directly OM related theme, but i've try to google it, but have not really understand whats the error means. thank you in advance

Code:


model Model_A
...
   algorithm
  if timer_dyn.y > t_dyn then
    condition1 := true;
  else
    condition1 := false;
  end if;
 
  if isOV or isUV or condition1 then
    isON := false;
  else
    isON := true;
  end if;
  y := i;

end Model_A;

model Model_B
   ...
   equation
  if timer_dyn.y > t_dyn then
    condition1 = true;
  else
    condition1 = false;
  end if;
 
  if isOV or isUV or condition1 then
    isON = false;
  else
    isON = true;
  end if;
  y = i;

end Model_B;

Hi Everyone,

I have some question about the difference between algorithm statment and equation and how it handled in Modelica. Both Model_A and Model_B have the same functions. Both work identically as far as some test that i run in OM (i.e isON change its state when ever the conditions are met). The only difference that i notice is when i export the model as FMU. In the description file of Model_A the following c-flies are included:


      ./simulation/solver/nonlinearSystem.c
      ./simulation/solver/nonlinearValuesList.c
      ./simulation/solver/nonlinearSolverHybrd.c
      ./simulation/solver/nonlinearSolverHomotopy.c
      ./external_solvers/enorm_.c
      ./external_solvers/hybrj_.c
      ./external_solvers/dpmpar_.c
      ./external_solvers/qrfac_.c
      ./external_solvers/qform_.c
      ./external_solvers/dogleg_.c
      ./external_solvers/r1updt_.c"
      ./external_solvers/r1mpyq_.c

that weren't included in the modelDescription of Model_B. So i was wondering, how/when was it preferable to assign somting as an algorithm statment and how/when it is better to do with a normal equation? One thing i notice is, with algorithm statment, you can, for example, write two or three differrent when-statment and assign the same variable with different value and still count as one equation, but the same process as equation will count as two or three.

Code:


when a then
  Variable := a
end when;

when b then
  Variable := b
end when;

cheers
A

For example: i have a partial/base model with some documentation writen in annotation. This model is then extended to a final mode.

Is there any posibbility to include the documentation from partial model to final model automatically? or is there a better approache it ro link(?) the information from final model to partial model so user can easily read the information about the partial model?

thanks in advance

On a simulation model, i have ~80+ components with naming pattern Components_1 ... _80 and i want to connect the input and output of the models with an array

Code:


RealInput u[80]
RealOutput y[80]

from Modelica.Blocks.Interfaces.

To speed things, i wrote a python script that output the equation to assign component's i/o to array i/o on a text file, and i only need to copy-paste it in text view.

the strange thing is, it works with the connection between component's input and RealInput but not with the outputs

Code:


Model Foo
  C Component_1,...,Component_80;
  RealInput u[80];
  RealOutput y[80];

equation
  Component_1.u = u[1];
  ...
  Component_80.u = u[80];

  Component_1.y = y[1];
  ...
  Component_80.y = y[80];

  //Note that all connections above are copied-pasted from a text file
end Foo;

the translation error is saying something like "Component_1.y variable is not exist". But if i wrote the equation manually for Component_1.y, the error message would than said that "Component_2.y is not exist". So what i understand is, i have to write all the connection manually.

i find this behaviour is very strange. Any Idea what happend here?

May-22-19 09:59:07
I have a simulation where the Power from a battery varies with time. I want to count how many...

Hi, so i copy the example and add a variable Counter

Code:


Integer Conter_1C(start=0,fixed=true);

and following equation

Code:


when battery_1C.PNet == 0 and battery_1C.PNet <> pre(battery_1C.PNet) then
    Counter_1C = pre(Counter_1C)+1;
  end when;

and after the simulation got Conter_1C = 43, which i think the right number of times when PNet equal to 0 before being cahrge. Hope it helps you.

Cheers

May-21-19 14:55:28
ThermoPower librarys' examples

Hmm, i can reproduce you error message, when i try to instantiate the HE model on ThermoPower.Example.RanikeCycle.Model.HE

which, if i understand correctly, can not be simulate on its own.

HE is used in ThermoPower.Example.RanikeCycle.Model.Plant, which the used on an example model in ThermoPower.Example.RanikeCycle.Simulators.ClosedLoop. Maybe that's the model you want to run. But it will still give you an error (at least on my pc with ver1.14.dev)

there is something funky going on with the example on thermo model(if you scroll down the forum, there are a lot of post regarding Thermo library).

Maybe someone who is more familiar/knowledgeable with the issue can help you further. Sorry.

Cheers

May-21-19 14:39:36
I have a simulation where the Power from a battery varies with time. I want to count how many...

HI, is it possible to share you model?

May-21-19 06:49:06
I have a simulation where the Power from a battery varies with time. I want to count how many...

jayahoharish wrote:

when PNet=0 then cn=pre(cn)+1; end when PNet=pre(Pnet);

You are missing a semicolon the end of  "end when" and the conditon of when should be boolean comparison, i.e PNet == 0. so more or less you code should look like this

Code:


when PNet == 0 and PNet <> pre(PNet) then
  cn = pre(cn)+1;
end when;

hope it helps. Cheers

May-21-19 06:40:30
ThermoPower librarys' examples

akhtarzeb wrote:


I cannot run any of the ThermoPower librarys' examples in the OMEdit. Why?

What kind of error did you get when trying to simulate an example from ThermoPower library?

perost wrote:


You must use arrays in that case, you can't construct variable names dynamically like that.

Okay, thank you very much.

Hallo everyone,

Code:


Model Foo
  MyModel. M1,M2,M3,...,Mn;
  Real y1,y2,y3,...,yn;

algortihm
  for i in 1:n loop
    yi := Mi.output;
  end for;

end Foo;

So i want to assign each model output from M[i] to its respective y[i] like the model above and got a translation Error.

is it possible to use for loop to assign variable as i intended above? or it only works for array index?

Cheers

Code:


loadModel(Modelica,{"3.2.2"})
cd("C:/OpenModelica/lib/omlibrary/Modelica 3.2.2/Blocks")
loadFile("Math.mo")

i forgot that i tested it in OM Compiler CLI. Try above commands in shell, i think now its working. current/big_smile

Ahhhh, i see... try to change the directory first and then load the file. For example in my case

Code:


cd("C:/Openmodelica/lib/omLibrary/Modelica 3.2.2/Blocks")
loadFile("Math.mo")

imho it should works current/big_smile

ndrsh2 wrote:

When I want to load the file /usr/lib/omlibrary/Modelica 3.2.2/Blocks/Math.mo in OMShell-terminal it fails:

Hi,

I can'not seems to fine a Math.mo file in my Modelica 3.2.2

Code:

loadFile("C:/OpenModelica/lib/omlibrary/Modelica 3.2.2/Math/Special.mo")

Above code loads the Special.mo inside the Math folder and it works. Do you want to load one model or the hole package?

Cheers

Code:


model goo
  parameter Real x;
  constant Integer c = 3;
  Real y

equation
  y = c * x;
end goo;

y is a variable that will be calulated in the simulation, x is a variable that you can change before a simulation (but will held cosntant from t=0 until t=end) and c is a constant that you define in the model and can not be change directly.

hope it helps.One good read about modeling in modelica could be found in http://book.xogeny.com/ if you are interested.

cheers

Hi Martin,

I've check on a win10 64bit at home and it still failed. Either from the long name or because mixed use of / and \ in windows (see code below). Anyhow, if its working, maybe it will work on the rt-machine as i intended.

Thank you again for your help.


Code:


[INFO][FMUCHK] Printing output file header
"time"
[INFO][FMUCHK] Model identifier for CoSimulation: PathTest
[INFO][FMILIB] Loading 'win64' binary with 'default' platform types
[INFO][FMUCHK] Version returned from CS FMU:   2.0
stdout            | info    | ... loading "TestTable" from "C:\Users\Arinomo\Desktop\Check\/E:/USERTEMP/fmucktmpa12888/resources/C:\Users\Arinomo\Desktop\Test\TestTable.txt"
assert            | debug   | Not possible to open file "C:\Users\Arinomo\Desktop\Check\/E:/USERTEMP/fmucktmpa12888/resources/C:\Users\Arinomo\Desktop\Test\TestTable.txt": No such file or directory
        [FMU][logFmi2Call][FMU status:Error] fmi2EnterInitializationMode: terminated by an assertion.
[FATAL][FMUCHK] Failed to initialize FMU for simulation (FMU status: OK)
FMU check summary:
FMU reported:
        1 warning(s) and error(s)
Checker reported:
        0 Warning(s)
        1 Error(s)
        1 Fatal error(s) occurred during processing

Hmm... that's interesting. I'll check if the proble really is a long path on Windows and will let you know. Thanks a lot.

Hallo Martin, Hallo Adrian,

thank you for the fix in nightly build. The loadResource (both in Modelica.Utilities and ModelicaService.ExternalReference) is now only include the intended file(s) in the resource folder of FMU.

I have a question regarding how the file inside resource folder is utilized. After a successful FMU export, I test the FMU using FMUChecker. I changed the original file's name on my computer to check if the file inside the resource folder is used or it still trying to used the original file and it seems fmuChecker is still looking for path to original file.

Is what I'm looking for, is the intended use case of including file in resource folder(i.e. FMU is useable out of the box by end-user)? or the end user should un-pack the FMU, download the file, change the path (e.g.  fileName of a combiTimeTable) and repack the FMU using makefile? or its just how fmuChecker works?

I've look at the FMI documentation, but seems didn't find any reference(or more likely missed it).

best regards
A

sjoelund.se wrote:


We do that if we have a call to uriToFileName(xxx) where xxx is not a constant string that we can resolve at compile-time. And for the MSL, it seems that the loadResource function is not marked with Inline=true.

I think the best fix would be for us to change ModelicaServices.ExternalReferences.loadResource to be marked Inline=true.

Hi Martin,
thank you for the feedback. Should I open a new ticket about this?

Hallo Adrian,

thanks for the reply. Regarding the Modelica URI, below is a simple model I made:

Code:


model PathTest
import Files = Modelica.Utilities.Files;
  Modelica.Blocks.Sources.CombiTimeTable combiTimeTable1(extrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint, fileName = Files.loadResource("modelica://KS_Tables/LookUp/myTable.txt"), smoothness = Modelica.Blocks.Types.Smoothness.ConstantSegments, tableName = "Test", tableOnFile = true)  annotation(
    Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

annotation(
    Icon(coordinateSystem(preserveAspectRatio = false)));end PathTest;

Where KS_Tables is an empty package I made, and LookUp is a folder I manually add in Win Explorer. Simulation of the model work fine with expected output. The problem is when I try to export the model as FMU using OMEdit (right mouse click-->Export-->FMU). When I did this, all Libraries that currently loaded in OMEdit are included in resource folder, regardless if they are used in model or not. When all other libraries are unloaded, only MSL is included, but not the KS_Tables.

Am I not understand the Modelica URI correctly? or did i make some other mistakes?

Thnks
A

Hallo everybody,

Say i have a model with two inputs u1 and u2 that feed to a 2D-LookupTable as an output in OMEdit. The table is saved inside a file with either .mat or .txt format.

My Question is, how does the FMU export process handle the external file? Can external file be included as a resource (i.e. packed together in FMU) or should the table hardcoded into the model? And if the table is hardcoded, is there any significant performance issue?

Using conditional in the fill Color is a better idea. I hope it is not hard to implement this function in future version. thanks, Adeel.

Hallo,

I'm trying to add a function that chenge the icon of one component based on the parameter selected in the diagram view with out needed to simulate the whole model (e.g. to make it easier for modeler to differentiate which function one model used).

my first idea is just to add a small rectangle in the middle of the larger rectangle and controll the visibility of the small rectangle using an if condirion set by parameter but it doesn't work.

Code:


model foo

  parameter Boolean isRed = false;

  annotation(
  Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-80, -80}, {80, 80}}, initialScale = 0.1),
  graphics = {Rectangle( origin = {0, -12}, fillColor = {0, 152, 154}, pattern = LinePattern.Dash, fillPattern = FillPattern.Solid, lineThickness = 1.5, extent = {{-60, 58}, {60, -28}}),
                     Rectangle(visible = isRed, origin = {-2, -10}, fillColor = {255, 0, 0}, pattern = LinePattern.Dash, fillPattern = FillPattern.Solid, lineThickness = 1.5, extent = {{-28, 32}, {36, -10}})
);

end foo;

Using the DynamicSelect on the small rectangle also didn't work

Code:


Rectangle(origin = {-2, -10}, fillColor = DynamicSelect({255, 0, 0},if isRed then {255,0,0} else {255,255,255}), pattern = LinePattern.Dash, fillPattern = FillPattern.Solid, lineThickness = 1.5, extent = {{-28, 32}, {36, -10}})

I think i've missed something. I've seen some example of water tank that change level or colour based on the parameter but it was happened during a simulation/ after the simulation was run and not automatically change into plotting view.

Is it possible to achieve what i intended in current OMEdit?

thanks in advance

Hallo,

I tried to write a comment on a ticket in tract but got marked as spam (both with email and as anonymous) and the reCapcha is broken.

Help? current/big_smile


best regards

NP! And your welcome...

I have not worked with JModelica, so i dont know how it works. OMEdit check your syntax and i think its a great thing. If you use OM Connection Editor and a syntax error comes up, it usually tell you at which line the error occur.

Maybe JModelica only check the keyword "end" after you declare a model or connection w/o checking the identifier. But I think i doesn't make any sense.

Hi,
on line 26 to 30

Code:


connector LiquidCon
         replaceable package medium=Medium;
           medium.Concentration c                                   "Concentration";
        flow Real F (unit="L/h")                                 "Flow rate";
     end LiquiCon;

you forget the D....  current/tongue

Is it possible to share the model?

best regards

Say I have a model that modelled

Code:

 y = x + c 

with c as a parameter with the value of 5 and i exported the model as FMU 2.0 for Co-Sim. What effect does it have, if I manually change the value of c to 3 in xml. does the master/import tool sees the value of c = 3? or it is still c = 5?

Mar-01-19 09:59:05
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

sjoelund.se wrote:


That's up to the FMU importer to implement. OMSimulator had some experimental real-time synchronization before its API changed current/smile

Okey, thanks for the calrification and good luck for the conference next week.

Mar-01-19 09:48:24
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Okey, thanks. i'll try to see if it is possilbe to use FMU from OMEdit with ConfigDesk from dSpace.

Do you have, by any chance, an information regarding implementation of OM's FMU for real-time test/HiL test?

Mar-01-19 07:59:35
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Hallo,

thanks for the feedback.

sjoelund.se wrote:


Which is different for different generated models. Note that the makefiles listed above says the prefix is KS_TA_HiL_Internal_SignalScaling, but the linking error has a different expected name...

I'm sorry, I copied the wrong makefile. I have edited my post so its consistent

sjoelund.se wrote:


Also note that you have -Wl,--output-def=KS_TA_HiL_Internal_SignalScaling.def in CPPFLAGS, which are preprocessor flags. It is a linker flag and might not be present when linking since it's not in LDFLAGS.

Referring to thread in

Code:

 https://openmodelica.org/forum/default-topic/2382-link-to-fmu-models 

could this be one of the reason of linking problem? at first i thought it could be one of the resons, but accoring to dSpace, since the "Source" tags is missing in the xml file,  ConfigurationDesk will ignore the binaries and try to compile directly from the source file. So maybe thats that.

The workaround of adding

Code:

 #define FMI2_FUNCTION_PREFIX Modelname_ 

is suggested by dSpace. Presumably referring to FMI2 Documentation section 2.1.1 page 14 and that's just how they set their automatic code generation for *.a and *.cpp used to build the real-time application. But as DarioMangoni said, it just broke a bunch more links, since now I got 30+ undifined referrence instead of the original 10.

Note that the original error all started with prefix dsfmu_ and referring to dsfmu_*.cpp file, and after the workaround it points to OM files in source folder.

One last question, in the ModelName_FMU.c generated by OMEdit, there one line that said

Code:

 #include "fmu2_model_interface.h 

why was it not

Code:

 #include "include/fmi2/fmu2_model_interface.h" 

Because the header file is in other subdirectory, so i thought this was my problem expalined on the first post and i have to include the

Code:

 FMURoot/source/inlcude/fmi2 

thanks again for the feedback, DarioMangoni and sjoelund.se

cheers

Feb-28-19 12:20:45
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Hallo DarioMangoni,

just an update, in case you are interested. The problem on the first post is solved by adding

Code:

#define FMI2_FUNCTION_PREFIX ModelName_

in the ModelName_FMU.c

some how the its not defined by default.

And a lot of

Code:

 #include "File" 

in the ModelName_model.h  and ModelName_FMU.c that are incorrect, because all the functions is now under

Code:

 source/include 

now i got a bunch more undefined reference (Hooray!!). i think i have to manually link every file.c that is needed by my model because it is not declared in the xml file.

Cheers

does anyone have any idea? i think it is one of the reason why i got so many undefined reference from my source code when compiling for a real-time application

Feb-26-19 14:58:48
mat file saved parameter after filtering, csv not.

in case somebody wants to see the progress

https://trac.openmodelica.org/OpenModel … 361#ticket

thanks, Adeel!

cheers

Hi,

notarobot wrote:



My question is now: where and how can I define my inputs and outputs in OpenModelica?

You coulde declare two additional variable in your OpenModelica model as

Code:


input Real u
output Real y

and assign them in algorithm to torque and angular velocity respectively

Code:


algorithm
torque := u;
angular_velocity := y;

its not an elegant solution but i think its work.

As if OMEdit and ADAMS co-sim compatible, i dont have any experience in that

cheers

Feb-26-19 13:22:53
mat file saved parameter after filtering, csv not.
Feb-26-19 12:21:45
mat file saved parameter after filtering, csv not.

Hallo,

i have a simulation model with around 53 components, from which i only interested in 1 variable from 10 components. Using filter i can get the variable i need in csv format, but the mat format saved all components parameters in addition with the variables i interested in.

Is this a default setting in mat format (that all parameters are saved)? or is it a bug?

i have looked in the user guide, but did not find any reference (or missed the reference)
thanks

Hallo,

i was looking around and found in resources/dynamic.log of my FMU interesting lines

Code:


In file included from MyFMU_FMU.c:54:0:
include/fmi2/fmu2_model_interface.c: In function 'omc_assert_fmi_common':
include/fmi2/fmu2_model_interface.c:162:16: warning: passing argument 1 of 'GC_vasprintf' from incompatible pointer type [-Wincompatible-pointer-types]
   GC_vasprintf(&str, msg, args);
                ^
In file included from include/openmodelica_func.h:52:0,
                 from MyFMU_FMU.c:10:
include/util/modelica_string.h:71:5: note: expected 'const char **' but argument is of type 'char **'
int GC_vasprintf(const char **strp, const char *fmt, va_list ap);
     ^

it doesnt seems to effect the behaviour of my model in fmuCheck and when I import it in simulink. just currious what is and why the warning exist

Best regards

Feb-20-19 13:58:17
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Hi DarioMangoni,

thanks for the reply and help.  it is the generated makefile from OMEdit so i think its pretty much a standard template. I dont know if i had much option to make this works. because the software that the fmu imported to doesn't give so moch ouption on how to compile the build for the RT-machine. That or my knowledge is not sufficient enough.

once again thank you for your help.

Cheers
Arinomo23

Code:

# Makefile generated by OpenModelica

CC=gcc
AR=@AR@
CFLAGS=-Os -falign-functions -fno-ipa-pure-const -mstackrealign -msse2 -mfpmath=sse
LD=$(CC) -shared
LDFLAGS=-L"C:/OpenModelica1.13.264bit//lib//omc" -Wl,-rpath,"C:/OpenModelica1.13.264bit//lib//omc" -fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lomcgc -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Wl,-Bdynamic  -lSimulationRuntimeFMI  -Wl,-Bstatic -lregex -ltre -lintl -liconv -static-libgcc -lpthread -lm -lgfortranbegin -lgfortran -lquadmath -lmingw32 -lgcc_eh -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -limagehlp -lopenblas -lhdf5 -lz -lszip -Wl,-Bdynamic
DLLEXT=.dll
NEED_RUNTIME=
NEED_DGESV=
FMIPLATFORM=win64
# Note: Simulation of the fmu with dymola does not work with -finline-small-functions (enabled by most optimization levels)
CPPFLAGS=-DOMC_MINIMAL_RUNTIME=1 -DCMINPACK_NO_DLL=1 -Wl,--output-def=HiL_TechDay.def
OMC_NUM_LINEAR_SYSTEMS=0
OMC_NUM_NONLINEAR_SYSTEMS=0
OMC_NUM_MIXED_SYSTEMS=0
OMC_NDELAY_EXPRESSIONS=0
OMC_NVAR_STRING=0

override CPPFLAGS += -Iinclude/ -Iinclude/fmi2 -I.    -DOMC_MODEL_PREFIX=HiL_TechDay_Beispiel -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0

MAINFILE=HiL_TechDay_Beispiel_FMU.c
MAINOBJ=HiL_TechDay_Beispiel_FMU.o
CFILES=HiL_TechDay_Beispiel.c HiL_TechDay_Beispiel_functions.c HiL_TechDay_Beispiel_records.c \
HiL_TechDay_Beispiel_01exo.c HiL_TechDay_Beispiel_02nls.c HiL_TechDay_Beispiel_03lsy.c HiL_TechDay_Beispiel_04set.c HiL_TechDay_Beispiel_05evt.c HiL_TechDay_Beispiel_06inz.c HiL_TechDay_Beispiel_07dly.c \
HiL_TechDay_Beispiel_08bnd.c HiL_TechDay_Beispiel_09alg.c HiL_TechDay_Beispiel_10asr.c HiL_TechDay_Beispiel_11mix.c HiL_TechDay_Beispiel_12jac.c HiL_TechDay_Beispiel_13opt.c HiL_TechDay_Beispiel_14lnz.c \
HiL_TechDay_Beispiel_15syn.c HiL_TechDay_Beispiel_16dae.c HiL_TechDay_Beispiel_17inl.c HiL_TechDay_Beispiel_init_fmu.c
OFILES=$(CFILES:.c=.o)
GENERATEDFILES=$(MAINFILE) HiL_TechDay_Beispiel_FMU.makefile HiL_TechDay_Beispiel_literals.h HiL_TechDay_Beispiel_model.h HiL_TechDay_Beispiel_includes.h HiL_TechDay_Beispiel_functions.h  HiL_TechDay_Beispiel_11mix.h HiL_TechDay_Beispiel_12jac.h HiL_TechDay_Beispiel_13opt.h HiL_TechDay_Beispiel_init_fmu.c HiL_TechDay_Beispiel_info.c $(CFILES) HiL_TechDay_Beispiel_FMU.libs

# FIXME: before you push into master...
RUNTIMEDIR=include
OMC_MINIMAL_RUNTIME=1
OMC_FMI_RUNTIME=1
include $(RUNTIMEDIR)/Makefile.objs
ifneq ($(NEED_RUNTIME),)
RUNTIMEFILES=$(FMI_ME_OBJS:%=$(RUNTIMEDIR)/%.o)
endif

PHONY: HiL_TechDay_Beispiel_FMU
HiL_TechDay_Beispiel_FMU: nozip
    cd .. && rm -f ../HiL_TechDay_Beispiel.fmu && zip -r ../HiL_TechDay.Beispiel.fmu *
nozip: $(MAINOBJ) HiL_TechDay_Beispiel_functions.h HiL_TechDay_Beispiel_literals.h $(OFILES) $(RUNTIMEFILES)
    $(CXX) -shared -I. -o HiL_TechDay_Beispiel$(DLLEXT) $(MAINOBJ) $(RUNTIMEFILES) $(OFILES) $(CPPFLAGS) -L"C:/Users/trari/Documents/HiL_TechDay"   $(CFLAGS) $(LDFLAGS) -llis -Wl,--kill-at
    mkdir.exe -p ../binaries/win64
    dlltool -d HiL_TechDay_Beispiel.def --dllname HiL_TechDay_Beispiel$(DLLEXT) --output-lib HiL_TechDay_Beispiel.lib --kill-at
    cp HiL_TechDay_Beispiel$(DLLEXT) HiL_TechDay_Beispiel.lib HiL_TechDay_Beispiel_FMU.libs ../binaries/win64/
    rm -f *.o HiL_TechDay_Beispiel$(DLLEXT) $(OFILES) $(RUNTIMEFILES)
    cd .. && rm -f ../HiL_TechDay_Beispiel.fmu && zip -r ../HiL_TechDay.Beispiel.fmu *

Feb-20-19 08:11:31
non matching symbols in the libraries

Hallo,

I've try the workaround you posted, but somehow there are no prefix <modelname>_fmi2function in the updated lib file. I ran the make command using the msys in OMEdit. I think that is my problem. any idea?

Edit:
my bad

thanks

Feb-19-19 15:13:01
non matching symbols in the libraries

Okey, thank you for your answer and link. I try to read more about library linking.

Feb-19-19 14:27:06
non matching symbols in the libraries

Hallo,
thank you for you answer.

DarioMangoni wrote:


first of all: are you sure that your program is actually linking the FMU? Did you put the correct linking options in the linker command line?

could you elaborate more on that? I'm not too familiar with the linker for compilation in c/cpp  current/big_smile . The problem is, the only options available are  for me to include add certain search path for the custom source code and library (in this case the Model.fmu\source\include and Model.fmu\source\lnclude\fmi2) or to put a c/c++ compiler options (i assume this is where a put the linker flags).

i've tried to used -L<dllpath> and -lModel.dll but it keep resulting the same error.

Feb-19-19 08:25:36
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Hallo everyone,

I'm trying to implement a FMU Model exported from OMEdit for a real-time testing using dSpace's ConfigurationDesk to buid the executable for RT-Machine and i ran into some problems.

At first i got an error saying

modelname.h:5:26: fatal error: openmodelica.h: No such file or directory

and

modelname_FMU.c:16:34: fatal error: fmu2_model_interface.h: No such file or directory

both could be solve by including the paths

...\modelname\sources\include

and

...\modelname\sources\include\fmi2

respectively to successfully buld the modelname.a library

after that i gor error that said

Creating application image file ...
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUInitMdl':
dsfmu_mdlfunctions.cpp:(.text+0x3e): undefined reference to `HiL_TechDay_Beispiel_fmi2Instantiate'
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUStartMdl':
dsfmu_mdlfunctions.cpp:(.text+0xdf): undefined reference to `HiL_TechDay_Beispiel_fmi2SetupExperiment'
dsfmu_mdlfunctions.cpp:(.text+0xfd): undefined reference to `HiL_TechDay_Beispiel_fmi2EnterInitializationMode'
dsfmu_mdlfunctions.cpp:(.text+0x117): undefined reference to `HiL_TechDay_Beispiel_fmi2ExitInitializationMode'
dsfmu_mdlfunctions.cpp:(.text+0x1ca): undefined reference to `HiL_TechDay_Beispiel_fmi2Reset'
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUStep':
dsfmu_mdlfunctions.cpp:(.text+0x230): undefined reference to `HiL_TechDay_Beispiel_fmi2SetReal'
dsfmu_mdlfunctions.cpp:(.text+0x26a): undefined reference to `HiL_TechDay_Beispiel_fmi2DoStep'
dsfmu_mdlfunctions.cpp:(.text+0x291): undefined reference to `HiL_TechDay_Beispiel_fmi2GetReal'
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUProvideInputs':
dsfmu_mdlfunctions.cpp:(.text+0x4b6): undefined reference to `HiL_TechDay_Beispiel_fmi2SetReal'
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUGetOutputs':
dsfmu_mdlfunctions.cpp:(.text+0x576): undefined reference to `HiL_TechDay_Beispiel_fmi2GetReal'
dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUStopMdl':
dsfmu_mdlfunctions.cpp:(.text+0x71a): undefined reference to `HiL_TechDay_Beispiel_fmi2Terminate'
collect2.exe: error: ld returned 1 exit status
OPUS MAKE: Shell line exit status 1. Stop.
Make failed

my knowlage in c/cpp flags and compiling or in general is very limited to understand what happend with that error.  current/big_smile

I know its not directly OpenModelica realted topic but maybe someone had an experience with working on ConfigurationDesk or more understaing about the error and could point out to me what/where shoud I start to read to understand the problem.

Thank you in advance

Best regards

Ok, thanks for the response

I commented out the inital equation

Code:

 if WireData[1] < 0 then

    terminate("Parameters for Wire model not possible.");
  end if;

and the simulation works and the result shows that WireData[1] = 0.6.

i dont understand what happend current/big_smile

Hallo everyone,

I have a wire model that use enumeration to enable different type and size of wire to be chossen for simulation. Until recently I used v.1.12.0 and it works. yesterday I installed the v.1.13.2 and got this error when i try to simulate a wire model

Code:


[1] 09:36:20 Translation Error
[KS_modelica.ExternalLibrary: 4649:13-4649:65]: Internal error BackendDAECreate.lowerEqn failed for initial equation
  terminate("Parameters for Wire model not possible.");

Insde the model in the initial equation, the insulation thickness value is checked and will be terminate if thickness is < 0. I assume somehow the value from database is not loaded dto model.

The Same model is checked on three different PCs (two with v.1.13 and one with 1.12), on both PCs with v1.13 the simulation is terminated due to said error. Unfortunately i can not share the model.

hope my description of the problem is good enough.

thanks in advance

I've also open a ticket #5340

Feb-14-19 09:36:11
non matching symbols in the libraries

Hallo,

i'm trying to build an application for a real-time hardware with dSpace and had error messages like

dsfmu_mdlfunctions.o86: In function `HiL_TechDay_Beispiel_DSFMUInitMdl':
dsfmu_mdlfunctions.cpp:(.text+0x3e): undefined reference to `HiL_TechDay_Beispiel_fmi2Instantiate'

i thought your solution could help. my question is, where did you put the flag  -Wl,--output-def=<modelname>.def ?

is it when you export the fmu model from modelica?

i know its an old post, maybe someone could shed a light on my problem and where i've done wrong

Thank you very much for the answer

Hallo everyone,

I would like to export a model from OpenModelica as a FMU. Inside a model there is one timmer block and a sine wave block.

On both block there is a reference to a variable time that referenced the elpased simulation time.

my question is, how does this work when i export the FMU and used it in other program (for example a software/hardware for HiL test). Is an internal time of real-time hardware would be referenced as time for these blocks? or there is someting else i've missed?

thank you in advance for your feedback

best regards

  • Index
  • » Users
  • » Arinomo23
  • » Profile
You are here: