Skip to content

Load FMU with Femyou not working #6

@bflo96

Description

@bflo96

Hello!

I have a program in C#, running on Visual Studio 2019, with target framework netcoreapp3.1.
I used Open Modelica v1.22.3 (64-bit).

My code:

using System;
using System.Collections.Generic;
using System.Text;

namespace TesteFMU
{
    public class Program
    {
       public static void Main(string[] args)
       {
          TestFMU test = new TestFMU();
          test.Calculation();
          Console.Write("Calculation concluded.");
       }
    }
using System;
using Femyou;
using System.IO;

namespace TestFMU
{
    public class TestFMU
    {
        public void Calculation()
        {
            string fmuFolder = File.ReadAllText(@"C:\FMUTests\");
            using var model = Model.Load(Path.Combine(fmuFolder, "TestFemyou.fmu"));
            using var instance = Tools.CreateInstance(model, "test");
            var x = model.Variables["x"];
            var y = model.Variables["y"];
            var z = model.Variables["z"];
            Console.WriteLine("x = " + Convert.ToString(x));
        }
    }
}

However, when I try to load the FMU, it shows this error:

System.IO.FileNotFoundException: 'Could not find or load the native library: C:\Users\10376\AppData\Local\Temp\Femyou\TestarFemyou.fmu\binaries\win64\TestarFemyou.dll

I don't understand why it tries to load a native library and why it fails despite the DLL being available when I manually check the folder.
Could it be a compatibility issue?
The example BouncingBall.fmu works just fine.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions