Fendi 0.4 Developper Documentation



The principle

The Fendi graphical interface communicate with the simulations engine with 2 files :
The simulation plugins are dynamic libraries (dll).

These files are XML file.

The datas.tmp file

This file contains 3 main parts :

Component fields are placed beween the tags <component> and </component>

Between these tags, you will find the 3 fixed fields :
After these fixed, you will find a list of paramerters. This list begins with the number of parameter beetwen the tags <parameternumber> and </parameternumber>. It is an integer.
After this parameter you will find the parameter list with 3 fields for each parameter :

Each network node field is placed between the tags <netnode> and </netnode>
Between these tags, you will find a list of component nodes connected to this network node.
Each component node field is placed between the tags <node> and </node>
Between these tags, you will find 2 fixed fields :
For example, for the Exemple1AC.sch very simple network :

The network

Here is the datas.tmp file generated :

<?xml version='1.0' encoding='UTF16' standalone='yes'?>

<component>
<type>9</type>
<systemname>SourceAC0</systemname>
<measure>False</measure>
<parameternumber>2</parameternumber>
<parametername>Tension</parametername>
<parametertype>0</parametertype>
<parametervalue>1</parametervalue>
<parametername>Phase</parametername>
<parametertype>0</parametertype>
<parametervalue>0</parametervalue>
</component>

<component>
<type>5</type>
<systemname>Resistor0</systemname>
<measure>False</measure>
<parameternumber>1</parameternumber>
<parametername>resistance</parametername>
<parametertype>0</parametertype>
<parametervalue>1</parametervalue>
</component>

<component>
<type>7</type>
<systemname>Ground0</systemname>
<measure>False</measure>
<parameternumber>0</parameternumber>
</component>

<netnode>
<node>
<component>SourceAC0</component>
<index>0</index>
</node>
<node>
<component>Resistor0</component>
<index>0</index>
</node>
</netnode>

<netnode>
<node>
<component>SourceAC0</component>
<index>1</index>
</node>
<node>
<component>Ground0</component>
<index>0</index>
</node>
<node>
<component>Resistor0</component>
<index>1</index>
</node>
</netnode>


The results.tmp file

This file contains 3 main parts :
Component simulation results are placed between the tags <component> and </component>.
Between these tags, you will find the fixed fields :
After these fixed, you will find a list of information to display. This list begins with the number of informations beetwen the tags <infosnumber> and </infosnumber>. It is an integer.
After this parameter you will find the informations list with 3 fields for each parameter :
Network node simulation results are placed beween the tags <netnode> and </netnode>. The fields are the same as the components except for the type and system name which are not given.

For example, here is the results.tmp file generated for the Exemple1AC.sch very simple network :

<?xml version='1.0' encoding='UTF16' standalone='yes'?>

<component>
<type>9</type>
<systemname>SourceAC0</systemname>
<infosnumber>1</infosnumber>
<infoname>Current</infoname>
<infotype>1</infotype>
<infounit>A</infounit>
<infovalue>1</infovalue>
<infovalue>0</infovalue>
</component>

<component>
<type>5</type>
<systemname>Resistor0</systemname>
<infosnumber>1</infosnumber>
<infoname>Current</infoname>
<infotype>1</infotype>
<infounit>A</infounit>
<infovalue>1</infovalue>
<infovalue>0</infovalue>
</component>

<netnode>
<infosnumber>1</infosnumber>
<infoname>Voltage</infoname>
<infotype>1</infotype>
<infounit>V</infounit>
<infovalue>1</infovalue>
<infovalue>0</infovalue>
</netnode>

<netnode>
<infosnumber>1</infosnumber>
<infoname>Voltage</infoname>
<infotype>1</infotype>
<infounit>V</infounit>
<infovalue>0</infovalue>
<infovalue>0</infovalue>
</netnode>


You can see these results in the graphical interface :

The results



Simulation plugin format

The simulation plugins are dynamic libraries (dll). The must contain 8 functions. 3 main functions :
5 function used by the Fendi graphical interface to build the engine parameters window : And one function to set the simulation engine parameters The function are now detailed below :

The execute function

The syntax of the function is :

function Execute:Boolean;
begin

end;

It return true if the function succeed and false if not.

The AllowedComponent function

The syntax of the function is :

function AllowedComponent(Number:Integer):Boolean;
begin

end

The input integer Number is the type number of a component (See the list below). If the plugin can simulate this component, you must return true and false of not.

The GetErrorMsg function

The syntax of the function is :

function GetErrorMsg:PChar;
begin

end

When the execute function fail, this function must return the corresponding error message.

The GetParamCount function

The syntax of the function is :

function GetParamCount:Integer;
begin

end

It return the number of parameters needed by the simulation engine.

The GetParamName function

The syntax of the function is :

function GetParamName(i:Integer):PChar;
begin

end

It return the name of parameter number i needed by the simulation engine. For the first parameter i is equal to 0.

The GetParamUnit function

The syntax of the function is :

function GetParamUnit(i:Integer):PChar;
begin

end

It return the unit of parameter number i needed by the simulation engine. For the first parameter i is equal to 0.

The SetParamValue function

The syntax of the function is :

procedure SetParamValue(i:Integer;Value:Double);
begin

end

It get the value of parameter number i needed by the simulation engine. For the first parameter i is equal to 0.

The GetParamDefault function

The syntax of the function is :

function GetParamDefaultValue(i:Integer):Double;
begin

end

It return the default value of parameter number i needed by the simulation engine. For the first parameter i is equal to 0.

See the plugins DC.dll and AC.dll as examples.

List of the components

Type number Component Parameters
4 Capacitor Capacitance (Farads)
5 Resistor Resistance (Ohms)
6 DC Source Voltage (Volts)
7 Ground
8 Comment
9 AC Source 2 nodes (1 Phase)
Voltage (Volts)
Phase (Degrees)
10 Inductor Inductance (Henry)
11 Transformer Ratio (No units)
12 Inductive line Xd=Xi (MilliHenry)
X0 (MilliHenry)
13 6 phases multipole Resistance (Ohms) 6x6 table
Inductance (Ohms) 6x6 table
14 12 phases multipole Resistance (Ohms) 12x12 table
Inductance (Ohms) 12x12 table
15 AC source 6 nodes (3 Phases) Voltage (Volts)
Phase (Degrees)
16 Fault Resistance (Ohms)
Fault present (No units) boolean
17 Impedance measure K0 (No units)
18 3 phases impedance Rd (Ohms)
Xd (MilliHenry)
Ri (Ohms)
Xi (MilliHenry)
R0 (Ohms)
X0 (MilliHenry)
19 3 phase fault R1 (Ohms)
R2 (Ohms)
R3 (Ohms)
Rg (Ohms)
Fault present (No units) boolean
20 Resistive line Xd=Xi (MilliHenry)
Rd=Ri (Ohms)
X0 (MilliHenry)
R0 (Ohms)
21 3 phases Transfer Function Real part 6x6 table
Complex part 6x6 table
22 N phases Transfer Function Number of phases
Real part NxN table
Complex part NxN table
23 3 phase shift transformer Angle (Degrees)
24 3 phases breaker Open (No units) boolean
25 3 winding transformer Ratio (No units)
26 Single phase shift transformer Angle (Degrees)
27 3 phase shift transformer with impedances
Angle (Degrees)
Rd (Ohms)
Xd (MilliHenry)
Ri (Ohms)
Xi (MilliHenry)
R01 (Ohms)
X01 (MilliHenry)
R02 (Ohms)
X02 (MilliHenry)
R03 (Ohms)
X03 (MilliHenry)
28 Load Active Power (W)
Reactive Power (Var)
29 2 Nodes Line Resistance (pu)
Inductance (pu)
Capacitance (pu)
30 1 Node Source Voltage (pu)
Phase (Degrees)


  Add a new component

To add a new component in the interface, follow the steps :

In the parameters, the tables sizes can be linked to an integer. You just have put the integer parameter number in parameter link value of the tables. This feature is used in the N phases Transfer Function.