88 import ptolemy.kernel.CompositeEntity;
89 import ptolemy.kernel.util.IllegalActionException;
90 import ptolemy.kernel.util.NameDuplicationException;
91 import ptolemy.kernel.util.InternalErrorException;
92 import ptolemy.kernel.util.Settable;
93 import ptolemy.actor.TypedIOPort;
94 import ptolemy.data.type.ArrayType;
95 import ptolemy.data.ArrayToken;
96 import ptolemy.data.type.BaseType;
97 import ptolemy.data.Token;
98 import ptolemy.data.IntToken;
99 import ptolemy.data.StringToken;
100 import ptolemy.data.ArrayToken;
101 import ptolemy.data.BooleanToken;
102 import ptolemy.data.expr.Parameter;
104 import java.util.ArrayList;
105 import java.util.HashMap;
106 import java.io.IOException;
107 import org.xml.sax.SAXException;
108 import javax.xml.parsers.ParserConfigurationException;
109 import javax.naming.OperationNotSupportedException;
110 import org.xml.sax.SAXParseException;
135 throws IllegalActionException,NameDuplicationException {
136 super(container, name);
139 input =
new TypedIOPort(
this,
"input",
true,
false);
140 input.setMultiport(
true);
146 input_tokenConsumptionRate.setExpression(
"1");
147 input_tokenConsumptionRate.setVisibility(Settable.NOT_EDITABLE);
148 input_tokenConsumptionRate.setTypeEquals(BaseType.INT);
149 input_tokenConsumptionRate.setPersistent(
false);
164 public boolean prefire() throws IllegalActionException {
165 Token rateToken = input_tokenConsumptionRate.getToken();
166 int required = ((IntToken) rateToken).intValue();
170 for (
int i = 0;
i < input.getWidth();
i++) {
171 if (!
input.hasToken(
i, required)) {
173 _debug(
"Called prefire(), "
174 +
" input tokenConsumptionRate = " + required
175 +
", input.hasToken(" +
i +
", " + required
176 +
") is false, prefire() returning false");
182 return super.prefire();
195 final int size = input.getWidth();
196 final int num = prop_arr.size();
198 String em =
"The number of input '" + size +
"' is ";
203 em +=
"than the number"
204 +
LS +
"of properties found in the configuration file '" + num +
"'.";
205 throw new IllegalActionException(em);
217 final int n = input.getWidth();
218 Token inp[] =
new Token[n];
229 public ArrayList<BACnetCompleteProperty>
addPropertyValue(Token[] inp)
throws IllegalActionException
231 ArrayList<BACnetCompleteProperty> proparr =
new ArrayList<BACnetCompleteProperty>();
232 for (
int i = 0;
i < prop_arr.size();
i++) {
234 int dev_inst_str = bcp.getDeviceInstance();
235 String obj_type = bcp.getObjectType();
236 int obj_inst = bcp.getObjectInstance();
237 String pro_name = bcp.getPropertyName();
238 String pro_value = inp[
i].toString();
239 String apptag = bcp.getApplicationTag();
240 String priority = bcp.getPropertyPriority();
241 String index = bcp.getPropertyIndex();
243 obj_type,obj_inst,pro_name,pro_value,
244 apptag,priority,index);
245 proparr.add(bcp_new);
281 public void fire() throws IllegalActionException {
String schemaFileName
Schema file path.
static ArrayList< BACnetCompleteProperty > prop_add_arr
BACnetCompleteProperty after adding the value from Ptolemy.
This actor writes to BACnet devices.
This class reads the XML configuration file and stores the data in the BACnetObjectType data type...
void removeToken()
Remove tokens in previous time step.
This is an abstract base class for actors that generates an output stream.
static final String FS
File seperator.
void fire()
At each timestep write properties to BACnet devices.
This object stores information of BACnet objects.
This class is used to create objects that have the information from the xml configuration file...
This class stores the BACnet property name and property value array pair.
Token[] consumeToken()
consume token, store the token in an array it is called in fire()
This file compiles the BSD socket interface for Simulink It is called by ant On it requires the Microsoft compiler since matlab requires the size of output arrays to be fixed If more elements are required
static final String LS
Line Seperator.
void sendToken()
Sends the error signal to the errorSignal port, the error message to the errorMessage port...
void prepareTokensToSend()
Get tokens to send for the next timestep.
void validateAttributes()
Validate application tag, priority and index.
void setSchemaFileName()
Sets the schema file name.
boolean prefire()
Return true if the number of available tokens on the input port is at least the declared consumption ...
Parameter input_tokenConsumptionRate
ArrayList< ProcessBuilder > proc_arr
Arraylist containing processes to be executed in console.
ArrayList< BACnetCompleteProperty > addPropertyValue(Token[] inp)
Replace the property value in BACnetCompleteProperty with tokens from Ptolemy.
static final String bcvtbhome
String that points to root directory of the BCVTB.
void initialize()
Initialize variables and check for errors.
BACnetWriter(CompositeEntity container, String name)
Construct an actor with the given container and name.
void checkNumberOfInput()
Check if the number of input tokens of the actor is equal to the number of properties read from the c...