-
Notifications
You must be signed in to change notification settings - Fork 10
/
FESTIV_GUI.m
3936 lines (3712 loc) · 222 KB
/
FESTIV_GUI.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
function FESTIV_GUI
% This function creates the FESTIV user interface.
%% Create main figure
mainFigure=figure('Visible','off','name','FESTIV','NumberTitle','off','units','pixels','position',[50 50 730 670],'menubar','none','color',[.9412 .9412 .9412]);
movegui(mainFigure,'center');
% create header
uicontrol('parent',mainFigure,'style','text','fontname','courier','string','Flexible Energy Scheduling Tool for Integrating Variable generation','units','normalized','position',[.02 .93 .96 .05],'fontunits','normalized','fontsize',0.45,'BackgroundColor',get(mainFigure,'color'));
uicontrol('parent',mainFigure,'style','text','fontname','courier','string','FESTIV','units','normalized','position',[.02 .83 .96 .12],'fontunits','normalized','fontsize',0.99,'BackgroundColor',get(mainFigure,'color'));
% create input file request
uicontrol('parent',mainFigure,'style','text','string','Input File:','units','normalized','position',[.02 .73 .1 .07],'fontunits','normalized','fontsize',0.3);
inputFileEditBox=uicontrol('parent',mainFigure,'style','edit','units','normalized','position',[.12 .76 .64 .05],'fontunits','normalized','fontsize',0.4,'backgroundcolor','white','horizontalalignment','left');
uicontrol('parent',mainFigure,'style','pushbutton','TooltipString', [' Select the appropriate input file from the list of files'],'units','normalized','position',[.77 .76 .13 .05],'string','Browse','fontunits','normalized','fontsize',0.5,'callback',{@browseforfile});
autosavecheck_in=uicontrol('parent',mainFigure,'style','checkbox','unit','normalized','position',[.91 .735 .1 .1],'string','<html>auto<br>save</html>','callback',{@autosavecallback});
% create DASCUC information request
uipanel('parent',mainFigure,'Title','DASCUC','units','normalized','Position', [.03 .24 .30 .5],'fontunits','normalized','fontsize',0.040,'BackgroundColor',get(mainFigure,'color'));
uicontrol('style','text','string','t_DAC:','TooltipString', ['(hrs) Time between DASCUC updates'],'units','normalized','position',[.04 .65 .08 .05],'fontunits','normalized','fontsize',0.35,'horizontalalignment','left');
uicontrol('style','text','string','H_DAC:','TooltipString', ['(count) DASCUC Scheduling Horizon'],'units','normalized','position',[.04 .59 .08 .05],'fontunits','normalized','fontsize',0.35,'horizontalalignment','left');
uicontrol('style','text','string','I_DAC:','TooltipString', ['(hrs) DASCUC Interval length'],'units','normalized','position',[.18 .65 .08 .05],'fontunits','normalized','fontsize',0.35,'horizontalalignment','left');
uicontrol('style','text','string','P_DAC:','TooltipString', ['(hrs) Model processing time'],'units','normalized','position',[.18 .59 .08 .05],'fontunits','normalized','fontsize',0.35,'horizontalalignment','left');
uicontrol('style','text','string','G_DAC:','TooltipString', ['(ClockTime Hour) Market Gate for DASCUC'],'units','normalized','position',[.1 .53 .08 .05],'fontunits','normalized','fontsize',0.35,'horizontalalignment','left');
tDAC_in_edit=uicontrol('style','edit','string','24','units','normalized','position',[.115 .673 .05 .03],'backgroundcolor','white');
HDAC_in_edit=uicontrol('style','edit','string','24','units','normalized','position',[.115 .613 .05 .03],'backgroundcolor','white');
IDAC_in_edit=uicontrol('style','edit','string','1','units','normalized','position',[.25 .673 .05 .03],'backgroundcolor','white');
PDAC_in_edit=uicontrol('style','edit','string','1','units','normalized','position',[.25 .613 .05 .03],'backgroundcolor','white');
GDAC_in_edit=uicontrol('style','edit','string','12','units','normalized','position',[.18 .553 .05 .03],'backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Load Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create Load Forecasts that are equal to the average Actual Load,' char(10) 'based on averaging over the interval resolution, I.' char(10) '3-Persistance Forecast: This will create Load Forecasts that are equal to the load before the sub model' char(10) 'would start (i.e., time – P). Note that this method will not work for DASCUC Load' char(10) 'Forecasts, as persistence forecasts would not be plausible.' char(10) '4-Predefined with NDE: This will create Load Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average Load for each interval in the sub-model'],'units','normalized','position',[.11 .5 .12 .04],'fontunits','normalized','fontsize',0.45);
DASCUCLF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.06 .46 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','VG Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create VG Forecasts that are equal to the average Actual VG, based ' char(10) 'on averaging over the interval resolution, I. Note that if any VCR exists, an input file would still be needed.' char(10) '3-Persistance Forecast: This will create VG Forecasts that are equal to the VG output before the' char(10) 'sub-model would start (i.e., time – P). Note that this method will not work for DASCUC VG' char(10) 'Forecasts, as persistence forecasts would not be plausible. Note that if any VCR exists, an input' char(10) 'file would still be needed.' char(10) '4-Predefined with NDE: This will create VG Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average VG for each interval in the sub-model. Note that' char(10) 'if any VCR exists, an input file would still be needed.'],'units','normalized','position',[.11 .43 .12 .04],'fontunits','normalized','fontsize',0.45);
DASCUCVGF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.06 .39 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Reserve Levels','TooltipString', ['1-No reserve: This will set the reserve requirements at 0MW for all services (Day-ahead only' char(10) '2-From Day Ahead: This will set the reserve requirements in RTSCUC and RTSCED at the dayahead level for the corresponding time interval (RTSCUC and RTSCED only).' char(10) '3-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory (See Section 4.1 Main Input File)'],'units','normalized','position',[.1 .36 .14 .04],'fontunits','normalized','fontsize',0.45);
DAC_RESERVE_FORECAST_MODE_in_GUI=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.06 .32 .22 .05],'string','1 - No reserve|2 - From Data File','backgroundcolor','white','value',1);
uicontrol('parent',mainFigure,'units','normalized','position',[.1 .27 .15 .05],'string','DASCUC Mods','fontunits','normalized','fontsize',0.4,'callback',{@dascuc_model_rules});
% create RTSCUC information request
uipanel('parent',mainFigure,'Title','RTSCUC','units','normalized','Position', [.35 .24 .30 .5],'fontunits','normalized','fontsize',0.040,'BackgroundColor',get(mainFigure,'color'));
uicontrol('parent',mainFigure,'style','text','string','t_RTC:','TooltipString', ['(minutes) Time between RTSCUC updates' char(10) 'CAUTION: Only simulations where t_RTC=I_RTC have been thoroughly tested'],'units','normalized','position',[.37 .65 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','H_RTC:','TooltipString', ['(count) RTSCUC Scheduling Horizon'],'units','normalized','position',[.37 .59 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','I_RTC:','TooltipString', ['(minutes) RTSCUC Interval length' char(10) 'CAUTION: Only simulations where t_RTC=I_RTC have been thoroughly tested'],'units','normalized','position',[.51 .65 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','P_RTC:','TooltipString', ['(minutes) Model processing time'],'units','normalized','position',[.51 .59 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','t_RTCSTART:','units','normalized','position',[.41 .53 .105 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
tRTC_in_edit=uicontrol('parent',mainFigure,'style','edit','string','15','units','normalized','position',[.445 .673 .05 .03],'backgroundcolor','white');
HRTC_in_edit=uicontrol('parent',mainFigure,'style','edit','string','3','units','normalized','position',[.445 .613 .05 .03],'backgroundcolor','white');
IRTC_in_edit=uicontrol('parent',mainFigure,'style','edit','string','15','units','normalized','position',[.58 .673 .05 .03],'backgroundcolor','white');
PRTC_in_edit=uicontrol('parent',mainFigure,'style','edit','string','15','units','normalized','position',[.58 .613 .05 .03],'backgroundcolor','white');
tRTCSTART_in_edit=uicontrol('parent',mainFigure,'style','edit','string','1','units','normalized','position',[.525 .553 .055 .03],'backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Load Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create Load Forecasts that are equal to the average Actual Load,' char(10) 'based on averaging over the interval resolution, I.' char(10) '3-Persistance Forecast: This will create Load Forecasts that are equal to the load before the sub model' char(10) 'would start (i.e., time – P). Note that this method will not work for DASCUC Load' char(10) 'Forecasts, as persistence forecasts would not be plausible.' char(10) '4-Predefined with NDE: This will create Load Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average Load for each interval in the sub-model'],'units','normalized','position',[.44 .5 .12 .04],'fontunits','normalized','fontsize',0.45);
RTSCUCLF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.39 .46 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','VG Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create VG Forecasts that are equal to the average Actual VG, based ' char(10) 'on averaging over the interval resolution, I. Note that if any VCR exists, an input file would still be needed.' char(10) '3-Persistance Forecast: This will create VG Forecasts that are equal to the VG output before the' char(10) 'sub-model would start (i.e., time – P). Note that this method will not work for DASCUC VG' char(10) 'Forecasts, as persistence forecasts would not be plausible. Note that if any VCR exists, an input' char(10) 'file would still be needed.' char(10) '4-Predefined with NDE: This will create VG Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average VG for each interval in the sub-model. Note that' char(10) 'if any VCR exists, an input file would still be needed.'],'units','normalized','position',[.44 .43 .12 .04],'fontunits','normalized','fontsize',0.45);
RTSCUCVGF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.39 .39 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Reserve Levels','TooltipString', ['1-No reserve: This will set the reserve requirements at 0MW for all services (Day-ahead only' char(10) '2-From Day Ahead: This will set the reserve requirements in RTSCUC and RTSCED at the dayahead level for the corresponding time interval (RTSCUC and RTSCED only).' char(10) '3-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory (See Section 4.1 Main Input File)'],'units','normalized','position',[.43 .36 .14 .04],'fontunits','normalized','fontsize',0.45);
RTC_RESERVE_FORECAST_MODE_in_GUI=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.39 .32 .22 .05],'string','1 - From Day Ahead|2 - From Data File','backgroundcolor','white','value',1);
uicontrol('parent',mainFigure,'units','normalized','position',[.43 .27 .15 .05],'string','RTSCUC Mods','fontunits','normalized','fontsize',0.4,'callback',{@rtscuc_model_rules});
% create RTSCED information request
uipanel('parent',mainFigure,'Title','RTSCED','units','normalized','Position', [.67 .24 .30 .5],'fontunits','normalized','fontsize',0.040,'BackgroundColor',get(mainFigure,'color'));
uicontrol('parent',mainFigure,'style','text','string','t_RTD:','TooltipString', ['(minutes) Time between updates' char(10) 'CAUTION: Only simulations where t_RTD=I_RTD have been thoroughly tested.'],'units','normalized','position',[.69 .65 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','H_RTD:','TooltipString', ['(count) Scheduling Horizon'],'units','normalized','position',[.69 .59 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','I_RTD:','TooltipString', ['(minutes) Interval length' char(10) 'CAUTION: Only simulations where t_RTD=I_RTD have been thoroughly tested.'],'units','normalized','position',[.83 .65 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','P_RTD:','TooltipString', ['(minutes) Model processing time'],'units','normalized','position',[.83 .59 .08 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
uicontrol('parent',mainFigure,'style','text','string','I_RTD_ADV:','TooltipString', ['(minutes) Interval length of advisory lookahead intervals'],'units','normalized','position',[.74 .53 .105 .05],'horizontalalignment','left','fontunits','normalized','fontsize',0.35);
tRTD_in_edit=uicontrol('parent',mainFigure,'style','edit','string','5','units','normalized','position',[.76 .673 .05 .03],'backgroundcolor','white');
HRTD_in_edit=uicontrol('parent',mainFigure,'style','edit','string','2','units','normalized','position',[.76 .613 .05 .03],'backgroundcolor','white');
IRTD_in_edit=uicontrol('parent',mainFigure,'style','edit','string','5','units','normalized','position',[.9 .673 .05 .03],'backgroundcolor','white');
PRTD_in_edit=uicontrol('parent',mainFigure,'style','edit','string','5','units','normalized','position',[.9 .613 .05 .03],'backgroundcolor','white');
IRTDADV_in_edit=uicontrol('parent',mainFigure,'style','edit','string','15','units','normalized','position',[.845 .553 .055 .03],'backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Load Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create Load Forecasts that are equal to the average Actual Load,' char(10) 'based on averaging over the interval resolution, I.' char(10) '3-Persistance Forecast: This will create Load Forecasts that are equal to the load before the sub model' char(10) 'would start (i.e., time – P). Note that this method will not work for DASCUC Load' char(10) 'Forecasts, as persistence forecasts would not be plausible.' char(10) '4-Predefined with NDE: This will create Load Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average Load for each interval in the sub-model'],'units','normalized','position',[.76 .5 .12 .04],'fontunits','normalized','fontsize',0.45);
RTSCEDLF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.71 .46 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','VG Forecast','TooltipString', ['1-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory' char(10) '2-Perfect Forecast: This will create VG Forecasts that are equal to the average Actual VG, based ' char(10) 'on averaging over the interval resolution, I. Note that if any VCR exists, an input file would still be needed.' char(10) '3-Persistance Forecast: This will create VG Forecasts that are equal to the VG output before the' char(10) 'sub-model would start (i.e., time – P). Note that this method will not work for DASCUC VG' char(10) 'Forecasts, as persistence forecasts would not be plausible. Note that if any VCR exists, an input' char(10) 'file would still be needed.' char(10) '4-Predefined with NDE: This will create VG Forecasts that have a predefined normally' char(10) 'distributed error randomly added to the Average VG for each interval in the sub-model. Note that' char(10) 'if any VCR exists, an input file would still be needed.'],'units','normalized','position',[.76 .43 .12 .04],'fontunits','normalized','fontsize',0.45);
RTSCEDVGF=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.71 .39 .22 .05],'string','1 - From Data File|2 - Perfect Forecast|3 - Persistence Forecast|4 - Predefined with NDE','backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string','Reserve Levels','TooltipString', ['1-No reserve: This will set the reserve requirements at 0MW for all services (Day-ahead only' char(10) '2-From Day Ahead: This will set the reserve requirements in RTSCUC and RTSCED at the dayahead level for the corresponding time interval (RTSCUC and RTSCED only).' char(10) '3-From Data File: This will read in the data that is given as a reference in the Main Input File,' char(10) 'and lies in the TIMESERIES directory (See Section 4.1 Main Input File)'],'units','normalized','position',[.75 .36 .14 .04],'fontunits','normalized','fontsize',0.45);
RTD_RESERVE_FORECAST_MODE_in_GUI=uicontrol('parent',mainFigure','style','popupmenu','units','normalized','position',[.71 .32 .22 .05],'string','1 - From Day Ahead|2 - From Data File','backgroundcolor','white','value',1);
uicontrol('parent',mainFigure,'units','normalized','position',[.75 .27 .15 .05],'string','RTSCED Mods','fontunits','normalized','fontsize',0.4,'callback',{@rtsced_model_rules});
% create network check information request
network_button_group=uibuttongroup('parent',mainFigure,'title','Network Check','units','normalized','position',[.67 .135 .145 .09],'fontunits','normalized','fontsize',0.15);
radiobutton1=uicontrol('parent',network_button_group,'style','radiobutton','units','normalized','position',[.07 .35 .4 .45],'string','Yes','TooltipString', ['This radio button is used to select if the model will incorporate the normal network constraints in' char(10) 'the DASCUC, RTSCUC, and RTSCED sub-models. By checking Yes, Network Check is' char(10) 'activated. By checking no, the system is modeled as a single bus without transmission flow' char(10) 'constraints.'],'fontunits','normalized','fontsize',0.55);
radiobutton2=uicontrol('parent',network_button_group,'style','radiobutton','units','normalized','position',[.57 .35 .4 .45],'string','No','TooltipString', ['This radio button is used to select if the model will incorporate the normal network constraints in' char(10) 'the DASCUC, RTSCUC, and RTSCED sub-models. By checking Yes, Network Check is' char(10) 'activated. By checking no, the system is modeled as a single bus without transmission flow' char(10) 'constraints.'],'fontunits','normalized','fontsize',0.55);
% create contingency check information request
ctgc_button_group=uibuttongroup('parent',mainFigure,'title','CTGC Check','units','normalized','position',[.825 .135 .145 .09],'fontunits','normalized','fontsize',0.15);
radiobutton4=uicontrol('parent',ctgc_button_group,'style','radiobutton','units','normalized','position',[.07 .35 .4 .45],'string','Yes','TooltipString', ['This radio button is used to select if the model will incorporate network contingency constraints.' char(10) 'By checking Yes, the Contingency Check is activated and DASCUC, RTSCUC, and RTSCED' char(10) 'will ensure monitored network contingencies are enforced. By checking no, these models will not' char(10) 'enforce any contingency constraints. Note that Network Check must be checked in order for' char(10) 'Contingency Check to be enabled.'],'fontunits','normalized','fontsize',0.55);
radiobutton3=uicontrol('parent',ctgc_button_group,'style','radiobutton','units','normalized','position',[.57 .35 .4 .45],'string','No','TooltipString', ['This radio button is used to select if the model will incorporate network contingency constraints.' char(10) 'By checking Yes, the Contingency Check is activated and DASCUC, RTSCUC, and RTSCED' char(10) 'will ensure monitored network contingencies are enforced. By checking no, these models will not' char(10) 'enforce any contingency constraints. Note that Network Check must be checked in order for' char(10) 'Contingency Check to be enabled.'],'fontunits','normalized','fontsize',0.55);
% create AGC information request
uipanel('parent',mainFigure,'Title','AGC','units','normalized','Position', [.03 .13 .3 .1],'fontunits','normalized','fontsize',0.15,'BackgroundColor',get(mainFigure,'color'));
uicontrol('parent',mainFigure,'units','normalized','position',[.05 .15 .12 .05],'string','AGC Param','TooltipString', ['Automatic Generation Control Parameters' char(10) 'This provides more options including CPS2 Options, Smoothed ACE Options, AGC Deadband, and AGC modes'],'fontunits','normalized','fontsize',0.4,'callback',{@agc_input});
uicontrol('parent',mainFigure,'units','normalized','position',[.19 .15 .12 .05],'string','AGC Mods','fontunits','normalized','fontsize',0.4,'callback',{@agc_model_rules});
% create simulation time request
uipanel('parent',mainFigure,'Title','Simulation Time (D:H:M:S-Start Date)','units','normalized','Position', [.35 .13 .3 .1],'fontunits','normalized','fontsize',0.15,'BackgroundColor',get(mainFigure,'color'));
days_to_simulate_edit=uicontrol('parent',mainFigure,'style','edit','string','1','units','normalized','position',[.37 .15 .04 .05],'backgroundcolor','white');
hours_to_simulate_edit=uicontrol('parent',mainFigure,'style','edit','string','0','units','normalized','position',[.425 .15 .04 .05],'backgroundcolor','white');
minutes_to_simulate_edit=uicontrol('parent',mainFigure,'style','edit','string','0','units','normalized','position',[.48 .15 .04 .05],'backgroundcolor','white');
seconds_to_simulate_edit=uicontrol('parent',mainFigure,'style','edit','string','0','units','normalized','position',[.535 .15 .04 .05],'backgroundcolor','white');
start_date_edit=uicontrol('parent',mainFigure,'style','edit','string','1','units','normalized','position',[.595 .15 .04 .05],'backgroundcolor','white');
uicontrol('parent',mainFigure,'style','text','string',':','units','normalized','position',[.415 .142 .007 .05],'fontunits','normalized','fontsize',0.5);
uicontrol('parent',mainFigure,'style','text','string',':','units','normalized','position',[.47 .142 .007 .05],'fontunits','normalized','fontsize',0.5);
uicontrol('parent',mainFigure,'style','text','string',':','units','normalized','position',[.525 .142 .007 .05],'fontunits','normalized','fontsize',0.5);
uicontrol('parent',mainFigure,'style','text','string','-','units','normalized','position',[.58 .142 .007 .05],'fontunits','normalized','fontsize',0.5);
% create extra options input request interfaces
options=uipanel('parent',mainFigure,'Title','Extra Options','units','normalized','Position', [.02 .03 .74 .09],'fontunits','normalized','fontsize',0.2,'BackgroundColor',get(mainFigure,'color'));
uicontrol('parent',options,'units','normalized','position',[.01 .15 .11 .8],'string','<html><center>RPU</center></html>','TooltipString', ['Reserve Pick Up' char(10) 'A SCUC/SCED run based on user-defined event rather than time'], 'fontunits','normalized','fontsize',0.33,'callback',{@rpu_callback});
uicontrol('parent',options,'units','normalized','position',[.135 .15 .11 .8],'string','<html><center>Multiple<br>Runs</center></html>','TooltipString', ['Run multiple scenarios back-to-back without the need' char(10) 'to re-enter all the information for each new run.'],'fontunits','normalized','fontsize',0.33,'callback',{@MultipleRuns_callback});
uicontrol('parent',options,'units','normalized','position',[.260 .15 .11 .8],'string','<html><center>CTGC<br>Options</center></html>','TooltipString','Simulate contingencies to occur during the time loop within FESTIV.','fontunits','normalized','fontsize',0.33,'callback',{@contingencies_callback});
uicontrol('parent',options,'units','normalized','position',[.385 .15 .11 .8],'string','<html><center>Debug</center></html>','TooltipString','Debug FESTIV during time frame selected.','fontunits','normalized','fontsize',0.33,'callback',{@debugging_callback});
uicontrol('parent',options,'units','normalized','position',[.51 .15 .11 .8],'string','<html><center>Other<br>Func Mods</center></html>','TooltipString', ['Functional Mods can be used to modify FESTIV before and after other processes throughout the FESTIV simulation'],'fontunits','normalized','fontsize',0.33,'callback',{@other_rules_callback});
uicontrol('parent',options,'units','normalized','position',[.635 .15 .11 .8],'string','<html><center>Save<br>Func Mods</center></html>','TooltipString','Save Parameters on Main FESTIV GUI and all Functional Mods. Parameters requiring additional buttons and Formulation Mods not saved.','fontunits','normalized','fontsize',0.33,'callback',{@save_rules_callback});
uicontrol('parent',options,'units','normalized','position',[.76 .15 .11 .8],'string','<html><center>Load<br>Func Mods</center></html>','TooltipString','Load Parameters on Main FESTIV GUI and all Functional Mods. Parameters requiring additional buttons and Formulation Mods are not loaded.','fontunits','normalized','fontsize',0.33,'callback',{@load_rules_callback});
uicontrol('parent',options,'units','normalized','position',[.885 .15 .11 .8],'string','<html><center>Formulation Mods</center></html>','TooltipString','Press here to adjust SCUC and SCED models using Formulation Mods.','fontunits','normalized','fontsize',0.33,'callback',{@build_gams_models_callback});
uicontrol('Parent',mainFigure,'Style','pushbutton','String','<html><center>Cancel</center></html>','units','normalized','Position', [0.775 0.03 0.1 0.08],'fontunits','normalized','fontsize',0.4,'Callback', {@cancel_callback});
uicontrol('Parent',mainFigure,'Style','pushbutton','String','<html><center>Go!</center></html>','units','normalized','Position', [.885 .03 0.1 .08],'fontunits','normalized','fontsize',0.40,'Callback',{@runFESTIV});
% make main figure visible
set(mainFigure,'visible','on');
%% Initialize variables that come up in other figures
K1_in_edit=[];
try
K1_in=evalin('base','K1_in');
catch
assignin('base','K1_in',1);
K1_in=evalin('base','K1_in');
end
K2_in_edit=[];
try
K2_in=evalin('base','K2_in');
catch
assignin('base','K2_in',2);
K2_in=evalin('base','K2_in');
end
Type3_integral_in_edit=[];
try
Type3_integral_in=evalin('base','Type3_integral_in');
catch
assignin('base','Type3_integral_in',180);
Type3_integral_in=evalin('base','Type3_integral_in');
end
CPS2_interval_in_edit=[];
try
CPS2_interval_in=evalin('base','CPS2_interval_in');
catch
assignin('base','CPS2_interval_in',10);
CPS2_interval_in=evalin('base','CPS2_interval_in');
end
L10_in_edit=[];
try
L10_in=evalin('base','L10_in');
catch
assignin('base','L10_in',50);
L10_in=evalin('base','L10_in');
end
agc_deadband_in_edit=[];
try
agc_deadband_in=evalin('base','agc_deadband_in');
catch
assignin('base','agc_deadband_in',5);
agc_deadband_in=evalin('base','agc_deadband_in');
end
agcmodes=[];
try
agcmode=evalin('base','agcmode');
catch
assignin('base','agcmode',3);
agcmode=evalin('base','agcmode');
end
multiplerunscheck=[];
outputfilenames=[];
simulationQueue={};
multiplerunscheckvalue=0;
multipleRunsOutputText=[];
addruns=[];
numberoffiles=1;
multipleRunsInputText=[];
inputfilenamesformultiple=[];
browseformultiple=[];
assignin('base','MRcheck',0);
radiobutton5=[];
HRPU_in_edit=[];
try
HRPU_in=evalin('base','HRPU_in');
catch
assignin('base','HRPU_in',6);
HRPU_in=evalin('base','HRPU_in');
end
IRPU_in_edit=[];
try
IRPU_in=evalin('base','IRPU_in');
catch
assignin('base','IRPU_in',10);
IRPU_in=evalin('base','IRPU_in');
end
PRPU_in_edit=[];
try
PRPU_in=evalin('base','PRPU_in');
catch
assignin('base','PRPU_in',1);
PRPU_in=evalin('base','PRPU_in');
end
ACE_RPU_THRESHOLD_MW_in_edit=[];
try
ACE_RPU_THRESHOLD_MW_in=evalin('base','ACE_RPU_THRESHOLD_MW_in');
catch
assignin('base','ACE_RPU_THRESHOLD_MW_in',1000);
ACE_RPU_THRESHOLD_MW_in=evalin('base','ACE_RPU_THRESHOLD_MW_in');
end
ACE_RPU_THRESHOLD_T_in_edit=[];
try
ACE_RPU_THRESHOLD_T_in=evalin('base','ACE_RPU_THRESHOLD_T_in');
catch
assignin('base','ACE_RPU_THRESHOLD_T_in',2);
ACE_RPU_THRESHOLD_T_in=evalin('base','ACE_RPU_THRESHOLD_T_in');
end
restrict_multiple_rpu_time_in_edit=[];
try
restrict_multiple_rpu_time_in=evalin('base','restrict_multiple_rpu_time_in');
catch
assignin('base','restrict_multiple_rpu_time_in',10);
restrict_multiple_rpu_time_in=evalin('base','restrict_multiple_rpu_time_in');
end
assignin('base','ALLOW_RPU_in','NO');
ALLOW_RPU_in=evalin('base','ALLOW_RPU_in');
ctgc_gen_in_edit=[];
ctgc_D_in_edit=[];
ctgc_H_in_edit=[];
ctgc_M_in_edit=[];
ctgc_S_in_edit=[];
outageQueue=[];
outagedgenindicies=[];
ngen=1;
radiobutton7=[];
radiobutton8=[];
radiobutton9=[];
Contingency_input_check_in=1;
assignin('base','gen_outage_time_in',0);
gen_outage_time_in=evalin('base','gen_outage_time_in');
assignin('base','SIMULATE_CONTINGENCIES_in','NO');
SIMULATE_CONTINGENCIES_in=evalin('base','SIMULATE_CONTINGENCIES_in');
evalin('base','ctgctabledata=[];');
radiobutton10=[];
radiobutton20=[];
radiobutton12=[];
radiobutton13=[];
radiobutton15=[];
timefordebugstop_in_edit=[];
assignin('base','USE_INTEGER_in','YES');
USE_INTEGER_in=evalin('base','USE_INTEGER_in');
assignin('base','solver_in','CPLEX');
solver_in=evalin('base','solver_in');
try
suppress_plots_in=evalin('base','suppress_plots_in');
catch
assignin('base','suppress_plots_in','NO');
suppress_plots_in=evalin('base','suppress_plots_in');
end
assignin('base','debugcheck_in',0);
debugcheck_in=evalin('base','debugcheck_in');
assignin('base','timefordebugstop_in',999);
timefordebugstop_in=evalin('base','timefordebugstop_in');
assignin('base','Contingency_input_check_in',0);
Contingency_input_check_in=evalin('base','Contingency_input_check_in');
modelinputFileEditBox=[];
modelinputFile=[];
dascucpre_modelQueue=[];
dascucpost_modelQueue=[];
rtscucpre_modelQueue=[];
rtscucpost_modelQueue=[];
rtscedpre_modelQueue=[];
rtscedpost_modelQueue=[];
agcpre_modelQueue=[];
agcpost_modelQueue=[];
dascucmodel_pre_list=[];
dascucmodel_post_list=[];
rtscucmodel_pre_list=[];
rtscucmodel_post_list=[];
rtscedmodel_pre_list=[];
rtscedmodel_post_list=[];
agcmodel_pre_list=[];
agcmodel_post_list=[];
rpupre_modelQueue=[];
rpupost_modelQueue=[];
rpumodel_pre_list=[];
rpumodel_post_list=[];
otherpre_modelQueue=[];
otherpost_modelQueue=[];
othermodel_pre_list=[];
othermodel_post_list=[];
try
DASCUC_RULES_PRE_in=evalin('base','DASCUC_RULES_PRE_in');
catch
assignin('base','DASCUC_RULES_PRE_in',[]);
DASCUC_RULES_PRE_in=evalin('base','DASCUC_RULES_PRE_in');
end;
try
DASCUC_RULES_POST_in=evalin('base','DASCUC_RULES_POST_in');
catch
assignin('base','DASCUC_RULES_POST_in',[]);
DASCUC_RULES_POST_in=evalin('base','DASCUC_RULES_POST_in');
end;
try
RTSCUC_RULES_PRE_in=evalin('base','RTSCUC_RULES_PRE_in');
catch
assignin('base','RTSCUC_RULES_PRE_in',[]);
RTSCUC_RULES_PRE_in=evalin('base','RTSCUC_RULES_PRE_in');
end;
try
RTSCUC_RULES_POST_in=evalin('base','RTSCUC_RULES_POST_in');
catch
assignin('base','RTSCUC_RULES_POST_in',[]);
RTSCUC_RULES_POST_in=evalin('base','RTSCUC_RULES_POST_in');
end;
try
RTSCED_RULES_PRE_in=evalin('base','RTSCED_RULES_PRE_in');
catch
assignin('base','RTSCED_RULES_PRE_in',[]);
RTSCED_RULES_PRE_in=evalin('base','RTSCED_RULES_PRE_in');
end;
try
RTSCED_RULES_POST_in=evalin('base','RTSCED_RULES_POST_in');
catch
assignin('base','RTSCED_RULES_POST_in',[]);
RTSCED_RULES_POST_in=evalin('base','RTSCED_RULES_POST_in');
end;
try
AGC_RULES_PRE_in=evalin('base','AGC_RULES_PRE_in');
catch
assignin('base','AGC_RULES_PRE_in',[]);
AGC_RULES_PRE_in=evalin('base','AGC_RULES_PRE_in');
end;
try
AGC_RULES_POST_in=evalin('base','AGC_RULES_POST_in');
catch
assignin('base','AGC_RULES_POST_in',[]);
AGC_RULES_POST_in=evalin('base','AGC_RULES_POST_in');
end;
try
RPU_RULES_PRE_in=evalin('base','RPU_RULES_PRE_in');
catch
assignin('base','RPU_RULES_PRE_in',[]);
RPU_RULES_PRE_in=evalin('base','RPU_RULES_PRE_in');
end;
try
RPU_RULES_POST_in=evalin('base','RPU_RULES_POST_in');
catch
assignin('base','RPU_RULES_POST_in',[]);
RPU_RULES_POST_in=evalin('base','RPU_RULES_POST_in');
end;
try
DATA_INITIALIZE_PRE_in=evalin('base','DATA_INITIALIZE_PRE_in');
catch
assignin('base','DATA_INITIALIZE_PRE_in',[]);
DATA_INITIALIZE_PRE_in=evalin('base','DATA_INITIALIZE_PRE_in');
end;
try
DATA_INITIALIZE_POST_in=evalin('base','DATA_INITIALIZE_POST_in');
catch
assignin('base','DATA_INITIALIZE_POST_in',[]);
DATA_INITIALIZE_POST_in=evalin('base','DATA_INITIALIZE_POST_in');
end;
try
FORECASTING_PRE_in=evalin('base','FORECASTING_PRE_in');
catch
assignin('base','FORECASTING_PRE_in',[]);
FORECASTING_PRE_in=evalin('base','FORECASTING_PRE_in');
end;
try
FORECASTING_POST_in=evalin('base','FORECASTING_POST_in');
catch
assignin('base','FORECASTING_POST_in',[]);
FORECASTING_POST_in=evalin('base','FORECASTING_POST_in');
end;
try
POST_PROCESSING_PRE_in=evalin('base','POST_PROCESSING_PRE_in');
catch
assignin('base','POST_PROCESSING_PRE_in',[]);
POST_PROCESSING_PRE_in=evalin('base','POST_PROCESSING_PRE_in');
end;
try
POST_PROCESSING_POST_in=evalin('base','POST_PROCESSING_POST_in');
catch
assignin('base','POST_PROCESSING_POST_in',[]);
POST_PROCESSING_POST_in=evalin('base','POST_PROCESSING_POST_in');
end;
try
RT_LOOP_PRE_in=evalin('base','RT_LOOP_PRE_in');
catch
assignin('base','RT_LOOP_PRE_in',[]);
RT_LOOP_PRE_in=evalin('base','RT_LOOP_PRE_in');
end;
try
RT_LOOP_POST_in=evalin('base','RT_LOOP_POST_in');
catch
assignin('base','RT_LOOP_POST_in',[]);
RT_LOOP_POST_in=evalin('base','RT_LOOP_POST_in');
end;
try
ACE_PRE_in=evalin('base','ACE_PRE_in');
catch
assignin('base','ACE_PRE_in',[]);
ACE_PRE_in=evalin('base','ACE_PRE_in');
end;
try
ACE_POST_in=evalin('base','ACE_POST_in');
catch
assignin('base','ACE_POST_in',[]);
ACE_POST_in=evalin('base','ACE_POST_in');
end;
try
FORCED_OUTAGE_PRE_in=evalin('base','FORCED_OUTAGE_PRE_in');
catch
assignin('base','FORCED_OUTAGE_PRE_in',[]);
FORCED_OUTAGE_PRE_in=evalin('base','FORCED_OUTAGE_PRE_in');
end;
try
FORCED_OUTAGE_POST_in=evalin('base','FORCED_OUTAGE_POST_in');
catch
assignin('base','FORCED_OUTAGE_POST_in',[]);
FORCED_OUTAGE_POST_in=evalin('base','FORCED_OUTAGE_POST_in');
end;
try
SHIFT_FACTOR_PRE_in=evalin('base','SHIFT_FACTOR_PRE_in');
catch
assignin('base','SHIFT_FACTOR_PRE_in',[]);
SHIFT_FACTOR_PRE_in=evalin('base','SHIFT_FACTOR_PRE_in');
end;
try
SHIFT_FACTOR_POST_in=evalin('base','SHIFT_FACTOR_POST_in');
catch
assignin('base','SHIFT_FACTOR_POST_in',[]);
SHIFT_FACTOR_POST_in=evalin('base','SHIFT_FACTOR_POST_in');
end;
try
ACTUAL_OUTPUT_PRE_in=evalin('base','ACTUAL_OUTPUT_PRE_in');
catch
assignin('base','ACTUAL_OUTPUT_PRE_in',[]);
ACTUAL_OUTPUT_PRE_in=evalin('base','ACTUAL_OUTPUT_PRE_in');
end;
try
ACTUAL_OUTPUT_POST_in=evalin('base','ACTUAL_OUTPUT_POST_in');
catch
assignin('base','ACTUAL_OUTPUT_POST_in',[]);
ACTUAL_OUTPUT_POST_in=evalin('base','ACTUAL_OUTPUT_POST_in');
end;
try
RELIABILITY_PRE_in=evalin('base','RELIABILITY_PRE_in');
catch
assignin('base','RELIABILITY_PRE_in',[]);
RELIABILITY_PRE_in=evalin('base','RELIABILITY_PRE_in');
end;
try
RELIABILITY_POST_in=evalin('base','RELIABILITY_POST_in');
catch
assignin('base','RELIABILITY_POST_in',[]);
RELIABILITY_POST_in=evalin('base','RELIABILITY_POST_in');
end;
try
COST_PRE_in=evalin('base','COST_PRE_in');
catch
assignin('base','COST_PRE_in',[]);
COST_PRE_in=evalin('base','COST_PRE_in');
end;
try
COST_POST_in=evalin('base','COST_POST_in');
catch
assignin('base','COST_POST_in',[]);
COST_POST_in=evalin('base','COST_POST_in');
end;
try
SAVING_PRE_in=evalin('base','SAVING_PRE_in');
catch
assignin('base','SAVING_PRE_in',[]);
SAVING_PRE_in=evalin('base','SAVING_PRE_in');
end;
try
SAVING_POST_in=evalin('base','SAVING_POST_in');
catch
assignin('base','SAVING_POST_in',[]);
SAVING_POST_in=evalin('base','SAVING_POST_in');
end;
autoSaveName_edit=[];
dac_modelinputFolderEditBox=[];
dac_modelinputLocationListBox=[];
dac_list_of_gams_rules=[];
dac_list_of_selected_gams_rules=[];
gamsFilesPaths_DAC=[];assignin('base','gamsFilesPaths_DAC',gamsFilesPaths_DAC);
gamsFilesNames_DAC=[];assignin('base','gamsFilesNames_DAC',gamsFilesNames_DAC);
rtc_modelinputFolderEditBox=[];
rtc_modelinputLocationListBox=[];
rtc_list_of_gams_rules=[];
rtc_list_of_selected_gams_rules=[];
gamsFilesPaths_RTC=[];assignin('base','gamsFilesPaths_RTC',gamsFilesPaths_RTC);
gamsFilesNames_RTC=[];assignin('base','gamsFilesNames_RTC',gamsFilesNames_RTC);
rtd_modelinputFolderEditBox=[];
rtd_modelinputLocationListBox=[];
rtd_list_of_gams_rules=[];
rtd_list_of_selected_gams_rules=[];
gamsFilesPaths_RTD=[];assignin('base','gamsFilesPaths_RTD',gamsFilesPaths_RTD);
gamsFilesNames_RTD=[];assignin('base','gamsFilesNames_RTD',gamsFilesNames_RTD);
%% Set default values
set(DASCUCLF,'value',2);
set(RTSCUCLF,'value',2);
set(RTSCEDLF,'value',2);
set(DASCUCVGF,'value',2);
set(RTSCUCVGF,'value',3);
set(RTSCEDVGF,'value',3);
set(radiobutton2,'value',1);
set(radiobutton3,'value',1);
set(DAC_RESERVE_FORECAST_MODE_in_GUI,'value',1);
set(RTC_RESERVE_FORECAST_MODE_in_GUI,'value',1);
set(RTD_RESERVE_FORECAST_MODE_in_GUI,'value',1);
try
a=evalin('base','HDAC_in');
set(HDAC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','IDAC_in');
set(IDAC_in_edit,'string',num2str(a))
catch
end;
try
a=evalin('base','tDAC_in');
set(tDAC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','GDAC_in');
set(GDAC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','PDAC_in');
set(PDAC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','HRTC_in');
set(HRTC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','IRTC_in');
set(IRTC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','tRTC_in');
set(tRTC_in_edit,'string',num2str(a));
catch
end;
try a=evalin('base','HRTD_in');
set(HRTD_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','IRTD_in');
set(IRTD_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','tRTD_in');
set(tRTD_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','daystosimulate');
set(days_to_simulate_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','hours_to_simulate_in');
set(hours_to_simulate_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','minutes_to_simulate_in');
set(minutes_to_simulate_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','seconds_to_simulate_in');
set(seconds_to_simulate_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','start_date_in');
set(start_date_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','checkthenetwork');
if strcmp(a,'YES')
set(radiobutton1,'value',1)
else
set(radiobutton2,'value',1)
end;
catch
end;
try
a=evalin('base','contingencycheck');
if strcmp(a,'YES')
set(radiobutton4,'value',1)
else
set(radiobutton3,'value',1)
end;
catch
end;
try
a=evalin('base','PRTC_in');
set(PRTC_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','tRTCSTART_in');
set(tRTCSTART_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','PRTD_in');
set(PRTD_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','IRTDADV_in');
set(IRTDADV_in_edit,'string',num2str(a));
catch
end;
try
a=evalin('base','DAC_load_forecast_data_create_in');
set(DASCUCLF,'value',a);
catch
end;
try
a=evalin('base','DAC_vg_forecast_data_create_in');
set(DASCUCVGF,'value',a);
catch
end;
try
a=evalin('base','RTC_load_forecast_data_create_in');
set(RTSCUCLF,'value',a);
catch
end;
try
a=evalin('base','RTC_vg_forecast_data_create_in');
set(RTSCUCVGF,'value',a);
catch
end;
try
a=evalin('base','RTD_load_forecast_data_create_in');
set(RTSCEDLF,'value',a);
catch
end;
try
a=evalin('base','RTD_vg_forecast_data_create_in');
set(RTSCEDVGF,'value',a);
catch
end;
try
a=evalin('base','DAC_RESERVE_FORECAST_MODE_in');
set(DAC_RESERVE_FORECAST_MODE_in_GUI,'value',a);
catch
end;
try
a=evalin('base','RTC_RESERVE_FORECAST_MODE_in');
set(RTC_RESERVE_FORECAST_MODE_in_GUI,'value',a);
catch
end;
try
a=evalin('base','RTD_RESERVE_FORECAST_MODE_in');
set(RTD_RESERVE_FORECAST_MODE_in_GUI,'value',a);
catch
end;
try
a=evalin('base','inputPath');
[~, name, ext] = fileparts(a);
displayname=strcat(name,ext);
set(inputFileEditBox,'string',displayname);
if strcmp(ext,'.h5')
assignin('base','useHDF5',1);
else
assignin('base','useHDF5',0);
end
catch
set(inputFileEditBox,'string','Browse for File');
end;
set(autosavecheck_in,'value',0);
dac_default_checked();
rtc_default_checked();
rtd_default_checked();
create_gams_rules();
%% ~~ CALLBACKS ~~
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% %%%
%%% C A L L B A C K S %%%
%%% %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Browse for input file callback
function browseforfile(~,~)
[inputFile,inputDir] = uigetfile(['Input',filesep,'*.xlsx;*.h5'],'Select FESTIV Input File');
if inputFile == 0
inputPath = '';
else
inputPath = [inputDir,inputFile];
end
[~,temprem]=strtok(inputFile,'.');
if strcmp(temprem,'.h5')
assignin('base','useHDF5',1);
else
assignin('base','useHDF5',0);
end
set(inputFileEditBox, 'string', inputFile);
assignin('base','inputPath',inputPath);
end
%% Create and open the L10 help dialog box
function L10help(~,~)
l10help=figure('name','L10 Values','NumberTitle','off','units','pixels','position',[500 500 250 210],'menubar','none');
movegui(l10help,'center');
cnames={'Name','~Peak [MW]','L10 [MW]'};
data={' ISO-NE',' 26,629',' 122.23';' NYISO',' 33,696',' 137.58';' MISO',' 95,105',' 231.12';' PJM',' 153,741',' 293.82';' CAISO',' 48,887',' 117.66';' BANC',' 4,500',' 35.70';' BPA',' 9,526',' 68.09';' PSCO',' 7,988',' 47.60'};
uitable('Parent',l10help,'Data',data,'ColumnName',cnames,'RowName',[],'Position',[10 35 227 166]);
uicontrol('Parent',l10help,'Style', 'pushbutton','String','Complete List','Position', [35 5 80 25],'Callback', @(hObject,eventData) web('http://www.nerc.com/docs/oc/rs/2013%20CPS2%20Bounds%20Report%20Final.pdf','-browser'));
uicontrol('Parent',l10help,'Style','pushbutton','String','Close','Position', [130 5 80 25],'Callback', @(hObject,eventData) close(gcf));
end
%% Create and open the multiple runs dialog box
function MultipleRuns_callback(~,~)
multipleRuns_figure=figure('name','Multiple Runs Input Dialog','NumberTitle','off','position',[50 50 730 500],'menubar','none','color',[.9412 .9412 .9412]);
movegui(multipleRuns_figure,'center');
multiplerunscheck=uicontrol('parent',multipleRuns_figure,'style','checkbox','string','Multiple Runs','units','normalized','position',[.02 .90 .15 .08],'fontunits','normalized','fontsize',0.35,'callback',{@multiplerunscheck_callback});
multipleRunsOutputText=uicontrol('parent',multipleRuns_figure,'style','text','string','Output File Name:','units','normalized','position',[0.035 .78 .20 .05],'fontunits','normalized','fontsize',0.4);
outputfilenames=uicontrol('parent',multipleRuns_figure,'style','edit','units','normalized','fontunits','normalized','position',[.215 .79 .615 .05],'fontsize',0.45,'backgroundcolor','white');
multipleRunsInputText=uicontrol('parent',multipleRuns_figure,'style','text','string','Input File Name:','units','normalized','position',[0.035 .85 .20 .05],'fontunits','normalized','fontsize',0.4);
inputfilenamesformultiple=uicontrol('parent',multipleRuns_figure,'style','edit','units','normalized','fontunits','normalized','position',[.215 .86 .615 .05],'fontsize',0.45,'string','test','backgroundcolor','white');
addruns=uicontrol('parent',multipleRuns_figure,'style','pushbutton','units','normalized','fontunits','normalized','position',[.855 .79 .10 .05],'string','Add','fontsize',0.5,'callback',{@addruns_callback});
simulationQueue=uitable('Parent',multipleRuns_figure,'units','normalized','position',[0.03 .12 .94 .65],'ColumnFormat',{'char','char'},'ColumnName',{'Input File Name', 'Output File Name'},'ColumnEditable',[false false],'ColumnWidth',{325 325},'CellSelectionCallback',@(src,evnt)set(src,'UserData',evnt.Indices));
browseformultiple=uicontrol('parent',multipleRuns_figure,'units','normalized','position',[.855 .86 .10 .05],'string','Browse','style','pushbutton','fontunits','normalized','fontsize',0.4,'callback',{@browseformultiplefiles});
uicontrol('parent',multipleRuns_figure,'units','normalized','position',[.87 .01 .10 .1],'string','Done','style','pushbutton','fontunits','normalized','fontsize',0.3,'callback',{@donemultiplefiles});
uicontrol('parent',multipleRuns_figure,'units','normalized','position',[.03 .01 .10 .1],'string','Remove','style','pushbutton','fontunits','normalized','fontsize',0.3,'callback',{@removemultiplefiles});
try set(inputfilenamesformultiple,'string',get(inputFileEditBox,'string'));catch;end;
x=evalin('base','MRcheck');
set(multiplerunscheck,'value',x)
if get(multiplerunscheck,'value')==1
set(multipleRunsOutputText,'Enable','ON');
set(outputfilenames,'Enable','ON');
set(simulationQueue,'Enable','ON');
set(addruns,'Enable','ON');
set(multipleRunsInputText,'enable','on');
set(inputfilenamesformultiple,'enable','on');
set(browseformultiple,'enable','on');
multiplerunscheckvalue=get(multiplerunscheck,'value');
else
set(addruns,'Enable','OFF');
set(multipleRunsOutputText,'Enable','OFF');
set(outputfilenames,'Enable','OFF');
set(simulationQueue,'Enable','OFF');
set(multipleRunsInputText,'enable','off');
set(inputfilenamesformultiple,'enable','off');
set(browseformultiple,'enable','off');
end
try inputfiles=evalin('base','tabledata');catch;end;
try set(simulationQueue,'data',inputfiles);catch;end;
end
%% Remove run from multiple runs dialog box
function removemultiplefiles(~,~)
inputfiles=get(simulationQueue,'data');
numberofinputfiles=size(inputfiles,1);
remove_idx=get(simulationQueue,'UserData');
remove_idx=remove_idx(1);
if remove_idx < numberofinputfiles
for i=remove_idx:numberofinputfiles-1
movefile(sprintf('tempws%d.mat',i+1),sprintf('tempws%d.mat',i))
end
end
inputfiles(remove_idx(1),:)=[];
set(simulationQueue,'data',inputfiles);
assignin('base','tabledata',inputfiles);
numberoffiles=numberoffiles-1;
end
%% Browse for input file for multiple runs dialog box
function browseformultiplefiles(~,~)
[inputFile,inputDir] = uigetfile(['Input',filesep,'*.xlsx;*.h5'],'Select FESTIV Input File');
if inputFile == 0
inputPath = '';
else
inputPath = [inputDir,inputFile];
end
set(inputfilenamesformultiple, 'string', inputFile);
assignin('base','inputPath',inputPath);
end
%% Prepare input dialog for multiple run inputs
function multiplerunscheck_callback(~,~)
if get(multiplerunscheck,'value')==1
assignin('base','MRcheck',1);
set(multipleRunsOutputText,'Enable','ON');
set(outputfilenames,'Enable','ON');
set(simulationQueue,'Enable','ON');
set(addruns,'Enable','ON');
set(multipleRunsInputText,'enable','on');
set(inputfilenamesformultiple,'enable','on');
set(browseformultiple,'enable','on');
multiplerunscheckvalue=get(multiplerunscheck,'value');
else
assignin('base','MRcheck',0);
set(addruns,'Enable','OFF');
set(multipleRunsOutputText,'Enable','OFF');
set(outputfilenames,'Enable','OFF');
set(simulationQueue,'Enable','OFF');
set(multipleRunsInputText,'enable','off');
set(inputfilenamesformultiple,'enable','off');
set(browseformultiple,'enable','off');
end
end
%% Done adding multiple files
function donemultiplefiles(~,~)
close(gcf);
end
%% Create the workspaces for the multiple runs
function addruns_callback(~,~)
outputname=get(outputfilenames,'String');
inputname=get(inputfilenamesformultiple,'string');
inputfiles=get(simulationQueue,'data');
if isempty(inputfiles) % for first file
inputfiles={inputname,outputname};
else
inputfiles(end+1,:)={inputname,outputname};
end
[~,temprem]=strtok(inputname,'.');
if strcmp(temprem,'.h5')
assignin('base','useHDF5',1);
else
assignin('base','useHDF5',0);
end
set(simulationQueue,'data',inputfiles);
assignin('base','tabledata',inputfiles);
checkthenetwork=get(radiobutton1,'value');
if checkthenetwork==1
checkthenetwork='YES';
else
checkthenetwork='NO';
end
contingencycheck=get(radiobutton4,'value');
if contingencycheck==0
contingencycheck='NO';
else
contingencycheck='YES';
end
if strcmp(checkthenetwork,'NO')
contingencycheck='NO';
set(radiobutton3,'value',1)
end
HDAC_in=str2double(get(HDAC_in_edit,'string'));
IDAC_in=str2double(get(IDAC_in_edit,'string'));
tDAC_in=str2double(get(tDAC_in_edit,'string'));
GDAC_in=str2double(get(GDAC_in_edit,'string'));
PDAC_in=str2double(get(PDAC_in_edit,'string'));
HRTC_in=str2double(get(HRTC_in_edit,'string'));
IRTC_in=str2double(get(IRTC_in_edit,'string'));
tRTC_in=str2double(get(tRTC_in_edit,'string'));
PRTC_in=str2double(get(PRTC_in_edit,'string'));
tRTCSTART_in=str2double(get(tRTCSTART_in_edit,'string'));
HRTD_in=str2double(get(HRTD_in_edit,'string'));
IRTD_in=str2double(get(IRTD_in_edit,'string'));
tRTD_in=str2double(get(tRTD_in_edit,'string'));
PRTD_in=str2double(get(PRTD_in_edit,'string'));
IRTDADV_in=str2double(get(IRTDADV_in_edit,'string'));
if IRTDADV_in < IRTD_in
IRTDADV_in = IRTD_in;
end
daystosimulate=str2double(get(days_to_simulate_edit,'string'));
hours_to_simulate_in = str2double(get(hours_to_simulate_edit,'string'));
minutes_to_simulate_in = str2double(get(minutes_to_simulate_edit,'string'));
seconds_to_simulate_in = str2double(get(seconds_to_simulate_edit,'string'));
start_date_in = str2double(get(start_date_edit,'string'));
if HRTD_in > HRTC_in
HRTD_in=HRTC_in;
end
DAC_load_forecast_data_create_in=get(DASCUCLF,'value');
DAC_vg_forecast_data_create_in=get(DASCUCVGF,'value');
RTC_load_forecast_data_create_in=get(RTSCUCLF,'value');
RTC_vg_forecast_data_create_in=get(RTSCUCVGF,'value');
RTD_load_forecast_data_create_in=get(RTSCEDLF,'value');
RTD_vg_forecast_data_create_in=get(RTSCEDVGF,'value');
DAC_RESERVE_FORECAST_MODE_in = get(DAC_RESERVE_FORECAST_MODE_in_GUI,'value');
RTC_RESERVE_FORECAST_MODE_in = get(RTC_RESERVE_FORECAST_MODE_in_GUI,'value');
RTD_RESERVE_FORECAST_MODE_in = get(RTD_RESERVE_FORECAST_MODE_in_GUI,'value');
Type3_integral_in=evalin('base','Type3_integral_in');
K1_in=evalin('base','K1_in');
K2_in=evalin('base','K2_in');
CPS2_interval_in=evalin('base','CPS2_interval_in');
L10_in=evalin('base','L10_in');
agcmode=evalin('base','agcmode');
agc_deadband_in=evalin('base','agc_deadband_in');
SIMULATE_CONTINGENCIES_in=evalin('base','SIMULATE_CONTINGENCIES_in');
gen_outage_time_in=evalin('base','gen_outage_time_in');
USE_INTEGER_in=evalin('base','USE_INTEGER_in');
solver_in=evalin('base','solver_in');
timefordebugstop_in=evalin('base','timefordebugstop_in');
debugcheck_in=evalin('base','debugcheck_in');
suppress_plots_in=evalin('base','suppress_plots_in');
assignin('base','HDAC_in',HDAC_in);
assignin('base','HDACtest',HDAC_in);
assignin('base','IDAC_in',IDAC_in);
assignin('base','tDAC_in',tDAC_in);
assignin('base','GDAC_in',GDAC_in);
assignin('base','PDAC_in',PDAC_in);
assignin('base','HRTC_in',HRTC_in);
assignin('base','IRTC_in',IRTC_in);
assignin('base','tRTC_in',tRTC_in);
assignin('base','PRTC_in',PRTC_in);
assignin('base','tRTCSTART_in',tRTCSTART_in);
assignin('base','HRTD_in',HRTD_in);
assignin('base','IRTD_in',IRTD_in);
assignin('base','tRTD_in',tRTD_in);
assignin('base','PRTD_in',PRTD_in);
assignin('base','IRTDADV_in',IRTDADV_in);
assignin('base','checkthenetwork',checkthenetwork);
assignin('base','contingencycheck',contingencycheck);
assignin('base','daystosimulate',daystosimulate);
assignin('base','hours_to_simulate_in',hours_to_simulate_in);
assignin('base','minutes_to_simulate_in',minutes_to_simulate_in);
assignin('base','seconds_to_simulate_in',seconds_to_simulate_in);
assignin('base','start_date_in',start_date_in);
assignin('base','RTD_load_forecast_data_create_in',RTD_load_forecast_data_create_in);
assignin('base','RTD_vg_forecast_data_create_in',RTD_vg_forecast_data_create_in);
assignin('base','RTC_load_forecast_data_create_in',RTC_load_forecast_data_create_in);
assignin('base','RTC_vg_forecast_data_create_in',RTC_vg_forecast_data_create_in);
assignin('base','DAC_RESERVE_FORECAST_MODE_in',DAC_RESERVE_FORECAST_MODE_in);
assignin('base','RTC_RESERVE_FORECAST_MODE_in',RTC_RESERVE_FORECAST_MODE_in);
assignin('base','RTD_RESERVE_FORECAST_MODE_in',RTD_RESERVE_FORECAST_MODE_in);
assignin('base','DAC_load_forecast_data_create_in',DAC_load_forecast_data_create_in);
assignin('base','DAC_vg_forecast_data_create_in',DAC_vg_forecast_data_create_in);
assignin('base','USE_INTEGER_in',USE_INTEGER_in);
assignin('base','solver_in',solver_in);
assignin('base','timefordebugstop_in',timefordebugstop_in);
assignin('base','debugcheck_in',debugcheck_in);
assignin('base','suppress_plots_in',suppress_plots_in);
assignin('base','DASCUC_RULES_PRE_in',DASCUC_RULES_PRE_in);
assignin('base','DASCUC_RULES_POST_in',DASCUC_RULES_POST_in);
assignin('base','RTSCUC_RULES_PRE_in',RTSCUC_RULES_PRE_in);
assignin('base','RTSCUC_RULES_POST_in',RTSCUC_RULES_POST_in);
assignin('base','RTSCED_RULES_PRE_in',RTSCED_RULES_PRE_in);
assignin('base','RTSCED_RULES_POST_in',RTSCED_RULES_POST_in);
assignin('base','AGC_RULES_PRE_in',AGC_RULES_PRE_in);
assignin('base','AGC_RULES_POST_in',AGC_RULES_POST_in);
assignin('base','RPU_RULES_PRE_in',RPU_RULES_PRE_in);
assignin('base','RPU_RULES_POST_in',RPU_RULES_POST_in);
assignin('base','DATA_INITIALIZE_PRE_in',DATA_INITIALIZE_PRE_in);
assignin('base','DATA_INITIALIZE_POST_in',DATA_INITIALIZE_POST_in);
assignin('base','FORECASTING_PRE_in',FORECASTING_PRE_in);
assignin('base','FORECASTING_POST_in',FORECASTING_POST_in);
assignin('base','RT_LOOP_PRE_in',RT_LOOP_PRE_in);
assignin('base','RT_LOOP_POST_in',RT_LOOP_POST_in);
assignin('base','POST_PROCESSING_PRE_in',POST_PROCESSING_PRE_in);
assignin('base','POST_PROCESSING_POST_in',POST_PROCESSING_POST_in);
assignin('base','ACE_PRE_in',ACE_PRE_in);
assignin('base','ACE_POST_in',ACE_POST_in);
assignin('base','cancel',0);
inputPath=evalin('base','inputPath');
completeinputpathname=inputPath;
assignin('base','completeinputpathname',completeinputpathname);
useHDF5=evalin('base','useHDF5');
% Get a list of all variables
allvars = whos;
% Identify the variables that ARE NOT graphics handles. This uses a regular
% expression on the class of each variable to check if it's a graphics object
tosave = cellfun(@isempty, regexp({allvars.class}, '^matlab\.(ui|graphics)\.'));