debug AdisTS

scenarios
Theophile Terraz 2025-12-02 13:32:50 +01:00
parent 012408d19e
commit f3c461cbd9
3 changed files with 22 additions and 7 deletions

View File

@ -307,6 +307,21 @@ class Pollutants(SQLSubModel):
def data(self):
return self._data
@data.setter
def data(self, data):
self._data = [PollutantCharacteristics(type=int(data[0]),
diametre=float(data[1]),
rho=float(data[2]),
porosity=float(data[3]),
cdc_riv=float(data[4]),
cdc_cas=float(data[5]),
apd=float(data[6]),
ac=float(data[7]),
bc=float(data[8]),
pollutant=self,
status=self._status
)]
@classmethod
def _db_create(cls, execute, ext=""):
execute(f"""
@ -397,7 +412,7 @@ class Pollutants(SQLSubModel):
data["pollutant"] = new_pollutant
new_pollutant._data = PollutantCharacteristics._db_load(
execute, data.copy()
execute, data=data
)
loaded.add(pid)
@ -421,7 +436,7 @@ class Pollutants(SQLSubModel):
f"AND scenario = {self._status.scenario_id}"
)
execute(
f"DELETE FROM pollutants_characteristics " +
"DELETE FROM pollutants_characteristics " +
f"WHERE pollutant = {self.id} " +
f"AND scenario = {self._status.scenario_id}"
)

View File

@ -260,7 +260,7 @@ class AdisTS(CommandLineSolver):
_nodes_views = set()
def get_reach_name(self, reach):
return f"Reach_{reach.id:>3}".replace(" ", "0")
return f"Reach_{reach.pamhyr_id:>3}".replace(" ", "0")
def get_node_name(self, node):
"""Generate a 3 char name for node
@ -271,7 +271,7 @@ class AdisTS(CommandLineSolver):
Returns:
A 3 char name string
"""
n = node.id
n = node.pamhyr_id
# print("node name id: ", n)
@ -401,9 +401,9 @@ class AdisTSwc(AdisTS):
) as f:
for LC in POL_LC:
reach = next(filter(
lambda edge: edge.id == LC.edge, study.river.edges()
lambda edge: edge.id == LC.edge, study.river.enable_edges()
)) # .name
reach_name = self.get_reach_name(self, reach)
reach_name = self.get_reach_name(reach)
f.write(f"${reach_name} {LC.begin_rk} {LC.end_rk}\n")
f.write(f"*temps |débit massique (kg/s)\n")
f.write(f"*---------++++++++++\n")

View File

@ -80,7 +80,7 @@ class AddCommand(QUndoCommand):
self._new = self._pollutants_lst.new(
self._pollutants_lst, self._index
)
self._new._data = [[0, 0., 0., 0., 0., 0., 0., 0., 0.]]
self._new.data = [0, 0., 0., 0., 0., 0., 0., 0., 0.]
self._new_ic_adists = self._data.new(self._index, self._new.id)
else:
self._pollutants_lst.insert(self._index, self._new)