// V-shaped magnet_rotor
//console.log("------ start script ------");
// Copyright 2018-2024, Vladimir Kuptsov
include('..\\sDraw.js');

function Rotor()
{
	// Rotor inner radius
	this.Rrinner = motor.rotorInnerRadius;
	// Rotor outer radius
	this.Rrouter = motor.rotorOuterRadius;
	// Number of pole pairs
	this.nPolePairs = motor.rotorNumberPolePairs;
	//Air gap length
	var lag = motor.airGap;
	
	// Initial rotor dimensions:
	// Magnet width:
	this.Wpm  = 2*lag;
	// Magnet length
	this.Lpm = (this.Rrinner + this.Rrouter)*3.14/this.nPolePairs/4;
	// Magnet inset depth
	this.Dis = 0.5*(this.Rrouter - this.Rrinner)/3;
	// Distance between magnets
	this.Dbt = lag;
	// Magnet angle
	this.Apm = 30;
	
	// Outer barrier dimensions:
	// upper length
	this.Lbo1 = lag/2;
	// lower length
	this.Lbo2 = lag;
	// upper fillet radius
	this.Rfo1 = lag/4;
	// lower fillet radius
	this.Rfo2 = lag/4;
	
	// Inner barrier dimensions:
	// upper length
	this.Lbi1 = lag/2;
	// lower length
	this.Lbi2 = lag;
	// upper fillet radius
	this.Rfi1 = lag/4;
	// lower fillet radius
	this.Rfi2 = lag/4;
	
	// Rotor surface groove
	// Groove radius
	this.Rg = 0;
	// Groove depth
	this.Dg = 0;
	// Groove position angle
	this.Ag = 10;
	
};

// generate rotor geometry 
// call from с++ code
Rotor.prototype.getGeometry = function (){

	// Machine type: InnerRotor | OuterRotor
	var machineType = motor.machineType;
	// Rotor inner radius
	this.Rrinner = motor.rotorInnerRadius;
	// Rotor outer radius
	this.Rrouter = motor.rotorOuterRadius; 
	// Number of pole pairs
	this.nPolePairs = motor.rotorNumberPolePairs;
	
	this.alfa = 360/this.nPolePairs/4;    // half pole pitch angle
	
	// rotor geometry array
	var geomr = new Array;
	
	// magnet
	this.point_1 = new QPointF(this.Dbt/2, this.Rrouter - this.Dis);
	
	var line_1_2 = sDraw.createLineByPointAngle(this.point_1.x(), this.point_1.y(), this.Apm);
	var line_1_4 = sDraw.createLineByPointAngle(this.point_1.x(), this.point_1.y(), this.Apm+90);
	var line_4_3 = sDraw.createLineParallel(line_1_2, this.Wpm, 'lower');
	var line_2_3 = sDraw.createLineParallel(line_1_4, this.Lpm, 'right');
	
	this.point_4 = sDraw.intersection(line_1_4, line_4_3); 
	this.point_2 = sDraw.intersection(line_1_2, line_2_3); 
	this.point_3 = sDraw.intersection(line_4_3, line_2_3); 
	
	var segment_1_2 = new Segment(this.point_1, this.point_2);
	geomr.push(segment_1_2);    // add segment_1_2
	
	var segment_2_3 = new Segment(this.point_2, this.point_3);
	geomr.push(segment_2_3);    // add segment_2_3
	
	var segment_3_4 = new Segment(this.point_3, this.point_4);
	geomr.push(segment_3_4);    // add segment_3_4
	
	var segment_4_1 = new Segment(this.point_4, this.point_1);
	geomr.push(segment_4_1);    // add segment_4_1
		
	// outer flux barrier
	var line_Lbo1 = sDraw.createLineParallel(line_2_3, this.Lbo1, 'right');
	this.point_5 = sDraw.intersection(line_1_2, line_Lbo1); 
	
	var line_Lbo2 = sDraw.createLineParallel(line_2_3, this.Lbo2, 'right');
	this.point_6 = sDraw.intersection(line_4_3, line_Lbo2); 
	
	var segment_2_5 = new Segment(this.point_2, this.point_5);
	var segment_5_6 = new Segment(this.point_5, this.point_6);
	var segment_6_3 = new Segment(this.point_6, this.point_3);
	
	var rounding2 = couplingSegments(segment_5_6, segment_6_3, this.Rfo2); 
	geomr.push(rounding2[1]);
	geomr.push(rounding2[2]);
	
	var rounding1 = couplingSegments(segment_2_5, rounding2[0], this.Rfo1); 
	geomr.push(rounding1[0]);
	geomr.push(rounding1[1]);
	geomr.push(rounding1[2]);
	
	// inner flux barrier
	var line_Lbi1 = sDraw.createLineParallel(line_1_4, this.Lbi1, 'left');
	this.point_7 = sDraw.intersection(line_1_2, line_Lbi1); 
	
	var line_Lbi2 = sDraw.createLineParallel(line_1_4, this.Lbi2, 'left');
	this.point_8 = sDraw.intersection(line_4_3, line_Lbi2); 
	
	var segment_1_7 = new Segment(this.point_1, this.point_7);
	var segment_7_8 = new Segment(this.point_7, this.point_8);
	var segment_8_4 = new Segment(this.point_8, this.point_4);
	
	var rounding4 = couplingSegments(segment_7_8, segment_8_4, this.Rfi2); 
	geomr.push(rounding4[1]);
	geomr.push(rounding4[2]);
	
	var rounding3 = couplingSegments(segment_1_7, rounding4[0], this.Rfi1); 
	geomr.push(rounding3[0]);
	geomr.push(rounding3[1]);
	geomr.push(rounding3[2]);
	
	// groove
	if (this.Rg>0 && this.Dg>0)  {   // if there is a groove
		var circle_groove_center = sDraw.createCircle(0, 0, this.Rrouter+this.Rg-this.Dg);
		var line_groove = sDraw.createLineByPointAngle(0, 0, 90-this.Ag);
		var point_gc = sDraw.intersection(circle_groove_center, line_groove, 'higher');
		var circle_groove = sDraw.createCircle(point_gc.x(), point_gc.y(), this.Rg);
		var circle_Rrouter = sDraw.createCircle(0, 0, this.Rrouter);
		
		var point_g1 = sDraw.intersection(circle_groove, circle_Rrouter, 'left');
		var point_g2 = sDraw.intersection(circle_groove, circle_Rrouter, 'right');
		
		var line_gc_g1 = sDraw.createLineBy2Points(point_gc.x(), point_gc.y(), point_g1.x(), point_g1.y());
		var line_gc_g2 = sDraw.createLineBy2Points(point_gc.x(), point_gc.y(), point_g2.x(), point_g2.y());
		
		var arc_g = new Arc(line_gc_g1.angleDeg, line_gc_g2.angleDeg, this.Rg, point_gc.x(), point_gc.y());
		geomr.push(arc_g);    // add groove border
		
		// groove material assignment point
		var circle_groove_material = sDraw.createCircle(0, 0, this.Rrouter-this.Dg/2); // circle through middle of groove
		this.point_groove_material = sDraw.intersection(circle_groove_material, line_groove, 'higher');
		
		// adding outer rotor border
		var line_0_g1 = sDraw.createLineBy2Points(0, 0, point_g1.x(), point_g1.y());
		var line_0_g2 = sDraw.createLineBy2Points(0, 0, point_g2.x(), point_g2.y());
		
		// outer rotor border (divided in 3 arcs)
		var arc_Rrouter1 = new Arc(90 - this.alfa, line_0_g2.angleDeg, this.Rrouter, 0, 0);
	    geomr.push(arc_Rrouter1);    
		var arc_Rrouter2 = new Arc(line_0_g1.angleDeg, 90, this.Rrouter, 0, 0);
		geomr.push(arc_Rrouter2);    
		var arc_Rrouter3 = new Arc(line_0_g2.angleDeg, line_0_g1.angleDeg, this.Rrouter, 0, 0);
		geomr.push(arc_Rrouter3);  	
	}
	else {  // without groove
		// outer rotor border
		var arc_Rrouter = new Arc(90 - this.alfa, 90, this.Rrouter, 0, 0);
		geomr.push(arc_Rrouter);    // add outer rotor border
	}
	
	// inner rotor border
	var arc_Rrinner = new Arc(90 - this.alfa, 90, this.Rrinner, 0, 0);
	geomr.push(arc_Rrinner);    
	
	return geomr;
};

// call from с++ code
Rotor.prototype.getMaterials = function() { // assign material types

	var materials = new Array(); // array of material assignment points
	var delta = 0.01;   // some small constant
		
	// magnet
	var materialMagnet = new MagnetParallelMaterial;
	// point(x1,y1) between point_1 and point_3
	var x1 = (this.point_1.x()+this.point_3.x())/2;
	var y1 = (this.point_1.y()+this.point_3.y())/2;
	materialMagnet.pos = new QPointF(x1, y1);
	// Magnetization angle
	materialMagnet.angle = this.Apm+90;
	materials.push(materialMagnet);
		
	// flux barrier 1
	var materialGeneral1 = new GeneralMaterial;
	// point(x2,y2) between point_2 and point_3
	var x2 = (this.point_2.x()+this.point_3.x())/2;
	var y2 = (this.point_2.y()+this.point_3.y())/2;
	materialGeneral1.pos = new QPointF(x2+delta, y2);
	materials.push(materialGeneral1);
	
	// flux barrier 2
	var materialGeneral2 = new GeneralMaterial;
	// point(x3,y3) between point_1 and point_4
	var x3 = (this.point_1.x()+this.point_4.x())/2;
	var y3 = (this.point_1.y()+this.point_4.y())/2;
	materialGeneral2.pos = new QPointF(x3-delta, y3);
	materials.push(materialGeneral2);
	
	// groove
	if (this.Rg>0 && this.Dg>0)  {   // if there is a groove
		var materialGrooveGeneral = new GeneralMaterial;
		var x4 = this.point_groove_material.x();
		var y4 = this.point_groove_material.y();
		materialGrooveGeneral.pos = new QPointF(x4, y4);
		materials.push(materialGrooveGeneral);
	}
	
	// rotor core
	var materialIron = new IronMaterial;
	materialIron.pos = new QPointF(delta,this.Rrouter-this.Dis/2);
	materials.push(materialIron);
	
	return materials;
};
	
var rotor = new Rotor();

// rotor widgets constuctor
function RotorUI(ui)
{
	this.ui = ui;

	// create a group for magnet widgets:
	this.groupMagnet = new QGroupBox("Magnet"); 
	// Arranging group of widgets:
	var layoutGroup_Magnet = new QGridLayout(this.groupMagnet); 
	// Adding widgets to the group
	this.labelWpm = new QLabel("Magnet width (Wpm):");
	this.labelWpm.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editWpm = new QDoubleSpinBox;
	this.editWpm.objectName = "Wpm";
	this.editWpm.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editWpm.decimals = 1;
	this.editWpm.singleStep = 1;
	this.editWpm.keyboardTracking = false;
	this.editWpm.value = rotor.Wpm;
	this.unitsWpm = new QLabel("mm");
	layoutGroup_Magnet.addWidget(this.labelWpm, 0, 0);
	layoutGroup_Magnet.addWidget(this.editWpm, 0, 1);
	layoutGroup_Magnet.addWidget(this.unitsWpm, 0, 2);
	
	this.labelLpm = new QLabel("Magnet length (Lpm):");
	this.labelLpm.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editLpm = new QDoubleSpinBox;
	this.editLpm.objectName = "Lpm";
	this.editLpm.decimals = 1;
	this.editLpm.singleStep = 1;
	this.editLpm.keyboardTracking = false;
	this.editLpm.value = rotor.Lpm;
	this.unitsLpm = new QLabel("mm");
	layoutGroup_Magnet.addWidget(this.labelLpm, 1, 0);
	layoutGroup_Magnet.addWidget(this.editLpm, 1, 1);
	layoutGroup_Magnet.addWidget(this.unitsLpm, 1, 2);
	
	this.labelDis = new QLabel("Magnet inset depth (Dis):");
	this.labelDis.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editDis = new QDoubleSpinBox;
	this.editDis.objectName = "Dis";
	this.editDis.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editDis.decimals = 1;
	this.editDis.singleStep = 1;
	this.editDis.keyboardTracking = false;
	this.editDis.value = rotor.Dis;
	this.unitsDis = new QLabel("mm");
	layoutGroup_Magnet.addWidget(this.labelDis, 2, 0);
	layoutGroup_Magnet.addWidget(this.editDis, 2, 1);
	layoutGroup_Magnet.addWidget(this.unitsDis, 2, 2);
	
	this.labelDbt = new QLabel("Distance between magnets (Dbt):");
	this.labelDbt.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editDbt = new QDoubleSpinBox;
	this.editDbt.objectName = "Dbt";
	this.editDbt.decimals = 1;
	this.editDbt.singleStep = 1;
	this.editDbt.keyboardTracking = false;
	this.editDbt.value = rotor.Dbt;
	this.unitsDbt = new QLabel("mm");
	layoutGroup_Magnet.addWidget(this.labelDbt, 3, 0);
	layoutGroup_Magnet.addWidget(this.editDbt, 3, 1);
	layoutGroup_Magnet.addWidget(this.unitsDbt, 3, 2);
	
	this.labelApm = new QLabel("Magnet angle (Apm):");
	this.labelApm.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editApm = new QDoubleSpinBox;
	this.editApm.objectName = "Apm";
	this.editApm.setRange(0, 90);
	this.editApm.decimals = 1;
	this.editApm.singleStep = 1;
	this.editApm.keyboardTracking = false;
	this.editApm.value = rotor.Apm;
	this.unitsApm = new QLabel("degrees");
	layoutGroup_Magnet.addWidget(this.labelApm, 4, 0);
	layoutGroup_Magnet.addWidget(this.editApm, 4, 1);
	layoutGroup_Magnet.addWidget(this.unitsApm, 4, 2);
	
	
	// create a group for outer flux barrier widgets:
	this.groupBarrier1 = new QGroupBox("Outer flux barrier"); 
	// Arranging group of widgets:
	var layoutGroup_Barrier1 = new QGridLayout(this.groupBarrier1); 
	// Adding widgets to the group
	this.labelLbo1 = new QLabel("Upper length (Lbo1):");
	this.labelLbo1.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editLbo1 = new QDoubleSpinBox;
	this.editLbo1.objectName = "Lbo1";
	this.editLbo1.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editLbo1.decimals = 1;
	this.editLbo1.singleStep = 0.1;
	this.editLbo1.keyboardTracking = false;
	this.editLbo1.value = rotor.Lbo1;
	this.unitsLbo1 = new QLabel("mm");
	layoutGroup_Barrier1.addWidget(this.labelLbo1, 0, 0);
	layoutGroup_Barrier1.addWidget(this.editLbo1, 0, 1);
	layoutGroup_Barrier1.addWidget(this.unitsLbo1, 0, 2);
	
	this.labelLbo2 = new QLabel("Lower length (Lbo2):");
	this.labelLbo2.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editLbo2 = new QDoubleSpinBox;
	this.editLbo2.objectName = "Lbo2";
	this.editLbo2.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editLbo2.decimals = 1;
	this.editLbo2.singleStep = 0.1;
	this.editLbo2.keyboardTracking = false;
	this.editLbo2.value = rotor.Lbo2;
	this.unitsLbo2 = new QLabel("mm");
	layoutGroup_Barrier1.addWidget(this.labelLbo2, 1, 0);
	layoutGroup_Barrier1.addWidget(this.editLbo2, 1, 1);
	layoutGroup_Barrier1.addWidget(this.unitsLbo2, 1, 2);
	
	this.labelRfo1 = new QLabel("Upper fillet radius (Rfo1):");
	this.labelRfo1.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editRfo1 = new QDoubleSpinBox;
	this.editRfo1.objectName = "Rfo1";
	this.editRfo1.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editRfo1.decimals = 1;
	this.editRfo1.singleStep = 0.1;
	this.editRfo1.keyboardTracking = false;
	this.editRfo1.value = rotor.Rfo1;
	this.unitsRfo1 = new QLabel("mm");
	layoutGroup_Barrier1.addWidget(this.labelRfo1, 2, 0);
	layoutGroup_Barrier1.addWidget(this.editRfo1, 2, 1);
	layoutGroup_Barrier1.addWidget(this.unitsRfo1, 2, 2);
	
	this.labelRfo2 = new QLabel("Lower fillet radius (Rfo2):");
	this.labelRfo2.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editRfo2 = new QDoubleSpinBox;
	this.editRfo2.objectName = "Rfo2";
	this.editRfo2.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editRfo2.decimals = 1;
	this.editRfo2.singleStep = 0.1;
	this.editRfo2.keyboardTracking = false;
	this.editRfo2.value = rotor.Rfo2;
	this.unitsRfo2 = new QLabel("mm");
	layoutGroup_Barrier1.addWidget(this.labelRfo2, 3, 0);
	layoutGroup_Barrier1.addWidget(this.editRfo2, 3, 1);
	layoutGroup_Barrier1.addWidget(this.unitsRfo2, 3, 2);
	
	
	// create a group for inner flux barrier widgets:
	this.groupBarrier2 = new QGroupBox("Inner flux barrier"); 
	// Arranging group of widgets:
	var layoutGroup_Barrier2 = new QGridLayout(this.groupBarrier2); 
	// Adding widgets to the group
	this.labelLbi1 = new QLabel("Upper length (Lbi1):");
	this.labelLbi1.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editLbi1 = new QDoubleSpinBox;
	this.editLbi1.objectName = "Lbi1";
	this.editLbi1.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editLbi1.decimals = 1;
	this.editLbi1.singleStep = 0.1;
	this.editLbi1.keyboardTracking = false;
	this.editLbi1.value = rotor.Lbi1;
	this.unitsLbi1 = new QLabel("mm");
	layoutGroup_Barrier2.addWidget(this.labelLbi1, 0, 0);
	layoutGroup_Barrier2.addWidget(this.editLbi1, 0, 1);
	layoutGroup_Barrier2.addWidget(this.unitsLbi1, 0, 2);
	
	this.labelLbi2 = new QLabel("Lower length (Lbi2):");
	this.labelLbi2.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editLbi2 = new QDoubleSpinBox;
	this.editLbi2.objectName = "Lbi2";
	this.editLbi2.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editLbi2.decimals = 1;
	this.editLbi2.singleStep = 0.1;
	this.editLbi2.keyboardTracking = false;
	this.editLbi2.value = rotor.Lbi2;
	this.unitsLbi2 = new QLabel("mm");
	layoutGroup_Barrier2.addWidget(this.labelLbi2, 1, 0);
	layoutGroup_Barrier2.addWidget(this.editLbi2, 1, 1);
	layoutGroup_Barrier2.addWidget(this.unitsLbi2, 1, 2);
	
	this.labelRfi1 = new QLabel("Upper fillet radius (Rfi1):");
	this.labelRfi1.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editRfi1 = new QDoubleSpinBox;
	this.editRfi1.objectName = "Rfi1";
	this.editRfi1.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editRfi1.decimals = 1;
	this.editRfi1.singleStep = 0.1;
	this.editRfi1.keyboardTracking = false;
	this.editRfi1.value = rotor.Rfi1;
	this.unitsRfi1 = new QLabel("mm");
	layoutGroup_Barrier2.addWidget(this.labelRfi1, 2, 0);
	layoutGroup_Barrier2.addWidget(this.editRfi1, 2, 1);
	layoutGroup_Barrier2.addWidget(this.unitsRfi1, 2, 2);
	
	this.labelRfi2 = new QLabel("Lower fillet radius (Rfi2):");
	this.labelRfi2.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editRfi2 = new QDoubleSpinBox;
	this.editRfi2.objectName = "Rfi2";
	this.editRfi2.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editRfi2.decimals = 1;
	this.editRfi2.singleStep = 0.1;
	this.editRfi2.keyboardTracking = false;
	this.editRfi2.value = rotor.Rfi2;
	this.unitsRfi2 = new QLabel("mm");
	layoutGroup_Barrier2.addWidget(this.labelRfi2, 3, 0);
	layoutGroup_Barrier2.addWidget(this.editRfi2, 3, 1);
	layoutGroup_Barrier2.addWidget(this.unitsRfi2, 3, 2);
	
	
	// create a group for groove widgets:
	this.groupGroove = new QGroupBox("Rotor surface groove"); 
	// Arranging group of widgets:
	var layoutGroup_Groove = new QGridLayout(this.groupGroove); 
	// Adding widgets to the group
	this.labelRg = new QLabel("Groove radius (Rg):");
	this.labelRg.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editRg = new QDoubleSpinBox;
	this.editRg.objectName = "Rg";
	this.editRg.setRange(0, motor.rotorOuterRadius);
	this.editRg.decimals = 1;
	this.editRg.singleStep = 0.1;
	this.editRg.keyboardTracking = false;
	this.editRg.value = rotor.Rg;
	this.unitsRg = new QLabel("mm");
	layoutGroup_Groove.addWidget(this.labelRg, 0, 0);
	layoutGroup_Groove.addWidget(this.editRg, 0, 1);
	layoutGroup_Groove.addWidget(this.unitsRg, 0, 2);
	
	this.labelDg = new QLabel("Groove depth (Dg):");
	this.labelDg.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editDg = new QDoubleSpinBox;
	this.editDg.objectName = "Dg";
	this.editDg.setRange(0, Math.abs(motor.rotorOuterRadius - motor.rotorInnerRadius));
	this.editDg.decimals = 1;
	this.editDg.singleStep = 0.1;
	this.editDg.keyboardTracking = false;
	this.editDg.value = rotor.Dg;
	this.unitsDg = new QLabel("mm");
	layoutGroup_Groove.addWidget(this.labelDg, 1, 0);
	layoutGroup_Groove.addWidget(this.editDg, 1, 1);
	layoutGroup_Groove.addWidget(this.unitsDg, 1, 2);
	
	this.labelAg = new QLabel("Groove angle (Ag):");
	this.labelAg.toolTip = "Use the ‘? Guide’ button above for explanation on this parameter";
	this.editAg = new QDoubleSpinBox;
	this.editAg.objectName = "Ag";
	this.editAg.setRange(0, 90/motor.rotorNumberPolePairs);
	this.editAg.decimals = 1;
	this.editAg.singleStep = 1;
	this.editAg.keyboardTracking = false;
	this.editAg.value = rotor.Ag;
	this.unitsAg = new QLabel("degrees");
	layoutGroup_Groove.addWidget(this.labelAg, 2, 0);
	layoutGroup_Groove.addWidget(this.editAg, 2, 1);
	layoutGroup_Groove.addWidget(this.unitsAg, 2, 2);
	
	
	this.layout = new QGridLayout(ui);
	this.layout.addWidget(this.groupMagnet, 0, 0, 1, 3);   // insert "Magnet" group into UI layout
	this.layout.addWidget(this.groupBarrier1, 1, 0, 1, 3); // insert "Outer flux barrier" group into UI layout
	this.layout.addWidget(this.groupBarrier2, 2, 0, 1, 3); // insert "Inner flux barrier" group into UI layout
	this.layout.addWidget(this.groupGroove, 3, 0, 1, 3);   // insert "Groove" group into UI layout
};

// update rotor widgets
RotorUI.prototype.updateUI = function()
{
	//console.log("rotorUI.updateUI");

}

// call this function from c++ code
createRotorUI = function(ui)
{
	rotorUI = new RotorUI(ui);
	rotorUI.updateUI();
}

	

	
	
	
