makePartPN :: NetworkIF network => [Part network] -> Part network -> MkPNMonad SimFlow SimValue [Chan]
    makePartPN parts part = do
        let partName = networkName part
        linkChans <- withLabel partName $ liftM DM.fromList $ sequence $ tryPart part $ do
            nwMapLinks $ \link -> return $ do
                linkChan <- teakLink partName link
                return (refLink link, linkChan)

        let portChans = tryPart part $ do
              portLinks <- liftM concat $ mapM' (nwGetPortAccess . fromJust . nwPortRef) $ networkPorts part
              return $ map (linkChans DM.!) portLinks

        let comps = tryPart part $ nwMapComps return
        mapM' (makeComp parts part linkChans) comps
        return portChans

    -- makeTopLevelPartPN : make a PN for a Part and connect the go port upto an R component
makePartPN :: NetworkIF network => [Part network] -> Part network -> MkPNMonad SimFlow SimValue [Chan]
makePartPN parts part = do
        let partName = networkName part
        linkChans <- withLabel partName $ liftM DM.fromList $ sequence $ tryPart part $ do
            nwMapLinks $ \link -> return $ do
                linkChan <- teakLink partName link
                return (refLink link, linkChan)

        let portChans = tryPart part $ do
              portLinks <- liftM concat $ mapM' (nwGetPortAccess . fromJust . nwPortRef) $ networkPorts part
              return $ map (linkChans DM.!) portLinks

        let comps = tryPart part $ nwMapComps return
        mapM' (makeComp parts part linkChans) comps
        return portChans

    -- makeTopLevelPartPN : make a PN for a Part and connect the go port upto an R component
makePartPN parts part = do
        let partName = networkName part
        linkChans <- withLabel partName $ liftM DM.fromList $ sequence $ tryPart part $ do
            nwMapLinks $ \link -> return $ do
                linkChan <- teakLink partName link
                return (refLink link, linkChan)

        let portChans = tryPart part $ do
              portLinks <- liftM concat $ mapM' (nwGetPortAccess . fromJust . nwPortRef) $ networkPorts part
              return $ map (linkChans DM.!) portLinks

        let comps = tryPart part $ nwMapComps return
        mapM' (makeComp parts part linkChans) comps
        return portChans

    -- makeTopLevelPartPN : make a PN for a Part and connect the go port upto an R component