The SystemModel directive cannot read the model

I encountered an error reading the model using the SystemModel instruction. What is the reason for this?

model = SystemModel["Model2"]

Model2.mo (5.68 KB)

The model has not been loaded. Load it with Import, see: MO—Wolfram Documentation

Sir, am I writing correctly? But the running results clearly indicate that I wrote incorrectly emm…

model = Import["Model2.mo", "MO"]

And how can I use the ImportString command to load a file? You used it in your previous reply.

"Model2.mo" is just the name of the file, Import needs a file path, as shown in the documentation. ImportString takes the modelica string of the model. You can copy it from the text view in System Modeler. After you paste it, you can choose to Iconize the string, see the documentation:

but this is optional.

Sir, I have successfully imported the model. Next, I want to linearize it using the SystemModelLinearize instruction, but the system prompts this error. How can I resolve it? Thank you!

model = Import["C:\\Users\\james\\Desktop\\Model2.mo", "MO"];
list = model["TopParameterNames"];
vars = list /. {QuantityVariable[x_, __] :> x};
SystemModelLinearize[model, 
  Method -> {"SymbolicDerivative", 
      "SymbolicParameters" -> vars}]

The model position can be changed according to your needs.

Model2.mo (5.59 KB)