Message Boards Message Boards

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

Screening out state space equations that match the actual situation

Posted 1 year ago

A professor taught me a method to obtain all the state space equations of a circuit, but there are some state space matrices that do not conform to the actual situation. How can I remove them?

The code:

spacemodel = SystemModelLinearize["Model2", 
    Method -> {"SymbolicDerivative", 
        "SymbolicParameters" -> {"r", "l", "c", "k1", "k2"}}];
kVals = Thread[{QuantityVariable[
       "k1",IndependentPhysicalQuantity[""]], QuantityVariable[
       "k2",IndependentPhysicalQuantity[""]]} -> #] & /@ 
   Tuples[{{True, False}, {True, False}}];
{#, spacemodel /. #} & /@ kVals // TableForm

As shown in the following code run results, (k1->True k2->True) and (k1->False k2->False) are not what I need because they do not meet the actual situation. How can I remove the state space equations for these two situations? Circuit file attached at the end.

Attachments:
POSTED BY: James James
4 Replies

If all you want to do is restrict the list of replacements then you can use these kVals instead:

kVals = Thread[{QuantityVariable["k1", 
       IndependentPhysicalQuantity[""]], 
      QuantityVariable["k2", 
       IndependentPhysicalQuantity[""]]} -> #] & /@ {{True, 
    False}, {False, True}};
POSTED BY: Sergio Vargas
Posted 1 year ago

Hello, sir! Yes, that's the method you taught me. Based on your method, I assigned Ron and Goff values of 0 in system modeler, and the running results are shown in the following figure. I have an idea that if "Indeterminate" appears in the matrix using a judgment method, then remove this matrix. Is my idea feasible? If possible, what command statements can be used to remove the matrix?

enter image description here

Attachments:
POSTED BY: James James

I have an idea that if "Indeterminate" appears in the matrix using a judgment method, then remove this matrix. Is my idea feasible? If possible, what command statements can be used to remove the matrix?

It's possible to write that code, but it'd be simpler to use the kVals I wrote above. What you are suggesting here could be done with something like this

Select[res, FreeQ[#, Indeterminate] &] 

, with res being the list of things you want to filter. For instance

res = {1, x, Indeterminate, 4};
Select[res, FreeQ[#, Indeterminate] &]

returns {1, x, 4}. After this filter you can then use TableForm to get the result formatted as a table.

But please take into account that this is not the core issue here. The core issue is that, for linearization purposes, the switch components that are used in that model can not have Ron and Goff be set to 0. Even if the model simulates with those values, the system of equations depends heavily on them being not 0, so the linearization simply won't work, as you have seen. As I mentioned in the other posts, to be able to model those vanishing values you are going to have to use other components, and not use the switch. That means using Modelica.Electrical.Analog.Ideal.Idle for a fully open circuit, or just a direct connection if you want to model 0 resistance.

POSTED BY: Sergio Vargas
Posted 1 year ago

Hi sir! thank you for your guidance and suggestions. I have tried to introduce resistance and conductance values into the linearization even if the resistance and conductance values of the switch are directly set to 0 in the system modeler. It is indeed necessary to use an ideal device or direct wire connection.

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