# Can't run simulation containing Modelica blocks

**URL:** <https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890>\
**Category:** Xcos\
**Created:** [March 30, 2025, 12:27pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890 "2025-03-30T12:27:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bored\_Maverick](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bored\_Maverick](https://scilab.discourse.group/u/Bored_Maverick)\
**Post date:** [March 30, 2025, 12:27pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/1 "2025-03-30T12:27:35Z")

</div>

Hello. I am new to scilab (version ‘scilab-2025.0.0’) and this community. I want to use Xcos as replacement to Matlab’s Simulink for my Mech. Eng. classes. Simulations with the ‘normal’ (explicit) blocks work well and produce the output graphs but when I try simulating a simple RLC circuit using the Modelica blocks in electrical palette, it produces the following error:  
“Modelica blocks are reduced to a block with:”  
“Number of differential states: 2”  
“Number of algebraic states: 0”  
“Number of discrete time states : 0”  
“Number of zero-crossing surfaces: 1”  
“Number of modes : 1”  
“Number of inputs : 0”  
“Number of outputs: 1”  
“Input/output dependency:[T]”  
“Analytical Jacobian: enabled (%Jacobian=%t)”  
“Parameter embedding mode: enabled (%Modelica\_ParEmb=%t)”  
“”  
"Generated files path: C:\Users\nahom\AppData\Local\Temp\SCI\_TMP\_14844\_7487"  
“”  
Generate a loader file  
Generate a Makefile  
Running the Makefile  
“sorry compiling problem”  
“Attempt to reference field of non-structure array.”  
“c\_pass1: build the modelica meta-block failed”

“xcos\_simulate: Error during block parameters update.”  
What does this mean? And how do I fix it? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 30, 2025, 3:00pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/2 "2025-03-30T15:00:04Z")

</div>

Hello,

Do you have a compiler ?

S.

---

<div class="post-metadata">

**Author:** ![Bored\_Maverick](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bored\_Maverick](https://scilab.discourse.group/u/Bored_Maverick)\
**Post date:** [March 30, 2025, 8:33pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/3 "2025-03-30T20:33:45Z")

</div>

No. So, I guess what you are talking about is an external C/C++ compiler for running the modelica blocks? I just learnt about this from chatting with Github co-pilot. It told me to get something called MinGW-w64 from its website but there I read that MinGW-w64 is not enough on its own and I need a " pre-built toolchain" and there were many options for that. Am I at the right place? What do I do next?

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 31, 2025, 7:24am UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/4 "2025-03-31T07:24:11Z")

</div>

Best option is Visual Studio Community edition ([Visual Studio 2022 Community Edition – Télécharger la dernière version gratuite](https://visualstudio.microsoft.com/fr/vs/community/)) or Scilab’s mingw toolbox ([ATOMS : MinGw toolbox details](https://atoms.scilab.org/toolboxes/mingw), which need the installation of MinGW gcc, please carefully read installation instructions).

S.

---

<div class="post-metadata">

**Author:** ![Bored\_Maverick](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bored\_Maverick](https://scilab.discourse.group/u/Bored_Maverick)\
**Post date:** [March 31, 2025, 2:42pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/5 "2025-03-31T14:42:15Z")

</div>

Update. So I tried both options. First I downloaded the Visual Studio toolbox installer and tried to install the “Desktop development with C++” workload but it was over 7GB in size and it will take all day with my internet speed. So I tried the other option, the MinGW toolbox. I first installed the package (a file named “winlibs-x86\_64-posix-seh-gcc-14.2.0-mingw-w64msvcrt-12.0.0-r3”) Then I installed the toolbox on the scilab console from within VScode (“atomsInstall(“wingw”)”) It installed but says “WARNING: MinGW Compiler not detected.” So I added the directory of the bin folder within the package to the PATH. I checked it’s correctly added by viewing the path. I tried again and still scilab says compiler not detected. Then I checked if the compiler works on command prompt outside VScode by trying to compile a simple C code. It compiled correctly and outputted a result. Then I tried reinstalling the toolbox but nothing changed. It still says ‘MinGW compiler not detected’. So I tried to run a simulation on Xcos anyway and when I launched Xcos I found that I can’t even add any blocks (not just modelica) from the library. I tried right-clicking and adding too but it doesn’t work! So, I went from only modelica blocks not working to Xcos not working entirely! 😭😭 Please help me. I need Xcos for my project work this semester and I can’t use simulink because MATLAB keeps crashing my PC! 🙏🙏

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [March 31, 2025, 3:58pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/6 "2025-03-31T15:58:14Z")

</div>

> [@mottelet](#):
>
> please carefully read installation instructions

Apparently you haven’t read the instructions at [ATOMS : MinGw toolbox details](https://atoms.scilab.org/toolboxes/mingw) :

_MinGW Compiler support for Scilab on Windows:_

_You need to install MinGW gcc package distributed by Equation Solution first_  
_(subsequent versions of gcc should work as well)._

_Both 32 and 64 bit versions of the MinGW gcc package (gcc-10.3.0-32.exe and_  
_gcc-10.3.0-64.exe files) can be found in the “Files” section of the_  
\*MinGW Toolbox page at \*

_[https://atoms.scilab.org/toolboxes/mingw/10.3.0/files/gcc-10.3.0-32.exe](https://atoms.scilab.org/toolboxes/mingw/10.3.0/files/gcc-10.3.0-32.exe)_  
_[https://atoms.scilab.org/toolboxes/mingw/10.3.0/files/gcc-10.3.0-64.exe](https://atoms.scilab.org/toolboxes/mingw/10.3.0/files/gcc-10.3.0-64.exe)_

_After installing the MinGW package, logout/login your Windows session and_  
_finally install the MinGW Scilab toolbox. The first time you load the toolbox,_  
_Scilab will rebuild some gcc libraries. The process may take a minute or more so_  
_please be patient and wait until Scilab returns control to the command prompt._

---

<div class="post-metadata">

**Author:** ![Bored\_Maverick](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bored\_Maverick](https://scilab.discourse.group/u/Bored_Maverick)\
**Post date:** [March 31, 2025, 9:39pm UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/7 "2025-03-31T21:39:41Z")

</div>

Thank you! It works now. Looks like the problem was I downloaded the wrong package yesterday. I was checking out the Xcos demos and it looks like I can do a lot of awesome things, very similar to MATLAB’s simulink. But most of the demos don’t have explanations and the help browser is not really that helpful. Wish there were more tutorials or books I can reference to make the learning curve a bit smoother. Anyway, thanks for you help. I didn’t know that you are one of the authors of the toolboxes on ATOMs! Until next time 👋

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 1, 2025, 7:05am UTC](https://scilab.discourse.group/t/cant-run-simulation-containing-modelica-blocks/890/8 "2025-04-01T07:05:57Z")

</div>

OK fine. There’s a book about Xcos " Introduction to Xcos: A Scilab Tool for Modeling Dynamical Systems", the authors made it available on ResearchGate: [https://www.researchgate.net/publication/343472236\_Introduction\_to\_Xcos\_A\_Scilab\_Tool\_for\_Modeling\_Dynamical\_Systems](https://www.researchgate.net/publication/343472236_Introduction_to_Xcos_A_Scilab_Tool_for_Modeling_Dynamical_Systems)

S.
