-
Notifications
You must be signed in to change notification settings - Fork 5
/
GUI_Syre.m
5904 lines (5008 loc) · 245 KB
/
GUI_Syre.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Copyright 2014
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
function varargout = GUI_Syre(varargin)
% GUI_SYRE MATLAB code for GUI_Syre.fig
% GUI_SYRE,by itself, creates a new GUI_SYRE or raises the existing
% singleton*.
%
% H = GUI_SYRE returns the handle to a new GUI_SYRE or the handle to
% the existing singleton*.
%
% GUI_SYRE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_SYRE.M with the given input arguments.
%
% GUI_SYRE('Property','Value',...) creates a new GUI_SYRE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_Syre_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_Syre_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help GUI_Syre
% Last Modified by GUIDE v2.5 25-Oct-2018 10:53:26
% Begin initialization code - DO NOT EDIT
% clc
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_Syre_OpeningFcn, ...
'gui_OutputFcn', @GUI_Syre_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before GUI_Syre is made visible.
function GUI_Syre_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to GUI_Syre (see VARARGIN)
addpath('./mfiles');
% Set figure position in the middle of the screen
set(hObject,'Units','pixel');
screenPos=get(groot,'ScreenSize');
figPos=get(hObject,'Position');
figPos(1:2)=screenPos(3:4)/2-figPos(3:4)/2;
set(hObject,'Position',figPos);
% Set the colors indicating a selected/unselected tab
handles.unselectedTabColor = 0.9*[1 1 1];
handles.selectedTabColor = [1 1 1];
% Choose default command line output for GUI_Syre
handles.output = hObject;
set(handles.GeometricTab,'BackgroundColor',handles.selectedTabColor);
set(handles.StatorTab,'BackgroundColor',handles.unselectedTabColor);
set(handles.MaterialsTab,'BackgroundColor',handles.unselectedTabColor);
set(handles.WindingsTab,'BackgroundColor',handles.unselectedTabColor);
set(handles.OptionsTab,'BackgroundColor',handles.unselectedTabColor);
set(handles.OptimizationTab,'BackgroundColor',handles.unselectedTabColor);
set(handles.PostProcTab,'BackgroundColor',handles.unselectedTabColor);
handles.pan1pos = get(handles.OptimizationPanel,'Position');
handles.left_right_corner = handles.pan1pos(2) + handles.pan1pos(4); % height
handles.pan2pos = get(handles.GeoPanel,'Position');
handles.pan3pos = get(handles.StatorPanel,'Position');
handles.pan4pos = get(handles.WindingsPanel,'Position');
handles.pan5pos = get(handles.OptionsPanel,'Position');
handles.pan6pos = get(handles.MaterialPanel,'Position');
handles.pan7pos = get(handles.PostProcePanel,'Position');
handles.pan8pos = get(handles.RotorGeometryPanel,'Position');
set(handles.GeoPanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan2pos(4)) handles.pan2pos(3) handles.pan2pos(4)])
set(handles.StatorPanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan3pos(4)) handles.pan3pos(3) handles.pan3pos(4)])
set(handles.WindingsPanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan4pos(4)) handles.pan4pos(3) handles.pan4pos(4)])
set(handles.OptionsPanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan5pos(4)) handles.pan5pos(3) handles.pan5pos(4)])
set(handles.MaterialPanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan6pos(4)) handles.pan6pos(3) handles.pan6pos(4)])
set(handles.PostProcePanel,'Position',[handles.pan1pos(1) (handles.left_right_corner-handles.pan7pos(4)) handles.pan7pos(3) handles.pan7pos(4)])
set(handles.RotorGeometryPanel,'Position',[(handles.pan1pos(1) + handles.pan3pos(3)) (handles.left_right_corner-handles.pan8pos(4)) handles.pan8pos(3) handles.pan8pos(4)])
set(handles.GeoPanel,'Visible','on')
set(handles.StatorPanel,'Visible','off')
set(handles.WindingsPanel,'Visible','off')
set(handles.OptionsPanel,'Visible','off')
set(handles.MaterialPanel,'Visible','off')
set(handles.OptimizationPanel,'Visible','off')
set(handles.PostProcePanel,'Visible','off')
set(handles.RotorGeometryPanel,'Visible','off') %rev.Gallo
%% === VISIBLE & ENABLE ===================================================
% set(handles.text22,'Visible','off');
% set(handles.PitchWindEdit,'Visible','off');
set(handles.AlphadegreeEdit,'Enable','off');
set(handles.hcmmEdit,'Enable','off');
set(handles.EstimatedCoppTemp,'Enable','off');
set(handles.CalculatedRatedCurrent,'Enable','off');
set(handles.Rsedit,'Enable','off');
set(handles.SlopeBarrier,'Enable','off');
set(handles.CurrentPP,'Enable','off');
set(handles.JouleLossesEdit,'Enable','off')
%% === FLAG VARI ==========================================================
handles.MatrixWinFlag = 1;
handles.UpdateData0 = 0;
handles.Opti = 0;
%% ========================================================================
% Update handles structure
% guidata(hObject, handles);
axes(handles.axes4);
SyreImg = imread('syre.png');
image(SyreImg);
axis off;
axes(handles.axes5);
set(handles.axes5,'YTickLabel',[]);
set(handles.axes5,'XTickLabel',[]);
box on;
load mot_01.mat
[dataSet,geo,per] = back_compatibility(dataSet,geo,per); % backward compatibility with previous version, to delete here
dataSet.currentpathname = [cd '\'];
dataSet.currentfilename = 'mot_01.mat';
%% ========================================================================
%% update new added parameters of ver. 259 & 260
% if ~isfield(dataSet,'TorqueOptCheck')
% dataSet.TorqueOptCheck = 0;
% dataSet.TorRipOptCheck = 0;
% end
%
% if ~isfield(dataSet,'LossEvaluationCheck')
% dataSet.LossEvaluationCheck = 0;
% dataSet.HysteresisLossFactor = 0;
% dataSet.HysteresisFrequencyFactor = 0;
% dataSet.HysteresisFluxDenFactor = 0;
% dataSet.EddyCurLossFactor = 0;
% dataSet.IronMassDen = 0;
% dataSet.EvalSpeed = 0;
% end
handles.dataSet = dataSet; % data structure
SetParameters(handles,dataSet) % aux. function for set the values in the edit boxes
handles = DrawPush_Callback(hObject, eventdata, handles);
%% ======= Matrix of winding visual =======================================
columnName = cell(1,floor(geo.Qs));
for i = 1 : floor(geo.Qs)
columnName{i} = ['Slot n° ',num2str(i)];
end
rowName{1} = 'Layer 1';
rowName{2} = 'Layer 2';
set(handles.WinTable,'rowname',rowName);
set(handles.WinTable,'columnname',columnName);
set(handles.WinTable,'data',dataSet.WinMatr(:,1:floor(geo.Qs)));
per.tempcuest = temp_est_simpleMod(geo,per);
dataSet.EstimatedCopperTemp = per.tempcuest;
set(handles.EstimatedCoppTemp,'String',num2str(per.tempcuest));
handles.dataSet = dataSet; % data structure
%% ========================================================================
guidata(hObject,handles);
% --- Outputs from this function are returned to the command line.
function varargout = GUI_Syre_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function PolePairsEdit_Callback(hObject, eventdata, handles)
% Number of pole pairs(geo.p)
% hObject handle to PolePairsEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of PolePairsEdit as text
% str2double(get(hObject,'String')) returns contents of PolePairsEdit as a double
dataSet = handles.dataSet;
dataSet.NumOfPolePairs = str2double(get(hObject,'String'));
p = dataSet.NumOfPolePairs;
Q = round(dataSet.NumOfSlots*6*p);
yq = dataSet.PitchShortFac*dataSet.NumOfSlots*3;
path = pwd;
cd(fullfile (path,'koil'));
system(['koil_syre.exe',' ',num2str(Q),' ',num2str(p),' ',num2str(yq)]);
cd(path);
Windings = MatrixWin();
%dataSet.WinMatr = Windings; % winding matrix
% t = gcd(round(dataSet.NumOfSlots*6*dataSet.NumOfPolePairs),dataSet.NumOfPolePairs); % periodicity
% if ((6*t/Q)>1)
% Qs = Q/t; % periodic machine
% else
% Qs = Q/2/t; % anti-periodic machine
% end
t2 = gcd(round(dataSet.NumOfSlots*6*dataSet.NumOfPolePairs),2*dataSet.NumOfPolePairs);
Qs = Q/t2;
set(handles.SlotSimulEdit,'String',int2str(Qs)); % set Qs in the GUI with the default value
dataSet.Qs = Qs;
dataSet.WinMatr = Windings(:,1:floor(Qs)); % winding matrix, only Qs columns
columnName = cell(1,floor(Qs));
for i = 1 : floor(Qs)
columnName{i} = ['Slot n° ',num2str(i)];
end
rowName{1} = 'Layer 1';
rowName{2} = 'Layer 2';
set(handles.WinTable,'rowname',rowName);
set(handles.WinTable,'columnname',columnName);
set(handles.WinTable,'data',dataSet.WinMatr(:,1:floor(Qs)));
dataSet.ToothLength = dataSet.StatorOuterRadius * (1-dataSet.AirGapRadius/dataSet.StatorOuterRadius*(1+dataSet.MagLoadingYoke/dataSet.NumOfPolePairs));
dataSet.ToothLength = round(dataSet.ToothLength*10000)/10000;
set(handles.ToothLengEdit,'String',mat2str(dataSet.ToothLength));
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function PolePairsEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to PolePairsEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% round to a set number of decimals cfr
function num = rrtd(num, cfr)
error(nargchk(2, 2, nargin, 'struct'))
validateattributes(num, {'single', 'double'}, {}, 'ROUNDN', 'NUM')
validateattributes(cfr, ...
{'numeric'}, {'scalar', 'real', 'integer'}, 'ROUNDN', 'CFR')
if cfr < 0
cc = 10 ^ -cfr;
num = round(cc * num) / cc;
elseif cfr > 0
cc = 10 ^ cfr;
num = cc * round(num / cc);
else
num = round(num);
end
%% AUX FUNCTIONS ==========================================================
%% SET PARAMETERS =========================================================
function SetParameters(handles,dataIn)
set(handles.PolePairsEdit,'String',num2str(dataIn.NumOfPolePairs));
set(handles.GapThiEdit,'String',num2str(dataIn.AirGapThickness));
set(handles.StatorOuterRadEdit,'String',num2str(dataIn.StatorOuterRadius));
set(handles.AirGapRadiusEdit,'String',num2str(dataIn.AirGapRadius));
set(handles.ShaftRadEdit,'String',num2str(dataIn.ShaftRadius));
set(handles.StackLenghtEdit,'String',num2str(dataIn.StackLength));
set(handles.NumOfSlotsEdit,'String',num2str(dataIn.NumOfSlots));
set(handles.ToothLengEdit,'String',num2str(dataIn.ToothLength));
set(handles.StatorSlotOpeEdit,'String',num2str(dataIn.StatorSlotOpen));
set(handles.ParallelSlotCheck,'Value',dataIn.ParallelSlotCheck);
set(handles.ToothWidthEdit,'String',num2str(dataIn.ToothWidth));
set(handles.ToothTanDepEdit,'String',num2str(dataIn.ToothTangDepth));
set(handles.ToothTangAngleEdit,'String',num2str(dataIn.ToothTangAngle));
set(handles.FillCorSlotEdit,'String',num2str(dataIn.FilletCorner));
set(handles.SlotMatEdit,'String',dataIn.SlotMaterial);
set(handles.StatorMatEdit,'String',dataIn.StatorMaterial);
set(handles.RotorMatEdit,'String',dataIn.RotorMaterial);
set(handles.FluxBarMatEdit,'String',dataIn.FluxBarrierMaterial);
set(handles.ShaftMatEdit,'String',dataIn.ShaftMaterial);
set(handles.SlotFillFacEdit,'String',num2str(dataIn.SlotFillFactor));
set(handles.PitchWindEdit,'String',num2str(dataIn.PitchShortFac));
set(handles.TurnsSeriesEdit,'String',num2str(dataIn.TurnsInSeries));
set(handles.JouleLossesEdit,'String',num2str(dataIn.AdmiJouleLosses));
set(handles.ThermalLoadKj,'String',num2str(dataIn.ThermalLoadKj));
set(handles.CopperTempEdit,'String',num2str(dataIn.TargetCopperTemp));
set(handles.HousingTempEdit,'String',num2str(dataIn.HousingTemp));
set(handles.EstimatedCoppTemp,'String',num2str(dataIn.EstimatedCopperTemp));
if strcmp(dataIn.FluxBarrierMaterial,'Bonded-Magnet')&&((strcmp(dataIn.TypeOfRotor,'Seg') || strcmp(dataIn.TypeOfRotor,'ISeg'))) %mod walter
set(handles.PMMaterial,'Enable','on');
set(handles.BrPMISegEdit,'Enable','on');
set(handles.BrPMISegEdit,'String',mat2str(dataIn.BrDesign));
set(handles.ObMag1Edit,'Enable','off');
set(handles.ObMag2Edit,'Enable','off');
set(handles.ObMag3Edit,'Enable','off');
set(handles.ObMag4Edit,'Enable','off');
set(handles.VertMag1Edit,'Enable','off');
set(handles.VertMag2Edit,'Enable','off');
set(handles.VertMag3Edit,'Enable','off');
set(handles.VertMag4Edit,'Enable','off');
set(handles.TotMag1Edit,'Enable','on');
set(handles.TotMag2Edit,'Enable','on');
set(handles.TotMag3Edit,'Enable','on');
set(handles.TotMag4Edit,'Enable','on');
elseif ~strcmp(dataIn.FluxBarrierMaterial,'Air')&&(strcmp(dataIn.TypeOfRotor,'Seg')||strcmp(dataIn.TypeOfRotor,'ISeg'))
set(handles.PMMaterial,'Enable','on');
set(handles.BrPMISegEdit,'Enable','off');
set(handles.BrPMISegEdit,'String',mat2str(dataIn.Br));
set(handles.ObMag1Edit,'Enable','on');
set(handles.ObMag2Edit,'Enable','on');
set(handles.ObMag3Edit,'Enable','on');
set(handles.ObMag4Edit,'Enable','on');
set(handles.VertMag1Edit,'Enable','on');
set(handles.VertMag2Edit,'Enable','on');
set(handles.VertMag3Edit,'Enable','on');
set(handles.VertMag4Edit,'Enable','on');
set(handles.TotMag1Edit,'Enable','off');
set(handles.TotMag2Edit,'Enable','off');
set(handles.TotMag3Edit,'Enable','off');
set(handles.TotMag4Edit,'Enable','off');
else
set(handles.PMMaterial,'Enable','off');
set(handles.BrPMISegEdit,'Enable','off');
set(handles.ObMag1Edit,'Enable','off');
set(handles.ObMag2Edit,'Enable','off');
set(handles.ObMag3Edit,'Enable','off');
set(handles.ObMag4Edit,'Enable','off');
set(handles.VertMag1Edit,'Enable','off');
set(handles.VertMag2Edit,'Enable','off');
set(handles.VertMag3Edit,'Enable','off');
set(handles.VertMag4Edit,'Enable','off');
set(handles.TotMag1Edit,'Enable','off');
set(handles.TotMag2Edit,'Enable','off');
set(handles.TotMag3Edit,'Enable','off');
set(handles.TotMag4Edit,'Enable','off');
set(handles.BrPMISegEdit,'String','0');
end
tmpO=dataIn.Areaob*dataIn.Br;
tmpV=dataIn.Areavert*dataIn.Br;
tmpT=dataIn.Areatot*dataIn.BrDesign;
set(handles.ObMag1Edit,'String',tmpO(1));
set(handles.ObMag2Edit,'String',tmpO(2));
set(handles.ObMag3Edit,'String',tmpO(3));
set(handles.ObMag4Edit,'String',tmpO(4));
set(handles.VertMag1Edit,'String',tmpV(1));
set(handles.VertMag2Edit,'String',tmpV(2));
set(handles.VertMag3Edit,'String',tmpV(3));
set(handles.VertMag4Edit,'String',tmpV(4));
set(handles.TotMag1Edit,'String',tmpT(1));
set(handles.TotMag2Edit,'String',tmpT(2));
set(handles.TotMag3Edit,'String',tmpT(3));
set(handles.TotMag4Edit,'String',tmpT(4));
% set(handles.DCLinkVolEdit,'String',num2str(dataIn.DCVoltage));
set(handles.CurrentOverLoadEdit,'String',num2str(dataIn.CurrOverLoad));
set(handles.NumberOfLayersEdit,'String',num2str(dataIn.NumOfLayers));
set(handles.OverSpeedEdit,'String',num2str(dataIn.OverSpeed));
set(handles.BrPMEdit,'String',mat2str(dataIn.BrDesign));
if strcmp(dataIn.FluxBarrierMaterial,'Bonded-Magnet')
set(handles.BrPMEdit,'Enable','on');
else
set(handles.BrPMEdit,'Enable','off');
end
set(handles.BrPPEdit,'String',mat2str(dataIn.BrPP));
set(handles.TempPPEdit,'String',num2str(dataIn.tempPP));
mat=material_properties_layer(0);
ind=1;
for ii=1:numel(mat.MatList)
if ~(strcmp(mat.MatList{ii},'Air')||strcmp(mat.MatList{ii},'Bonded-Magnet')||strcmp(mat.MatList{ii},'Virgin Bonded-Magnet 04T'))
material{ind}=mat.MatList{ii};
ind=ind+1;
end
end
material=reshape(material,ind-1,1);
set(handles.PMMaterial,'String',material);
set(handles.SlotSimulEdit,'String',num2str(dataIn.Qs));
set(handles.BetaEdit,'String',mat2str(dataIn.BarFillFac));
set(handles.MaxGenEdit,'String',num2str(dataIn.MaxGen));
set(handles.XPopEdit,'String',num2str(dataIn.XPop));
set(handles.MinExpTorEdit,'String',num2str(dataIn.MinExpTorque));
set(handles.NGridPPEdit,'String',num2str(dataIn.NumGrid));
set(handles.MaxExpeRippleTorEdit,'String',num2str(dataIn.MaxRippleTorque));
set(handles.MecTolerEdit,'String',num2str(dataIn.MinMechTol));
set(handles.SimPosMOEdit,'String',num2str(dataIn.SimPoMOOA));
set(handles.RotorPosiMOEdit,'String',num2str(dataIn.RotPoMOOA));
set(handles.SimPosFinerEdit,'String',num2str(dataIn.SimPoFine));
set(handles.RotorPosFinerEdit,'String',num2str(dataIn.RotPoFine));
set(handles.MeshEdit,'String',num2str(dataIn.Mesh));
set(handles.MeshMOOAEdit,'String',num2str(dataIn.Mesh_MOOA));
set(handles.NumOfRotorPosiPPEdit,'String',num2str(dataIn.NumOfRotPosPP));
set(handles.SpanEltPPEdit,'String',num2str(dataIn.AngularSpanPP));
set(handles.Alpha1BouEdit,'String',mat2str(dataIn.Alpha1Bou));
set(handles.DeltaAlphaBouEdit,'String',mat2str(dataIn.DeltaAlphaBou));
set(handles.hcBouEdit,'String',mat2str(dataIn.hcBou));
set(handles.DfeBouEdit,'String',mat2str(dataIn.DfeBou));
set(handles.PhaseAngleCurrBouEdit,'String',mat2str(dataIn.PhaseAngleCurrBou));
set(handles.GapBouEdit,'String',mat2str(dataIn.GapBou));
set(handles.BrBouEdit,'String',mat2str(dataIn.BrBou));
set(handles.AirgapRadiusBouEdit,'String',mat2str(dataIn.GapRadiusBou));
set(handles.ToothWidthBouEdit,'String',mat2str(dataIn.ToothWiBou));
set(handles.ToothLenBouEdit,'String',mat2str(dataIn.ToothLeBou));
set(handles.StatorSlotOpenBouEdit,'String',mat2str(dataIn.StatorSlotOpenBou));
set(handles.ToothTangDepthBouEdit,'String',mat2str(dataIn.ToothTangDepthBou));
set(handles.LossEvaluationCheck,'Value',dataIn.LossEvaluationCheck);
set(handles.RadRibSplitCheck,'Value',dataIn.RadRibSplit);
if strcmp(dataIn.TypeOfRotor,'Seg')
set(handles.RadRibSplitCheck,'Enable','on');
else
set(handles.RadRibSplitCheck,'Enable','off');
end
% FBS
if (strcmp(dataIn.TypeOfRotor,'Circular')||strcmp(dataIn.TypeOfRotor,'Seg'))
set(handles.ThetaFBSEdit,'Enable','on')
set(handles.ThetaFBSBouEdit,'Enable','on')
set(handles.ThetaFBSBouCheck,'Enable','on')
else
set(handles.ThetaFBSEdit,'Enable','off')
set(handles.ThetaFBSBouEdit,'Enable','off')
set(handles.ThetaFBSBouCheck,'Enable','off')
end
set(handles.ThetaFBSEdit,'String',num2str(dataIn.thetaFBS));
set(handles.ThetaFBSBouEdit,'String',mat2str(dataIn.ThetaFBSBou));
if dataIn.LossEvaluationCheck == 0
set(handles.HysteresisLossFactorEdit,'Enable','off');
set(handles.HysteresisFrequencyFactorEdit,'Enable','off');
set(handles.HysteresisFluxDenEdit,'Enable','off');
set(handles.EddyCurLossFactorEdit,'Enable','off');
set(handles.MassDensityEdit,'Enable','off');
set(handles.EvaluatedSpeedEdit,'Enable','on');
dataIn.HysteresisLossFactor = 0;
dataIn.HysteresisFrequencyFactor = 0;
dataIn.HysteresisFluxDenFactor = 0;
dataIn.EddyCurLossFactor = 0;
set(handles.HysteresisLossFactorEdit,'String',mat2str(dataIn.HysteresisLossFactor));
set(handles.HysteresisFrequencyFactorEdit,'String',mat2str(dataIn.HysteresisFrequencyFactor));
set(handles.HysteresisFluxDenEdit,'String',mat2str(dataIn.HysteresisFluxDenFactor));
set(handles.EddyCurLossFactorEdit,'String',mat2str(dataIn.EddyCurLossFactor));
set(handles.MassDensityEdit,'String',mat2str(0));
set(handles.EvaluatedSpeedEdit,'String',mat2str(dataIn.EvalSpeed));
else
set(handles.HysteresisLossFactorEdit,'Enable','on');
set(handles.HysteresisFrequencyFactorEdit,'Enable','on');
set(handles.HysteresisFluxDenEdit,'Enable','on');
set(handles.EddyCurLossFactorEdit,'Enable','on');
set(handles.MassDensityEdit,'Enable','on');
set(handles.EvaluatedSpeedEdit,'Enable','on');
set(handles.HysteresisLossFactorEdit,'String',mat2str(dataIn.HysteresisLossFactor));
set(handles.HysteresisFrequencyFactorEdit,'String',mat2str(dataIn.HysteresisFrequencyFactor));
set(handles.HysteresisFluxDenEdit,'String',mat2str(dataIn.HysteresisFluxDenFactor));
set(handles.EddyCurLossFactorEdit,'String',mat2str(dataIn.EddyCurLossFactor));
set(handles.MassDensityEdit,'String',mat2str(dataIn.IronMassDen));
set(handles.EvaluatedSpeedEdit,'String',mat2str(dataIn.EvalSpeed));
end
set(handles.bRangeEdit,'String',mat2str(dataIn.bRange));
set(handles.xRangeEdit,'String',mat2str(dataIn.xRange));
set(handles.BfeEdit,'String',num2str(dataIn.Bfe));
set(handles.ktEdit,'String',num2str(dataIn.kt));
switch dataIn.FEAfixN
case 1
set(handles.FEAfixPopUp,'Value',1);
case 4
set(handles.FEAfixPopUp,'Value',2);
case 5
set(handles.FEAfixPopUp,'Value',3);
case 1000
set(handles.FEAfixPopUp,'Value',4);
end
% if (strcmp(dataIn.TypeOfRotor,'Circular')||strcmp(dataIn.TypeOfRotor,'Seg')||strcmp(dataIn.TypeOfRotor,'ISeg'))
% set(handles.FEAfixPopUp,'Enable','on');
% set(handles.FEAfixPushButt,'Enable','on');
% else
% set(handles.FEAfixPopUp,'Enable','on');
% set(handles.FEAfixPushButt,'Enable','on');
% end
set(handles.CurrLoXBEdit,'String',num2str(dataIn.CurrLoPP));
set(handles.CurrLoPPEdit,'String',mat2str(dataIn.CurrLoPP));
set(handles.GammaPPEdit,'String',mat2str(dataIn.GammaPP));
set(handles.DxEdit,'String',mat2str(dataIn.DepthOfBarrier));
set(handles.AlphapuEdit,'String',mat2str(dataIn.ALPHApu));
set(handles.hcpuEdit,'String',mat2str(dataIn.HCpu));
set(handles.currentMotFileName,'String',dataIn.currentfilename);
set(handles.MassCuEdit,'String',dataIn.MaxCuMass);
set(handles.MassCuOptCheck,'Value',dataIn.MassCuOptCheck);
if dataIn.NumOfSlots<1
set(handles.SlotLayerPosCheck,'Enable','on');
else
set(handles.SlotLayerPosCheck,'Enable','off');
end
set(handles.TanRibEdit,'String',mat2str(dataIn.TanRibEdit));
set(handles.RadRibEdit,'String',mat2str(dataIn.RadRibEdit));
set(handles.SlotLayerPosCheck,'Value',dataIn.SlotLayerPosCheck);
if dataIn.RadRibCheck == 1
set(handles.RadRibEdit,'Enable','on');
else
set(handles.RadRibEdit,'Enable','off');
end
set(handles.RadRibCheck,'Value',dataIn.RadRibCheck);
%% CHECK BOU ==============================================================
set(handles.Dalpha1BouCheck,'Value',dataIn.Dalpha1BouCheck);
set(handles.DalphaBouCheck,'Value',dataIn.DalphaBouCheck);
set(handles.hcBouCheck,'Value',dataIn.hcBouCheck);
set(handles.DxBouCheck,'Value',dataIn.DxBouCheck);
set(handles.GammaBouCheck,'Value',dataIn.GammaBouCheck);
set(handles.GapBouCheck,'Value',dataIn.GapBouCheck);
set(handles.BrBouCheck,'Value',dataIn.BrBouCheck);
set(handles.AirgapRadiusBouCheck,'Value',dataIn.AirgapRadiusBouCheck);
set(handles.ToothWidthBouCheck,'Value',dataIn.ToothWidthBouCheck);
set(handles.ToothLengthBouCheck,'Value',dataIn.ToothLengthBouCheck);
set(handles.StatorSlotOpenBouCheck,'Value',dataIn.StatorSlotOpenBouCheck);
set(handles.ToothTangDepthBouCheck,'Value',dataIn.ToothTangDepthBouCheck);
%set(handles.SlopeBarrBouCheck,'Value',dataIn.SlopeBarrBouCheck); %rev.Gallo
set(handles.ThetaFBSBouCheck,'Value',dataIn.ThetaFBSBouCheck);
%% ========================================================================
%% CHECK OBJ ==============================================================
set(handles.TorqueOptCheck,'Value',dataIn.TorqueOptCheck);
set(handles.TorRipOptCheck,'Value',dataIn.TorRipOptCheck);
if isfield(dataIn,'MassCuOptCheck') % da eliminare con compatibilità
set(handles.MassCuOptCheck,'Value',dataIn.MassCuOptCheck);
else
set(handles.MassCuOptCheck,'Value',0);
end
set(handles.MassPMOptCheck,'Value',dataIn.MassPMOptCheck);
%% ========================================================================
if strcmp(dataIn.RMVTmp,'OFF')
set(handles.RemTMPRadio,'Value',0);
else
set(handles.RemTMPRadio,'Value',1);
end
if strcmp(dataIn.XFEMMOpt,'N')
set(handles.XFEMMOptRadio,'Value',0);
else
set(handles.XFEMMOptRadio,'Value',1);
end
% Listbox materiali
contents = get(handles.TypeOfRotorList,'String');
N = length(contents);
idx = 1;
for k = 1 : N
if strcmp(dataIn.TypeOfRotor,contents{k})
idx = k;
break;
end
end
set(handles.TypeOfRotorList,'Value',idx);
if strcmp(dataIn.TypeOfRotor,'SPM')
[~, ~, ~, ~, mat] = data0(dataIn);
dataIn.Br = mat.LayerMag.Br;
set(handles.BrPMEdit,'String',num2str(dataIn.Br));
set(handles.BrPPEdit,'String',num2str(dataIn.Br));
dataIn.BrPP = dataIn.Br;
set(handles.BrPMEdit,'Enable','off');
%% limit b range by 3<lm/g<8
% dataIn.bRange(1)=3;
% dataIn.bRange(2)=8;
dataIn.bRange = round(dataIn.bRange*100)/100;
set(handles.bRangeEdit,'String',mat2str(dataIn.bRange));
end
handles.dataSet = dataIn;
%% === SPM ===================================================
if strcmp(dataIn.TypeOfRotor,'SPM')
set(handles.AlphadegreeEdit,'Enable','on');
set(handles.hcmmEdit,'Enable','on');
set(handles.hcpuEdit,'String',mat2str(0));
set(handles.hcpuEdit,'Enable','off');
set(handles.AlphapuEdit,'String',mat2str(0));
set(handles.AlphapuEdit,'Enable','off');
set(handles.DxEdit,'String',mat2str(dataIn.DepthOfBarrier));
set(handles.DxEdit,'Enable','on');
set(handles.NumberOfLayersEdit,'String',mat2str(dataIn.AngleSpanOfPM));
set(handles.NumberOfLayersEdit,'Enable','off');
set(handles.AlphadegreeEdit,'String',mat2str(dataIn.AngleSpanOfPM));
set(handles.hcmmEdit,'String',mat2str(dataIn.ThicknessOfPM));
set(handles.Alpha1BouEdit,'Enable','off');
set(handles.Dalpha1BouCheck,'Enable','off','Value',0);
set(handles.DeltaAlphaBouEdit,'Enable','off');
set(handles.DalphaBouCheck,'Enable','off','Value',0);
set(handles.DfeBouEdit,'Enable','off');
set(handles.DxBouCheck,'Enable','off','Value',0);
set(handles.RadRibCheck,'Enable','off');
set(handles.RadRibCheck,'Value',0);
set(handles.RadRibEdit,'Enable','off');
else
set(handles.AlphadegreeEdit,'Enable','off');
set(handles.AlphapuEdit,'Enable','on');
set(handles.hcmmEdit,'Enable','off');
set(handles.hcpuEdit,'Enable','on');
if strcmp(dataIn.TypeOfRotor,'ISeg')
set(handles.DxEdit,'Enable','off');
set(handles.DxBouCheck,'Enable','off');
set(handles.DxBouCheck,'Value',0);
set(handles.DfeBouEdit,'Enable','off');
else
set(handles.DxEdit,'Enable','on');
set(handles.DxBouCheck,'Enable','on');
set(handles.DxBouCheck,'Value',dataIn.DxBouCheck);
set(handles.DfeBouEdit,'Enable','on');
end
% set(handles.NumberOfLayersEdit,'Enable','on'); %rev.Gallo
if dataIn.Dalpha1BouCheck
set(handles.Alpha1BouEdit,'Enable','on');
end
set(handles.Alpha1BouEdit,'Enable','on');
set(handles.Dalpha1BouCheck,'Enable','on','Value',dataIn.Dalpha1BouCheck);
set(handles.DeltaAlphaBouEdit,'Enable','on');
set(handles.DalphaBouCheck,'Enable','on','Value',dataIn.DalphaBouCheck);
set(handles.RadRibCheck,'Enable','on');
set(handles.RadRibCheck,'Value',dataIn.RadRibCheck);
if dataIn.RadRibCheck
set(handles.RadRibEdit,'Enable','on');
else
set(handles.RadRibEdit,'Enable','off');
end
set(handles.Num3PhaseCircuitEdit,'String',num2str(dataIn.Num3PhaseCircuit)); %AS
end
%Set Parameters Vtype rotor geometry into the GUI - rev.Gallo
if strcmp(dataIn.TypeOfRotor,'Vtype')
set(handles.SlopeBarrier,'Enable','on');
set(handles.SlopeBarrier,'String',num2str(dataIn.SlopeBarrier));
set(handles.SlopeBarrBouEdit,'String',mat2str(dataIn.SlopeBarrBou));
set(handles.SlopeBarrBouEdit,'Enable','on');
set(handles.SlopeBarrBouCheck,'Enable','on','Value',dataIn.SlopeBarrBouCheck);
set(handles.syrmDesignPushButt,'Enable','on');
else
set(handles.SlopeBarrier,'Enable','off');
dataIn.SlopeBarrier=0; %posso solo disabilitarlo e porlo uguale a zero quando non sono nel caso Vtype
%(lo pongo uguale a zero qui perchè per le altre macchine il parametro
%slope barrier NON ESISTE E NON E' SETTATO A NULLA,per cui lo imposto
%qui nel settaggio inziale di default dei parametri
set(handles.SlopeBarrier,'String',num2str(dataIn.SlopeBarrier));
set(handles.SlopeBarrBouEdit,'String',mat2str(dataIn.SlopeBarrBou));
set(handles.SlopeBarrBouEdit,'Enable','off');
set(handles.SlopeBarrBouCheck,'Enable','off','Value',dataIn.SlopeBarrBouCheck);
set(handles.syrmDesignPushButt,'Enable','on');
% set(handles.MassPMEdit,'String',num2str(dataIn.MaxPMMass));
% set(handles.MassPMOptCheck,'Enable','on','Value',dataIn.MassPMOptCheck);
end
set(handles.MassPMEdit,'String',num2str(dataIn.MaxPMMass));
% if dataIn.BarFillFac ==0
% set(handles.MassPMOptCheck,'Enable','off','Value',dataIn.MassPMOptCheck);
% set(handles.MassPMEdit,'Enable','off');
% else
set(handles.MassPMOptCheck,'Enable','on','Value',dataIn.MassPMOptCheck);
set(handles.MassPMEdit,'Enable','on');
% end
function GapThiEdit_Callback(hObject, eventdata, handles)
% Airgap Thickness[mm](geo.g)
% hObject handle to GapThiEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of GapThiEdit as text
% str2double(get(hObject,'String')) returns contents of GapThiEdit as a double
dataSet = handles.dataSet;
dataSet.AirGapThickness = str2double(get(hObject,'String'));
if strcmp(dataSet.TypeOfRotor,'SPM')
% dataSet.bRange(1)=3;
% dataSet.bRange(2)=8;
dataSet.bRange = round(dataSet.bRange*100)/100;
set(handles.bRangeEdit,'String',mat2str(dataSet.bRange));
end
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function GapThiEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to GapThiEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function StatorOuterRadEdit_Callback(hObject, eventdata, handles)
% Stator outer radius[mm](geo.R)
% hObject handle to StatorOuterRadEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of StatorOuterRadEdit as text
% str2double(get(hObject,'String')) returns contents of StatorOuterRadEdit as a double
dataSet = handles.dataSet;
dataSet.StatorOuterRadius = str2double(get(hObject,'String'));
dataSet.ToothLength = dataSet.StatorOuterRadius * (1-dataSet.AirGapRadius/dataSet.StatorOuterRadius*(1+dataSet.MagLoadingYoke/dataSet.NumOfPolePairs));
dataSet.ToothLength = round(dataSet.ToothLength*10000)/10000;
set(handles.ToothLengEdit,'String',mat2str(dataSet.ToothLength));
set(handles.ToothLenBouEdit,'String',mat2str(dataSet.ToothLeBou));
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function StatorOuterRadEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to StatorOuterRadEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function AirGapRadiusEdit_Callback(hObject, eventdata, handles)
% Airgap Radius [mm](geo.r)
% hObject handle to AirGapRadiusEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AirGapRadiusEdit as text
% str2double(get(hObject,'String')) returns contents of AirGapRadiusEdit as a double
dataSet = handles.dataSet;
dataSet.AirGapRadius = str2double(get(hObject,'String'));
dataSet.ToothLength = dataSet.StatorOuterRadius * (1-dataSet.AirGapRadius/dataSet.StatorOuterRadius*(1+dataSet.MagLoadingYoke/dataSet.NumOfPolePairs));
dataSet.ToothLength = round(dataSet.ToothLength*10000)/10000;
set(handles.ToothLengEdit,'String',mat2str(dataSet.ToothLength));
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function AirGapRadiusEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to AirGapRadiusEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function ShaftRadEdit_Callback(hObject, eventdata, handles)
% Shaft radius [mm] (geo.Ar)
% hObject handle to ShaftRadEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of ShaftRadEdit as text
% str2double(get(hObject,'String')) returns contents of ShaftRadEdit as a double
dataSet = handles.dataSet;
dataSet.ShaftRadius = str2double(get(hObject,'String'));
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function ShaftRadEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to ShaftRadEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function StackLenghtEdit_Callback(hObject, eventdata, handles)
% Stack length [mm] (geo.l)
% hObject handle to StackLenghtEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of StackLenghtEdit as text
% str2double(get(hObject,'String')) returns contents of StackLenghtEdit as a double
dataSet = handles.dataSet;
dataSet.StackLength = str2double(get(hObject,'String'));
handles.dataSet = dataSet;
handles = DrawPush_Callback(hObject, eventdata, handles);
guidata(hObject,handles)
% --- Executes during object creation, after setting all properties.
function StackLenghtEdit_CreateFcn(hObject, eventdata, handles)
% hObject handle to StackLenghtEdit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in .
function TypeOfRotorList_Callback(hObject, eventdata, handles)
% Type of rotor (geo.RotType)
% hObject handle to TypeOfRotorList (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns TypeOfRotorList contents as cell array
% contents{get(hObject,'Value')} returns selected item from TypeOfRotorList
contents = get(hObject,'String');
s = contents{get(hObject,'Value')};
dataSet = handles.dataSet;
dataSet.TypeOfRotor = s;
if strcmp(dataSet.TypeOfRotor,'Seg') || strcmp(dataSet.TypeOfRotor,'ISeg')
dataSet.Areavert=zeros(1,4);
dataSet.Areaob=zeros(1,4);
dataSet.Areavert0 =zeros(1,4);
dataSet.Areaob0 =zeros(1,4);
dataSet.Areatot =zeros(1,4);
dataSet.dob =ones(1,4);
dataSet.dvert =ones(1,4);
dataSet.BarFillFac =1;
set(handles.BetaEdit,'Enable','off');
set(handles.BrPMEdit,'Enable','on');
set(handles.BetaEdit,'String',dataSet.BarFillFac);
set(handles.SlopeBarrier,'Enable','off'); %rev.Gallo
else
set(handles.PMMaterial,'Enable','off');
set(handles.BrPMISegEdit,'Enable','off');
set(handles.BetaEdit,'Enable','on');
set(handles.BrPMEdit,'Enable','on');
set(handles.BrPMISegEdit,'String',mat2str(dataSet.Br));
set(handles.BrPMEdit,'String',mat2str(dataSet.Br));
set(handles.SlopeBarrier,'Enable','off'); %rev.Gallo
end
if strcmp(dataSet.TypeOfRotor,'Seg')
set(handles.RadRibSplitCheck,'Enable','on');
else
set(handles.RadRibSplitCheck,'Enable','off');
end
% if (strcmp(dataSet.TypeOfRotor,'Circular')||strcmp(dataSet.TypeOfRotor,'Seg')||strcmp(dataSet.TypeOfRotor,'ISeg'))
% set(handles.FEAfixPopUp,'Enable','on');
% else
% set(handles.FEAfixPopUp,'Enable','off');
% end
%FBS
if (strcmp(dataSet.TypeOfRotor,'Circular')||strcmp(dataSet.TypeOfRotor,'Seg'))
set(handles.ThetaFBSEdit,'Enable','on')
set(handles.ThetaFBSBouEdit,'Enable','on')
set(handles.ThetaFBSBouCheck,'Enable','on')
else
dataSet.thetaFBS=0;
dataSet.ThetaFBSBouCheck=0;
set(handles.ThetaFBSEdit,'Enable','off')
set(handles.ThetaFBSBouEdit,'Enable','off')
set(handles.ThetaFBSBouCheck,'Enable','off')
end
%Set initial value Vtype parameters - rev.Gallo
if strcmp(dataSet.TypeOfRotor,'Vtype')
if dataSet.NumOfLayers~=1
dataSet.NumOfLayers = 1;
dataSet.ALPHApu = 0.67;
dataSet.HCpu = 0.2;
dataSet.DepthOfBarrier = 0;
dataSet.SlopeBarrier = 60;
dataSet.RadRibEdit = 0;
dataSet.RadRibCheck = 0;
dataSet.RadRibSplit = 0;
end
dataSet.BarFillFac = 1;
set(handles.SlopeBarrBouEdit,'Enable','on');
set(handles.SlopeBarrBouCheck,'Enable','on');
dataSet.SlopeBarrBou=[10 90];
dataSet.SlopeBarrBouCheck=0;
set(handles.SlopeBarrBouCheck,'Value',dataSet.SlopeBarrBouCheck);
set(handles.SlopeBarrBouEdit,'String',mat2str(dataSet.SlopeBarrBou));
set(handles.SlopeBarrier,'Enable','on');
set(handles.SlopeBarrier,'String',num2str(dataSet.SlopeBarrier));
%dataSet.FluxBarrierMaterial = 'BMN-38EH'; %imposto materiale magnete commerciale
%set(handles.FluxBarMatEdit,'String',dataSet.FluxBarrierMaterial);
else
set(handles.SlopeBarrier,'String',num2str(dataSet.SlopeBarrier));
set(handles.SlopeBarrBouEdit,'String',mat2str(dataSet.SlopeBarrBou));
set(handles.SlopeBarrBouEdit,'Enable','off');
set(handles.SlopeBarrBouCheck,'Enable','off','Value',dataSet.SlopeBarrBouCheck);
end
if (strcmp(dataSet.TypeOfRotor,'Fluid') || strcmp(dataSet.TypeOfRotor,'Seg') || strcmp(dataSet.TypeOfRotor,'Circular'))
dataSet.DxBouCheck = 0;
set(handles.DxBouCheck,'Value',dataSet.DxBouCheck);
set(handles.DxEdit,'Enable','on');
set(handles.DfeBouEdit,'Enable','on');
else
dataSet.DxBouCheck = 0;
set(handles.DxBouCheck,'Value',dataSet.DxBouCheck);
set(handles.DxEdit,'Enable','off');
set(handles.DfeBouEdit,'Enable','off');
end
if strcmp(dataSet.TypeOfRotor,'SPM')
dataSet.DepthOfBarrier = 1;
dataSet.Dalpha1BouCheck =0;
dataSet.DalphaBouCheck = 0;
dataSet.DxBouCheck = 0;
dataSet.BarFillFac = 1;
dataSet.FluxBarrierMaterial = 'BMN-38EH';
[~,~,~,~,mat] = data0(dataSet);
dataSet.Br = mat.LayerMag.Br;
dataSet.BrPP = dataSet.Br;
set(handles.FluxBarMatEdit,'String',dataSet.FluxBarrierMaterial);
set(handles.BrPMEdit,'String',num2str(dataSet.Br));
set(handles.BrPPEdit,'String',num2str(dataSet.BrPP));
dataSet.bRange = [4 6];
dataSet.bRange = round(dataSet.bRange*100)/100;
set(handles.bRangeEdit,'String',mat2str(dataSet.bRange));
else
set(handles.hcpuEdit,'String',mat2str(dataSet.HCpu));
set(handles.AlphapuEdit,'Enable','on');
set(handles.AlphapuEdit,'String',mat2str(dataSet.ALPHApu));
set(handles.NumberOfLayersEdit,'Enable','on');
set(handles.NumberOfLayersEdit,'String',mat2str(dataSet.NumOfLayers));
if strcmp(dataSet.TypeOfRotor,'Vtype') %rev.Gallo
set(handles.NumberOfLayersEdit,'Enable','off');
dataSet.FluxBarrierMaterial = 'BMN-38EH'; %imposto materiale magnete commerciale caso Vtype
else
dataSet.FluxBarrierMaterial = 'Air';
end
set(handles.Alpha1BouEdit,'Enable','on');
set(handles.DeltaAlphaBouEdit,'Enable','on');
if (strcmp(dataSet.TypeOfRotor,'Fluid') || strcmp(dataSet.TypeOfRotor,'Seg') || strcmp(dataSet.TypeOfRotor,'Circular'))
if not(length(dataSet.DepthOfBarrier) == dataSet.NumOfLayers)
dataSet.DepthOfBarrier = zeros(1,dataSet.NumOfLayers);
end
set(handles.DxEdit,'String',mat2str(dataSet.DepthOfBarrier));
end
% dataSet.FluxBarrierMaterial = 'Air'; %rev.Gallo
[bounds, ~, geo, ~, mat] = data0(dataSet);
data = buildDefaultRQ(bounds);
dataSet.RQ = data;
dataSet.Br = mat.LayerMag.Br;
dataSet.BrPP = dataSet.Br;
set(handles.FluxBarMatEdit,'String',dataSet.FluxBarrierMaterial);
set(handles.BrPMEdit,'String',num2str(dataSet.Br));
set(handles.BrPPEdit,'String',num2str(dataSet.BrPP));
if max(dataSet.bRange)>1
dataSet.bRange = [0.4 0.6];
end
[truefalse, index] = ismember('dx', geo.RQnames);
if truefalse
dataSet.DfeBou = bounds(index,:); % barrier offset [p.u.]
end
flag_plot = 'Y';
h = handles.axes5;
[hc,dalpha,~] = Plot_Machine(h,dataSet,flag_plot);
view = round(100*[dalpha hc])/100;