Git Product home page Git Product logo

Comments (4)

Oaz avatar Oaz commented on July 27, 2024 1

Can you provide a piece of code to reproduce this issue?

from femyou.

Nils12345678901234567 avatar Nils12345678901234567 commented on July 27, 2024

If you modify the test LogWhenVariableCannotBeSet like this:

 [Test]
 public void LogWhenVariableCannotBeSet()
 {
     var spyCallback = new SpyCallback();
     using var model = Model.Load(TestTools.GetFmuPath("BouncingBall.fmu"));
     using var instance = model.CreateCoSimulationInstance("my name", spyCallback);
     try
     {
         GC.Collect();  // Force garbage collection here to reproduce bug
         instance.WriteReal((model.Variables["v_min"], 1));
     }

Note: The test will not fail, it will never finish execution. You have to look in the output window to see the error message.

from femyou.

Nils12345678901234567 avatar Nils12345678901234567 commented on July 27, 2024

I tried to reproduce with the test FeedthroughReferenceScenario as well but that didi not work. I suspect that the 'Feedthrough.fmu' fmu never calls any callbacks. A similar test using BouncingBall.fmu would probably show the problem.

from femyou.

Nils12345678901234567 avatar Nils12345678901234567 commented on July 27, 2024

If the local variable functions in the constructor of the Callbacks class is changed to a member variable of the Callbacks-class like shown below this should fix the problem.

 class Callbacks : IDisposable
 {
     private FMI2.fmi2CallbackFunctions functions;
     public Callbacks(Instance instance, ICallbacks cb)
     {
         Instance = instance;
         CB = cb;
         handle = GCHandle.Alloc(this);
         functions = new FMI2.fmi2CallbackFunctions
         {
             logger = LoggerCallback,
             allocateMemory = Marshalling.AllocateMemory,
             freeMemory = Marshalling.FreeMemory,
             stepFinished = StepFinishedCallback,
             componentEnvironment = GCHandle.ToIntPtr(handle)
         };

from femyou.

Related Issues (3)

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.