Sie sind auf Seite 1von 2

Für die Erstellung des C/C++ Programms, das eine Dynamic Link Library (DLL) ist, ist notwendig MS Visual Studio 2008 oder höher (Wie ein Compiler).

Die Funktionen, die DLL enthält, sind:

- Zugang und Änderung jeder Variablen jeder Komponente ( Schalter: Ein/Aus, Tap Position des Transformators, )

- Ausführung jeder Analyse/Berechnungsfunktion

- Hinzufügen und Entfernen von Komponenten des Netzwerks

Deklaration of the „RunNeplanScript()“ function prototype:

- „RunNeplanScript()“ ist the main entry to run dll

- #define NPL_TEST_API

- #define NPL_TEST_API

declspec(dllexport)

declspec(dllimport)

Command to export “RunNeplanScript()” Command to import “RunNeplanScript()”

Example: Changing the length of the Line. In first case the length ist 5km, in second case just 1km.

-----------------------------------------------------------------------------------------------------------------------------------

NPL_TEST_API BOOL RunNeplanScript()

{

BOOL bRunOk = True; cString sMsg; TCHAR wcMsg[300]; // Get the element ID of line “LINE 1-3” unsigned long ElementID=0;

GetElementByName(_T(“LINE”),_T(“LINE1-3”),ElementID);

// Change the length of the line “LINE1-3” to 5.0 (undervoltage in “PINO ” node) if (ElementID >0)

SetParameterDouble(ElementID,_T(“Length”),5.0);

//Run load flow and refresh screen RunAnalysisLF(); RefreshScreen(); //Messagess sMsg=_T(“Run load flow LINE 1-3 length=5.0”); swprintf_s(wcMsg, _T(“%s”), sMsg); WriteMessageToLogFile(wcMsg); AfxMessageBox(sMsg); // Change the length of the line “LINE1-3” to 1.0 (normal voltage in “PINO ” node) if (ElementID >0) SetParameterDouble(ElementID,_T(“Length”), 1.0); //Run load flow again and refresh screen RunAnalysisLF(); RefreshScreen(); sMsg=_T(“Run load flow LINE 1-3 length=1.0”); swprintf_s(wcMsg, _T(“%s”), sMsg); WriteMessageToLogFile(wcMsg); AfxMessageBox(sMsg);

// Show the Neplan Report (‘ScriptLogFile.out ’ file) ShowReport(); return bRunOk;

}

----------------------------------------------------------------------------------------------------------------------------------------

// Remove Load flow controls areas transactions and imports BOOL RemoveAllControlAreaImports(); BOOL RemoveAllControlAreaTransactions(); // Add control area import for load flow BOOL AddCotrolAreaImport(TCHAR* wcName,TCHAR* wcAreaName, double dP, double dToler, BOOL bActive); // Gets the data of a control area import item defined for load flow BOOL GetAreaControl2Item(int nItem, LPTSTR lpName, LPTSTR lpAreaName, long& IAreaID, double& dP, double& dToler, bool….) // Get number of control area imports defined for load flow int GetNumAreaControl2Items(); //Get an element ID by name void GetElementByName(TCHAR* wcType, TCHAR* wcName, unsigned long& IElementID, BOOL bWithErrorMsg = TRUE); //Get an element ID by name, all names must be unique in the Neplan project! void GetElementByUniqueName(TCHAR* wcName, unsigned long& IElementID); // Get all elements of a certain type void GetElements(TCHAR* sType, int& nCount, unsigned long*& pIElementsIDs); //Free the element list, which was get gy the ‘GetElements’ function void FreeElements(unsigned long*& pElementsIDs); // Gets a node from an element, nNodeNr=0-4 -> 0=1 st node, 2=2 nd node,… etc. BOOL GetNodeFromElement(unsigned long& INodeID, unsigned long IElementID, int nNodeNr=0); //Gets the protected element of a protection device BOOL GetProtectedElement(unsigned long& IElementID, unsigned long IProtectionID); //Gets a element from a Node, nElementNr BOOL GetElementFromNode(unsigned long& IElementID, unsigned long INodeID, int nElementNr);