Code Monkey home page Code Monkey logo

Comments (9)

tbeu avatar tbeu commented on August 29, 2024

One more reason is that SimulationX Code-Export (for FMU e.g.) removes the Modelica function call of

(calculationTime,availableTime) = Modelica_DeviceDrivers.OperatingSystem.realtimeSynchronize(time,resolution);

if neither calculationTime nor availableTime is exported (from FMU e.g.) since it is considered as a pure function with uninteresting output.

from modelica_devicedrivers.

tbeu avatar tbeu commented on August 29, 2024

I think that the output variables calculationTime and availableTime of realtimeSynchronize are not in accordance with the Modelica standard and should be removed here. The reason is that they depend on the integrator step size. That's why there also is no last operator in Modelica. I propose a fixed implementation like

Real ret;
equation
  ret = Modelica_DeviceDrivers.OperatingSystem.realtimeSynchronize(time);
  assert(ret<0.5,"Error in realtimeSynchronize.");

That's the way how I usually implement functions with impure behavior. This way realtimeSynchronize is always called by the simulation tool as its output is the input of the assertion check.

Note that the resolution parameter of realtimeSynchronize is gone once #43 is applied and fixed.

from modelica_devicedrivers.

bernhard-thiele avatar bernhard-thiele commented on August 29, 2024

The realtime synchronization is a (dirty) hack as stated in the documentation to the block. I think there is no chance for a clean implementation within a Modelica standard conform library. Since you have control over your tool, you should be able to handle it much better on the tool side.

Still, if the hack can be improved, one should do it. I got another proposal about improving it (per email) a while ago. However, I first have to set up a Windows installation to test it. I should have done that some time ago, but keep postponing it... I'll do it soon.

from modelica_devicedrivers.

tbeu avatar tbeu commented on August 29, 2024

I think it is possible to implement it in a Modelica-conform way if moving to external object and getting rid of output variables calculationTime and availableTime. If you like I can prepare a pull request.

And, yes, SimulationX has a built-in real-time synchronization. But this is not availbale if code is exported for stand-alone applications (like FMU etc.).

from modelica_devicedrivers.

tbeu avatar tbeu commented on August 29, 2024

Did you manage to set up a Win installation. If not I can offer to test it.

from modelica_devicedrivers.

bernhard-thiele avatar bernhard-thiele commented on August 29, 2024

I have a windows installation, just no VS2010 installed on it (only VS2013) so that I can't build Windows XP compatible libraries as you explained to me.
However, I have merged all of your last patches in Linux and not yet tested for Windows. So if you want to test it, you are welcome :-).

from modelica_devicedrivers.

tbeu avatar tbeu commented on August 29, 2024

Which branch is it? I do not find any changes that remove static variables from MDD_realtimeSynchronize.

from modelica_devicedrivers.

bernhard-thiele avatar bernhard-thiele commented on August 29, 2024

I thought I had pulled a patch from you that solved it. However, I just searched the history and the patches that I pulled from you addressed other things
(6d2830a, 6d2830a, 6d2830a)
Is there a patch that I missed?

If not, no problem I will change it to external objects. Just not sure if I find the time today.

from modelica_devicedrivers.

tbeu avatar tbeu commented on August 29, 2024

No, I did not provide a patch for this issue.

from modelica_devicedrivers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.