LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
sn_pn_firing_rates.h File Reference

Ports of matlab/src/api/sn/sn_pn_firing_rates.m and sn_pn_avg_rates.m. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/svd.h"
Include dependency graph for sn_pn_firing_rates.h:

Go to the source code of this file.

Classes

struct  line::api::SnPnFiringRates
 What sn_pn_firing_rates returns; x empty means "no answer", as in the reference. More...
struct  line::api::SnPnAvgRates< T >
 What sn_pn_avg_rates rewrites in place; empty tables are left empty. More...

Namespaces

namespace  line
namespace  line::api

Functions

template<class T>
SnPnFiringRates line::api::sn_pn_firing_rates (const qn::NetworkStruct< T > &sn, const Matrix< T > &TN, bool tput_is_tokens)
 Ports of matlab/src/api/sn/sn_pn_firing_rates.m and sn_pn_avg_rates.m.
template<class T>
SnPnAvgRates< T > line::api::sn_pn_avg_rates (const qn::NetworkStruct< T > &sn, const Matrix< T > &QN, const Matrix< T > &TN, const Matrix< T > &AN, const Matrix< T > &RN)
 Port of sn_pn_avg_rates: rewrite the place rows of TN, AN and RN so that they agree with the recovered mode firing rates.

Detailed Description

Ports of matlab/src/api/sn/sn_pn_firing_rates.m and sn_pn_avg_rates.m.

A solver reports a PLACE's throughput as the rate at which its tokens are consumed; what a stochastic Petri net is actually driven by is the firing rate of each transition MODE. These two functions invert that: they recover the mode firing rates x from the reported place throughputs, and then rewrite the place-level throughput, arrival rate and response time so that the reported tables are consistent with the token balance.

THE SYSTEM. Two families of equations, both linear in x. (a) measurement: for each (place, class) whose consumption is non-empty, the consumed rate equals the throughput the solver reported. With tputIsTokens the consumption is weighted by the arc multiplicity, and without it only by whether the mode touches the place at all – the difference between "tokens per unit time" and "firings per unit time", which is what the two callers respectively hold. (b) balance: production equals consumption at every place, so the marking is stationary. Immediate modes are excluded from the measurement rows (they fire in zero time, so no measured rate is theirs) but not from the balance rows. The least-squares solution is the pseudo-inverse, as the reference has it, and a solution with a materially negative rate is REJECTED rather than clamped: a negative firing rate means the reported throughputs are not consistent with any marking-stationary firing vector, and the caller must keep its own numbers rather than be handed a repaired impossibility.

GUARDS. The reference refuses an open net (a Source or a Sink present) and a net in which a place is routed to anything other than a transition, because neither shape satisfies the balance it is about to impose.

PER-CLASS ARCS. The reference's enabling and firing tables are (nnodes x nclasses); this port's TransitionParam sums the class dimension away when the model is read, so a multi-class net cannot be answered here and is refused by name rather than answered with a class-blind arc.

ARITHMETIC: double. The pseudo-inverse is an SVD.

Definition in file sn_pn_firing_rates.h.