Subscripts matrix addition

Use this forum to post Vensim related questions.
Post Reply
lellis
Junior Member
Posts: 7
Joined: Sat Jan 09, 2010 2:54 pm

Subscripts matrix addition

Post by lellis »

I am developing a model (my firts one out of class) related to farm management. One of its modules involves 5 different crops and 6 different patches where they are grown, some overlapping patches. They will further integrate with soil quality module, herd structure and development, feed production, etc. and finally with effects of Conservation Agriculture practices (that are different per crop) in all these variables.
I have created some subscripts to deal with their equations, but I am having a difficulty with one of them. I am attaching that part of the model.

I want to have a variable "Cop Area" that summarizes the sum of each individual crop allocated area, and then put that together with the production variables of yields to have each one total production, and not dealing with each individual area and then each individual production as it does now.

I am not being able to create that summarized area matrix . I have tried inumerous equations, always with some errors in the result. I present two of them in the attached model.

Thanks for any help,

Lellis
Attachments
Test CropArea.mdl
(15.46 KiB) Downloaded 546 times
tomfid
Administrator
Posts: 3995
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

I think what you're after may be:

Patch Grows Crop[Crops,PatchNumber]=
IF THEN ELSE(Crop per Patch[Crops,PatchNumber]=Crops,1,0)
Units: Dmnl

Total Crop Area[Crops]=
SUM(Patch Grows Crop[Crops,PatchNumber!]*Patch Size[PatchNumber!])
Units: ha

If the patch cropping pattern doesn't change, these could be made INITIALs to improve performance. Also, for big matrices, VECTOR SELECT would probably be a good idea.

I notice that your crop per patch implies multiple crops on some patches. Presumably this is seasonal rotation or something?

One other hint: for things like your Crop per Patch[Crops,PatchNumber] matrix, it's often easier to enter the data in Excel, then use GET XLS CONSTANTS to retrieve it. That way it's easy to see the #s. Alternatively, use <control><enter> (or is it <shift><enter>?) to format your matrix like this:
1,0,0,0,0,0;
0,2,2,0,0,0;
0,0,0,3,0,0;
0,0,0,0,4,4;
0,5,5,5,0,0;

Tom
lellis
Junior Member
Posts: 7
Joined: Sat Jan 09, 2010 2:54 pm

Post by lellis »

Thanks a lot Tom.

Yes, the idea is that in most of the patches there will be some kind of crop rotation for improved soil fertility and weed control, or cover crop for green manure.

Thanks also for the more elegant and clearer suggestion about the way to present the matrix.

Lellis
Post Reply