Changeset 2692
- Timestamp:
- 01/17/12 05:58:16 (4 months ago)
- Location:
- simo/trunk
- Files:
-
- 6 edited
-
simulator/xml/lexicon.xml (modified) (1 diff)
-
simulator/xml/prediction_models/Distribution_models.xml (modified) (3 diffs)
-
src/models/Finland/c/DistributionmodelLibrary.c (modified) (1 diff)
-
src/models/Finland/c/DistributionmodelLibrary.h (modified) (1 diff)
-
src/models/Finland/c/InitmodelLibrary.c (modified) (2 diffs)
-
src/models/Finland/c/InitmodelLibrary.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simo/trunk/simulator/xml/lexicon.xml
r2666 r2692 9485 9485 <value>1</value> 9486 9486 <description>N is measured</description> 9487 </enum> 9488 </values> 9489 </variable> 9490 <variable> 9491 <name>BA_measured</name> 9492 <min_value>0</min_value> 9493 <max_value>1</max_value> 9494 <description>Categorical variable referring measured (not predicted) 9495 basal area</description> 9496 <values> 9497 <enum> 9498 <value>0</value> 9499 <description>BA is not measured</description> 9500 </enum> 9501 <enum> 9502 <value>1</value> 9503 <description>BA is measured</description> 9487 9504 </enum> 9488 9505 </values> -
simo/trunk/simulator/xml/prediction_models/Distribution_models.xml
r2198 r2692 353 353 <variables> 354 354 <variable> 355 <name> d</name>355 <name>h</name> 356 356 </variable> 357 357 <variable> … … 415 415 <variables> 416 416 <variable> 417 <name> d</name>417 <name>h</name> 418 418 </variable> 419 419 <variable> … … 2633 2633 </result> 2634 2634 </model> 2635 <model> 2636 <name>Height_distribution_young_pine_Siipilehto</name> 2637 <implemented_at>DistributionModels.dll</implemented_at> 2638 <implemented_in>C</implemented_in> 2639 <author> 2640 <name>Jouni Siipilehto</name> 2641 </author> 2642 <description>Generates trees in seedling stand; 2643 stand's mean an ddominant height and number of trees per hectare as 2644 attributes.</description> 2645 <published_in>Siipilehto, J. 2009. Modeling stand structure in young Scots pine dominated stands. Forest Ecology and Management 257 (2009): 223-232.</published_in> 2646 <species_list> 2647 <species>1</species> 2648 </species_list> 2649 <geographical_coverage>Entire country</geographical_coverage> 2650 <applies_for>Young stand. N between 500 and 4000 trees/ha. H_dom between 1 and 17 m.</applies_for> 2651 <research_material>Permanent sample plots from 7th NFI. Values given as (min, mean, max): H_gM (0.1, 4.4, 2652 15.0), N (146, 1276, 4160), Age (2, 15.6, 62), TS (690, 974, 1314) total 576 sample plots from 192 stands. In total 43828 trees.</research_material> 2653 <variables> 2654 <variable> 2655 <name>N</name> 2656 <level>stratum</level> 2657 <limits> 2658 <lower_limit>500</lower_limit> 2659 <upper_limit>4000</upper_limit> 2660 </limits> 2661 </variable> 2662 <variable> 2663 <name>H_gM</name> 2664 <level>stratum</level> 2665 <limits> 2666 <lower_limit>1</lower_limit> 2667 <upper_limit>15</upper_limit> 2668 </limits> 2669 </variable> 2670 <variable> 2671 <name>H_dom</name> 2672 <level>stratum</level> 2673 <limits> 2674 <lower_limit>1</lower_limit> 2675 <upper_limit>17</upper_limit> 2676 </limits> 2677 </variable> 2678 <variable> 2679 <name>HEIGHT_CLASS_WIDTH</name> 2680 <level>simulation</level> 2681 </variable> 2682 <variable> 2683 <name>MAX_CLASS_COUNT</name> 2684 <level>simulation</level> 2685 </variable> 2686 </variables> 2687 <result> 2688 <object>tree</object> 2689 <variables> 2690 <variable> 2691 <name>h</name> 2692 </variable> 2693 <variable> 2694 <name>n</name> 2695 </variable> 2696 </variables> 2697 </result> 2698 </model> 2699 <model> 2700 <name>Diameter_distribution_little_ba_and_n_JKK</name> 2701 <implemented_at>DistributionModels.dll</implemented_at> 2702 <implemented_in>C</implemented_in> 2703 <author> 2704 <name>Jouni Kalliovirta</name> 2705 </author> 2706 <description>Generate trees for seedtree stratum; stand's number of trees, weigted 2707 median diameterr and weigted median height as attributes</description> 2708 <species_list> 2709 <species>1</species> 2710 <species>2</species> 2711 <species>3</species> 2712 <species>4</species> 2713 <species>5</species> 2714 <species>6</species> 2715 <species>7</species> 2716 <species>8</species> 2717 <species>9</species> 2718 </species_list> 2719 <geographical_coverage>Entire country</geographical_coverage> 2720 <variables> 2721 <variable> 2722 <name>N</name> 2723 <level>stratum</level> 2724 <limits> 2725 <lower_limit>0</lower_limit> 2726 </limits> 2727 </variable> 2728 <variable> 2729 <name>D_gM</name> 2730 <level>stratum</level> 2731 <limits> 2732 <lower_limit>0</lower_limit> 2733 </limits> 2734 </variable> 2735 <variable> 2736 <name>H_gM</name> 2737 <level>stratum</level> 2738 <limits> 2739 <lower_limit>1.3</lower_limit> 2740 </limits> 2741 </variable> 2742 <variable> 2743 <name>BA</name> 2744 <level>stratum</level> 2745 <limits> 2746 <lower_limit>0</lower_limit> 2747 </limits> 2748 </variable> 2749 <variable> 2750 <name>BA_measured</name> 2751 <level>stratum</level> 2752 <limits> 2753 <enum>0 1</enum> 2754 </limits> 2755 </variable> 2756 <variable> 2757 <name>MAX_CLASS_COUNT</name> 2758 <level>simulation</level> 2759 </variable> 2760 </variables> 2761 <result> 2762 <object>tree</object> 2763 <variables> 2764 <variable> 2765 <name>d</name> 2766 </variable> 2767 <variable> 2768 <name>h</name> 2769 </variable> 2770 <variable> 2771 <name>n</name> 2772 </variable> 2773 </variables> 2774 </result> 2775 </model> 2635 2776 </model_group> 2636 2777 </modelbase> -
simo/trunk/src/models/Finland/c/DistributionmodelLibrary.c
r2605 r2692 4451 4451 4452 4452 } 4453 4454 int Height_distribution_young_pine_Siipilehto (double N, double H_gM, double H_dom, double HEIGHT_CLASS_WIDTH, 4455 double max_class_count, int *nres, struct heightclass_weibull *dist, char *errors, 4456 int errorCheckMode, double allowedRiskLevel, double rectFactor) { 4457 int ret = 1; 4458 4459 4460 //Check for fatal errors 4461 char errorStr[100] = ""; 4462 if (N<=0) 4463 { 4464 ret = 0; 4465 constructErrorMessage (errorStr, "N<=0(N=",N); 4466 } 4467 if (H_gM<=0) 4468 { 4469 ret = 0; 4470 constructErrorMessage (errorStr, "H_gM<=0(H_gM=",H_gM); 4471 } 4472 if (H_dom<=0) 4473 { 4474 ret = 0; 4475 constructErrorMessage (errorStr, "H_dom<=0(H_dom=",H_dom); 4476 } 4477 4478 // Weibull distribution cumulative distribution function parameters 4479 4480 double b = exp(0.1942+0.9971*log(H_gM)-0.058/log(H_dom/H_gM+0.4)); 4481 double c = exp(-2.4203+0.0895*H_gM-0.0637*H_dom+0.251*log(N)+1.2707/log(H_dom/H_gM+0.4)); 4482 double h0 = b * pow( -log( 0 + 0.000000000000001 ), (1 / c)); 4483 double h100 = b * pow( -log( 1.0 - 0.999999999999999 ), (1 / c)); // HUOM! Weibull-jakauman prosenttipistejakauman yhtälö? 4484 4485 // how many height classes (??????) 4486 int class_count = (int) floor((h100-h0)/HEIGHT_CLASS_WIDTH) + 1; 4487 if (class_count > max_class_count) 4488 { 4489 ret = 0; 4490 constructErrorMessage (errorStr, "Number of generated height classes exceeds the maximum allowed number of classes (set by MAX_CLASS_COUNT)!",max_class_count); 4491 } 4492 if (ret == 0) { 4493 strcat(errors, errorStr); 4494 return 0; 4495 } 4496 4497 // height distribution vector, elements contain height and number of stems / ha in the class 4498 //tÀÀllÀ pitÀisi lisÀksi laskea uusi arvo parametrille b ja sen jÀlkeen pyörÀyttÀÀ jakauma vielÀ uusiksi 4499 //ja ehkÀ myös lpm:t puille 4500 construct_heightdist_using_Weibull_2_parameters( b, c, HEIGHT_CLASS_WIDTH, N, h0, h100, class_count, dist ); 4501 4502 *nres = class_count; 4503 4504 return ret; 4505 } 4506 4507 int Diameter_distribution_little_ba_and_n_JKK (double N, double D_gM, double H_gM, double BA, double BA_measured, double MAX_CLASS_COUNT, 4508 int *nres, struct diamclass_seedtree *dist, char *errors, 4509 int errorCheckMode, double allowedRiskLevel, double rectFactor) 4510 { 4511 int ret = 1; 4512 double dist2[3][3]; 4513 4514 dist2[0][0] = D_gM*0.95; 4515 dist2[0][1] = H_gM*0.95; 4516 dist2[0][2] = N/3; 4517 dist2[1][0] = D_gM; 4518 dist2[1][1] = H_gM; 4519 dist2[1][2] = N/3; 4520 dist2[2][0] = D_gM*1.05; 4521 dist2[2][1] = H_gM*1.05; 4522 dist2[2][2] = N/3; 4523 4524 //If basal area measured 4525 //Calculate basal area and scale stem number for sample trees 4526 if (BA_measured == 1) 4527 { 4528 double ba_sum=0; 4529 double ba; 4530 int i; 4531 for (i = 0; i < 3; i++) 4532 { 4533 ba = PI * pow(( dist2[i][0] / 2 ), 2) * dist2[i][2]; 4534 ba_sum=ba+ba_sum; 4535 } 4536 double scale = ba_sum/BA; 4537 N=N*scale; 4538 } 4539 4540 dist[0].d = dist2[0][0]; 4541 dist[0].h = dist2[0][1]; 4542 dist[0].n = N/3; 4543 dist[1].d = dist2[1][0]; 4544 dist[1].h = dist2[1][1]; 4545 dist[1].n = N/3; 4546 dist[2].d = dist2[2][0]; 4547 dist[2].h = dist2[2][1]; 4548 dist[2].n = N/3; 4549 4550 *nres = 3; 4551 4552 return ret; 4553 } -
simo/trunk/src/models/Finland/c/DistributionmodelLibrary.h
r2198 r2692 94 94 DLLEXPORT int Diameter_distribution_pine_Weibull_MELA_Mykkanen ( double BA, double D_gM, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 95 95 DLLEXPORT int Diameter_distribution_MELA_JKK (double BA, double D_gM, double SP, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 96 DLLEXPORT int Height_distribution_young_pine_Siipilehto (double N, double H_gM, double H_dom, double HEIGHT_CLASS_WIDTH, double max_class_count, int *nres, struct heightclass_weibull *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 97 DLLEXPORT int Diameter_distribution_little_ba_and_n_JKK (double N, double D_gM, double H_gM, double BA, double BA_measured, double MAX_CLASS_COUNT, int *nres, struct diamclass_seedtree *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); -
simo/trunk/src/models/Finland/c/InitmodelLibrary.c
r2133 r2692 194 194 to_zero[0].Carbon_flux_natural_removal=0; 195 195 to_zero[0].Carbon_flux_natural_removal_energy=0; 196 to_zero[0].BA_measured=1; 196 197 197 198 *nres = 1; … … 433 434 values[0].Carbon_flux_natural_removal=0; 434 435 values[0].Carbon_flux_natural_removal_energy=0; 436 values[0].BA_measured=0; 435 437 436 438 *nres = 1; -
simo/trunk/src/models/Finland/c/InitmodelLibrary.h
r2133 r2692 58 58 double Carbon_flux_natural_removal; 59 59 double Carbon_flux_natural_removal_energy; 60 double BA_measured; 60 61 }; 61 62 … … 343 344 double Carbon_flux_natural_removal; 344 345 double Carbon_flux_natural_removal_energy; 346 double BA_measured; 345 347 }; 346 348
Note: See TracChangeset
for help on using the changeset viewer.
