Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

The SystemModel directive cannot read the model

Posted 1 year ago

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

model = SystemModel["Model2"]

enter image description here

Attachments:
POSTED BY: James James
4 Replies
Posted 1 year ago

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}]

enter image description here

The model position can be changed according to your needs.

Attachments:
POSTED BY: James James

"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:

https://reference.wolfram.com/language/ref/Iconize.html

but this is optional.

POSTED BY: Sergio Vargas
Posted 1 year ago

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

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

enter image description here

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

POSTED BY: James James

The model has not been loaded. Load it with Import, see: https://reference.wolfram.com/language/ref/format/MO.html

POSTED BY: Sergio Vargas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard