Skip to content

Commit

Permalink
Merge pull request #53 from zsarnoczay/master
Browse files Browse the repository at this point in the history
azs - updates to Loss tab including consequence function visualization and selection of decision variables
  • Loading branch information
fmckenna authored May 5, 2023
2 parents aa63abd + 0822d80 commit 18c67c1
Show file tree
Hide file tree
Showing 12 changed files with 1,203 additions and 183 deletions.
21 changes: 13 additions & 8 deletions Examples/pbdl-0001/src/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@
"Losses": {
"BldgRepair": {
"ConsequenceDatabase": "FEMA P-58",
"DecisionVariables": {
"Carbon": true,
"Cost": true,
"Energy": true,
"Time": true
},
"MapApproach": "Automatic",
"ReplacementCarbon": {
"Distribution": "normal",
"Median": "10000000",
"Median": "1e7",
"Theta_1": "0.3",
"Unit": "kg"
},
Expand All @@ -97,10 +103,10 @@
},
"ReplacementEnergy": {
"Distribution": "normal",
"Median": "100000000",
"Median": "1e9",
"Theta_1": "0.3",
"Unit": "MJ"
},
},
"ReplacementTime": {
"Distribution": "lognormal",
"Median": "15000",
Expand Down Expand Up @@ -187,7 +193,6 @@
"name": "",
"planArea": 129600,
"stories": 1,
"dampingRatio": 0.02,
"units": {
"force": "kips",
"length": "in",
Expand Down Expand Up @@ -217,6 +222,7 @@
"weight": 144
}
],
"dampingRatio": 0.02,
"height": 144,
"massX": 0,
"massY": 0,
Expand Down Expand Up @@ -250,13 +256,12 @@
"seed": 946
},
"saveWorkDir": true,
"uqEngine": "Dakota",
"uqType": "Forward Propagation"
},
"localAppDir": "C:/SimCenter/",
"localAppDir": "/Users/adamzs/SimCenter",
"randomVariables": [
],
"remoteAppDir": "C:/SimCenter/",
"remoteAppDir": "/Users/adamzs/SimCenter",
"runType": "runningLocal",
"workingDir": "C:/Workdir/PBE"
"workingDir": "/Users/adamzs/Documents/PBE/LocalWorkDir"
}
58 changes: 49 additions & 9 deletions Examples/pbdl-0002/src/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,59 @@
"Losses": {
"BldgRepair": {
"ConsequenceDatabase": "Hazus Earthquake",
"DecisionVariables": {
"Carbon": false,
"Cost": true,
"Energy": false,
"Time": true
},
"MapApproach": "Automatic"
}
},
"Outputs": {
"Asset": {
"Sample": true,
"Statistics": true
},
"Damage": {
"GroupedSample": true,
"GroupedStatistics": true,
"Sample": true,
"Statistics": true
},
"Demand": {
"Sample": true,
"Statistics": true
},
"Format": {
"CSV": true,
"JSON": false
},
"Loss": {
"BldgRepair": {
"AggregateSample": true,
"AggregateStatistics": true,
"GroupedSample": true,
"GroupedStatistics": true,
"Sample": true,
"Statistics": true
}
}
}
},
"DefaultValues": {
"driverFile": "driver",
"edpFiles": [
"EDP.json"
],
"filenameBIM": "BIM.json",
"filenameDL": "BIM.json",
"filenameAIM": "AIM.json",
"filenameDL": "AIM.json",
"filenameEDP": "EDP.json",
"filenameEVENT": "EVENT.json",
"filenameSAM": "SAM.json",
"filenameSIM": "SIM.json",
"rvFiles": [
"BIM.json",
"AIM.json",
"SAM.json",
"EVENT.json",
"SIM.json"
Expand All @@ -98,6 +134,8 @@
"GeneralInformation": {
"NumberOfStories": 3,
"PlanArea": 129600,
"StructureType": "RM1",
"YearBuilt": 1990,
"depth": 360,
"height": 144,
"location": {
Expand Down Expand Up @@ -158,6 +196,7 @@
"weight": 144
}
],
"dampingRatio": 0.02,
"height": 48,
"massX": 0,
"massY": 0,
Expand All @@ -175,8 +214,6 @@
"analysis": "Transient -numSubLevels 2 -numSubSteps 10",
"convergenceTest": "NormUnbalance 1.0e-2 10",
"dampingModel": "Rayleigh Damping",
"dampingRatio": 0.02,
"dampingRatioModal": 0.02,
"firstMode": 1,
"integration": "Newmark 0.5 0.25",
"modalRayleighTangentRatio": 0,
Expand All @@ -192,10 +229,13 @@
"samples": 40,
"seed": 867
},
"uqEngine": "Dakota",
"saveWorkDir": true,
"uqType": "Forward Propagation"
},
"localAppDir": "C:/SimCenter/",
"correlationMatrix": [
1
],
"localAppDir": "/Users/adamzs/SimCenter",
"randomVariables": [
{
"distribution": "Normal",
Expand All @@ -208,7 +248,7 @@
"variableClass": "Uncertain"
}
],
"remoteAppDir": "C:/SimCenter/",
"remoteAppDir": "/Users/adamzs/SimCenter",
"runType": "runningLocal",
"workingDir": "C:/Workdir/PBE"
"workingDir": "/Users/adamzs/Documents/PBE/LocalWorkDir"
}
20 changes: 13 additions & 7 deletions LossModel/PelicunComponentContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ PelicunComponentContainer::PelicunComponentContainer(QWidget *parent)

selectDBLayout->addWidget(databaseCombo, 1);

// export db
QPushButton *btnExportDataBase = new QPushButton();
btnExportDataBase->setMinimumWidth(100);
btnExportDataBase->setMaximumWidth(100);
Expand Down Expand Up @@ -683,7 +684,7 @@ PelicunComponentContainer::PelicunComponentContainer(QWidget *parent)
//compDetailsFormLayout->addRow(tr("Name: "), compName);
*/

// fragility info (temporary location)
// fragility info

fragilityViz = new QWebEngineView();
fragilityViz->setMinimumHeight(240);
Expand Down Expand Up @@ -901,9 +902,9 @@ PelicunComponentContainer::generateFragilityInfo(QString comp_DB_path)

QString output_path = workDir + "/resources/fragility_viz/";

this->statusMessage(python);
this->statusMessage(workDir);
this->statusMessage(output_path);
//this->statusMessage(python);
//this->statusMessage(workDir);
//this->statusMessage(output_path);

QProcess proc;
QStringList params;
Expand Down Expand Up @@ -1251,12 +1252,14 @@ int PelicunComponentContainer::updateAvailableComponents(){
QString line = stream.readLine();
QStringList line_list;

this->parseCSVLine(line, line_list);
//this->parseCSVLine(line, line_list);
parseCSVLine(line, line_list, this);

QString compName = line_list[0];

if (compName == "ID") {
this->parseCSVLine(line, header);
//this->parseCSVLine(line, header);
parseCSVLine(line, header, this);
continue;
}

Expand Down Expand Up @@ -1536,6 +1539,7 @@ PelicunComponentContainer::exportComponentVulnerabilityDB(void) {
this->statusMessage(QString("Successfully exported damage and loss database..."));
}

/*
void
PelicunComponentContainer::parseCSVLine(QString &line, QStringList &line_list)
{
Expand Down Expand Up @@ -1585,6 +1589,7 @@ PelicunComponentContainer::parseCSVLine(QString &line, QStringList &line_list)
}
}
}
*/

void
PelicunComponentContainer::deleteCompConfig(){
Expand Down Expand Up @@ -1666,7 +1671,8 @@ PelicunComponentContainer::loadComponentAssignment(QString filePath) {
QString line = stream.readLine();
QStringList line_list;

this->parseCSVLine(line, line_list);
//this->parseCSVLine(line, line_list);
parseCSVLine(line, line_list, this);

QString compName = line_list[0];
if (compName == "ID") {
Expand Down
3 changes: 2 additions & 1 deletion LossModel/PelicunComponentContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

#include <SimCenterWidget.h>
#include <SimCenterAppWidget.h>
#include "PelicunShared.h"
#include <QWebEngineView>

#include <quazip.h>
Expand Down Expand Up @@ -92,7 +93,7 @@ class PelicunComponentContainer : public SimCenterAppWidget
void clearCompGroupWidget();
void retrieveCompGroups();

void parseCSVLine(QString &line, QStringList &line_list);
//void parseCSVLine(QString &line, QStringList &line_list);

public slots:
int updateAvailableComponents();
Expand Down
11 changes: 6 additions & 5 deletions LossModel/PelicunDamageContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PelicunDamageContainer::PelicunDamageContainer(QWidget *parent)
: SimCenterAppWidget(parent)
{

int maxWidth = 400;
int maxWidth = 800;

this->setMaximumWidth(maxWidth);

Expand All @@ -67,7 +67,7 @@ PelicunDamageContainer::PelicunDamageContainer(QWidget *parent)
// Global Vulnerability ---------------------------------------------------

QGroupBox *GlobalVulGB = new QGroupBox("Global Vulnerabilities");
GlobalVulGB->setMaximumWidth(maxWidth);
GlobalVulGB->setMaximumWidth(500);

QVBoxLayout *loGV = new QVBoxLayout(GlobalVulGB);

Expand Down Expand Up @@ -309,7 +309,7 @@ PelicunDamageContainer::PelicunDamageContainer(QWidget *parent)
// Data Source ------------------------------------------------------------

QGroupBox *DamageProcessGB = new QGroupBox("Damage Process");
DamageProcessGB->setMaximumWidth(maxWidth);
//DamageProcessGB->setMaximumWidth(maxWidth);

QVBoxLayout *loDP = new QVBoxLayout(DamageProcessGB);

Expand Down Expand Up @@ -365,8 +365,9 @@ PelicunDamageContainer::PelicunDamageContainer(QWidget *parent)
// assemble the widgets ---------------------------------------------------

gridLayout->addWidget(GlobalVulGB,0,0);
gridLayout->addWidget(DamageProcessGB,1,0);
gridLayout->setRowStretch(1, 1);
gridLayout->addWidget(DamageProcessGB,0,1);

gridLayout->setRowStretch(0, 1);

this->setLayout(gridLayout);
}
Expand Down
4 changes: 2 additions & 2 deletions LossModel/PelicunDemandContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
PelicunDemandContainer::PelicunDemandContainer(QWidget *parent)
: SimCenterAppWidget(parent)
{
this->setMaximumWidth(700);
this->setMaximumWidth(800);

int maxWidth = 350;
int maxWidth = 400;

collConfig = new QVector<QMap<QString, QString>* >;
truncConfig = new QVector<QMap<QString, QString>* >;
Expand Down
Loading

0 comments on commit 18c67c1

Please sign in to comment.