I am the new one

Project:NAADSM
Version:4.0.3
Component:Code
Category:bug report
Priority:high
Assigned:unassigned
Status:active

Running the application produces a run-time error that crashes app when local area spread is on. Appears that the calculation of K is causing runtime error(division by 0). Debug dll reports the values for herd-size-infectious and herd-size-susceptible are missing, I confirmed they are being written to the XML export file. If K is calculated with 0 for either herd size a division by 0 error would occur. snippet of messages generated during the simulation:


loading model 5, "local-area-spread-model" Model = <601372CC> module is a singleton "new" function = <600F5BE9>
----- ENTER new (local-area-spread-model)
----- ENTER build_max_herd_size_by_prod_type
----- EXIT build_max_herd_size_by_prod_type
----- ENTER set_params (local-area-spread-model)
----- ENTER naadsm_read_prodtype_attribute token (Expat encoding) = "A"
----- EXIT naadsm_read_prodtype_attribute
----- ENTER naadsm_read_prodtype_attribute token (Expat encoding) = "A"
----- EXIT naadsm_read_prodtype_attribute setting parameters for A -> A
----- ENTER PAR_get_length parameter herd-size-infectious is missing a "value" element missing or invalid length parameter
----- EXIT PAR_get_length setting infectious herd size to 0
----- ENTER PAR_get_length parameter herd-size-susceptible is missing a "value" element missing or invalid length parameter
----- EXIT PAR_get_length setting susceptible herd size to 0
----- ENTER PAR_get_length
----- EXIT PAR_get_length
----- ENTER PAR_get_probability
----- EXIT PAR_get_probability

I exported the XML and it shows that the GUI is sending these parameters to the model:

<local-area-spread-model from-production-type="A" to-production-type="A">
  <herd-size-infectious>10</herd-size-infectious>
  <herd-size-susceptible>100</herd-size-susceptible>
  <herd-distance> <value>0.1</value> <units><xdf:unit>km</xdf:unit></units> </herd-distance>
  <prob>0.002</prob>
</local-area-spread-model>

<!-- Not using direct contact for source="A" dest="B" -->

<!-- Not using indirect contact for source="A" dest="B" -->

<!-- Not using local area spread for source="A" dest="B" -->

<local-area-spread-model from-production-type="B" to-production-type="B">
  <herd-size-infectious>10</herd-size-infectious>
  <herd-size-susceptible>100</herd-size-susceptible>
  <herd-distance> <value>1</value> <units><xdf:unit>km</xdf:unit></units> </herd-distance>
  <prob>0.002</prob>
</local-area-spread-model>

Description
AttachmentSize
RuntimeError_4.0.3.zip295.92 KB

Comments

#1

I see the problem - local-area-spread-model.c is treating those parameters as ones that should have a <value> and <units> element inside them. I can fix that by making local-area-spread-model.c treat those as "unitless" parameters.

#2

Assigned to:guest» Neil Harvey
Status:active» needs review

Just checked in a change that ought to fix this. Give it a try!

#3

Thanks, I will so this morning. I could not find a XSD definition for "animals" or "individuals", so modifying the XML would have been more work!

#4

Status:needs review» active

Changing the status back to "active" since "needs review" made the issue vanish from the open issues list.

#6

Status:active» needs review

Neil, would it be better to modify the GUI to generate XML in the format that local-area-spread-model.c was originally expecting, or are you happy with this solution?

(Note: the issue raised in comment #4 above regarding the open issues list has been corrected.)

#7

I'm OK with this solution. I will need to adjust some test cases, but that's no big deal.

I will also check that the airborne module and the local area spread module both take these parameters the same way.

#8

Airborne-spread-model and local-area-spread-model both now expect just a plain number for herd-size-infectious and herd-size-susceptible (instead of <value> and <units> sub-elements, like they used to expect). Test cases that use those parameters have been updated.

#9

Status:needs review» fixed

The simulation ran sucessfully with these changes, in which both local area and airborne spread were used.

#10

Status:fixed» closed

The fix for this issue has been incorporated into NAADSM 4.0.4. This issue is now closed.

#11

Title:Runtime time error stopping application when local area spread is on» I am the new one
Assigned to:Neil Harvey» guest
Status:closed» active

I like the valuable info you provide in your articles.
I will bookmark your weblog and check again here frequently.

I am quite certain I'll learn many new stuff right here!
Good luck bouncy castles for sale uk (Susannah)
the next!