📄 dnetwr.cpp
字号:
// DNetWR.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "DNetWR.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.
//
/////////////////////////////////////////////////////////////////////////////
// CDNetWRApp
BEGIN_MESSAGE_MAP(CDNetWRApp, CWinApp)
//{{AFX_MSG_MAP(CDNetWRApp)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CDNetWRApp construction
CDNetWRApp::CDNetWRApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDNetWRApp object
CDNetWRApp theApp;
CDNet DNet;
extern "C"_declspec(dllexport)
void Initialize()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.Initialize();
}
extern "C"_declspec(dllexport)
void AddBranch(UINT nIndex,BOOL state,UINT head,UINT tail,double BranchArea,double distance)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.AddBranch(nIndex,state,head,tail,BranchArea,distance);
}
extern "C"_declspec(dllexport)
void AddCable(UINT nIndex,BOOL state,UINT head,UINT tail,double CableArea,
UINT sort,double VoltageGrade,double distance)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.AddCable(nIndex,state,head,tail,CableArea,
sort,VoltageGrade,distance);
}
extern "C"_declspec(dllexport)
void AddTrans(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.AddTrans(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,
double a,BOOL nType=TRUE)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetBeginInfo(nIndex,nNode/*节点号*/, wP,wQ,a,nType);
}
extern "C"_declspec(dllexport)
void AddSwitch(UINT nIndex,UINT head,UINT tail)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.AddSwitch(nIndex,head,tail);
}
extern "C"_declspec(dllexport)
void SetSwitchState0(UINT nIndex,BOOL state)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetSwitchState0(nIndex,state);
}
extern "C"_declspec(dllexport)
void AddCap(UINT nIndex,UINT node,double dP,double Sn,double Vn)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.AddCap(nIndex,node,dP,Sn,Vn);
}
extern "C"_declspec(dllexport)
void SetFeederInfo(UINT nIndex,INT nElement,double voltage,
double measureAP,double measureAQ,
double convergenceP=0.05,double convergenceQ=0.10)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetFeederInfo(nIndex,nElement,voltage,measureAP,measureAQ,
convergenceP,convergenceQ);
}
extern "C"_declspec(dllexport)
void SetConergenceV(double value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetConergenceV(value);
}
extern "C"_declspec(dllexport)
void SetConvergenceP(double value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetConvergenceP(value);
}
extern "C"_declspec(dllexport)
void SetBasicInfo(double SBvalue,double VBvalue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetBasicInfo(SBvalue,VBvalue);
}
extern "C"_declspec(dllexport)
void SetMark0(BOOL mark)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetMark0(mark);
}
extern "C"_declspec(dllexport)
void SetMaxIter(int value)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetMaxIter(value);
}
extern "C"_declspec(dllexport)
void DNetFlow()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.DNetFlow();
}
extern "C"_declspec(dllexport)
void NetAnalyse0()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.NetAnalyse0();
}
extern "C"_declspec(dllexport)
void DNetInitialize()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.DNetInitialize();
}
extern "C"_declspec(dllexport)
int GetnBranch()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetnBranch();
}
extern "C"_declspec(dllexport)
int GetMaxEle()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetMaxEle();
}
extern "C"_declspec(dllexport)
BOOL GetNodeVsEle(UINT nElement,UINT& nNode)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetNodeVsEle(nElement,nNode);
}
extern "C"_declspec(dllexport)
BOOL BranchWasteA(INT nIndex,UINT& head,UINT& tail,double& PWaste,double& QWaste)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.BranchWasteA(nIndex,head,tail,PWaste,QWaste);
}
extern "C"_declspec(dllexport)
BOOL TransWasteA(INT nIndex,UINT& head,UINT& tail,double& PFeWaste,double&
QFeWaste,double& PCuWaste,double& QCuWaste)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.TransWasteA(nIndex,head,tail,PFeWaste,QFeWaste,PCuWaste,QCuWaste);
}
extern "C"_declspec(dllexport)
void SetRuntime(double time)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetRuntime(time);
}
extern "C"_declspec(dllexport)
void SetErrorA(double value=0.001)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.SetErrorA(value);
}
extern "C"_declspec(dllexport)
INT GetFeederNumber()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetFeederNumber();
}
extern "C"_declspec(dllexport)
void GetTotalWaste(double& WasteAP,double& WasteAQ)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.GetTotalWaste(WasteAP,WasteAQ);
}
extern "C"_declspec(dllexport)
BOOL GetFeeder(INT nIndex,double& MeaAP,double& MeaAQ,
double& AP,double& AQ)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return DNet.GetFeeder(nIndex,MeaAP,MeaAQ,
AP,AQ);
}
extern "C"_declspec(dllexport)
void GetOverLoadRatio(double* pData=NULL)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
DNet.GetOverLoadRatio(pData);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -