public class BeckhoffRoof extends AbstractShelter implements DriverDepending, Simulating, Preserving, Initializable
| Modifier and Type | Class and Description |
|---|---|
static class |
BeckhoffRoof.Action |
static class |
BeckhoffRoof.Concurrent
A class for testing concurrent opening/closing cycles.
|
private class |
BeckhoffRoof.PlcTrigger
A trigger that listens to cache change events issued by a Beckhoff ADS
driver.
|
private class |
BeckhoffRoof.SimulateToggle |
static class |
BeckhoffRoof.Status |
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private double |
accelerate
Only in simulation mode the acceleration factor.
|
private PollingBeckhoffServer |
ads
The socket connected to a PLC talking ADS.
|
private Trigger |
closing
Internal signal of an ongoing closing operation, false if completed.
|
private static DateFormat |
DEFDATEFORMAT |
private static long |
DEFLIMITPOLLING
Polling of roof status period.
|
private static String |
DEFLOCKLIMITS
These variables must all be true for roof locked.
|
private static boolean |
DEFLOCKOPEN
We do not lock the roof in the open position.
|
private static long |
DEFLOCKOUT
A default time-out for roof opening/closing.
|
private static boolean |
DEFLOCKSHUT
We do lock the roof in the close position.
|
private static String |
DEFMANUALONLY
This variable is
AdsSocketChannel.BTRUE in manual-only mode. |
private static boolean |
DEFOPENABORTABLE
We allow a lately received close to abort an ongoing open.
|
private static String |
DEFOPENCOMMAND
The variable to initiate roof opening.
|
private static String |
DEFOPENLIMITS
These variables must all be true for roof open.
|
private static boolean |
DEFSHUTABORTABLE
We do not allow a lately received open to abort an ongoing close.
|
private static boolean |
DEFSHUTBEFORE
Default no shut before open.
|
private static String |
DEFSHUTCOMMAND
The variable to initiate roof closing.
|
private static String |
DEFSHUTLIMITS
These variables must all be true for roof closed.
|
private static String |
DEFSTATUSROOFS
These variables are status indicators for each roof.
|
private static long |
DEFTIMEOUT
A default time-out for roof opening/closing.
|
static String |
KEY_DATEFORMAT
The keys to the simple-date format string for status messages.
|
static String |
KEY_KEEPTIMES
Save the roof times to this file for simulator mode.
|
static String |
KEY_LIMITPOLLING
Polling time for limit switch state monitoring.
|
static String |
KEY_LOCKLIMITS
The list of variables that are true if roofs are completely shut.
|
static String |
KEY_LOCKOPEN
If true, wait for lock on open.
|
static String |
KEY_LOCKSHUT
If true, wait for lock on shut.
|
static String |
KEY_LOCKTIME
Links to the time-out on roof opening operation.
|
static String |
KEY_MANUALONLY
This variable is
AdsSocketChannel.BTRUE in manual-only mode. |
static String |
KEY_OPENABORTABLE
If true, we allow shut to overrule an ongoing opening operation.
|
static String |
KEY_OPENCOMMAND
The variable to initiate roof opening.
|
static String |
KEY_OPENLIMITS
The list of variables that are true if roofs are completely open.
|
static String |
KEY_OPENTIME
Links to the time-out on roof opening operation.
|
static String |
KEY_ROOFDRIVER
The key linked to the polling instance to read from.
|
static String |
KEY_SHUTABORTABLE
If true, we allow open to overrule an ongoing closing operation.
|
static String |
KEY_SHUTBEFORE
If true, first close roof before opening.
|
static String |
KEY_SHUTCOMMAND
The variable to initiate roof closing.
|
static String |
KEY_SHUTLIMITS
The list of variables that are true if roofs are completely shut.
|
static String |
KEY_SHUTTIME
Links to the time-out on roof opening operation.
|
static String |
KEY_STATUSROOFS
The list of variables that identify current roof status.
|
private boolean |
opencancel
Internal flag signaling that an ongoing open should be canceled.
|
private Trigger |
opening
Internal signal of an ongoing opening operation, false if completed.
|
private List<BeckhoffRoof.PlcTrigger> |
rooflock
All this triggers have to be true for roofs fully locked.
|
private List<BeckhoffRoof.PlcTrigger> |
roofopen
All this triggers have to be true for roofs fully opened.
|
private List<BeckhoffRoof.PlcTrigger> |
roofshut
All this triggers have to be true for roofs fully shut.
|
private boolean |
shutcancel
Internal flag signaling that an ongoing close should be canceled.
|
private boolean |
simulate
If true, we are in simulation mode.
|
private TimeKeeper |
stats
For recording the various times.
|
KEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
BeckhoffRoof(Map<String,String> prop)
Default all values except the
PollingBeckhoffServer's name. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accelerate(double by) |
boolean |
close(boolean auto)
Issues a close roof to the PLC.
|
private boolean |
closeSimulate() |
private boolean |
closeWithPlc() |
String |
conciseStatus() |
void |
exit() |
Object |
extendedStatus() |
Date |
getLastCloseTime()
Returns the last date for fully close achieved.
|
Date |
getLastOpenTime()
Returns the last date for fully opened achieved.
|
private List<BeckhoffRoof.Status> |
getStatusList() |
void |
init()
We create the open and close limit triggers, but we do not assign the
Beckhoff driver here, this is done in the register driver section.
|
boolean |
isClosed()
Only if all triggers in
KEY_SHUTLIMITS are true, we return true
here. |
boolean |
isLocked() |
boolean |
isOpen()
Only if all triggers in
KEY_OPENLIMITS are true, we return true
here. |
private long |
lock() |
boolean |
manualOnly()
We read the variable in the PLC that signals only manual access to the
roof.
|
boolean |
open(boolean auto)
Issues an open roof to the PLC.
|
private boolean |
openSimulate() |
private boolean |
openWithPlc() |
private boolean |
preOpen()
Before opening the roof we ensure that it is shut, if the trigger
KEY_SHUTBEFORE is set. |
boolean |
preserve()
On exit, we save our current state if the serialize property is set.
|
private boolean |
preShut()
No action required before shutting the roof.
|
private BeckhoffRoof.Status |
readStatusFromVariable(String s) |
boolean |
registerDriver(Driver beckhoff)
If driver is a polling beckhoff driver,
PollingBeckhoffServer and
has the appropriate name, we assign it to the roof limit switches and
keep a local reference for opening and closing the roof. |
private void |
registerDriverToParameters(CacheChangedCaster beckhoff,
List<BeckhoffRoof.PlcTrigger> plc) |
boolean |
restore()
We restore our old value by reading the last date and target count from
a serialization file.
|
boolean |
startSimulate() |
boolean |
stopSimulate() |
createShelterclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String KEY_ROOFDRIVER
public static final String KEY_OPENCOMMAND
public static final String KEY_SHUTBEFORE
public static final String KEY_SHUTCOMMAND
public static final String KEY_MANUALONLY
AdsSocketChannel.BTRUE in manual-only mode.public static final String KEY_OPENABORTABLE
public static final String KEY_SHUTABORTABLE
public static final String KEY_OPENLIMITS
public static final String KEY_SHUTLIMITS
public static final String KEY_LOCKLIMITS
public static final String KEY_LOCKOPEN
public static final String KEY_LOCKSHUT
public static final String KEY_STATUSROOFS
public static final String KEY_OPENTIME
public static final String KEY_SHUTTIME
public static final String KEY_LOCKTIME
public static final String KEY_LIMITPOLLING
public static final String KEY_DATEFORMAT
public static final String KEY_KEEPTIMES
private static final String DEFOPENCOMMAND
private static final boolean DEFSHUTBEFORE
private static final String DEFSHUTCOMMAND
private static final boolean DEFOPENABORTABLE
private static final boolean DEFSHUTABORTABLE
private static final boolean DEFLOCKOPEN
private static final boolean DEFLOCKSHUT
private static final long DEFTIMEOUT
private static final long DEFLOCKOUT
private static final long DEFLIMITPOLLING
private static final String DEFMANUALONLY
AdsSocketChannel.BTRUE in manual-only mode.private static final String DEFOPENLIMITS
private static final String DEFSHUTLIMITS
private static final String DEFLOCKLIMITS
private static final String DEFSTATUSROOFS
private static final DateFormat DEFDATEFORMAT
private transient PollingBeckhoffServer ads
private TimeKeeper stats
private boolean simulate
private double accelerate
private List<BeckhoffRoof.PlcTrigger> roofopen
private List<BeckhoffRoof.PlcTrigger> roofshut
private List<BeckhoffRoof.PlcTrigger> rooflock
private Trigger closing
private Trigger opening
private boolean opencancel
private boolean shutcancel
public BeckhoffRoof(Map<String,String> prop)
PollingBeckhoffServer's name.prop - public void init()
throws InitException
init in interface InitializableInitExceptionpublic boolean startSimulate()
startSimulate in interface Simulatingpublic boolean stopSimulate()
stopSimulate in interface Simulatingpublic boolean accelerate(double by)
throws UnsupportedOperationException
accelerate in interface SimulatingUnsupportedOperationExceptionpublic boolean registerDriver(Driver beckhoff)
PollingBeckhoffServer and
has the appropriate name, we assign it to the roof limit switches and
keep a local reference for opening and closing the roof.registerDriver in interface DriverDependingbeckhoff - private void registerDriverToParameters(CacheChangedCaster beckhoff, List<BeckhoffRoof.PlcTrigger> plc)
private List<BeckhoffRoof.Status> getStatusList()
private BeckhoffRoof.Status readStatusFromVariable(String s)
s - public Object extendedStatus()
extendedStatus in interface StatusProvidingpublic String conciseStatus()
conciseStatus in interface StatusProvidingpublic boolean manualOnly()
public boolean isOpen()
KEY_OPENLIMITS are true, we return true
here.isOpen in interface Shelteringpublic boolean isClosed()
KEY_SHUTLIMITS are true, we return true
here.isClosed in interface Shelteringpublic boolean isLocked()
public Date getLastOpenTime()
getLastOpenTime in interface Shelteringpublic Date getLastCloseTime()
getLastCloseTime in interface Shelteringpublic boolean open(boolean auto)
opencancel to true, this
method ensures that the open-roof command is either not sent or reset.
Once this is enforced, waiting threads are notified.open in interface Shelteringauto - Ignoredprivate boolean openWithPlc()
unopen - receive - private boolean openSimulate()
public boolean close(boolean auto)
KEY_SHUTABORTABLE, then canceling of the shutting procedure
proceeds as in open.close in interface Shelteringauto - Ignoredprivate boolean closeWithPlc()
throws UnsupportedOperationException
unshut - receive - UnsupportedOperationExceptionprivate long lock()
throws InterruptedException
InterruptedExceptionprivate boolean closeSimulate()
unopen - receive - private boolean preOpen()
throws IOException
KEY_SHUTBEFORE is set.IOExceptionpublic void exit()
exit in interface ExitCleaningpublic boolean restore()
restore in interface Preservingpublic boolean preserve()
preserve in interface Preservingprivate boolean preShut()