Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: StreamManager: add GetFeedInit #196

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

Selene29
Copy link
Contributor

I am using the core without ui.
You actually need to set them, otherwise the flowsheet init will error, when it checks the inital state.
Even though all streams have the needed data.

@vasylskorych
Copy link
Member

Hi @Selene29, what exactly is the problem? Because there are only getters in the PR, so I can only guess how they are used.
Is it somehow related to 5d2b90d?

@Selene29
Copy link
Contributor Author

Selene29 commented Jan 14, 2025

No.
I added them because i got annoyed, on how to quickly access them.
Inletflow needs to have an "InputMaterial" feed stream set, otherwise
calling flowsheet->Initialize() has an error, because it also checks the init streams.

I personally set all streams by hand in code, therefore i dont care about the whole init stuff at all.
I completely missed them till i checked why it failed.

void CCentrifugeZoneManager::Simulate(double _timeBeg, double _timeEnd)
{
	auto p1 = GetPortStream(str::Port_Main_Top_Left_In);

	auto leftInlet = flowsheet->GetUnitByName("Main Top Left Inlet")->GetModel();
	//auto leftInlet = flowsheet->GetUnit("C55E0B290D8944C0832689B391867977")->GetModel();
	auto initStream = leftInlet->GetStreamsManager().GetFeedInit("InputMaterial");
	initStream->CopyFromStream(_timeBeg, _timeEnd, p1);

	auto workStream = leftInlet->GetStreamsManager().GetFeed("InputMaterial");
	workStream->CopyFromStream(_timeBeg, _timeEnd, p1);


	string errors1 = flowsheet->CheckPortsConnections();
	if (errors1 != "") {}
	bool check = flowsheet->DetermineCalculationSequence();
	if (!check) {}
	const std::string error = flowsheet->Initialize();
	if (!error.empty())
	{
		RaiseError(error);
		return;
	}

	flowsheet->GetParameters()->EndSimulationTime(_timeEnd);

	simulator = new CSimulator();
	simulator->SetFlowsheet(flowsheet);
	simulator->Simulate();

I simulate my flowsheet inside dyssols flowsheet, therefore i have a new flowsheet in a unit.

@vasylskorych vasylskorych merged commit ba0f7af into DyssolTEC:master Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants