-
Notifications
You must be signed in to change notification settings - Fork 2
/
IFileFx.mod
executable file
·5645 lines (5606 loc) · 265 KB
/
IFileFx.mod
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
{++++++++++++++++++++++++++++++++++++++RAPTOR++++++++++++++++++++++++++++++++++++++}
{+ +}
{+ Implementation Module : FileFx +}
{+ Author : Chuck Carter/Steve Brown/Tony Malerich +}
{+ Last Modified : October 2008 CMC +}
{+ Description : This module handles all io functions involved with opening, +}
{+ saving, or closing .RBD and .CFG (except Prefs) files. +}
{+ +}
{++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
IMPLEMENTATION MODULE FileFx;
FROM IOMod IMPORT StreamObj, FileUseType(Input, Output, Update, Append),ReadKey;
FROM Menu IMPORT MenuItemObj;
FROM Objects IMPORT intArray,boolArray,strArray,ALL SparingType,RBDBlockObj,RBDNodeObj,LinkObj,SparePoolObj,
RapTriggerObj,poolGroup,triggerGroup,arrowhead,ALL directionType, totalSpares,totalRes,factBools,
factInts,factReals,factStrs,factFparams,factRparams,factPreParams,factPostParams,factPMParams,
factSparing,PhaseObj,InitFactorySettings,RBDHierObj,spareList,resList,trigList,deferTrig,RBDEventObj,
RBDBasicObj;
FROM GTypes IMPORT TextBufferType, ALL SysCursorType, PointArrayType;
FROM Intract IMPORT SendAlert, HelpBoxObj,GetNumParams,GetSpareList,GetResList,GetTrigList;
FROM Display IMPORT menubar,dTimeTrunc,dTimeStartTime,dCycleStartTime,dFailTrunc,dCycleTrunc,root,grid,dFailStartTime,
dNumberOfRuns,dTimeSlice, cusZoomVal, yMin, yMax,xOrigin,yOrigin,systemUnits,sysStreams,window,
systemImage,images,dialogs,totalLinks,flowGenerated,openMenuFile,totalTriggers,systemRedCost,
activePhases,phaseTimes,sysLostCost,compileType,weakAnalysis,costAnalysis,capacityAnalysis,
devVersion, SetView,defaultBlock,dZeroFail,reportPath,libraryPath,rbdPath,nameOfFile,weakLinkAnalType,
GYthreshold,YRthreshold,demoCrippleLimit,phaseObjArray,diagnosticsStream,diagFile,diagnostics,AddWindow,
sysComment,startId,endId,nextId,nextLinkId,blockGroup,eventGroup,nodeGroup,hierGroup,linkGroup,
AddHier,importing,levelLimit,deepestLevel,activeWindow,somethingChanged,termType,ClearPasteBuffer,
studentCrippleLimit,simOptionChanged;
FROM Form IMPORT FileDialogBoxObj;
FROM Image IMPORT ImageObj;
FROM OSMod IMPORT GetProgDir,FileExists;
FROM Runsim IMPORT FinalArray;
FROM Button IMPORT ButtonObj;
FROM UtilMod IMPORT DateTime;
FROM GrpMod IMPORT QueueObj;
FROM Menubar IMPORT ResetNewFile;
FROM Text IMPORT TextObj;
VAR
message : TextBufferType;
dontClose,studentFile : BOOLEAN;
PROCEDURE OpenFile(IN startOpen,append : BOOLEAN;
INOUT totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents : INTEGER;
IN appendingLevel : INTEGER;
INOUT gridIsOn, fileIsOpen : BOOLEAN;
INOUT fileName, pathName, filter : STRING;
OUT nixed : BOOLEAN);
VAR
pathString,fromRef,toRef,extension,nextString,nextString1,version,defFile : STRING;
i,j,k,numEmpParam,dotPosition,rap4ColdPools,numSpPools,numResPools,phaseGroups,
phaseRemainder,nextInt,nextInt1,nextInt2,nextInt3,nextInt4,nextInt5,nextInt6,nextInt7,
existingBlocks,existingNodes,existingHiers,existingLinks,trigsToRead,numPhases,
blocksEvents,existingEvents,appendNum,sparesToRead,resToRead,appendingDepth,
defaultToRead,importHierId : INTEGER;
linkStartX,linkStartY,linkEndX,linkEndY,newSpArr,emerTime,nextReal,spCost,
SLOtime,initCst,fixedCst,timeCst,emerCst,nextReal1,nextReal2,nextReal3,nextReal4,
nextReal5 : REAL;
cancelled,saveCancelled,validFileName,goodFile,RSO,ESO,SLO,phases,newBool,
validVersion,foundStart,foundEnd,keepPhasing,failEmp,repEmp,sbMessage,
pearson6Used,addPoolObj : BOOLEAN;
saveFile, empFile : StreamObj;
block : RBDBlockObj;
event : RBDEventObj;
node : RBDNodeObj;
hier,papaHier : RBDHierObj;
link : LinkObj;
pool : SparePoolObj;
trig : RapTriggerObj;
phase : PhaseObj;
linkPoints : PointArrayType;
failVars,repVars,preVals,postVals,pmVals,posArray,realsArray,params : realArray;
boolsArray,isBlockArray,usesPhasingArray : boolArray;
idsArray,intsArray,phaseArray : intArray;
stringArray,typeArray : strArray;
sparing : SparingType;
temp,blockImage : ImageObj;
changedArray : ARRAY INTEGER, INTEGER OF STRING;
hierFileGp : QueueObj;
BEGIN
IF (NOT append)
CloseFFile(gridIsOn,fileIsOpen,saveCancelled,fileName,pathName,filter,totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents);
ELSE
saveCancelled:=FALSE;
openMenuFile:=FALSE;
END IF;
IF NOT saveCancelled
IF NOT openMenuFile
REPEAT
IF startOpen = FALSE;
GetFileName(fileName, pathName, "*.rbd", "Select File Name");
IF fileName = "NoFile"
cancelled := TRUE;
EXIT;
END IF;
dotPosition := POSITION(fileName, ".");
extension := SUBSTR((dotPosition + 1), (dotPosition + 3), fileName);
extension := LOWER(extension);
END IF;
IF (extension <> "rbd") OR (dotPosition = 0)
NEW(message, 1..1);
message[1] := "Not a valid RBD file! ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
validFileName := FALSE;
ELSE
validFileName := TRUE;
pathString := pathName + fileName;
NEW(saveFile);
ASK saveFile TO Open(pathString, Input); {cmc 10/8/08}
IF (saveFile.ioResult <> 0)
NEW(message, 1..3);
message[1] := "RAPTOR cannot open the document '"+pathString+"'.";
message[2] := "It may have been moved or deleted from the current directory. ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
startOpen := FALSE;
ELSE
ASK saveFile TO Close;
ASK saveFile TO Open(pathString, Input);
END IF;
END IF;
UNTIL ((validFileName) AND (saveFile.ioResult = 0));
ELSE
NEW(saveFile);
ASK saveFile TO Open(menuPath+menuFile, Input); {cmc 10/8/08}
dotPosition := POSITION(menuFile, ".");
IF (saveFile.ioResult <> 0)
NEW(message, 1..3);
message[1] := "RAPTOR cannot open the document '"+menuPath+menuFile+"'.";
message[2] := "It may have been moved or deleted from the current directory. ";
{cmc 10/8/08}
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
ASK window TO SetTitle(versionStr + " - ");
ASK menubar TO Enable(6);
ASK window TO Draw;
ResetNewFile;
RETURN;
ELSE
ASK saveFile TO Close;
ASK saveFile TO Open(menuPath+menuFile, Input);
END IF;
pathName := menuPath;
fileName := menuFile;
END IF;
IF NOT cancelled
{at this point a valid RBD file is open}
ASK window TO SetSysCursor(BusyCursor);
IF gridIsOn
ASK grid TO Colorize("Normal");
ELSE
ASK grid TO Colorize("Hide");
END IF;
fileIsOpen := TRUE;
ASK saveFile TO ReadString(version);
validVersion:=TRUE;
studentFile := FALSE;
IF (SUBSTR(1,8,version)="Version7")
IF ( (STRTOREAL (SUBSTR(10,12,version))) > 6.3 )
rapVersion:=7;
nextString:=SUBSTR(10,12,version);
nextReal:= STRTOREAL(nextString);
IF nextReal < 6.5
validVersion:=FALSE;
NEW(message, 1..4);
message[1] := " Raptor can not open this file!!! ";
message[2] := " BETA ALERT! ";
message[3] := "This beta version file is not supported. If you would like to ";
message[4] := "use this file contact Mr. Kenneth Murphy at RAPTORTECH@arinc.com.";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
RETURN;
END IF;
IF ((nextReal = 6.5) AND (compileType = "demo"))
validVersion:=FALSE;
NEW(message, 1..3);
message[1] := "This is the demo version of Raptor. It ";
message[2] := "is incompatible with this file version,";
message[3] := "and is unable to open this RBD";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
END IF;
IF ((nextReal > 6.5) AND (compileType = "gmd"))
validVersion:=FALSE;
NEW(message, 1..4);
message[1] := " Raptor can not open this file!!! ";
message[2] := " FILE ALERT! ";
message[3] := "This file is not supported by Raptor 6.5. If you would like to ";
message[4] := "use this file contact Mr. Kenneth Murphy at RAPTORTECH@arinc.com.";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
RETURN;
END IF;
{ ASK saveFile TO ReadString(nextString); tony 1-05: removed because we no longer write a devName}
ASK saveFile TO ReadString(nextString); {looking to see if student version file}
IF nextString="Student"
studentFile:=TRUE;
END IF;
ELSE
validVersion:=FALSE;
NEW(message, 1..4);
message[1] := " MARS ATTACKS ALERT!!! ";
message[2] := " ";
message[3] := "This beta version file is not supported. If you would like to ";
message[4] := "use this file contact Mr. Kenneth Murphy at RAPTORTECH@arinc.com.";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
RETURN;
END IF;
ELSIF (SUBSTR(1,8,version)="Version6")
rapVersion:=6;
IF SUBSTR(10,10,version) < "N"
validVersion:=FALSE;
NEW(message, 1..4);
message[1] := " GORGON ALERT!!! ";
message[2] := " ";
message[3] := "This beta version file is not supported. If you would like to ";
message[4] := "use this file contact Mr. Kenneth Murphy at RAPTORTECH@arinc.com.";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
RETURN;
END IF;
ELSIF (SUBSTR(1,8,version)="Version5")
rapVersion:=6;
ELSIF (version="Version+")
rapVersion:=5;
ELSE
validVersion:=FALSE;
NEW(message, 1..4);
message[1] := "The file does not appear to properly formatted. It may be from ";
message[2] := "an incompatible version of RAPTOR that is not supported by ";
message[3] := versionStr+". If you would like an old file converted to ";
message[4] := versionStr+" email the file to RAPTORTECH@arinc.com.";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
RETURN;
END IF;
IF ((append) AND (rapVersion<>7))
validVersion:=FALSE;
NEW(message, 1..3);
message[1] := " IMPORT ALERT!!! ";
message[2] := "The Import RBD feature is only valid with a "+versionStr+" file.";
message[3] := " Please save the file as a "+versionStr+" before importing.";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
ASK window TO SetSysCursor(NormalCursor);
RETURN;
END IF;
IF (fileName <> "Unnamed RBD");
ASK menubar TO AddFileName(pathName, fileName);
rbdPath:=pathName;
END IF;
ASK saveFile TO ReadLine(nextString);
NEW(posArray,1..2);
NEW(idsArray, 1..3);
NEW(boolsArray, 1..18);
NEW(intsArray, 1..17);
NEW(realsArray, 1..28);
NEW(stringArray, 1..6);
{***}
IF diagnostics
ASK diagnosticsStream TO Open(diagFile, Append);
ASK diagnosticsStream TO WriteLn;
nextString:="Opened file "+pathName+fileName;
ASK diagnosticsStream TO WriteString(nextString);
ASK diagnosticsStream TO WriteLn;
ASK diagnosticsStream TO Close;
END IF;
{***}
IF append
existingBlocks:=totalBlocks;
existingEvents:=totalEvents;
existingNodes:=totalNodes;
existingHiers:=totalHiers;
existingLinks:=totalLinks;
keepPhasing:=FALSE;
appendNum:=nextId;
defaultToRead:=0;
ELSE
existingBlocks:=0;
existingEvents:=0;
existingNodes:=0;
existingHiers:=0;
existingLinks:=0;
keepPhasing:=TRUE;
appendNum:=0;
nextId:=1;
nextLinkId:=1; {beta145}
defaultToRead:=1;
END IF;
{begin read hierarchy rbd}
IF rapVersion=7
NEW(hierFileGp);
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt); {activePhases}
IF ((append) AND (nextInt=activePhases)) {eag - phasing kept if # of phases is same in imported rbd as original}
keepPhasing:=TRUE;
ELSIF (NOT append)
activePhases:=nextInt;
END IF;
numPhases:=nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
totalBlocks:=existingBlocks+nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
totalEvents:=existingEvents+nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
totalNodes:=existingNodes+nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
totalLinks:=existingLinks+nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(sparesToRead);
IF (NOT append)
numSpPools:=sparesToRead;
ELSE
numSpPools:=totalSpares;
END IF;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(resToRead);
IF (NOT append)
numResPools:=resToRead;
END IF;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(trigsToRead);
IF (NOT append)
totalTriggers:=trigsToRead;
END IF;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
totalHiers:=existingHiers+nextInt;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt);
IF (NOT append)
deepestLevel:=nextInt;
IF ((nextInt) > levelLimit)
NEW(message, 1..3);
message[1] := " EXCEEDS LEVEL LIMIT!!! ";
message[2] := versionStr+" cannot open this RBD because it ";
message[3] := "exceeds the maximum possible levels. ";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
END IF;
ELSE
appendingDepth:=nextInt;
END IF;
IF ((totalBlocks > demoCrippleLimit) AND (compileType = "demo"))
NEW(message, 1..3);
message[1] := "This demo version limits the number of blocks on screen ";
IF (NOT append)
message[2] := "to "+INTTOSTR(demoCrippleLimit)+". The file you are attempting to open contains";
message[3] := "more than "+INTTOSTR(demoCrippleLimit)+" blocks. ";
ELSE
message[2] := "to "+INTTOSTR(demoCrippleLimit)+". The file you are attempting to import would increase";
message[3] := "the total to more than "+INTTOSTR(demoCrippleLimit)+" blocks. ";
END IF;
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
ELSIF ((compileType="student") AND (totalBlocks > studentCrippleLimit))
NEW(message, 1..3);
NEW(message, 1..3);
message[1] := "This student version limits the number of blocks on screen ";
IF (NOT append)
message[2] := "to "+INTTOSTR(studentCrippleLimit)+". The file you are attempting to open contains";
message[3] := "more than "+INTTOSTR(studentCrippleLimit)+" blocks. ";
ELSE
message[2] := "to "+INTTOSTR(studentCrippleLimit)+". The file you are attempting to import would increase";
message[3] := "the total to more than "+INTTOSTR(studentCrippleLimit)+" blocks. ";
END IF;
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
ELSIF ((compileType="student") AND (NOT studentFile))
NEW(message, 1..3);
message[1] := "This is the student version of Raptor. It ";
message[2] := "is incompatible with the full release version";
message[3] := "of Raptor, so is unable to open this file";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
ELSIF ((compileType="demo") AND (studentFile))
NEW(message, 1..3);
message[1] := "This is the demo version of Raptor. It ";
message[2] := "is incompatible with the student version,";
message[3] := "and is unable to open this file";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
ELSIF ((compileType="gmd") AND (studentFile))
NEW(message, 1..3);
message[1] := "This is Raptor version 6.5. It ";
message[2] := "is incompatible with the student version,";
message[3] := "and is unable to open this file";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
END IF;
IF (NOT append)
activeWindow:=0;
DISPOSE(phaseTimes);
IF activePhases <> 0
NEW(phaseTimes, 1..activePhases);
NEW(phaseArray, 1..activePhases);
ELSE
NEW(phaseTimes, 1..1);
NEW(phaseArray, 1..1);
END IF;
ASK saveFile TO ReadString(nextString);{/}
ASK saveFile TO ReadString(nextString); {System Data}
ASK saveFile TO ReadString(nextString); {System Data}
ASK saveFile TO ReadLine(nextString); {} {Start of System section }
ASK saveFile TO ReadString(systemImage);
ASK saveFile TO ReadString(nextString);
IF nextString = "TimeSim"
termType := 1;
ASK saveFile TO ReadReal(dTimeTrunc);
ASK saveFile TO ReadReal(dTimeStartTime);
dFailTrunc:=1.0;
dCycleTrunc:=10.0;
ELSIF nextString = "FailSim"
termType := 2;
ASK saveFile TO ReadReal(dFailTrunc);
ASK saveFile TO ReadReal(dFailStartTime);
dTimeTrunc:=1000.0;
dCycleTrunc:=10.0;
ELSIF nextString = "CycleSim"
termType := 3;
ASK saveFile TO ReadReal(dCycleTrunc);
ASK saveFile TO ReadReal(dCycleStartTime);
dTimeTrunc:=1000.0;
dFailTrunc:=1.0;
END IF;
ASK saveFile TO ReadReal(dNumberOfRuns);
ASK saveFile TO ReadReal(dTimeSlice);
ASK saveFile TO ReadReal(yMin);
ASK saveFile TO ReadReal(yMax);
ASK saveFile TO ReadReal(cusZoomVal); {zoom}
ASK saveFile TO ReadString(systemUnits);
ASK saveFile TO ReadString(nextString);
IF nextString = "GraphicsOn"
dSimWithGraph := TRUE;
ELSE
dSimWithGraph := FALSE;
END IF;
FOR i:=1 TO 11
ASK saveFile TO ReadInt(sysStreams[i]);
END FOR;
ASK saveFile TO ReadReal(xOrigin); {x center}
ASK saveFile TO ReadReal(yOrigin); {y center}
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=0)
negShutUp:=FALSE;
ELSE
negShutUp:=TRUE;
END IF;
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=0)
dZeroFail:=FALSE;
ELSE
dZeroFail:=TRUE;
END IF;
ASK saveFile TO ReadInt(flowGenerated);
ASK saveFile TO ReadReal(systemRedCost); {system redCost}
ASK saveFile TO ReadReal(sysLostCost);
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=0)
weakAnalysis:=FALSE;
ELSE
weakAnalysis:=TRUE;
END IF;
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=0)
costAnalysis:=FALSE;
ELSE
costAnalysis:=TRUE;
END IF;
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=0)
capacityAnalysis:=FALSE;
ELSE
capacityAnalysis:=TRUE;
END IF;
ASK saveFile TO ReadString(nextString);
IF nextString="Availability"
weakLinkAnalType:=1;
ELSIF nextString="Dependability"
weakLinkAnalType:=2;
ELSE
weakLinkAnalType:=3;
END IF;
ASK saveFile TO ReadReal(GYthreshold);
ASK saveFile TO ReadReal(YRthreshold);
ASK saveFile TO ReadInt(nextInt); {not used}
IF (nextInt=-1)
ProtectedFile := TRUE;
NEW(message, 1..3);
message[1] := "The file is read only. You may view it and ";
message[2] := "simulate it, but you will not be able to save";
message[3] := "any changes.";
ELSIF ((nextInt=1) AND (compileType="demo"))
NEW(message, 1..3);
message[1] := "This is the demo version of Raptor.";
message[2] := "It is incompatible with the student version,";
message[3] := "and is unable to open this file";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
ELSE
ProtectedFile := FALSE;
END IF;
ASK saveFile TO ReadLine(nextString);
ASK saveFile TO ReadLine(nextString); {EndOfSystemData}
IF nextString<>"EndOfSystemData"
{add any new variables here}
END IF;
loadingFile:=TRUE;
SetView(cusZoomVal,xOrigin,yOrigin);
loadingFile:=FALSE;
ELSE {append}
FOR i:=1 TO 6
ASK saveFile TO ReadLine(nextString);
IF i=4
FOR j:=1 TO 8 {to get zoom value from appending rbd}
ASK saveFile TO ReadString(nextString);
END FOR;
ASK saveFile TO ReadReal(nextReal);
FOR j:=1 TO 26 {to check read only value}
ASK saveFile TO ReadString(nextString);
END FOR;
ASK saveFile TO ReadInt(nextInt3);
END IF;
END FOR;
IF activeWindow>0
hier := ASK root Child("RBDHier",activeWindow);
nextInt:=hier.level
ELSE
nextInt:=0;
END IF;
IF ((nextInt+appendingDepth) >= levelLimit) {>= is appropriate}
NEW(message, 1..3);
message[1] := " EXCEEDS LEVEL LIMIT!!! ";
message[2] := "Importing this rbd as a hierarchy would ";
message[3] := "exceed the maximum possible levels. ";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
END IF;
IF ((nextInt + appendingDepth + 1) > deepestLevel)
deepestLevel := nextInt + appendingDepth + 1;
END IF; {eag}
IF (nextInt3 = -1)
NEW(message, 1..2);
message[1] := " This rbd is read only. ";
message[2] := "It cannot be imported as a hierarchy ";
ErrorOpeningFile(totalBlocks,totalNodes,totalLinks,totalHiers,totalEvents,existingBlocks,existingNodes,
existingLinks,existingHiers,existingEvents,totalTriggers,numResPools,saveFile,fileIsOpen,saveCancelled,append,nixed);
CleanArrays(posArray,realsArray,idsArray,intsArray,boolsArray,stringArray);
RETURN;
END IF;
somethingChanged:=TRUE;
importing:=TRUE;
AddHier;
INC(existingHiers);
hier := ASK window Child("RBDHier",nextId-1);
importHierId:=nextId-1;
ASK hier TO SetName(SUBSTR(1,dotPosition-1,fileName));
ASK hier TO SetZoom(nextReal);
END IF; {NOT append}
ASK saveFile TO ReadLine(nextString); {__HIERARCHY_DATA}
ASK saveFile TO ReadLine(nextString); {column header}
FOR i := (existingHiers+1) TO totalHiers {read in hierarchy table in .rbd file}
NEW(hier);
ASK hierGroup TO Add(hier);
ASK hierFileGp TO Add(hier);
ASK hier TO LoadFromLibrary (images, "RBDHier");
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadInt(nextInt); {Id}
ASK saveFile TO ReadReal(nextReal1); {xPosition}
ASK saveFile TO ReadReal(nextReal2); {yPosition}
ASK hier TO SetID("RBDHier", (appendNum+nextInt));
ASK root TO AddAfterGraphic((ASK root Child("RBDBlock",0)),hier);
ASK saveFile TO ReadInt(nextInt); {parentID}
ASK hier TO SetParentID(nextInt+appendNum);
IF hier.parentID=activeWindow
ASK hier TO DisplayAt(nextReal1/1.25, nextReal2/1.25); {x & y coordinates}
ASK hier TO Draw; {only if hier on top level}
ELSE
ASK hier TO SetHidden(TRUE);
ASK hier TO DisplayAt(nextReal1/1.25, nextReal2/1.25); {x & y coordinates}
END IF;
ASK hier TO SetName(nextString);
ASK saveFile TO ReadInt(nextInt1); {connectIntoNum}
ASK saveFile TO ReadInt(nextInt2); {ConnectOutOfNum}
FOR j := 1 TO nextInt1
ASK hier TO IncLink(INTO);
END FOR;
FOR j := 1 TO nextInt2
ASK hier TO IncLink(OUTOF);
END FOR;
ASK saveFile TO ReadInt(nextInt);
IF nextInt=1
ASK hier TO SetConnectToNode(TRUE);
ELSE
ASK hier TO SetConnectToNode(FALSE);
END IF;
ASK saveFile TO ReadReal(nextReal);
ASK hier TO SetZoom(nextReal);
ASK saveFile TO ReadReal(nextReal);
ASK hier TO SetxCenter(nextReal);
ASK saveFile TO ReadReal(nextReal);
ASK hier TO SetyCenter(nextReal);
ASK saveFile TO ReadInt(nextInt);
ASK hier TO SetInID(nextInt+appendNum);
ASK saveFile TO ReadInt(nextInt);
ASK hier TO SetOutID(nextInt+appendNum);
ASK saveFile TO ReadInt(nextInt);
ASK hier TO SetLevel(nextInt+appendingLevel);
ASK saveFile TO ReadInt(nextInt);
IF (nextInt=1) AND (keepPhasing) {eag}
ASK hier TO SetusesPhasing(TRUE);
ELSE
ASK hier TO SetusesPhasing(FALSE);
END IF;
ASK hier TO CreateChildGroup;
ASK saveFile TO ReadReal(nextReal1); {xOrigin}
ASK saveFile TO ReadReal(nextReal2); {yOrigin}
nextReal:= STRTOREAL(SUBSTR(12,15,version));
IF nextReal = 4.2 {Otto, hier x-yOrigins not set}
nextReal1:=0.0;
nextReal2:=80.0;
END IF;
ASK hier TO SetOrigin(nextReal1,nextReal2);
ASK saveFile TO ReadInt(nextInt); {myDepth}
ASK hier TO SetmyDepth(nextInt);
ASK saveFile TO ReadInt(nextInt); {emptyInt}
ASK saveFile TO ReadInt(nextInt); {emptyInt}
ASK saveFile TO ReadReal(nextReal); {emptyReal}
ASK saveFile TO ReadReal(nextReal); {emptyReal}
END FOR;
FOREACH hier IN hierFileGp
IF hier.parentID <> activeWindow
papaHier := ASK root Child("RBDHier", hier.parentID);
IF papaHier=NILOBJ
papaHier := ASK window Child("RBDHier",hier.parentID);
END IF;
ASK papaHier.childGroup TO Add(hier);
END IF;
END FOREACH;
ASK saveFile TO ReadString(nextString);
ASK saveFile TO ReadLine(nextString); {EndofHierarchyData}
ASK saveFile TO ReadLine(nextString); {__BLOCK_DATA}
ASK saveFile TO ReadLine(nextString); {column header}
FOR i := (existingBlocks+1) TO (totalBlocks+defaultToRead) {read in first table in .rbd file}
ASK saveFile TO ReadString(nextString); {block.blockName}
ASK saveFile TO ReadInt(nextInt1); {block.Id}
IF nextInt1=0
block := ASK root Child("RBDBlock",0);
ELSE
NEW(block);
END IF;
ASK saveFile TO ReadReal(nextReal1); {xPosition}
ASK saveFile TO ReadReal(nextReal2); {yPosition}
ASK saveFile TO ReadInt(nextInt2); {parentID}
ASK saveFile TO ReadInt(nextInt3); {block.connectIntoNum}
ASK saveFile TO ReadInt(nextInt4); {block.ConnectOutOfNum}
IF nextInt1<>0
ASK block TO LoadFromLibrary (images, "RBDBlock"); {tony10-04-roys goofy rbd}
END IF;
ASK block TO SetID("RBDBlock", (appendNum+nextInt1)); {block number}
IF nextInt1<>0
ASK blockGroup TO Add(block);
ASK root TO AddAfterGraphic((ASK root Child("RBDBlock",0)),block);
ASK block TO SetParentID(appendNum+nextInt2);
IF (block.parentID=activeWindow)
ASK block TO DisplayAt(nextReal1/1.25, nextReal2/1.25); {x & y coordinates}
ASK block TO Draw; {only display if block on top level}
ELSE
ASK block TO SetHidden(TRUE);
papaHier := ASK root Child("RBDHier", block.parentID);
IF papaHier=NILOBJ
papaHier := ASK window Child("RBDHier",block.parentID);
END IF;
ASK papaHier.childGroup TO Add(block);
ASK block TO DisplayAt(nextReal1/1.25, nextReal2/1.25); {x & y coordinates}
END IF;
FOR j := 1 TO nextInt3
ASK block TO IncLink(INTO);
END FOR;
FOR j := 1 TO nextInt4
ASK block TO IncLink(OUTOF);
END FOR;
END IF;
IF nextInt1<>0
ASK block TO SetDefaultBlockName(nextString); {tony10-04-roys goofy rbd}
END IF;
ASK block TO SetInitName(nextString);
ASK saveFile TO ReadInt(nextInt); {usesPhasing}
IF (nextInt = 1)
ASK block TO SetusesPhasing(TRUE);
ELSE
ASK block TO SetusesPhasing(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {simStartType}
ASK block TO SetsimStartType(nextInt);
ASK saveFile TO ReadReal(nextReal); {amountExhausted}
ASK block TO SetamountExhausted(nextReal);
ASK saveFile TO ReadInt(nextInt1); {failDistro}
ASK block TO SetfailDistro(nextInt1);
ASK saveFile TO ReadInt(nextInt2); {numFailParams}
ASK block TO SetnumFailParams(nextInt2);
ASK saveFile TO ReadInt(nextInt); {failStream}
ASK block TO SetfailStream(nextInt);
IF nextInt1=16
failEmp:=TRUE;
ELSE
NEW(failVars, 1..nextInt2);
END IF;
FOR j := 1 TO 3
ASK saveFile TO ReadReal(nextReal); {failure distribution parameters}
IF ((j<=nextInt2) AND (NOT failEmp))
failVars[j] := nextReal;
END IF;
END FOR;
IF (NOT failEmp)
ASK block TO SetfailVals(failVars);
END IF;
DISPOSE(failVars);
ASK saveFile TO ReadInt(nextInt1); {repairDistro}
ASK block TO SetrepairDistro(nextInt1);
ASK saveFile TO ReadInt(nextInt2); {numRepairParams}
ASK block TO SetnumRepairParams(nextInt2);
ASK saveFile TO ReadInt(nextInt); {repairStream}
ASK block TO SetrepairStream(nextInt);
IF nextInt1=16
repEmp:=TRUE;
ELSE
NEW(repVars, 1..nextInt2);
END IF;
FOR j := 1 TO 3
ASK saveFile TO ReadReal(nextReal); {repair distribuiton parameters}
IF ((j <= nextInt2) AND (NOT repEmp))
repVars[j] := nextReal;
END IF;
END FOR;
IF (NOT repEmp);
ASK block TO SetrepairVals(repVars);
END IF;
DISPOSE(repVars);
ASK saveFile TO ReadReal(nextReal); {SBstress}
ASK block TO SetSBstress(nextReal);
ASK saveFile TO ReadInt(nextInt); {GDType} {1=linear,2=geometric, 3=asymptotic}
ASK block TO SetGDType(nextInt);
ASK saveFile TO ReadReal(nextReal); {GDRate}
ASK block TO SetGDRate(nextReal);
ASK saveFile TO ReadReal(nextReal); {GDLimit}
ASK block TO SetGDLimit(nextReal);
ASK saveFile TO ReadString(nextString); {poolName}
ASK block TO SetpoolName(nextString);
ASK saveFile TO ReadString(nextString); {sparingType}
IF nextString = "Infinite"
sparing := Infinite;
ASK block TO SetinfiniteSpares(TRUE);
ELSIF nextString = "Pooled"
sparing := SparePool;
ELSIF nextString = "Custom"
sparing := Custom;
ELSE
sparing := None;
END IF;
ASK block TO SetsparingType(sparing);
ASK saveFile TO ReadInt(nextInt); {RSO}
IF nextInt = 1
ASK block TO SetroutineSpareOrdering(TRUE);
ELSE
ASK block TO SetroutineSpareOrdering(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {initStock}
ASK block TO SetinitStock(nextInt);
ASK saveFile TO ReadInt(nextInt); {newSpares}
ASK block TO SetnewSpares(nextInt);
ASK saveFile TO ReadReal(nextReal);{arriveEvery}
ASK block TO SetarrivalRate(nextReal);
ASK saveFile TO ReadInt(nextInt); {ESO}
IF nextInt = 1
ASK block TO SetemerSpareOrdering(TRUE);
ELSE
ASK block TO SetemerSpareOrdering(FALSE);
END IF;
ASK saveFile TO ReadReal(nextReal); {emerTime}
ASK block TO SetemerTime(nextReal);
ASK saveFile TO ReadInt(nextInt); {SLO}
IF nextInt = 1
ASK block TO SetstockLevelOrdering(TRUE);
ELSE
ASK block TO SetstockLevelOrdering(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {level}
ASK block TO SetSLOOrderLevel(nextInt);
ASK saveFile TO ReadInt(nextInt); {quantity}
ASK block TO SetSLONewSpares(nextInt);
ASK saveFile TO ReadReal(nextReal); {SLOTime}
ASK block TO SetSLOTime(nextReal);
ASK saveFile TO ReadInt(nextInt); {preDist}
IF nextInt=0
nextInt:=19;
END IF;
ASK block TO SetpreDist(nextInt);
GetNumParams(block.preDist,nextInt); {numPreLdtParams}
NEW(failVars, 1..nextInt);
FOR j := 1 TO 3
ASK saveFile TO ReadReal(nextReal); {preLDT distribuiton parameters}
IF j<=nextInt
failVars[j] := nextReal;
END IF;
END FOR;
ASK block TO SetpreParams(failVars);
DISPOSE(failVars);
ASK saveFile TO ReadInt(nextInt); {postDist}
IF nextInt=0
nextInt:=19;
END IF;
ASK block TO SetpostDist(nextInt);
GetNumParams(block.postDist,nextInt); {numPosrLDTParams}
NEW(failVars, 1..nextInt);
FOR j := 1 TO 3
ASK saveFile TO ReadReal(nextReal); {postLDT distribuiton parameters}
IF j<=nextInt
failVars[j] := nextReal;
END IF;
END FOR;
ASK block TO SetpostParams(failVars);
DISPOSE(failVars);
ASK saveFile TO ReadInt(nextInt); {numDiffRes}
ASK saveFile TO ReadInt(nextInt1); {numRes1}
ASK saveFile TO ReadInt(nextInt2); {numRes1PM}
ASK saveFile TO ReadString(nextString); {res1Name}
ASK block TO SetnumDiffRes(nextInt);
ASK block TO SetnumRes1(nextInt1);
ASK block TO SetnumRes1PM(nextInt2);
ASK block TO Setres1Name(nextString);
ASK saveFile TO ReadInt(nextInt); {UsesPM}
IF nextInt = 1
ASK block TO SetUsesPM(TRUE);
ELSE
ASK block TO SetUsesPM(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {pmSpare}
IF nextInt = 1
ASK block TO SetpmSpare(TRUE);
ELSE
ASK block TO SetpmSpare(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {pmRefresh}
IF nextInt = 1
ASK block TO SetpmRefresh(TRUE);
ELSE
ASK block TO SetpmRefresh(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {pmMisDefer}
IF nextInt = 1
ASK block TO SetpmMisDefer(TRUE);
ELSE
ASK block TO SetpmMisDefer(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {pmFailReset}
IF nextInt = 1
ASK block TO SetpmFailReset(TRUE);
ELSE
ASK block TO SetpmFailReset(FALSE);
END IF;
ASK saveFile TO ReadInt(nextInt); {pmReqDefer}
IF nextInt = 1
ASK block TO SetpmReqDefer(TRUE);
ELSE
ASK block TO SetpmReqDefer(FALSE);
END IF;
ASK saveFile TO ReadReal(nextReal); {pmStagger}
ASK block TO SetpmStagger(nextReal);
ASK saveFile TO ReadReal(nextReal); {pmFreq}
ASK block TO SetpmFreq(nextReal);
ASK saveFile TO ReadInt(nextInt); {pmTriggered}
IF nextInt = 1
ASK block TO SetpmTriggered(TRUE);
ELSE
ASK block TO SetpmTriggered(FALSE);
END IF;
ASK saveFile TO ReadString(nextString);
ASK block TO SetpmTrig(nextString);
ASK saveFile TO ReadInt(nextInt); {postDist}
IF nextInt=0
nextInt:=19;
END IF;
ASK block TO SetpmDist(nextInt);
GetNumParams(block.pmDist,nextInt); {numPMParams}
NEW(failVars, 1..nextInt);
FOR j := 1 TO 3
ASK saveFile TO ReadReal(nextReal); {pm distribution parameters}
IF j<=nextInt
failVars[j] := nextReal;
END IF;
END FOR;
ASK block TO SetpmParams(failVars);
DISPOSE(failVars);
ASK saveFile TO ReadInt(nextInt); {DependencyNum}
IF ((nextInt>0) AND (append))
nextInt:=nextInt+appendNum;
END IF;
ASK saveFile TO ReadReal(nextReal); {DepNothingPerc}
ASK saveFile TO ReadReal(nextReal1); {DepIdlePerc}
ASK saveFile TO ReadReal(nextReal2); {DepPMPerc}
ASK saveFile TO ReadReal(nextReal3); {DepFailPerc}
ASK saveFile TO ReadReal(nextReal4); {DepPMThreshold}
ASK saveFile TO ReadInt(nextInt1);
IF nextInt1 = 1
newBool:=TRUE;
ELSE
newBool:=FALSE;
END IF;
ASK saveFile TO ReadString(nextString1); {DepType}
IF NOT(nextInt>0)
nextString1:="";
END IF;
ASK block TO SetDep(nextInt,nextString1);
ASK block TO SetDepVals(nextReal,nextReal1,nextReal2,nextReal3,nextReal4,newBool);
ASK saveFile TO ReadReal(nextReal); {initialCost}
ASK block TO SetinitialCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {Running operating Cost}
ASK block TO SetOperatingCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {standbyCost}
ASK block TO SetstandbyCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {idleCost}
ASK block TO SetidleCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {repHoldCost}
ASK block TO SetrepHoldCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {repPerTime}
ASK block TO SetrepairingCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {repFixed}
ASK block TO SetrepFixedCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {donePerTime}
ASK block TO SetdoneCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {doneFixed}
ASK block TO SetdoneFixedCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {pmHoldCost}
ASK block TO SetpmHoldCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {pmCost}
ASK block TO SetpmCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {pmFixedCost}
ASK block TO SetpmFixedCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {spareCost}
ASK block TO SetspareCost(nextReal);
ASK saveFile TO ReadReal(nextReal); {emerShippingCost}
ASK block TO SetemerShippingCost(nextReal);
ASK saveFile TO ReadInt(nextInt); {alwaysAddDoneCost}
IF nextInt = 1
ASK block TO SetalwaysAddDoneCost(TRUE);
ELSE
ASK block TO SetalwaysAddDoneCost(FALSE);
END IF;
IF ((numPhases>0) AND (block.usesPhasing))
NEW(params,1..numPhases);
NEW(typeArray,1..numPhases);
FOR j := 1 TO numPhases
ASK saveFile TO ReadString(nextString); {phase values}
typeArray[j]:=SUBSTR(1,1,nextString);
ASK saveFile TO ReadReal(nextReal);
params[j]:=nextReal;
END FOR;
IF keepPhasing
ASK block TO SetPhases(TRUE, params,typeArray);
ELSE
ASK block TO SetusesPhasing(FALSE);
END IF;
DISPOSE(params);
DISPOSE(typeArray);
END IF; {(numPhases>0) AND (block.usesPhasing)}
IF failEmp
ASK saveFile TO ReadLine(nextString);
NEW(failVars,1..block.numFailParams);
FOR j:=1 TO block.numFailParams