見出し画像

Maple: Tips ブロック線図の結合「SystemConnect」の使い方


システムの検討をする際に、プラントや制御器を個別に設計、要するに作って、それらを連結してシステム全体の振る舞いを見たいということがよくあります。今回はそんなとき、Mapleでどのようにシステムを連結するかを紹介します。

システムの定義

まず、Mapleでシステムやシステムの連結をするコマンドを使うための「DynamicsSystems」ライブラリを「with(DynamicSystems)」を使って読み込みます。
次に今回、連結するシステムを「TransferFunction」関数を使って2つ定義します。定義したシステムは「sys1」と「sys2」です。プログラムの例を以下に示します。なお、定義したシステムを見たい場合には「PrintSystem(sys)」と書けば、定義したシステムの中身を見ることができます。「PrintSystem」関数も「DynamicsSystems」ライブラリの関数です。

with(DynamicSystems);

sys1 := TransferFunction(1/(s^2 + 0.5*s + 1));

sys2 := TransferFunction(1/(s + 1));

システムの連結

システムをつなぐ関数は「SystemConnect」です。以後のすべての連結はこの関数を使います。連結の仕方の違いは「connection」オプションの指定で決めるだけです。

①直列接続
図1のように直列にシステムを接続する場合、「connection」オプションを「serial」とすることで2つのシステムを直列に接続できます。プログラム例の「sys3」が直列接続した結果のシステムになります。

図1 直列接続
sys3 := SystemConnect(sys1, sys2, connection = serial);

②並列接続
2つのシステムに同一の入力を与えて、それぞれの出力を足し合わせたものを出力とする場合に並列接続をします(図2)。「connection」オプションを「parallel」とすることで2つのシステムを並列に接続できます。
プログラム例の「sys4」が並列接続した結果のシステムになります。

図2 並列接続
sys4 := SystemConnect(sys1, sys2, connection = parallel);

③フィードバック接続(戻りはマイナスで入力に加える)
制御システムにおいてよく見るタイプのフィードバック接続です(図3)。「sys1」の出力が全体システムの出力とします。その出力をフィードバックループに存在する「sys2」に入力し、「sys2」の出力を「sys1」への入力にマイナスで加えるタイプのフィードバック接続です。「connection」オプションを「negativefeedback」とすることでフィードバック接続になります。プログラム例の「sys5」がフィードバック接続した結果のシステムになります。戻りをプラスで入力側に接続したい場合には「positivefeedback」を使います。

図3 フィードバック接続
sys5 := SystemConnect(sys1, sys2, connection = negativefeedback);

他にも接続オプションがありますので、必要に応じたオプションを設定してみてください。

【English】

When examining systems, it is often the case that plants and controllers are designed and built individually, in essence, and then you want to connect them together to observe the behaviour of the system as a whole. In this article, we will show you how to connect systems in Maple in such cases.

System definition

First, load the "DynamicsSystems" library using "with(DynamicSystems)"
to use the commands to define systems and connect systems in Maple.
Next, define two systems to be connected this time using 'TransferFunction'. The systems defined are 'sys1' and 'sys2'. An example program is shown below. If you want to see the defined systems, you can write "PrintSystem(sys)" to see the contents of the defined systems. PrintSystem" is also a function of the "DynamicsSystems" library.

with(DynamicSystems);

sys1 := TransferFunction(1/(s^2 + 0.5*s + 1));

sys2 := TransferFunction(1/(s + 1));

System connections

The function that connects the systems is "SystemConnect". All subsequent connections use this function. The only difference in the way the connection is made is determined by specifying the "connection" option.

①Series connection
Two systems can be connected in serial by setting the "connection" option to "serial" when connecting systems in serial, as shown in Figure 1. The "sys3" in the program example is the system resulting from the serial connection.

Figure 1. Series connection
sys3 := SystemConnect(sys1, sys2, connection = serial);

②Parallel connection
A parallel connection is when the inputs to two systems are identical and their outputs are added together to form the output of the whole system ( Figure 2). Two systems can be connected in parallel by setting the "connection" option to "parallel". The 'sys4' in the program example is the system resulting from the parallel connection.

Figure 2. Parallel connection
sys4 := SystemConnect(sys1, sys2, connection = parallel);

③Feedback connection (return is negative and added to input)
This is a common type of feedback connection in control systems ( Figure 3). Assume that the output of "sys1" is the output of the overall system. The output is input to "sys2", which is located in the feedback loop, and the output of "sys2" is added to the input to "sys1" as a negative value. A feedback connection can be made by setting the "connection" option to "negativefeedback". The "sys5" in the program example is the system resulting from the feedback connection. If you want to connect the return to the input side with a positive value, use "positivefeedback".

Figure 3. Negative-Feedback connection
sys5 := SystemConnect(sys1, sys2, connection = negativefeedback);

There are other connection options available, so try to set the options according to your needs.

【Sample】

Created by Maple 2023.2

この記事が気に入ったらサポートをしてみませんか?