質問編集履歴
3
分かりにくかったところの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,10 +14,10 @@
|
|
14
14
|
#iclude <Psim.h>
|
15
15
|
|
16
16
|
|
17
|
+
|
18
|
+
```C言語/////////////////////////////////////////////////////////////////////
|
17
19
|
// PLACE GLOBAL VARIABLES OR USER FUNCTIONS HERE...
|
18
|
-
static float f_PI = 3.141592653, Th; //ここで、使う変数を定義しています。Thは、角度Θの意味です。
|
20
|
+
static float f_PI = 3.141592653, Th; //ここで、使う変数を定義しています。Thは、角度Θの意味です。// FUNCTION: SimulationStep
|
19
|
-
```C言語/////////////////////////////////////////////////////////////////////
|
20
|
-
// FUNCTION: SimulationStep
|
21
21
|
// This function runs at every time step.
|
22
22
|
//double t: (read only) time
|
23
23
|
//double delt: (read only) time step as in Simulation control
|
2
分かりにくかったところの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,24 +11,12 @@
|
|
11
11
|
E0、fai0のをリアルタイムに更新するプログラムがわかりません。
|
12
12
|
|
13
13
|
エラーメッセージ
|
14
|
+
#iclude <Psim.h>
|
14
15
|
|
15
16
|
|
16
|
-
|
17
|
-
### 該当のソースコード
|
18
|
-
|
19
|
-
```C言語
|
20
|
-
Psim回路内のCブロックのプログラムです。
|
21
|
-
|
22
|
-
ソースコード
|
23
|
-
|
24
|
-
|
25
|
-
#include <Psim.h>
|
26
|
-
|
27
17
|
// PLACE GLOBAL VARIABLES OR USER FUNCTIONS HERE...
|
28
18
|
static float f_PI = 3.141592653, Th; //ここで、使う変数を定義しています。Thは、角度Θの意味です。
|
29
|
-
|
30
|
-
```ここに言語を入力
|
31
|
-
/////////////////////////////////////////////////////////////////////
|
19
|
+
```C言語/////////////////////////////////////////////////////////////////////
|
32
20
|
// FUNCTION: SimulationStep
|
33
21
|
// This function runs at every time step.
|
34
22
|
//double t: (read only) time
|
@@ -55,9 +43,7 @@
|
|
55
43
|
Th = Th + 2.0*f_PI;
|
56
44
|
}
|
57
45
|
|
58
|
-
コード
|
59
|
-
```
|
60
|
-
////////////////////////////////////////////////////////////
|
46
|
+
////////////////////////////////////////////////////////////
|
61
47
|
// FUNCTION: SimulationBegin
|
62
48
|
// Initialization function. This function runs once at the beginning of simulation
|
63
49
|
// For parameter sweep or AC sweep simulation, this function runs at the beginning of each simulation cycle.
|
@@ -67,8 +53,7 @@
|
|
67
53
|
//int nOutputCount: (read only) Number of output nodes
|
68
54
|
//int nParameterCount: (read only) Number of parameters is always zero for C-Blocks. Ignore nParameterCount and pszParameters
|
69
55
|
//int *pnError: (write only) assign *pnError = 1; if there is an error and
|
70
|
-
```
|
71
|
-
|
56
|
+
set the error message in szErrorMsg
|
72
57
|
// strcpy(szErrorMsg, "Error message here...");
|
73
58
|
// DO NOT CHANGE THE NAME OR PARAMETERS OF THIS FUNCTION
|
74
59
|
void SimulationBegin(
|
@@ -83,8 +68,7 @@
|
|
83
68
|
}//シミュレーションの初期値をここに言語を入力
|
84
69
|
|
85
70
|
|
86
|
-
```
|
87
|
-
|
71
|
+
/////////////////////////////////////////////////////////////////////
|
88
72
|
// FUNCTION: SimulationEnd
|
89
73
|
// Termination function. This function runs once at the end of simulation
|
90
74
|
// For parameter sweep or AC sweep simulation, this function runs at the end of each simulation cycle.
|
@@ -97,8 +81,12 @@
|
|
97
81
|
|
98
82
|
|
99
83
|
}//シミュレーション終了時のコマンドをうつところです。
|
84
|
+
コード
|
100
|
-
```
|
85
|
+
```
|
101
86
|
|
87
|
+
|
88
|
+
|
89
|
+
|
102
90
|
### 試したこと
|
103
91
|
PSIMのCブロックを使って実際にプログラミングを行っていた人のサイトをまず探しましたが、見つかりませんでした。そこで、与えた初期値を時間ごとに更新して計算するプログラミングを調べましたが、出てきませんでした。
|
104
92
|
|
1
分かりにくかったところの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
|
+
2枚の写真で示されている回路は、機械系の制御を行うコンバータの回路であり、そのシミュレーションを現在私が行ております。どちらも下の回路の一番左端の部分の電圧E0と電圧E0の位相角であるfai0を計算するための回路です。
|
2
|
-
|
3
|
+
私は、E0,fai0の初期値をこの回路にまず与えた後、任意の時間ごとのE0とfai0の値を計算し、回路のE0,fai0の値を時間ごとに更新していき、その結果を波形に出したいです。下の回路のC言語ブロックでE0,fai0をもとめるためのプログラムを作成します。
|
3
4
|
|
4
5
|

|
5
6
|

|
6
|
-
下の写真はシミュレーション回路を映した図です。このシミュレーション回路は
|
7
|
-
、電圧E0、E0の位相角のfai0をもとめる計算
|
7
|
+
下の写真はシミュレーション回路を映した図です。このシミュレーション回路は機械系の制御システムを示した回路であり、回路の左の方にあり、6個の入力と3個の出力が長方形がCブロックです。Cブロックの上の二つの入力は上の写真で計算されたE0,fai0の値をCブロックに入力します。その下の二つの入力は、シミュレーションの最初で初期値のE0,fai0の値を入力します。なお、力率PF0,PF1,PF2と書かれているメーターの上についている長方形のブロックは、力率を求めるための計算システムが入っております。また、一番右端のブロックの内部にはコンバータの回路が入っております。
|
8
|
+
次に上の図は、下の回路から電流io、電圧vo、電力p2を挿入して回路の力率、、電圧E0、E0の位相角のfai0をもとめる計算を行うシミュレーション回路です。この四角の中には計算を行うためのシステムが入っています。
|
8
9
|
|
9
10
|
### 発生している問題・エラーメッセージ
|
10
|
-
|
11
|
+
E0、fai0のをリアルタイムに更新するプログラムがわかりません。
|
11
12
|
|
12
13
|
エラーメッセージ
|
13
14
|
|
@@ -20,15 +21,13 @@
|
|
20
21
|
|
21
22
|
ソースコード
|
22
23
|
|
23
|
-
|
24
|
+
|
24
|
-
#include <String.h>
|
25
|
-
#include <math.h>
|
26
25
|
#include <Psim.h>
|
27
26
|
|
28
27
|
// PLACE GLOBAL VARIABLES OR USER FUNCTIONS HERE...
|
29
28
|
static float f_PI = 3.141592653, Th; //ここで、使う変数を定義しています。Thは、角度Θの意味です。
|
30
29
|
|
31
|
-
|
30
|
+
```ここに言語を入力
|
32
31
|
/////////////////////////////////////////////////////////////////////
|
33
32
|
// FUNCTION: SimulationStep
|
34
33
|
// This function runs at every time step.
|
@@ -56,9 +55,9 @@
|
|
56
55
|
Th = Th + 2.0*f_PI;
|
57
56
|
}
|
58
57
|
|
59
|
-
|
58
|
+
コード
|
60
|
-
|
59
|
+
```
|
61
|
-
|
60
|
+
//////////////////////////////////////////////////////////////
|
62
61
|
// FUNCTION: SimulationBegin
|
63
62
|
// Initialization function. This function runs once at the beginning of simulation
|
64
63
|
// For parameter sweep or AC sweep simulation, this function runs at the beginning of each simulation cycle.
|
@@ -67,7 +66,9 @@
|
|
67
66
|
//int nInputCount: (read only) Number of input nodes
|
68
67
|
//int nOutputCount: (read only) Number of output nodes
|
69
68
|
//int nParameterCount: (read only) Number of parameters is always zero for C-Blocks. Ignore nParameterCount and pszParameters
|
70
|
-
//int *pnError: (write only) assign *pnError = 1; if there is an error and
|
69
|
+
//int *pnError: (write only) assign *pnError = 1; if there is an error and
|
70
|
+
```
|
71
|
+
```set the error message in szErrorMsg
|
71
72
|
// strcpy(szErrorMsg, "Error message here...");
|
72
73
|
// DO NOT CHANGE THE NAME OR PARAMETERS OF THIS FUNCTION
|
73
74
|
void SimulationBegin(
|
@@ -78,12 +79,12 @@
|
|
78
79
|
{
|
79
80
|
// ENTER INITIALIZATION CODE HERE...
|
80
81
|
|
81
|
-
|
82
82
|
|
83
|
-
}//シミュレーションの初期値を
|
83
|
+
}//シミュレーションの初期値をここに言語を入力
|
84
84
|
|
85
85
|
|
86
|
+
```
|
86
|
-
/////////////////////////////////////////////////////////////////////
|
87
|
+
```/////////////////////////////////////////////////////////////////////
|
87
88
|
// FUNCTION: SimulationEnd
|
88
89
|
// Termination function. This function runs once at the end of simulation
|
89
90
|
// For parameter sweep or AC sweep simulation, this function runs at the end of each simulation cycle.
|
@@ -96,9 +97,8 @@
|
|
96
97
|
|
97
98
|
|
98
99
|
}//シミュレーション終了時のコマンドをうつところです。
|
100
|
+
```
|
99
101
|
|
100
|
-
|
101
|
-
|
102
102
|
### 試したこと
|
103
103
|
PSIMのCブロックを使って実際にプログラミングを行っていた人のサイトをまず探しましたが、見つかりませんでした。そこで、与えた初期値を時間ごとに更新して計算するプログラミングを調べましたが、出てきませんでした。
|
104
104
|
|