Commit 7b033c85 authored by Ozmen O's avatar Ozmen O
Browse files

PV and SimTim are added to serial communication

parent f6f0982b
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ using namespace std;
using namespace adevs;

// Number of computers to connect via network **************************************************************
const int numComputers = 2;
const int numComputers = 8;

class FMUModel:
	public TransactiveSystemWholeSystem
@@ -87,6 +87,16 @@ class FMUModel:
                                str = strs.str();
	                        str = str+"\n";
			}
			if (request == "Time"){
				strs << get_t();
				str = strs.str();
                                str = str+"\n";
			}
			if (request == "PV"){
				strs << get_storage1_ppv();
				str = strs.str();
				str = str+"\n";
			}
			char* buffer = new char[str.length()];
			strcpy(buffer, str.c_str());
			computer_io_type* c = new computer_io_type(buffer,str.length());
@@ -129,7 +139,7 @@ class FMUModel:
					token1.erase(0,pos2 + delimiter.length());
					count=count+1;
				}
				if ((token1 != "IndoorTempF") & (token1 != "UpperTankTemp") & (token1 != "ESConfig") & (token1 != "PVConfig")){
				if ((token1 != "IndoorTempF") & (token1 != "UpperTankTemp") & (token1 != "ESConfig") & (token1 != "PVConfig") & (token1 != "SimTime")){
					if (from == "HVAC"){
						double temp = (atof(token1.c_str())-32)*5/9;
						set_hvac1_Setpoint_k(temp);
@@ -156,9 +166,12 @@ class FMUModel:
				if (token1 == "ESConfig"){
					request = "ES";
				}
				//if (token1 == "PVConfig"){
				//	request = "PV";
				//}
				if (token1 == "PVConfig"){
					request = "PV";
				}
				if (token1 == "SimTime"){
					request = "Time";
				}
				s.erase(0,pos1 + mes_sep.length());
			}
		}
+18 −5
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ using namespace std;
using namespace adevs;

// Number of computers to connect via network **************************************************************
const int numComputers = 9;
const int numComputers = 8;

class FMUModel:
	public TransactiveSystemWholeSystem
@@ -87,6 +87,16 @@ class FMUModel:
                                str = strs.str();
	                        str = str+"\n";
			}
			if (request == "Time"){
				strs << get_t();
				str = strs.str();
                                str = str+"\n";
			}
			if (request == "PV"){
				strs << get_storage1_ppv();
				str = strs.str();
				str = str+"\n";
			}
			char* buffer = new char[str.length()];
			strcpy(buffer, str.c_str());
			computer_io_type* c = new computer_io_type(buffer,str.length());
@@ -129,7 +139,7 @@ class FMUModel:
					token1.erase(0,pos2 + delimiter.length());
					count=count+1;
				}
				if ((token1 != "IndoorTempF") & (token1 != "UpperTankTemp") & (token1 != "ESConfig") & (token1 != "PVConfig")){
				if ((token1 != "IndoorTempF") & (token1 != "UpperTankTemp") & (token1 != "ESConfig") & (token1 != "PVConfig") & (token1 != "SimTime")){
					if (from == "HVAC"){
						double temp = (atof(token1.c_str())-32)*5/9;
						set_hvac1_Setpoint_k(temp);
@@ -156,9 +166,12 @@ class FMUModel:
				if (token1 == "ESConfig"){
					request = "ES";
				}
				//if (token1 == "PVConfig"){
				//	request = "PV";
				//}
				if (token1 == "PVConfig"){
					request = "PV";
				}
				if (token1 == "SimTime"){
					request = "Time";
				}
				s.erase(0,pos1 + mes_sep.length());
			}
		}
+385 −383

File changed.

Preview size limit exceeded, changes collapsed.

Loading