Message Boards Message Boards

0
|
1993 Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Obtain the initial value of inductance or capacitance set in Systemmodeler

Posted 1 year ago

How to obtain the initial value of inductance or capacitance set in Systemmodeler in Mathematica?

1) initial value of inductance
enter image description here

2)initial value of capacitance
enter image description here

Then attach my circuit in the attachments.

Attachments:
POSTED BY: James James
5 Replies

You can use the following function to get the integer value:

IntegerPart[(*variable*)]
POSTED BY: Ankit Naik
Posted 1 year ago

Sir, I tested it today and found that "the solution error was not caused by the dot in the initial value mentioned yesterday", but that after I set the initial values of capacitance and inductance, the state space equation could not be obtained normally using the SystemModelLinearize command. How can we solve it? enter image description here enter image description here

My code:

spacemodel = SystemModelLinearize["Model2", 
   Method -> {"SymbolicDerivative", 
       "SymbolicParameters" -> {"r", "l", "c", "k1", "k2"}}]

Then attach my circuit in the attachments.

Attachments:
POSTED BY: James James
model = SystemModel["Model2"];
model[{"InitialValues", {"inductor1.i", "capacitor1.v"}}]

You can load the model in Mathematica as a System Model, and use the "InitialValues" property.

POSTED BY: Ankit Naik
Posted 1 year ago

Thank you very much! Your answer gave me inspiration. Now I have another small problem, the questions are as follows:

I use initvalueil and initvaluevc in the code to obtain the values of inductor1.i and capacitor1.v, but the initvalueil value contains a dot, which causes me to be unable to operate correctly in the subsequent code. Could you tell me how this dot comes from and how can I eliminate this dot? enter image description here

My code:

model = SystemModel["Model2"];
init = model[{"InitialValues", {"inductor1.i", "capacitor1.v"}}]
initvalueil = init[[1, 2]]
initvaluevc = init[[2, 2]]
Attachments:
POSTED BY: James James
Posted 1 year ago

Thank you!!!

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

Group Abstract Group Abstract