⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 model.c

📁 一种求解目标函数最小化的MATLAB仿真程序.
💻 C
字号:
/* Number of Generators:2,  They are bus #1 to bus #2*/

/* Number of PV loads:0  */

/* Number of PQ loads:1,  It is bus #3 */

/*The classic steady state model: */



f1[1]=(((e[1]*(e[1]*g[1][1]))+(((b[1][3]*e[1])*(e[3]*sin((th[1]-th[3]))))+((cos((th[1]-th[3]))*e[3])*
(e[1]*g[1][3]))))-p[1]);



             /*The derivative with respect to th[1]  */

j[1][1]=(((b[1][3]*e[1])*(e[3]*cos((th[1]-th[3]))))+((((-1)*sin((th[1]-th[3])))*e[3])*
(e[1]*g[1][3])));



             /*The derivative with respect to th[2]  */

j[1][2]=0;



             /*The derivative with respect to e[3]  */

j[1][3]=(((b[1][3]*e[1])*sin((th[1]-th[3])))+(cos((th[1]-th[3]))*(e[1]*g[1][3])));



             /*The derivative with respect to th[3]  */

j[1][4]=(((b[1][3]*e[1])*(e[3]*(cos((th[1]-th[3]))*(-1))))+((((-1)*(sin((th[1]-th[3]))*(-1)))*e[3])*
(e[1]*g[1][3])));



f1[2]=(((e[2]*(e[2]*g[2][2]))+(((b[2][3]*e[2])*(e[3]*sin((th[2]-th[3]))))+((cos((th[2]-th[3]))*e[3])*
(e[2]*g[2][3]))))-p[2]);



             /*The derivative with respect to th[1]  */

j[2][1]=0;



             /*The derivative with respect to th[2]  */

j[2][2]=(((b[2][3]*e[2])*(e[3]*cos((th[2]-th[3]))))+((((-1)*sin((th[2]-th[3])))*e[3])*(e[2]*g[2][3])));



             /*The derivative with respect to e[3]  */

j[2][3]=(((b[2][3]*e[2])*sin((th[2]-th[3])))+(cos((th[2]-th[3]))*(e[2]*g[2][3])));



             /*The derivative with respect to th[3]  */

j[2][4]=(((b[2][3]*e[2])*(e[3]*(cos((th[2]-th[3]))*(-1))))+((((-1)*(sin((th[2]-th[3]))*(-1)))*e[3])*
(e[2]*g[2][3])));



f1[3]=((((((b[3][1]*e[3])*(e[1]*sin((th[3]-th[1]))))+((cos((th[3]-th[1]))*e[1])*(e[3]*g[3][1])))+(((b[3][2]*
e[3])*(e[2]*sin((th[3]-th[2]))))+((cos((th[3]-th[2]))*e[2])*(e[3]*g[3][2]))))+(e[3]*(e[3]*
g[3][3])))-p[3]);



             /*The derivative with respect to th[1]  */

j[3][1]=(((b[3][1]*e[3])*(e[1]*(cos((th[3]-th[1]))*(-1))))+((((-1)*(sin((th[3]-th[1]))*(-1)))*
e[1])*(e[3]*g[3][1])));



             /*The derivative with respect to th[2]  */

j[3][2]=(((b[3][2]*e[3])*(e[2]*(cos((th[3]-th[2]))*(-1))))+((((-1)*(sin((th[3]-th[2]))*(-1)))*e[2])*
(e[3]*g[3][2])));



             /*The derivative with respect to e[3]  */

j[3][3]=((((b[3][1]*(e[1]*sin((th[3]-th[1]))))+((cos((th[3]-th[1]))*e[1])*g[3][1]))+((b[3][2]*(e[2]*sin((th[3]-
th[2]))))+((cos((th[3]-th[2]))*e[2])*g[3][2])))+((e[3]*g[3][3])+(e[3]*g[3][3])));



             /*The derivative with respect to th[3]  */

j[3][4]=((((b[3][1]*e[3])*(e[1]*cos((th[3]-th[1]))))+((((-1)*sin((th[3]-th[1])))*e[1])*(e[3]*g[3][1])))+
(((b[3][2]*e[3])*(e[2]*cos((th[3]-th[2]))))+((((-1)*sin((th[3]-th[2])))*e[2])*(e[3]*g[3][2]))));



f2[1]=((((((g[3][1]*e[3])*(e[1]*sin((th[3]-th[1]))))-((cos((th[3]-th[1]))*e[1])*(e[3]*b[3][1])))+(((g[3][2]*
e[3])*(e[2]*sin((th[3]-th[2]))))-((cos((th[3]-th[2]))*e[2])*(e[3]*b[3][2]))))+(0-(e[3]*
(e[3]*b[3][3]))))-q[3]);



             /*The derivative with respect to th[1]  */

j[4][1]=(((((g[3][1]*e[3])*(e[1]*(cos((th[3]-th[1]))*(-1))))-((((-1)*(sin((th[3]-th[1]))*
(-1)))*e[1])*(e[3]*b[3][1])))+(0-(0*(e[3]*b[3][2]))))+(0-((0*(e[3]*
b[3][3]))+(e[3]*((0*b[3][3])+(e[3]*0))))));



             /*The derivative with respect to th[2]  */

j[4][2]=(((0-(0*(e[3]*b[3][1])))+(((g[3][2]*e[3])*(e[2]*(cos((th[3]-th[2]))*(-1))))-((((-1)*
(sin((th[3]-th[2]))*(-1)))*e[2])*(e[3]*b[3][2]))))+(0-((0*(e[3]*b[3][3]))+(e[3]*
((0*b[3][3])+(e[3]*0))))));



             /*The derivative with respect to e[3]  */

j[4][3]=((((g[3][1]*(e[1]*sin((th[3]-th[1]))))-((cos((th[3]-th[1]))*e[1])*b[3][1]))+((g[3][2]*(e[2]*sin((th[3]-
th[2]))))-((cos((th[3]-th[2]))*e[2])*b[3][2])))+(0-((1*(e[3]*b[3][3]))+(e[3]*((1*
b[3][3])+(e[3]*0))))));



             /*The derivative with respect to th[3]  */

j[4][4]=(((((g[3][1]*e[3])*(e[1]*cos((th[3]-th[1]))))-((((-1)*sin((th[3]-th[1])))*e[1])*(e[3]*b[3][1])))+
(((g[3][2]*e[3])*(e[2]*cos((th[3]-th[2]))))-((((-1)*sin((th[3]-th[2])))*e[2])*(e[3]*b[3][2]))))+
(0-((0*(e[3]*b[3][3]))+(e[3]*((0*b[3][3])+(e[3]*0))))));



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -