hexaeder / SimulinkSDIImporter.jl

Import data from Simulink SDI Sessions to Julia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimulinkSDIImporter

Package to import timeseries from a saved SDI Session (.mldatx-file) to julia.

Main entry point is the read_data function. Given a SDI state as mldatx file data.mldatx with contents

├─ "Synced Voltage Setpoint Change"
│  ├─ "Run 1: Converter_Model @ TargetPC1"
│  │  ├─ "U_INV_dq"
│  │  └─ "I_INV_dq"
│  └─ "Run 2: Converter_Model @ TargetPC2"
│     ├─ "U_INV_dq"
│     └─ "I_INV_dq"
└─ "Synced Current Setpoint Change"
    ├─ "Run 4: Converter_Model @ TargetPC1"
    |  ├─ "U_INV_dq"
    |  └─ "I_INV_dq"
    └─ "Run 5: Converter_Model @ TargetPC2"
        ├─ "U_INV_dq"
        └─ "I_INV_dq"

the command

read_data(data.mldatx, [r"Voltage", "Run 1", "U"])

will launch MATLAB in the background, export the timeseries to data.export folder in CSV format and return a DataFrame of the U_INV_dq signal. If the cached CSV is already available, it reads the CSV directly which is reasonably fast.

The matlab command(path) and the flags can be changed by changing SimulinkSDIImporter.MATLAB_EXEC and SimulinkSDIImporter.MATLAB_FLAGS.

Its possible launch the SDI to check the data without opening the MATLAB SDI using show_sdi(file).

show_structure(file) prints a tree of all signals in the file.

Aggregated Export directory

Per default, the data within basedir/example.mldatx will be exported to basedir/example.mldatx.export. However, if the basedir contains a directory called sdi_exports, the exported data will be stored in basedir/sdi_exports/example.mldatx.export.

Disclaimer

Tested with MATLAB 2022b for with data recorded from a SpeedGoat Realtime Computer using a MacOS and Linux.

About

Import data from Simulink SDI Sessions to Julia.

License:MIT License


Languages

Language:MATLAB 51.6%Language:Julia 48.4%