📄 dnetdllr.cpp
字号:
// DNetDLLR.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "DNetDLLR.h"
#include "DNet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CDNetDLLRApp
BEGIN_MESSAGE_MAP(CDNetDLLRApp, CWinApp)
//{{AFX_MSG_MAP(CDNetDLLRApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDNetDLLRApp construction
CDNetDLLRApp::CDNetDLLRApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDNetDLLRApp object
CDNetDLLRApp theApp;
CDNet DNet;
extern "C"_declspec(dllexport)
void Initialization()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.Initialization();
}
extern "C"_declspec(dllexport)
void SetBranch(UINT nIndex,BOOL state,UINT head,UINT tail,double BranchArea,double distance)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetBranch(nIndex,state,head,tail,BranchArea,distance);
}
extern "C"_declspec(dllexport)
void SetCable(UINT nIndex,BOOL state,UINT head,UINT tail,double CableArea,
UINT sort,double VoltageGrade,double distance)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetCable(nIndex,state,head,tail,CableArea,
sort,VoltageGrade,distance);
}
extern "C"_declspec(dllexport)
void SetTrans(UINT nIndex,BOOL state,UINT head,UINT tail,double PFaultWaste,double VFault,double PKong,
double KCurrent,double STotal,double GVoltage,double position)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetTrans(nIndex,state,head,tail,PFaultWaste,VFault,PKong,
KCurrent,STotal,GVoltage,position);
}
extern "C"_declspec(dllexport)
void SetBeginInfo(INT nIndex,INT nNode/*节点号*/, double wP,double wQ)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetBeginInfo(nIndex,nNode/*节点号*/, wP,wQ);
}
extern "C"_declspec(dllexport)
void SetSwitch(UINT nIndex,UINT head,UINT tail)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetSwitch(nIndex,head,tail);
}
extern "C"_declspec(dllexport)
void SetSwitchState(UINT nIndex,BOOL state)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetSwitchState(nIndex,state);
}
extern "C"_declspec(dllexport)
void SetCapInfo(UINT nIndex,UINT node,double dP,double Sn,double Vn)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetCapInfo(nIndex,node,dP,Sn,Vn);
}
extern "C"_declspec(dllexport)
void SetFeederInfo(UINT nIndex,INT nElement,double voltage)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetFeederInfo(nIndex,nElement,voltage);
}
extern "C"_declspec(dllexport)
void SetFeederMumber(int number)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetFeederMumber(number);
}
extern "C"_declspec(dllexport)
void SetVoltageConergence(double value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetVoltageConergence(value);
}
extern "C"_declspec(dllexport)
void SetPowerConvergence(double value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetPowerConvergence(value);
}
extern "C"_declspec(dllexport)
void SetSB(double SBvalue,double VBvalue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetSB(SBvalue,VBvalue);
}
extern "C"_declspec(dllexport)
void SetMark(BOOL mark)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetMark(mark);
}
extern "C"_declspec(dllexport)
void SetIterstion(int value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetIterstion(value);
}
extern "C"_declspec(dllexport)
BOOL DistributionFlow()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.DistributionFlow();
}
extern "C"_declspec(dllexport)
void NetAnalyse()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.NetAnalyse();
}
extern "C"_declspec(dllexport)
BOOL DNetInitialization()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.DNetInitialization();
}
extern "C"_declspec(dllexport)
int GetBranchNumber()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetBranchNumber();
}
extern "C"_declspec(dllexport)
int GetMaxElement()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetMaxElement();
}
extern "C"_declspec(dllexport)
double GetDNetEnergeWaste()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetDNetEnergeWaste();
}
extern "C"_declspec(dllexport)
BOOL GetNodeData(INT nIndex,double& voltage,double& wP,double& wQ)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetNodeData(nIndex,voltage,wP,wQ);
}
extern "C"_declspec(dllexport)
BOOL GetBranchData(INT nIndex,UINT& head,UINT& tail,double& wPHead,double& wQHead,
double& wPTail,double& wQTail,double& wCurrent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetBranchData(nIndex,head,tail,wPHead,wQHead,wPTail,wQTail,wCurrent);
}
extern "C"_declspec(dllexport)
BOOL GetNodeAtElement(UINT nElement,UINT& nNode)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetNodeAtElement(nElement,nNode);
}
extern "C"_declspec(dllexport)
BOOL BranchWaste(INT nIndex,UINT& head,UINT& tail,double& PWaste,double& QWaste,double& wCurrent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.BranchWaste(nIndex,head,tail,PWaste,QWaste,wCurrent);
}
extern "C"_declspec(dllexport)
BOOL TransWaste(INT nIndex,UINT& head,UINT& tail,double& PFeWaste,double&
QFeWaste,double& PCuWaste,double& QCuWaste,double& wCurrent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.TransWaste(nIndex,head,tail,PFeWaste,QFeWaste,PCuWaste,QCuWaste,wCurrent);
}
extern "C"_declspec(dllexport)
INT GetSwitch()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetSwitch();
}
extern "C"_declspec(dllexport)
BOOL GetSwitchInfo(INT nIndex,INT& head,INT& tail,double& current)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetSwitchInfo(nIndex,head,tail,current);
}
extern "C"_declspec(dllexport)
BOOL Flow()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.Flow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -