Skip to content

Commit

Permalink
Merge pull request #7341 from ORNL-AMO/issue-7289
Browse files Browse the repository at this point in the history
Issue 7289 - Add moisture modal to flue gas
  • Loading branch information
rhernandez-intertech authored Feb 18, 2025
2 parents 4b07195 + e87bb8b commit f9080d3
Show file tree
Hide file tree
Showing 36 changed files with 234 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<span *ngIf="byMassForm.controls.moistureInAirCombustion.errors.min">Value can't be less than
{{byMassForm.controls.moistureInAirCombustion.errors.min.min}} %.</span>
</span>
<a id="moistureCalc" class="form-text small click-link" (click)="showMoistureModal()">Calculate</a>
</div>

<div class="form-group">
Expand Down Expand Up @@ -208,4 +209,14 @@
</div>
</div>
</div>
</div>

<div bsModal #moistureModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="moistureModalLabel" aria-hidden="true" [config]="{backdrop: 'static'}">
<div class="modal-dialog modal-lg flue-gas-modal">
<div class="modal-content h-100">
<app-flue-gas-moisture-modal class="h-100" *ngIf="showMoisture" (closeModal)="hideMoistureModal($event)"
(hideModal)="hideMoistureModal($event)" [settings]="settings"></app-flue-gas-moisture-modal>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class FlueGasFormMassComponent implements OnInit {
@ViewChild('formElement', { static: false }) formElement: ElementRef;

@ViewChild('materialModal', { static: false }) public materialModal: ModalDirective;
@ViewChild('moistureModal', { static: false }) public moistureModal: ModalDirective;

resetDataSub: Subscription;
byMassForm: UntypedFormGroup;
Expand All @@ -44,6 +45,7 @@ export class FlueGasFormMassComponent implements OnInit {
warnings: FlueGasWarnings;

higherHeatingValue: number;
showMoisture: boolean;

constructor(private flueGasService: FlueGasService,
private flueGasFormService: FlueGasFormService,
Expand Down Expand Up @@ -221,6 +223,25 @@ export class FlueGasFormMassComponent implements OnInit {
return test;
}


showMoistureModal() {
this.flueGasService.modalOpen.next(true);
this.showMoisture = true;
this.moistureModal.show();
}

hideMoistureModal(moistureInAirCombustion?: number) {
if (moistureInAirCombustion) {
moistureInAirCombustion = Number(moistureInAirCombustion.toFixed(2));
this.byMassForm.controls.moistureInAirCombustion.patchValue(moistureInAirCombustion);
}
this.moistureModal.hide();
this.showMoisture = false;
this.flueGasService.modalOpen.next(false);
this.calculate();
}


showMaterialModal() {
this.flueGasService.modalOpen.next(true);
this.materialModal.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<span *ngIf="byVolumeForm.controls.moistureInAirCombustion.errors.min">Value can't be less than
{{byVolumeForm.controls.moistureInAirCombustion.errors.min.min}} %.</span>
</span>
<a id="moistureCalc" class="form-text small click-link" (click)="showMoistureModal()">Calculate</a>
</div>

<div *ngIf="!inModal" class="form-group">
Expand Down Expand Up @@ -180,4 +181,14 @@
</div>
</div>
</div>
</div>

<div bsModal #moistureModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="moistureModalLabel" aria-hidden="true" [config]="{backdrop: 'static'}">
<div class="modal-dialog modal-lg flue-gas-modal">
<div class="modal-content h-100">
<app-flue-gas-moisture-modal class="h-100" *ngIf="showMoisture" (closeModal)="hideMoistureModal($event)"
(hideModal)="hideMoistureModal($event)" [settings]="settings"></app-flue-gas-moisture-modal>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class FlueGasFormVolumeComponent implements OnInit, OnDestroy {
@ViewChild('formElement', { static: false }) formElement: ElementRef;

@ViewChild('materialModal', { static: false }) public materialModal: ModalDirective;
@ViewChild('moistureModal', { static: false }) public moistureModal: ModalDirective;

resetDataSub: Subscription;
generateExampleSub: Subscription;
Expand All @@ -52,6 +53,7 @@ export class FlueGasFormVolumeComponent implements OnInit, OnDestroy {
baselineDataSub: Subscription;

higherHeatingValue: number;
showMoisture: boolean;

constructor(private flueGasService: FlueGasService,
private convertUnitsService: ConvertUnitsService,
Expand Down Expand Up @@ -244,6 +246,23 @@ export class FlueGasFormVolumeComponent implements OnInit, OnDestroy {
this.materialModal.show();
}

showMoistureModal() {
this.flueGasService.modalOpen.next(true);
this.showMoisture = true;
this.moistureModal.show();
}

hideMoistureModal(moistureInAirCombustion?: number) {
if (moistureInAirCombustion) {
moistureInAirCombustion = Number(moistureInAirCombustion.toFixed(2));
this.byVolumeForm.controls.moistureInAirCombustion.patchValue(moistureInAirCombustion);
}
this.moistureModal.hide();
this.showMoisture = false;
this.flueGasService.modalOpen.next(false);
this.calculate();
}

hideMaterialModal(event?: any) {
if (event) {
this.options = this.sqlDbApiService.selectGasFlueGasMaterials();
Expand Down
4 changes: 3 additions & 1 deletion src/app/calculator/furnaces/flue-gas/flue-gas.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { OperatingHoursModalModule } from '../../../shared/operating-hours-modal
import { EnergyFormComponent } from './energy-form/energy-form.component';
import { FlueGasFormService } from './flue-gas-form.service';
import { EnergyFormService } from './energy-form.service';
import { FlueGasMoistureModalModule } from '../../../shared/flue-gas-moisture-modal/flue-gas-moisture-modal.module';



Expand All @@ -37,7 +38,8 @@ import { EnergyFormService } from './energy-form.service';
SuiteDbModule,
SharedPipesModule,
ExportableResultsTableModule,
OperatingHoursModalModule
OperatingHoursModalModule,
FlueGasMoistureModalModule
],
exports: [
FlueGasComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, OnInit, Input, EventEmitter, Output, ViewChild, SimpleChanges } from '@angular/core';
import { FlueGasCompareService } from "../flue-gas-compare.service";
import { ModalDirective } from 'ngx-bootstrap/modal';
import { LossesService } from '../../losses.service';
import { Settings } from '../../../../shared/models/settings';
Expand All @@ -12,6 +11,7 @@ import { SolidLiquidFlueGasMaterial } from '../../../../shared/models/materials'
import { SqlDbApiService } from '../../../../tools-suite-api/sql-db-api.service';
import { firstValueFrom } from 'rxjs';
import { SolidLiquidMaterialDbService } from '../../../../indexedDb/solid-liquid-material-db.service';
import { FlueGasCompareService } from '../flue-gas-compare.service';

@Component({
selector: 'app-flue-gas-losses-form-mass',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, OnInit, Input, EventEmitter, Output, ViewChild, SimpleChanges } from '@angular/core';
import { FlueGasCompareService } from "../flue-gas-compare.service";
import { ModalDirective } from 'ngx-bootstrap/modal';
import { LossesService } from '../../losses.service';
import { Settings } from '../../../../shared/models/settings';
Expand All @@ -10,6 +9,7 @@ import { FlueGasMaterial } from '../../../../shared/models/materials';
import { SqlDbApiService } from '../../../../tools-suite-api/sql-db-api.service';
import { FlueGasMaterialDbService } from '../../../../indexedDb/flue-gas-material-db.service';
import { firstValueFrom } from 'rxjs';
import { FlueGasCompareService } from '../flue-gas-compare.service';

@Component({
selector: 'app-flue-gas-losses-form-volume',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import * as _ from 'lodash';
import { PhastService } from '../../phast.service';
import { FlueGas, FlueGasByVolumeSuiteResults, MaterialInputProperties } from '../../../shared/models/phast/losses/flueGas';
import { Losses } from '../../../shared/models/phast/phast';
import { FlueGasCompareService } from './flue-gas-compare.service';
import { Settings } from '../../../shared/models/settings';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { FlueGasService } from '../../../calculator/furnaces/flue-gas/flue-gas.service';
import { FlueGasFormService } from '../../../calculator/furnaces/flue-gas/flue-gas-form.service';
import { SolidLiquidFlueGasMaterial } from '../../../shared/models/materials';
import { SqlDbApiService } from '../../../tools-suite-api/sql-db-api.service';
import { FlueGasCompareService } from './flue-gas-compare.service';
@Component({
selector: 'app-flue-gas-losses',
templateUrl: './flue-gas-losses.component.html',
Expand Down
17 changes: 4 additions & 13 deletions src/app/phast/losses/flue-gas-losses/flue-gas-losses.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,26 @@ import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FlueGasLossesComponent } from './flue-gas-losses.component';
import { FlueGasLossesFormVolumeComponent } from './flue-gas-losses-form-volume/flue-gas-losses-form-volume.component';
import { FlueGasLossesMoistureComponent } from './flue-gas-losses-moisture/flue-gas-losses-moisture.component';
import { FlueGasLossesFormMassComponent } from "./flue-gas-losses-form-mass/flue-gas-losses-form-mass.component";
import { FlueGasCompareService } from "./flue-gas-compare.service";
import { SuiteDbModule } from '../../../suiteDb/suiteDb.module';
import { ModalModule } from 'ngx-bootstrap/modal';
import { SharedPipesModule } from '../../../shared/shared-pipes/shared-pipes.module';
import { FlueGasMoistureResultsComponent } from './flue-gas-moisture-results/flue-gas-moisture-results.component';
import { FlueGasMoistureHelpComponent } from './flue-gas-moisture-help/flue-gas-moisture-help.component';
import { FlueGasMoisturePanelComponent } from './flue-gas-moisture-panel/flue-gas-moisture-panel.component';
import { FlueGasMoistureModalComponent } from './flue-gas-moisture-modal/flue-gas-moisture-modal.component';

import { FlueGasMoistureModalModule } from '../../../shared/flue-gas-moisture-modal/flue-gas-moisture-modal.module';
import { FlueGasCompareService } from './flue-gas-compare.service';
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
SuiteDbModule,
ModalModule,
SharedPipesModule
SharedPipesModule,
FlueGasMoistureModalModule
],
declarations: [
FlueGasLossesComponent,
FlueGasLossesFormMassComponent,
FlueGasLossesFormVolumeComponent,
FlueGasLossesMoistureComponent,
FlueGasMoistureResultsComponent,
FlueGasMoistureHelpComponent,
FlueGasMoisturePanelComponent,
FlueGasMoistureModalComponent,
],
providers: [
FlueGasCompareService,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core';
import { PHAST } from '../../../../shared/models/phast/phast';
import { LossesService } from '../../losses.service';
import { UntypedFormGroup } from '@angular/forms';
import { FlueGasCompareService } from '../../flue-gas-losses/flue-gas-compare.service';
import { FlueGas, FlueGasWarnings } from '../../../../shared/models/phast/losses/flueGas';
import { Subscription } from 'rxjs';
import { FlueGasFormService } from '../../../../calculator/furnaces/flue-gas/flue-gas-form.service';
import { Settings } from '../../../../shared/models/settings';
import { FlueGasCompareService } from '../../flue-gas-losses/flue-gas-compare.service';

@Component({
selector: 'app-flue-gas-tab',
Expand Down
2 changes: 1 addition & 1 deletion src/app/phast/phast-compare.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { OtherLossesCompareService } from './losses/other-losses/other-losses-co
import { OpeningLossesCompareService } from './losses/opening-losses/opening-losses-compare.service';
import { HeatSystemEfficiencyCompareService } from './losses/heat-system-efficiency/heat-system-efficiency-compare.service';
import { GasLeakageCompareService } from './losses/gas-leakage-losses/gas-leakage-compare.service';
import { FlueGasCompareService } from './losses/flue-gas-losses/flue-gas-compare.service';
import { FixtureLossesCompareService } from './losses/fixture-losses/fixture-losses-compare.service';
import { ExtendedSurfaceCompareService } from './losses/extended-surface-losses/extended-surface-compare.service';
import { ExhaustGasCompareService } from './losses/exhaust-gas/exhaust-gas-compare.service';
Expand All @@ -18,6 +17,7 @@ import { PHAST, Losses } from '../shared/models/phast/phast';
import { EnergyInputCompareService } from './losses/energy-input/energy-input-compare.service';
import { OperationsCompareService } from './losses/operations/operations-compare.service';
import { BehaviorSubject } from 'rxjs';
import { FlueGasCompareService } from './losses/flue-gas-losses/flue-gas-compare.service';

@Injectable()
export class PhastCompareService {
Expand Down
4 changes: 3 additions & 1 deletion src/app/phast/phast.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { UpdateUnitsModalModule } from '../shared/update-units-modal/update-unit
import { WelcomeScreenComponent } from './welcome-screen/welcome-screen.component';
import { ImportExportModule } from '../shared/import-export/import-export.module';
import { SnackbarModule } from '../shared/snackbar-notification/snackbar.module';
import { FlueGasMoistureModalModule } from '../shared/flue-gas-moisture-modal/flue-gas-moisture-modal.module';

@NgModule({
declarations: [
Expand Down Expand Up @@ -84,7 +85,8 @@ import { SnackbarModule } from '../shared/snackbar-notification/snackbar.module'
UnitConverterModule,
PhastSankeyModule,
UpdateUnitsModalModule,
ImportExportModule
ImportExportModule,
FlueGasMoistureModalModule
],
providers: [
PhastService,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SuiteDbModule } from '../../suiteDb/suiteDb.module';
import { ModalModule } from 'ngx-bootstrap/modal';
import { SharedPipesModule } from '../shared-pipes/shared-pipes.module';
import { FlueGasLossesMoistureComponent } from './flue-gas-moisture-modal/flue-gas-losses-moisture/flue-gas-losses-moisture.component';
import { FlueGasMoistureResultsComponent } from './flue-gas-moisture-modal/flue-gas-moisture-results/flue-gas-moisture-results.component';
import { FlueGasMoistureHelpComponent } from './flue-gas-moisture-modal/flue-gas-moisture-help/flue-gas-moisture-help.component';
import { FlueGasMoisturePanelComponent } from './flue-gas-moisture-modal/flue-gas-moisture-panel/flue-gas-moisture-panel.component';
import { FlueGasMoistureModalComponent } from './flue-gas-moisture-modal/flue-gas-moisture-modal.component';
import { LossesModule } from '../../phast/losses/losses.module';
import { FlueGasMoistureModalService } from './flue-gas-moisture-modal.service';


@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
SuiteDbModule,
ModalModule,
SharedPipesModule,
],
declarations: [
FlueGasLossesMoistureComponent,
FlueGasMoistureResultsComponent,
FlueGasMoistureHelpComponent,
FlueGasMoisturePanelComponent,
FlueGasMoistureModalComponent,
],
providers: [
FlueGasMoistureModalService
],
exports: [
FlueGasLossesMoistureComponent,
FlueGasMoistureResultsComponent,
FlueGasMoistureHelpComponent,
FlueGasMoisturePanelComponent,
FlueGasMoistureModalComponent,
],
})
export class FlueGasMoistureModalModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { FlueGasMoistureModalService } from './flue-gas-moisture-modal.service';

describe('FlueGasMoistureModalService', () => {
let service: FlueGasMoistureModalService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(FlueGasMoistureModalService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
Loading

0 comments on commit f9080d3

Please sign in to comment.