Model runs offline but fails during RT-LAB code separation — GetArtemisInfo error

Hello everyone,

My Simulink model runs successfully offline, but I cannot compile it in RT-LAB. The build fails during the “Preparing original model for code separation and generation” stage with the following error:

“Array indices must be positive integers or logical values.”

The error stack includes:

  • GetArtemisInfo
  • ArtemisEntryPoint
  • opSeparatePackages

The process then stops with: “Error preparing original model for code separation.”

My setup is:

  • MATLAB/Simulink R2022b
  • RT-LAB v2023.3.0.15
  • Windows host
  • OPAL-RT Linux target, Red Hat 5.2
  • ARTEMiS blocks in the model

The model is relatively simple: two electrical networks connected through an ARTEMiS Distributed Parameters Line (DPL). One network includes a voltage source converter (VSC) and a PV array.

I have already reinstalled MATLAB and ARTEMiS, but the issue persists. During earlier troubleshooting, uninstalling ARTEMiS allowed compilation to proceed.

Has anyone encountered this error? What could cause the model to run successfully offline but fail during RT-LAB code separation, and which settings should I check?

I have attached a screenshot of the compilation log.

Thank you for your help.

hii, no screenshot came through on my side :sweat_smile: but I think I’ve seen this one, so here’s my guess

From the stack (GetArtemisInfo → ArtemisEntryPoint → opSeparatePackages), it fails at “Preparing original model for code separation”. That’s the step where RT-LAB looks at your top level and splits it into the SM_/SS_/SC_ subsystems. From what I understand this happens on the Windows host in MATLAB, before anything gets sent to the target. So it runs offline (no separation there) but dies when RT-LAB tries to split it. And since it compiles when ARTEMiS is uninstalled, I think it’s the ARTEMiS part of the separation that fails, maybe while it’s reading the DPL. “Array indices must be positive integers” sounds like it’s looking for something (a line, a port, a subsystem) and finds nothing.

So I think the issue is your RT-LAB project settings + how the model is set up for RT-LAB, more than the model itself. Things I’d check:

  1. Where the DPL sits. When I used the DPL to split between cores, the docs say:
  2. ARTEMiS guide block. Is there one ARTEMiS guide block in each SM_/SS_ subsystem, with the same Ts as powergui (discrete)? In the doc example they add one per subnetwork. Also make sure the DPL is set to “ARTEMiS model” and not “SPS model” in the mask.
  3. Versions. Which ARTEMiS version did you reinstall? I think ARTEMiS has to match your RT-LAB version, not just MATLAB. I remember a case where the exact same error showed up with one ARTEMiS version and went away when they changed ARTEMiS. So maybe check that your ARTEMiS supports RT-LAB 2023.3 + R2022b.
  4. Target settings. You wrote Red Hat 5.2. Is that really the target OS, or is it OPAL-RT Linux? In RT-LAB → Assignation/Execution, check that the target platform (x86 vs x64) matches your simulator. I once had my target not showing up just because the platform setting was wrong.
  5. Init scripts. If you use variables like Ts from a script, put them in the model InitFcn callback so they exist when RT-LAB opens the model to separate it.

Other docs that helped me:

btw wyd with the VSC + PV, is it a grid-tied inverter study? :eyes: And are you connecting to the I/O of a simulator (like analog/digital out to a real controller), or is it all just model for now? If you have I/O blocks in there, which subsystem are they in?

I’m trying to evaluate relay performance during power system disturbances in the presence of inverter-based resources (IBRs).