Comments (4)
Can you provide a piece of code to reproduce this issue?
from femyou.
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from femyou.