baumfalk / TrafficMAS

TrafficMAS, the code
MIT License
0 stars 0 forks source link

Define organisations in XML #30

Closed baumfalk closed 9 years ago

baumfalk commented 9 years ago

I'm thinking about the following:

<organisations>
    <organisation id="org1">
        <sensors>
            <sensor id="sens1" />
            <sensor id="sens5" />
        </sensors>
        <norms>
            <norm id="norm1" />
            <norm id="norm2" />
        </norms>
    </organisation>
    <organisation id="org2">
        <sensors>
            <sensor id="sens3" />
        </sensors>
        <norms>
            <norm id="norm4" />
        </norms>
    </organisation>
</organisations>
Maxic commented 9 years ago

if we define custom norm schemes as such:

<norm_schemes>
    <norm_scheme id="ramp-merging">     
        <sensors value="3"/>
        <sanction value="LowFine"/>
    </norm_scheme>  
</norm_schemes>

We can instantiate the sensors using the organisations.xml:

<organisations>
    <organisation id="org1">
        <sensors>
            <sensor id="sens1" />
            <sensor id="sens2" />
            <sensor id="sens4" />
            <sensor id="sens5" />
        </sensors>
        <norms>
            <norm id="norm1">
                <norm_sensor num="1" id="sens2"/>  
                <norm_sensor num="2" id="sens1"/>  
                <norm_sensor num="3" id="sens4"/>  
            </norm>
        </norms>
    </organisation>
    <organisation id="org2">
        <sensors>
            <sensor id="sens3" />
        </sensors>
        <norms>
            <norm id="norm4" />
                <norm_sensor num="1" id="sens3"/>  
            </norm>
        </norms>
    </organisation>
</organisations>

As long as is documented what number norm_sensor should belong to which sensor in the real world, this should work.

Maxic commented 9 years ago

To instantiate the organisations, we need both a list of sensors from which it observes, and a list of norms. Currently, the sensors that a norm uses are defined in the norms xml file. This may change in the future with more generic norms.

<organisations>
    <organisation id="org1">
        <sensors>
            <sensor id="A28_350_lane0_s1" />
            <sensor id="A28_350_lane0_s2" />
        </sensors>
        <norms>
            <norm id="maxspeed"/>
        </norms>
    </organisation>
</organisations>