-
Notifications
You must be signed in to change notification settings - Fork 401
/
Copy pathCreateNewIDFUsingRulesV9_4_0.f90
1474 lines (1336 loc) · 68.1 KB
/
CreateNewIDFUsingRulesV9_4_0.f90
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
MODULE SetVersion
USE DataStringGlobals
USE DataVCompareGlobals
PUBLIC
CONTAINS
SUBROUTINE SetThisVersionVariables()
VerString='Conversion 9.3 => 9.4'
VersionNum=9.4
sVersionNum='9.4'
IDDFileNameWithPath=TRIM(ProgramPath)//'V9-3-0-Energy+.idd'
NewIDDFileNameWithPath=TRIM(ProgramPath)//'V9-4-0-Energy+.idd'
RepVarFileNameWithPath=TRIM(ProgramPath)//'Report Variables 9-3-0 to 9-4-0.csv'
END SUBROUTINE
END MODULE
SUBROUTINE CreateNewIDFUsingRules(EndOfFile,DiffOnly,InLfn,AskForInput,InputFileName,ArgFile,ArgIDFExtension)
! SUBROUTINE INFORMATION:
! AUTHOR Linda Lawrie
! DATE WRITTEN July 2002
! MODIFIED For each release
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine creates new IDFs based on the rules specified by
! developers. This will result in a more complete transition but
! takes more time to create.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE InputProcessor
USE DataVCompareGlobals
USE VCompareGlobalRoutines
USE DataStringGlobals, ONLY: ProgNameConversion
USE General
USE DataGlobals, ONLY: ShowMessage, ShowContinueError, ShowFatalError, ShowSevereError, ShowWarningError
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
LOGICAL, INTENT(INOUT) :: EndOfFile
LOGICAL, INTENT(IN) :: DiffOnly
INTEGER, INTENT(IN) :: InLfn
LOGICAL, INTENT(IN) :: AskForInput
CHARACTER(len=*), INTENT(IN) :: InputFileName
LOGICAL, INTENT(IN) :: ArgFile
CHARACTER(len=*), INTENT(IN) :: ArgIDFExtension
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: fmta="(A)"
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER IoS
INTEGER DotPos
INTEGER Status
INTEGER NA
INTEGER NN
INTEGER CurArgs
INTEGER DifLfn
INTEGER xCount
INTEGER Num
INTEGER, EXTERNAL :: GetNewUnitNumber
INTEGER Arg
LOGICAL, SAVE :: FirstTime=.true.
CHARACTER(len=30) UnitsArg
CHARACTER(len=MaxNameLength) :: ObjectName
CHARACTER(len=30), EXTERNAL :: TrimTrailZeros
CHARACTER(len=MaxNameLength) :: UCRepVarName=blank
CHARACTER(len=MaxNameLength) :: UCCompRepVarName=blank
LOGICAL DelThis
INTEGER pos
INTEGER pos2
LOGICAL ExitBecauseBadFile
LOGICAL StillWorking
LOGICAL NoDiff
LOGICAL checkrvi
LOGICAL NoVersion
LOGICAL DiffMinFields ! Set to true when diff number of min-fields between the two objects
LOGICAL Written
INTEGER :: Var
INTEGER :: CurVar
LOGICAL ArgFileBeingDone
LOGICAL LatestVersion
CHARACTER(len=10) :: LocalFileExtension=' '
LOGICAL :: WildMatch
LOGICAL :: ConnComp
LOGICAL :: ConnCompCtrl
LOGICAL :: FileExist
CHARACTER(len=MaxNameLength) :: CreatedOutputName
LOGICAL, ALLOCATABLE, DIMENSION(:) :: DeleteThisRecord
INTEGER :: COutArgs
CHARACTER(len=16) :: UnitsField
LOGICAL :: ErrFlag
INTEGER :: I, CurField, NewField, KAindex=0, SearchNum
INTEGER :: AlphaNumI
REAL :: SaveNumber
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! I N S E R T L O C A L V A R I A B L E S H E R E !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
LOGICAL :: processNumberErrFlag
INTEGER :: convertedNumber
INTEGER :: numOutputDiagnostics = 0
INTEGER :: numOutputDiagnosticsNames = 0
INTEGER outputDiagnosticNum
CHARACTER(len=MaxNameLength) :: OutputDiagnosticsName
CHARACTER(len=MaxNameLength), ALLOCATABLE, DIMENSION(:) :: OutputDiagnosticsNames
LOGICAL :: alreadyProcessedOneOutputDiagnostic=.false.
INTEGER :: nE, nEC, nG, nNG, nFO, nFON
LOGICAL :: changeMeterNameFlag
INTEGER :: totMeterCustom = 0
INTEGER :: totMeterCustomDecr = 0
INTEGER numMeterCustom
CHARACTER(len=MaxNameLength) :: MeterCustomName
CHARACTER(len=MaxNameLength), ALLOCATABLE, DIMENSION(:) :: MeterCustomNames
LOGICAL :: throwPythonWarning = .TRUE.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! E N D O F I N S E R T L O C A L V A R I A B L E S H E R E !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
If (FirstTime) THEN ! do things that might be applicable only to this new version
FirstTime=.false.
EndIf
StillWorking=.true.
ArgFileBeingDone=.false.
LatestVersion=.false.
NoVersion=.true.
LocalFileExtension=ArgIDFExtension
EndOfFile=.false.
IOS=0
DO WHILE (StillWorking)
ExitBecauseBadFile=.false.
DO WHILE (.not. EndOfFile)
IF (AskForInput) THEN
WRITE(*,*) 'Enter input file name, with path'
write(*,fmta,advance='no') '-->'
READ(*,fmta) FullFileName
ELSE
IF (.not. ArgFile) THEN
READ(InLfn,*,IOSTAT=IoS) FullFileName
ELSEIF (.not. ArgFileBeingDone) THEN
FullFileName=InputFileName
IOS=0
ArgFileBeingDone=.true.
ELSE
FullFileName=Blank
IOS=1
ENDIF
IF (FullFileName(1:1) == '!') THEN
FullFileName=Blank
CYCLE
ENDIF
ENDIF
UnitsArg=Blank
IF (IoS /= 0) FullFileName=Blank
FullFileName=ADJUSTL(FullFileName)
IF (FullFileName /= Blank) THEN
CALL DisplayString('Processing IDF -- '//TRIM(FullFileName))
WRITE(Auditf,fmta) ' Processing IDF -- '//TRIM(FullFileName)
DotPos=SCAN(FullFileName,'.',.true.) ! Scan backward looking for extension,
IF (DotPos /= 0) THEN
FileNamePath=FullFileName(1:DotPos-1)
LocalFileExtension=MakeLowerCase(FullFileName(DotPos+1:))
ELSE
FileNamePath=FullFileName
WRITE(*,*) ' assuming file extension of .idf'
WRITE(Auditf,fmta) ' ..assuming file extension of .idf'
FullFileName=TRIM(FullFileName)//'.idf'
LocalFileExtension='idf'
ENDIF
! Process the old input
DifLfn=GetNewUnitNumber()
INQUIRE(File=TRIM(FullFileName),EXIST=FileOK)
IF (.not. FileOK) THEN
WRITE(*,*) 'File not found='//TRIM(FullFileName)
WRITE(Auditf,*) 'File not found='//TRIM(FullFileName)
EndOfFile=.true.
ExitBecauseBadFile=.true.
EXIT
ENDIF
IF (LocalFileExtension == 'idf' .or. LocalFileExtension == 'imf') THEN
checkrvi=.false.
ConnComp=.false.
ConnCompCtrl=.false.
IF (DiffOnly) THEN
OPEN(DifLfn,FILE=TRIM(FileNamePath)//'.'//TRIM(LocalFileExtension)//'dif')
ELSE
OPEN(DifLfn,FILE=TRIM(FileNamePath)//'.'//TRIM(LocalFileExtension)//'new')
ENDIF
IF (LocalFileExtension == 'imf') THEN
CALL ShowWarningError('Note: IMF file being processed. No guarantee of perfection. Please check new file carefully.',Auditf)
ProcessingIMFFile=.true.
ELSE
ProcessingIMFFile=.false.
ENDIF
CALL ProcessInput(IDDFileNameWithPath,NewIDDFileNameWithPath,FullFileName)
IF (FatalError) THEN
ExitBecauseBadFile=.true.
EXIT
ENDIF
! Clean up from any previous passes, then re-allocate. These are for the 'standard' stuff, not your own
! Do not add anything here!
IF(ALLOCATED(DeleteThisRecord)) DEALLOCATE(DeleteThisRecord)
IF(ALLOCATED(Alphas)) DEALLOCATE(Alphas)
IF(ALLOCATED(Numbers)) DEALLOCATE(Numbers)
IF(ALLOCATED(InArgs)) DEALLOCATE(InArgs)
IF(ALLOCATED(TempArgs)) DEALLOCATE(TempArgs)
IF(ALLOCATED(AorN)) DEALLOCATE(AorN)
IF(ALLOCATED(ReqFld)) DEALLOCATE(ReqFld)
IF(ALLOCATED(FldNames)) DEALLOCATE(FldNames)
IF(ALLOCATED(FldDefaults)) DEALLOCATE(FldDefaults)
IF(ALLOCATED(FldUnits)) DEALLOCATE(FldUnits)
IF(ALLOCATED(NwAorN)) DEALLOCATE(NwAorN)
IF(ALLOCATED(NwReqFld)) DEALLOCATE(NwReqFld)
IF(ALLOCATED(NwFldNames)) DEALLOCATE(NwFldNames)
IF(ALLOCATED(NwFldDefaults)) DEALLOCATE(NwFldDefaults)
IF(ALLOCATED(NwFldUnits)) DEALLOCATE(NwFldUnits)
IF(ALLOCATED(OutArgs)) DEALLOCATE(OutArgs)
ALLOCATE(Alphas(MaxAlphaArgsFound),Numbers(MaxNumericArgsFound))
ALLOCATE(InArgs(MaxTotalArgs))
ALLOCATE(TempArgs(MaxTotalArgs))
ALLOCATE(AorN(MaxTotalArgs),ReqFld(MaxTotalArgs),FldNames(MaxTotalArgs),FldDefaults(MaxTotalArgs),FldUnits(MaxTotalArgs))
ALLOCATE(NwAorN(MaxTotalArgs),NwReqFld(MaxTotalArgs),NwFldNames(MaxTotalArgs),NwFldDefaults(MaxTotalArgs),NwFldUnits(MaxTotalArgs))
ALLOCATE(OutArgs(MaxTotalArgs))
ALLOCATE(DeleteThisRecord(NumIDFRecords))
ALLOCATE(MeterCustomNames(NumIDFRecords))
DeleteThisRecord=.false.
NoVersion=.true.
DO Num=1,NumIDFRecords
IF (MakeUPPERCase(IDFRecords(Num)%Name) /= 'VERSION') CYCLE
NoVersion=.false.
EXIT
ENDDO
DO Num=1,NumIDFRecords
IF (DeleteThisRecord(Num)) THEN
Write(DifLfn,fmta) '! Deleting: '//TRIM(IDFRecords(Num)%Name)//'="'//TRIM(IDFRecords(Num)%Alphas(1))//'".'
ENDIF
ENDDO
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! P R E P R O C E S S I N G !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Do any kind of Preprocessing that is needed here (eg: a first pass on objects to store some attributes etc)
! Begin Pre-process Output:Diagnostics which is now a unique-object, gathering all the unique diagnostic keys used
numOutputDiagnostics = GetNumObjectsFound('OUTPUT:DIAGNOSTICS')
! No need if we do not have duplicate ones already
IF (numOutputDiagnostics > 1) THEN
CALL DisplayString('Processing IDF -- OutputDiagnostics preprocessing . . .')
IF(ALLOCATED(OutputDiagnosticsNames)) DEALLOCATE(OutputDiagnosticsNames)
! 12 unique key choices
ALLOCATE(OutputDiagnosticsNames(12))
numOutputDiagnosticsNames = 0
! First pass to get all current unique OutputDiagnostic Keys
DO outputDiagnosticNum=1,numOutputDiagnostics
CALL GetObjectItem('OUTPUT:DIAGNOSTICS',outputDiagnosticNum,Alphas,NumAlphas,Numbers,NumNumbers,Status)
DO CurField = 1, NumAlphas
OutputDiagnosticsName = MakeUPPERCase(TRIM(Alphas(CurField)))
IF ( .not. (ANY(OutputDiagnosticsNames == OutputDiagnosticsName) )) THEN
numOutputDiagnosticsNames = numOutputDiagnosticsNames + 1
OutputDiagnosticsNames(numOutputDiagnosticsNames) = OutputDiagnosticsName
ENDIF
ENDDO
ENDDO
CALL DisplayString('Processing IDF -- OutputDiagnostics preprocessing complete.')
ENDIF
! End Pre-process OutputDiagnostics
!- Pre-process for names of Meter:Custom objects
totMeterCustom = GetNumObjectsFound('METER:CUSTOM')
IF (totMeterCustom > 0) THEN
DO numMeterCustom=1, totMeterCustom
CALL GetObjectItem('METER:CUSTOM', numMeterCustom, Alphas, NumAlphas, Numbers, NumNumbers, Status)
MeterCustomName = MakeUpperCase(TRIM(Alphas(1)))
MeterCustomNames(numMeterCustom) = MeterCustomName
END DO
END IF
!- Ene Pre-process for names of Meter:Custom objects
!- Pre-process for names of Meter:CustomDecrement objects
totMeterCustomDecr = GetNumObjectsFound('METER:CUSTOMDECREMENT')
IF (totMeterCustomDecr > 0) THEN
DO numMeterCustom=1, totMeterCustomDecr
CALL GetObjectItem('METER:CUSTOMDECREMENT', numMeterCustom, Alphas, NumAlphas, Numbers, NumNumbers, Status)
MeterCustomName = MakeUpperCase(TRIM(Alphas(1)))
MeterCustomNames(numMeterCustom + totMeterCustom) = MeterCustomName
END DO
END IF
!- Ene Pre-process for names of Meter:CustomDecrement objects
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! P R O C E S S I N G !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CALL DisplayString('Processing IDF -- Processing idf objects . . .')
DO Num=1,NumIDFRecords
IF (DeleteThisRecord(Num)) CYCLE
DO xcount=IDFRecords(Num)%CommtS+1,IDFRecords(Num)%CommtE
WRITE(DifLfn,fmta) TRIM(Comments(xcount))
if (xcount == IDFRecords(Num)%CommtE) WRITE(DifLfn,fmta) ''
ENDDO
IF (NoVersion .and. Num == 1) THEN
CALL GetNewObjectDefInIDD('VERSION',NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1) = sVersionNum
CurArgs=1
CALL ShowWarningError('No version found in file, defaulting to '//sVersionNum,Auditf)
CALL WriteOutIDFLinesAsComments(DifLfn,'Version',CurArgs,OutArgs,NwFldNames,NwFldUnits)
ENDIF
! deleted objects. no transition.
! eg: IF (MakeUPPERCase(TRIM(IDFRecords(Num)%Name)) == 'PROGRAMCONTROL') CYCLE
ObjectName=IDFRecords(Num)%Name
IF (FindItemInList(ObjectName,ObjectDef%Name,NumObjectDefs) /= 0) THEN
CALL GetObjectDefInIDD(ObjectName,NumArgs,AorN,ReqFld,ObjMinFlds,FldNames,FldDefaults,FldUnits)
NumAlphas=IDFRecords(Num)%NumAlphas
NumNumbers=IDFRecords(Num)%NumNumbers
Alphas(1:NumAlphas)=IDFRecords(Num)%Alphas(1:NumAlphas)
Numbers(1:NumNumbers)=IDFRecords(Num)%Numbers(1:NumNumbers)
CurArgs=NumAlphas+NumNumbers
InArgs=Blank
OutArgs=Blank
TempArgs=Blank
NA=0
NN=0
DO Arg=1,CurArgs
IF (AorN(Arg)) THEN
NA=NA+1
InArgs(Arg)=Alphas(NA)
ELSE
NN=NN+1
InArgs(Arg)=Numbers(NN)
ENDIF
ENDDO
ELSE
WRITE(Auditf,fmta) 'Object="'//TRIM(ObjectName)//'" does not seem to be on the "old" IDD.'
WRITE(Auditf,fmta) '... will be listed as comments (no field names) on the new output file.'
WRITE(Auditf,fmta) '... Alpha fields will be listed first, then numerics.'
NumAlphas=IDFRecords(Num)%NumAlphas
NumNumbers=IDFRecords(Num)%NumNumbers
Alphas(1:NumAlphas)=IDFRecords(Num)%Alphas(1:NumAlphas)
Numbers(1:NumNumbers)=IDFRecords(Num)%Numbers(1:NumNumbers)
DO Arg=1,NumAlphas
OutArgs(Arg)=Alphas(Arg)
ENDDO
NN=NumAlphas+1
DO Arg=1,NumNumbers
OutArgs(NN)=Numbers(Arg)
NN=NN+1
ENDDO
CurArgs=NumAlphas+NumNumbers
NwFldNames=Blank
NwFldUnits=Blank
CALL WriteOutIDFLinesAsComments(DifLfn,ObjectName,CurArgs,OutArgs,NwFldNames,NwFldUnits)
CYCLE
ENDIF
Nodiff=.true. ! Nodiff is true by default
DiffMinFields=.false.
Written=.false.
IF (FindItemInList(MakeUPPERCase(ObjectName),NotInNew,SIZE(NotInNew)) == 0) THEN
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
! Check minfields
IF (ObjMinFlds /= NwObjMinFlds) THEN
DiffMinFields=.true.
ELSE
DiffMinFields=.false.
ENDIF
ENDIF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IF NOT ONLY MAKING PRETTY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (.not. MakingPretty) THEN
SELECT CASE (MakeUPPERCase(TRIM(IDFRecords(Num)%Name)))
CASE ('VERSION')
IF ((InArgs(1)(1:3)) == sVersionNum .and. ArgFile) THEN
CALL ShowWarningError('File is already at latest version. No new diff file made.',Auditf)
CLOSE(diflfn,STATUS='DELETE')
LatestVersion=.true.
EXIT
ENDIF
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1) = sVersionNum
NoDiff=.false.
! changes for this version, pick one of the spots to add rules, this will reduce the possibility of merge conflicts
! CASE('OBJECTNAMEHERE')
! CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
! nodiff=.false.
! OutArgs(1)=InArgs(1)
! OutArgs(2) = 'SequentialLoad'
! OutArgs(3:CurArgs+1)=InArgs(2:CurArgs)
! CurArgs = CurArgs + 1
! If your original object starts with A, insert the rules here
! If your original object starts with C, insert the rules here
CASE('CONSTRUCTION:INTERNALSOURCE')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
OutArgs(1:5)=InArgs(1:5)
OutArgs(6) = '0.0'
OutArgs(7:CurArgs+1)=InArgs(6:CurArgs)
CurArgs = CurArgs + 1
! If your original object starts with D, insert the rules here
! If your original object starts with E, insert the rules here
CASE('ENERGYMANAGEMENTSYSTEM:ACTUATOR')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.true.
OutArgs(1:4)=InArgs(1:4)
IF (MakeUPPERCase(InArgs(4)).eq.'ELECTRIC POWER LEVEL') THEN
OutArgs(4)='Electricity Rate'
END IF
IF (MakeUPPERCase(InArgs(4)).eq.'GAS POWER LEVEL') THEN
OutArgs(4)='NaturalGas Rate'
END IF
! Decided not to transition these at the last minute
! IF (MakeUPPERCase(InArgs(4)).eq.'ELECTRIC POWER DRAW RATE') THEN
! OutArgs(4)='Draw Electricity Rate'
! END IF
!
! IF (MakeUPPERCase(InArgs(4)).eq.'ELECTRIC POWER CHARGE RATE') THEN
! OutArgs(4)='Charge Electricity Rate'
! END IF
! If your original object starts with F, insert the rules here
! If your original object starts with G, insert the rules here
! If your original object starts with H, insert the rules here
! If your original object starts with I, insert the rules here
! If your original object starts with L, insert the rules here
! If your original object starts with M, insert the rules here
! If your original object starts with N, insert the rules here
! If your original object starts with O, insert the rules here
CASE('OUTPUT:DEBUGGINGDATA')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
NoDiff=.false.
! This object previously used a numeric field, where 1 would mean TRUE and any other would mean FALSE
! and it is being replaced by a Yes/No choice field now
DO CurField = 1, CurArgs
! Default to No
OutArgs(CurField) = 'No'
convertedNumber = ProcessNumber(InArgs(CurField), processNumberErrFlag)
IF (processNumberErrFlag) THEN
CALL ShowWarningError('For ' // TRIM(ObjectName) // ', field "' // TRIM(FldNames(CurField)) // '"="' // &
TRIM(InArgs(CurField)) // '" is not a number, defaulting to No', Auditf)
ELSE IF (INT(convertedNumber) == 1) THEN
OutArgs(CurField) = 'Yes'
END IF
END DO
CASE('OUTPUT:DIAGNOSTICS')
! This is now a unique object, but it should be quite rare to encounter cases where two of these were present
! and this does not affect the simulation, so do nothing fancy but write any extra one as a comment
! and write to the audit file. The user will already get a warning in the console about it being unique
IF (.not. alreadyProcessedOneOutputDiagnostic) THEN
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
IF (numOutputDiagnostics > 1) THEN
! Consolidate all into this one
OutArgs(1:numOutputDiagnosticsNames) = OutputDiagnosticsNames(1:numOutputDiagnosticsNames)
CurArgs = numOutputDiagnosticsNames
NoDiff=.false.
ELSE
! Business as usual
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
NoDiff=.true.
ENDIF
alreadyProcessedOneOutputDiagnostic=.true.
ELSE
WRITE(Auditf,fmta) 'Object="'//TRIM(ObjectName)//'" is now a unique object in the "new" IDD.'
WRITE(Auditf,fmta) '... will be listed as comments on the new output file but keys consolidated in the first found.'
CALL WriteOutIDFLinesAsComments(DifLfn,ObjectName,CurArgs,InArgs,FldNames,FldUnits)
Written=.true.
ENDIF
! If your original object starts with P, insert the rules here
CASE('PERFORMANCEPRECISIONTRADEOFFS')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
OutArgs(1:4)=InArgs(1:4)
IF (MakeUPPERCase(OutArgs(3)) == 'MODE05') THEN
OutArgs(3) = 'Mode06'
ENDIF
CASE('PYTHONPLUGIN:INSTANCE')
IF (throwPythonWarning) THEN
CALL ShowWarningError('PythonPlugin:Instance found -- note the API changed from v9.3 and v9.4 -- check docs and update with new state argument.',Auditf)
CALL writePreprocessorObject(DifLfn,PrognameConversion, 'Warning', 'PythonPlugin:Instance found -- note the API changed from v9.3 and v9.4 -- check docs and update with new state argument.')
throwPythonWarning = .false.
END IF
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
! If your original object starts with R, insert the rules here
! If your original object starts with S, insert the rules here
! If your original object starts with T, insert the rules here
! If your original object starts with U, insert the rules here
! If your original object starts with V, insert the rules here
! If your original object starts with W, insert the rules here
! If your original object starts with Z, insert the rules here
CASE('ZONEHVAC:LOWTEMPERATURERADIANT:VARIABLEFLOW')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
OutArgs(1:4)=InArgs(1:4)
OutArgs(5)='ConvectionOnly'
OutArgs(6)=InArgs(5)
OutArgs(7)='0.016'
OutArgs(8)=InArgs(6)
OutArgs(9)='0.35'
OutArgs(10)=InArgs(7)
OutArgs(11) = 'HalfFlowPower'
OutArgs(12:CurArgs+4)=InArgs(8:CurArgs)
CurArgs = CurArgs + 4
CASE('ZONEHVAC:LOWTEMPERATURERADIANT:ELECTRIC')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
OutArgs(1:9)=InArgs(1:9)
OutArgs(10) = 'HalfFlowPower'
OutArgs(11:CurArgs+1)=InArgs(10:CurArgs)
CurArgs = CurArgs + 1
CASE('ZONEHVAC:LOWTEMPERATURERADIANT:CONSTANTFLOW')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
OutArgs(1:4)=InArgs(1:4)
OutArgs(5)='ConvectionOnly'
OutArgs(6)=InArgs(5)
OutArgs(7)='0.016'
OutArgs(8)=InArgs(6)
OutArgs(9)='0.35'
OutArgs(10)=InArgs(7)
OutArgs(11) = '0.8'
OutArgs(12:CurArgs+4)=InArgs(8:CurArgs)
CurArgs = CurArgs + 4
CASE('ZONEHVAC:HYBRIDUNITARYHVAC')
ObjectName = "ZoneHVAC:HybridUnitaryHVAC"
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.false.
! fields 1-14 same
OutArgs(1:14)=InArgs(1:14)
! insert Fan Heat Included in Lookup Tables field
OutArgs(15)='Yes'
! insert Fan Heat Gain Location
OutArgs(16)=Blank
! insert Fan Heat Gain In Airstream Fraction field
OutArgs(17)=Blank
! same Scaling Factor
OutArgs(18)=InArgs(15)
! remove Number of Operating Modes
OutArgs(19)=InArgs(17)
! all others equal
OutArgs(20:CurArgs+2)=InArgs(18:CurArgs)
CurArgs = CurArgs + 2
NoDiff = .false.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Changes for report variables, meters, tables -- update names !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Changes for report variables, meters, tables -- update names
CASE('OUTPUT:VARIABLE')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
IF (OutArgs(1) == Blank) THEN
OutArgs(1)='*'
nodiff=.false.
ENDIF
CALL ScanOutputVariablesForReplacement( &
2, &
DelThis, &
checkrvi, &
nodiff, &
ObjectName, &
DifLfn, &
.true., & !OutVar
.false., & !MtrVar
.false., & !TimeBinVar
CurArgs, &
Written, &
.false.)
IF (DelThis) CYCLE
CASE ('OUTPUT:METER','OUTPUT:METER:METERFILEONLY','OUTPUT:METER:CUMULATIVE','OUTPUT:METER:CUMULATIVE:METERFILEONLY')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
CALL ScanOutputVariablesForReplacement( &
1, &
DelThis, &
checkrvi, &
nodiff, &
ObjectName, &
DifLfn, &
.false., & !OutVar
.true., & !MtrVar
.false., & !TimeBinVar
CurArgs, &
Written, &
.false.)
IF (DelThis) CYCLE
! Begin - Special section for v9.4
IF (CurArgs .GE. 1) THEN
changeMeterNameFlag = .true.
DO numMeterCustom=1, totMeterCustom + totMeterCustomDecr
MeterCustomName = MeterCustomNames(numMeterCustom)
IF (MeterCustomName .eq. MakeUPPERCase(InArgs(1))) THEN
changeMeterNameFlag = .false.
END IF
END DO
IF (changeMeterNameFlag) THEN
CALL ReplaceFuelNameWithEndUseSubcategory(OutArgs(1), NoDiff)
END IF
END IF
! End - Special section for v9.4
CASE('OUTPUT:TABLE:TIMEBINS')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
IF (OutArgs(1) == Blank) THEN
OutArgs(1)='*'
nodiff=.false.
ENDIF
CALL ScanOutputVariablesForReplacement( &
2, &
DelThis, &
checkrvi, &
nodiff, &
ObjectName, &
DifLfn, &
.false., & !OutVar
.false., & !MtrVar
.true., & !TimeBinVar
CurArgs, &
Written, &
.false.)
IF (DelThis) CYCLE
! Begin - Special section for v9.4
IF (CurArgs .GE. 2) THEN
changeMeterNameFlag = .true.
DO numMeterCustom=1, totMeterCustom + totMeterCustomDecr
MeterCustomName = MeterCustomNames(numMeterCustom)
IF (MeterCustomName .eq. MakeUPPERCase(InArgs(2))) THEN
changeMeterNameFlag = .false.
END IF
END DO
IF (changeMeterNameFlag) THEN
CALL ReplaceFuelNameWithEndUseSubcategory(OutArgs(2), NoDiff)
END IF
END IF
! End - Special section for v9.4
!ExternalInterface:FunctionalMockupUnitImport:From:Variable, field 2
!ExternalInterface:FunctionalMockupUnitExport:From:Variable, field 2
CASE('EXTERNALINTERFACE:FUNCTIONALMOCKUPUNITIMPORT:FROM:VARIABLE', &
'EXTERNALINTERFACE:FUNCTIONALMOCKUPUNITEXPORT:FROM:VARIABLE')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
IF (OutArgs(1) == Blank) THEN
OutArgs(1)='*'
nodiff=.false.
ENDIF
CALL ScanOutputVariablesForReplacement( &
2, &
DelThis, &
checkrvi, &
nodiff, &
ObjectName, &
DifLfn, &
.false., & !OutVar
.false., & !MtrVar
.false., & !TimeBinVar
CurArgs, &
Written, &
.false.)
IF (DelThis) CYCLE
!EnergyManagementSystem:Sensor, field 3
CASE('ENERGYMANAGEMENTSYSTEM:SENSOR')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
nodiff=.true.
CALL ScanOutputVariablesForReplacement( &
3, &
DelThis, &
checkrvi, &
nodiff, &
ObjectName, &
DifLfn, &
.false., & !OutVar
.false., & !MtrVar
.false., & !TimeBinVar
CurArgs, &
Written, &
.true.)
IF (DelThis) CYCLE
CASE('OUTPUT:TABLE:MONTHLY')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.true.
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
CurVar=3
DO Var=3,CurArgs,2
UCRepVarName=MakeUPPERCase(InArgs(Var))
OutArgs(CurVar)=InArgs(Var)
OutArgs(CurVar+1)=InArgs(Var+1)
! May still need some logic here for this
! CALL ReplaceFuelNameWithEndUseSubcategory(OutArgs(CurVar), NoDiff)
pos=INDEX(UCRepVarName,'[')
IF (pos > 0) THEN
UCRepVarName=UCRepVarName(1:pos-1)
OutArgs(CurVar)=InArgs(Var)(1:pos-1)
OutArgs(CurVar+1)=InArgs(Var+1)
ENDIF
DelThis=.false.
DO Arg=1,NumRepVarNames
UCCompRepVarName=MakeUPPERCase(OldRepVarName(Arg))
IF (UCCompRepVarName(Len_Trim(UCCompRepVarName):Len_Trim(UCCompRepVarName)) == '*') THEN
WildMatch=.true.
UCCompRepVarName(Len_Trim(UCCompRepVarName):Len_Trim(UCCompRepVarName))=' '
pos=INDEX(TRIM(UCRepVarname),TRIM(UCCompRepVarName))
ELSE
WildMatch=.false.
pos=0
if (UCRepVarName == UCCompRepVarName) pos=1
ENDIF
IF (pos > 0 .and. pos /= 1) CYCLE
IF (pos > 0) THEN
IF (NewRepVarName(Arg) /= '<DELETE>') THEN
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg) /= Blank .and. .not. SameString(NewRepVarCaution(Arg)(1:6),'Forkeq') ) THEN
IF (.not. OTMVarCaution(Arg)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg))//'" has the following caution "'//trim(NewRepVarCaution(Arg))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
nodiff=.false.
ELSE
DelThis=.true.
ENDIF
IF (OldRepVarName(Arg) == OldRepVarName(Arg+1)) THEN
IF (.not. SameString(NewRepVarCaution(Arg)(1:6),'Forkeq')) THEN
! Adding a var field.
CurVar=CurVar+2
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg+1)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg+1))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg+1) /= Blank) THEN
IF (.not. OTMVarCaution(Arg+1)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg+1))//'" has the following caution "'//trim(NewRepVarCaution(Arg+1))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg+1)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
nodiff=.false.
ENDIF
ENDIF
IF (OldRepVarName(Arg) == OldRepVarName(Arg+2)) THEN ! only 1 more... for ForkEq
! Adding a var field.
CurVar=CurVar+2
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg+2)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg+2))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg+2) /= Blank) THEN
IF (.not. OTMVarCaution(Arg+2)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg+2))//'" has the following caution "'//trim(NewRepVarCaution(Arg+2))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg+2)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
nodiff=.false.
ENDIF
EXIT
ENDIF
ENDDO
IF (.not. DelThis) THEN
! Begin - Special section for v9.4
changeMeterNameFlag = .true.
DO numMeterCustom=1, totMeterCustom + totMeterCustomDecr
MeterCustomName = MeterCustomNames(numMeterCustom)
IF (MeterCustomName .eq. MakeUPPERCase(InArgs(Var))) THEN
changeMeterNameFlag = .false.
END IF
END DO
IF (changeMeterNameFlag) THEN
CALL ReplaceFuelNameWithEndUseSubcategory(OutArgs(CurVar), NoDiff)
END IF
! End - Special section for v9.4
CurVar=CurVar+2
END IF
ENDDO
CurArgs=CurVar-1
CASE('OUTPUT:TABLE:ANNUAL')
CALL GetNewObjectDefInIDD(ObjectName,NwNumArgs,NwAorN,NwReqFld,NwObjMinFlds,NwFldNames,NwFldDefaults,NwFldUnits)
nodiff=.true.
OutArgs(1:CurArgs)=InArgs(1:CurArgs)
CurVar=4
DO Var=4,CurArgs,3
UCRepVarName=MakeUPPERCase(InArgs(Var))
OutArgs(CurVar)=InArgs(Var)
OutArgs(CurVar+1)=InArgs(Var+1)
pos=INDEX(UCRepVarName,'[')
IF (pos > 0) THEN
UCRepVarName=UCRepVarName(1:pos-1)
OutArgs(CurVar)=InArgs(Var)(1:pos-1)
OutArgs(CurVar+1)=InArgs(Var+1)
OutArgs(CurVar+2)=InArgs(Var+2)
ENDIF
DelThis=.false.
DO Arg=1,NumRepVarNames
UCCompRepVarName=MakeUPPERCase(OldRepVarName(Arg))
IF (UCCompRepVarName(Len_Trim(UCCompRepVarName):Len_Trim(UCCompRepVarName)) == '*') THEN
WildMatch=.true.
UCCompRepVarName(Len_Trim(UCCompRepVarName):Len_Trim(UCCompRepVarName))=' '
pos=INDEX(TRIM(UCRepVarname),TRIM(UCCompRepVarName))
ELSE
WildMatch=.false.
pos=0
if (UCRepVarName == UCCompRepVarName) pos=1
ENDIF
IF (pos > 0 .and. pos /= 1) CYCLE
IF (pos > 0) THEN
IF (NewRepVarName(Arg) /= '<DELETE>') THEN
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg) /= Blank .and. .not. SameString(NewRepVarCaution(Arg)(1:6),'Forkeq') ) THEN
IF (.not. OTMVarCaution(Arg)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg))//'" has the following caution "'//trim(NewRepVarCaution(Arg))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
OutArgs(CurVar+2)=InArgs(Var+2)
nodiff=.false.
ELSE
DelThis=.true.
ENDIF
IF (OldRepVarName(Arg) == OldRepVarName(Arg+1)) THEN
IF (.not. SameString(NewRepVarCaution(Arg)(1:6),'Forkeq')) THEN
! Adding a var field.
CurVar=CurVar+3
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg+1)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg+1))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg+1) /= Blank) THEN
IF (.not. OTMVarCaution(Arg+1)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg+1))//'" has the following caution "'//trim(NewRepVarCaution(Arg+1))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg+1)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
OutArgs(CurVar+2)=InArgs(Var+2)
nodiff=.false.
ENDIF
ENDIF
IF (OldRepVarName(Arg) == OldRepVarName(Arg+2)) THEN ! only 1 more... for ForkEq
! Adding a var field.
CurVar=CurVar+3
IF (.not. WildMatch) THEN
OutArgs(CurVar)=NewRepVarName(Arg+2)
ELSE
OutArgs(CurVar)=TRIM(NewRepVarName(Arg+2))//OutArgs(CurVar)(Len_Trim(UCCompRepVarName)+1:)
ENDIF
IF (NewRepVarCaution(Arg+2) /= Blank) THEN
IF (.not. OTMVarCaution(Arg+2)) THEN ! caution message not written yet
CALL writePreprocessorObject(DifLfn,PrognameConversion,'Warning', &
'Output Table Monthly (old)="'//trim(OldRepVarName(Arg))// &
'" conversion to Output Table Monthly (new)="'// &
trim(NewRepVarName(Arg+2))//'" has the following caution "'//trim(NewRepVarCaution(Arg+2))//'".')
write(diflfn,fmtA) ' '
OTMVarCaution(Arg+2)=.true.
ENDIF
ENDIF
OutArgs(CurVar+1)=InArgs(Var+1)
OutArgs(CurVar+2)=InArgs(Var+2)
nodiff=.false.
ENDIF
EXIT
ENDIF
ENDDO
IF (.not. DelThis) THEN
! Begin - Special section for v9.4
changeMeterNameFlag = .true.
DO numMeterCustom=1, totMeterCustom + totMeterCustomDecr
MeterCustomName = MeterCustomNames(numMeterCustom)
IF (MeterCustomName .eq. MakeUPPERCase(InArgs(Var))) THEN
changeMeterNameFlag = .false.
END IF
END DO
IF (changeMeterNameFlag) THEN
CALL ReplaceFuelNameWithEndUseSubcategory(OutArgs(CurVar), NoDiff)