diff --git a/citam/engine/main.py b/citam/engine/main.py index ffc15fb3..d35457e5 100644 --- a/citam/engine/main.py +++ b/citam/engine/main.py @@ -321,6 +321,17 @@ def run_simulation(inputs: dict): LOG.info("Extracting stats...") my_model.save_outputs(work_directory) + # Write policy.json + policy = {} + del inputs["output_directory"] + policy["facility_name"] = inputs["facility_name"] + policy["general"] = inputs + policy["meetings"] = my_model.meetings_policy_params + policy["scheduling"] = my_model.scheduling_rules + policy["traffic"] = inputs["traffic_policy"] + with open(os.path.join(work_directory, "policy.json"), "w") as outfile: + json.dump(policy, outfile) + if upload_results and upload_location is not None: LOG.info("Uploading results to server...") cwd = os.getcwd() diff --git a/citamjs/src/components/Overview.vue b/citamjs/src/components/Overview.vue index b6af138f..2af32288 100644 --- a/citamjs/src/components/Overview.vue +++ b/citamjs/src/components/Overview.vue @@ -190,12 +190,14 @@ export default { .get("/list") //get list of policies, simulations, facilities .then((response) => { this.policyList = response.data.map((list) => list); + console.log("Policy list is: ", this.policyList); this.$store.commit("setPolicyList", this.policyList); return axios.all(response.data.map((x) => axios.get(`/${x.RunID}`))); }) .then((runResponse) => { // eslint-disable-next-line no-unused-vars this.runList = runResponse.map((run) => run.data); + console.log("Run List: ", this.runList); return axios.all( runResponse.map((x) => axios.get(`/${x.data.RunID}/statistics`)) ); diff --git a/citamjs/src/components/Policies.vue b/citamjs/src/components/Policies.vue index 74969003..0dfeb23d 100644 --- a/citamjs/src/components/Policies.vue +++ b/citamjs/src/components/Policies.vue @@ -29,7 +29,7 @@ href="#" @click="getPolicyDetails(policy.policyHash, id)" > - {{ policy.policyHash }} + {{ policy.simulationName }} @@ -71,13 +71,13 @@
Total Steps
- {{ policyDetails.general.daylength }} + {{ policyDetails.general.total_timesteps }}
Total Hours
- {{ policyDetails.general.daylength / 3600 }} + {{ policyDetails.general.total_timesteps / 3600 }}
@@ -89,7 +89,7 @@
Number of Agents
- {{ policyDetails.general.NumberOfEmployees }} + {{ policyDetails.general.n_agents }}
@@ -102,7 +102,13 @@
Distance (Meters)
- {{ policyDetails.general.contact_distance }} + {{ + Math.round( + (policyDetails.general.contact_distance + + Number.EPSILON) * + 100 + ) / 100 + }}
@@ -123,7 +129,7 @@
- Shift Start time + Shift Start Timestep
- Percent of agents assigned to shift + Percent of Agents Assigned to Shift
- {{ shift.percent_workforce }} + {{ shift.percent_agents * 100 }}%
@@ -155,7 +161,7 @@ future, the possibility will be given to manually add specific meetings that always take place (e.g. classroom instructions). -
+
MEETING DURATION
@@ -216,6 +222,7 @@
+
No meetings in this simulation.
SCHEDULING POLICY
@@ -282,7 +289,8 @@
A traffic policy is made of list of circulation rules where each - rule is as follows: + rule will apply to specific hallways (or aisles) and will dictate + the direciton of agent traffic in that space.
@@ -296,7 +304,7 @@
- Aisle SSegment Id + Aisle Segment Id
item.facilityName == this.selectedFacility ).policies, }; + console.log("Policy name: ", this.polName); + console.log("Policy data: ", this.policyData); if (_.isEmpty(this.polName)) { this.selectedPolicyData.policyInfo = this.policyData.policies[0]; axios - .get(`/${this.selectedPolicyData.policyInfo.simulationRuns[0].runID}/policy`) //get policy info with any of the simid - .then((response) => { - this.policyDetails = response.data; - return response.data; - }) - .catch((error) => { - console.log(error.response) - alert('No policy data found, please check if policy.json file exists') - }); + .get( + `/${this.selectedPolicyData.policyInfo.simulationRuns[0].runID}/policy` + ) //get policy info with any of the simid + .then((response) => { + console.log("We have the policy: ", response.data); + this.policyDetails = response.data; + return response.data; + }) + .catch((error) => { + console.log(error.response); + alert( + "No policy data found, please check if policy.json file exists" + ); + }); } else { this.selectedPolicyData.policyInfo = this.policyData.policies.find( (item) => item.policyHash == this.polName ); axios - .get(`/${this.selectedPolicyData.policyInfo.simulationRuns[0].runID}/policy`) //get policy info with any of the simid - .then((response) => { - this.policyDetails = response.data; - return response.data; - }) + .get( + `/${this.selectedPolicyData.policyInfo.simulationRuns[0].runID}/policy` + ) //get policy info with any of the simid + .then((response) => { + this.policyDetails = response.data; + return response.data; + }) .catch((error) => { - console.log(error.response) - alert('No policy data found, please check if policy.json file exists') - }); + console.log(error.response); + alert( + "No policy data found, please check if policy.json file exists" + ); + }); this.polIndex = this.policyData.policies.findIndex( (item) => item.policyHash == this.polName );