Monday, March 26, 2007

Making musical sense by email, appendix A

Because I believe in transparency as far as possible, here is the first of two models I did in support of the dialog Greg Sandow and I had on the future of classical music. Neither model is a paradigm of modeling artistry; they're simple, quick models to support our dialog and exploration. If we begin to use these more deeply, we'd certainly test and document them more seriously.

Here's the model I used to create the initial graphs I shared with Greg and Drew:


States = {
twenties, thirties, forties, fifties, sixties
};

Inputs = {
newpa, # Number of young people becoming concert-goers pa
};

Outputs = {
input,
avgage,
total
};

decade = 10.0;
bins = 5.0; # no. of decades modeled
population = 1.0e6; # total initial concertgoers

Initialize{
twenties = population / bins;
thirties = population / bins;
forties = population / bins;
fifties = population / bins;
sixties = population / bins;
}

Dynamics{
to30spa = twenties / decade;
to40spa = thirties / decade;
to50spa = forties / decade;
to60spa = fifties / decade;
endingpa = sixties / decade;

dt(twenties) = newpa - to30spa;
dt(thirties) = to30spa - to40spa;
dt(forties) = to40spa - to50spa;
dt(fifties) = to50spa - to60spa;
dt(sixties) = to60spa - endingpa;
}

CalcOutputs{
input = newpa;
total = twenties + thirties + forties + fifties + sixties;
avgage = (25.0 * twenties + 35 * thirties + 45 * forties
+ 55 * fifties + 65 * sixties) / total;
}


I've stripped out most of the comments to make it shorter; I suspect most of you who are familiar with system dynamics modeling (and many who aren't) can probably understand what's going on.

This model is written for the MCSim simulator created by Frédéric Bois and Don Maszle.

Here is the simulation file that runs the various experiments:


Integrate(Lsodes, 1e-6, 1e-6, 1);
OutputFile("simplerun01.out");
StartTime(0.0);

Simulation{
newpa = NDoses(2,20000.0,10000.0,0.0,10.0);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}

Simulation{
newpa = PerExp(20000.0, 400.0, 0.0, 0.010);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}

Simulation{
newpa = NDoses(2,20000.0,0.0,0.0,10.0);
PrintStep(input,0.0,200.0,1.0);
PrintStep(total,0.0,200.0,1.0);
PrintStep(avgage,0.0,200.0,1.0);
}

END.


For more on the syntax used in these files, see the documentation for MCSim.

Labels: , ,

0 Comments:

Post a Comment

<< Home