env_labels=env_modes,
    disc_sys_labels=sys_modes,
    cts_ss=cont_state_space
)

print(switched_dynamics)

ppp = abstract.prop2part(cont_state_space, cont_props)
ppp, new2old = abstract.part2convex(ppp)

"""Discretize to establish transitions"""
start = time.time()

N = 8
trans_len=1

disc_params = {}
for mode in modes:
    disc_params[mode] = {'N':N, 'trans_length':trans_len}

swab = abstract.multiproc_discretize_switched(
    ppp, switched_dynamics, disc_params,
    plot=True, show_ts=True
)
print(swab)

#ax = sys_ts.ts.plot()

elapsed = (time.time() - start)
print('Discretization lasted: ' + str(elapsed))
Esempio n. 2
0
ax.figure.savefig(imgpath + 'ppp.pdf')

## Discretize to establish transitions
if os.name == "posix":
    start = os.times()[2]
    logger.info('start time: ' + str(start))
else:
    logger.info(
        'Timing currently only available for POSIX platforms (not Windows)')

disc_params = {}
disc_params[('normal', 'fly')] = {'N': N, 'trans_length': 3}
disc_params[('refuel', 'fly')] = {'N': N, 'trans_length': 3}

sys_ts = abstract.multiproc_discretize_switched(ppp,
                                                switched_dynamics,
                                                disc_params,
                                                plot=True)

if os.name == "posix":
    end = os.times()[2]
    logger.info('end time: ' + str(end))
    elapsed = (end - start)
    logger.info('Discretization lasted: ' + str(elapsed))

## Save abstraction to save debugging time
fname = './abstract_switched.pickle'
#pickle.dump(sys_ts, open(fname, 'wb') )

#sys_ts = pickle.load(open(fname, 'r') )

## Specifications
Esempio n. 3
0
ax = ppp.plot()
ax.figure.savefig(imgpath + 'ppp.pdf')

"""Discretize to establish transitions"""
if os.name == "posix":
    start = os.times()[2]
    logger.info('start time: ' + str(start))
else:
    logger.info('Timing currently only available for POSIX platforms (not Windows)')

disc_params = {}
disc_params[('normal', 'fly')] = {'N':N, 'trans_length':3}
disc_params[('refuel', 'fly')] = {'N':N, 'trans_length':3}

sys_ts = abstract.multiproc_discretize_switched(
    ppp, switched_dynamics, disc_params, plot=False
)

if os.name == "posix":
    end = os.times()[2]
    logger.info('end time: ' + str(end))
    elapsed = (end - start)
    logger.info('Discretization lasted: ' + str(elapsed))

"""Save abstraction to save debugging time"""
fname = './abstract_switched.pickle'
#pickle.dump(sys_ts, open(fname, 'wb') )

#sys_ts = pickle.load(open(fname, 'r') )

"""Specs"""