Skip to content

Commit

Permalink
Fix to run on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-okeefe committed Mar 27, 2024
1 parent 3997efe commit f99d8e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
28 changes: 14 additions & 14 deletions src/erin_next.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,9 @@ namespace erin
flow_t outflow = FinalizeFlowValue(outflowReq, outflowAvail);
if (inflow >= outflow)
{
ss.Flows[mov.InFromEnvConn].Requested_W = 0.0;
ss.Flows[mov.InFromEnvConn].Available_W = 0.0;
ss.Flows[mov.InFromEnvConn].Actual_W = 0.0;
ss.Flows[mov.InFromEnvConn].Requested_W = 0;
ss.Flows[mov.InFromEnvConn].Available_W = 0;
ss.Flows[mov.InFromEnvConn].Actual_W = 0;
flow_t waste = inflow - outflow;
ss.Flows[mov.WasteflowConn].Requested_W = waste;
ss.Flows[mov.WasteflowConn].Available_W = waste;
Expand All @@ -561,9 +561,9 @@ namespace erin
ss.Flows[mov.InFromEnvConn].Requested_W = supply;
ss.Flows[mov.InFromEnvConn].Available_W = supply;
ss.Flows[mov.InFromEnvConn].Actual_W = supply;
ss.Flows[mov.WasteflowConn].Requested_W = 0.0;
ss.Flows[mov.WasteflowConn].Available_W = 0.0;
ss.Flows[mov.WasteflowConn].Actual_W = 0.0;
ss.Flows[mov.WasteflowConn].Requested_W = 0;
ss.Flows[mov.WasteflowConn].Available_W = 0;
ss.Flows[mov.WasteflowConn].Actual_W = 0;
}
}

Expand Down Expand Up @@ -1588,11 +1588,11 @@ namespace erin
}

void
PrintFlows(Model const& m, SimulationState const& ss, double t)
PrintFlows(Model const& m, SimulationState const& ss, double time_s)
{
std::cout << "time: " << t << " s, "
<< TimeToISO8601Period(t) << ", "
<< TimeInSecondsToHours(t) << " h"
std::cout << "time: " << time_s << " s, "
<< TimeToISO8601Period(static_cast<uint64_t>(time_s)) << ", "
<< TimeInSecondsToHours(static_cast<uint64_t>(time_s)) << " h"
<< std::endl;
for (size_t flowIdx = 0; flowIdx < ss.Flows.size(); ++flowIdx)
{
Expand All @@ -1611,10 +1611,10 @@ namespace erin
FlowSummary summary = {
.Time = t,
.Inflow = 0,
.OutflowAchieved = 0,
.OutflowRequest = 0,
.StorageCharge = 0,
.OutflowAchieved = 0,
.StorageDischarge = 0,
.StorageCharge = 0,
.Wasteflow = 0,
.EnvInflow = 0,
};
Expand Down Expand Up @@ -1842,8 +1842,8 @@ namespace erin
assert(cop > 0.0);
Mover mov = {
.COP = cop,
.OutflowConn = 0,
.InflowConn = 0,
.OutflowConn = 0,
.InFromEnvConn = 0,
.WasteflowConn = 0,
.MaxOutflow_W = max_flow_W,
Expand Down Expand Up @@ -1879,8 +1879,8 @@ namespace erin
Model_AddConnection(m, envId, 0, thisId, 1, wasteflowId);
return {
.Id = thisId,
.EnvConn = econn,
.WasteConn = wconn,
.EnvConn = econn,
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/erin_next_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ namespace erin
);
for (size_t i = 0; i < numOutflows; ++i)
{
maxOutflows_W[i] = Power_ToWatt(maxOutflowsRaw[i], rateUnit);
maxOutflows_W[i] =
static_cast<flow_t>(
Power_ToWatt(maxOutflowsRaw[i], rateUnit));
}
s.TheModel.Muxes[s.TheModel.ComponentMap.Idx[id]].MaxOutflows_W =
std::move(maxOutflows_W);
Expand Down Expand Up @@ -456,7 +458,7 @@ namespace erin
size_t constEffIdx =
s.TheModel.ComponentMap.Idx[id];
s.TheModel.ConstEffConvs[constEffIdx].MaxOutflow_W =
maxOutflow_W;
static_cast<flow_t>(maxOutflow_W);
}
if (input.contains("max_lossflow"))
{
Expand All @@ -467,7 +469,7 @@ namespace erin
size_t constEffIdx =
s.TheModel.ComponentMap.Idx[id];
s.TheModel.ConstEffConvs[constEffIdx].MaxLossflow_W =
maxLossflow_W;
static_cast<flow_t>(maxLossflow_W);
}
} break;
case ComponentType::PassThroughType:
Expand Down

0 comments on commit f99d8e8

Please sign in to comment.